forked from OSchip/llvm-project
[X86] Break out logic to map FMA Intrinsic number to Opcode
No functional change. Will be used to lower AVX512 masking FMA intrinsics. llvm-svn: 215663
This commit is contained in:
parent
50b83f0bb8
commit
9b4f08c729
|
@ -14239,6 +14239,54 @@ static SDValue getVectorMaskingNode(SDValue Op, SDValue Mask,
|
|||
Op, PreservedSrc);
|
||||
}
|
||||
|
||||
static unsigned getOpcodeForFMAIntrinsic(unsigned IntNo) {
|
||||
switch (IntNo) {
|
||||
default: llvm_unreachable("Impossible intrinsic"); // Can't reach here.
|
||||
case Intrinsic::x86_fma_vfmadd_ps:
|
||||
case Intrinsic::x86_fma_vfmadd_pd:
|
||||
case Intrinsic::x86_fma_vfmadd_ps_256:
|
||||
case Intrinsic::x86_fma_vfmadd_pd_256:
|
||||
case Intrinsic::x86_fma_vfmadd_ps_512:
|
||||
case Intrinsic::x86_fma_vfmadd_pd_512:
|
||||
return X86ISD::FMADD;
|
||||
case Intrinsic::x86_fma_vfmsub_ps:
|
||||
case Intrinsic::x86_fma_vfmsub_pd:
|
||||
case Intrinsic::x86_fma_vfmsub_ps_256:
|
||||
case Intrinsic::x86_fma_vfmsub_pd_256:
|
||||
case Intrinsic::x86_fma_vfmsub_ps_512:
|
||||
case Intrinsic::x86_fma_vfmsub_pd_512:
|
||||
return X86ISD::FMSUB;
|
||||
case Intrinsic::x86_fma_vfnmadd_ps:
|
||||
case Intrinsic::x86_fma_vfnmadd_pd:
|
||||
case Intrinsic::x86_fma_vfnmadd_ps_256:
|
||||
case Intrinsic::x86_fma_vfnmadd_pd_256:
|
||||
case Intrinsic::x86_fma_vfnmadd_ps_512:
|
||||
case Intrinsic::x86_fma_vfnmadd_pd_512:
|
||||
return X86ISD::FNMADD;
|
||||
case Intrinsic::x86_fma_vfnmsub_ps:
|
||||
case Intrinsic::x86_fma_vfnmsub_pd:
|
||||
case Intrinsic::x86_fma_vfnmsub_ps_256:
|
||||
case Intrinsic::x86_fma_vfnmsub_pd_256:
|
||||
case Intrinsic::x86_fma_vfnmsub_ps_512:
|
||||
case Intrinsic::x86_fma_vfnmsub_pd_512:
|
||||
return X86ISD::FNMSUB;
|
||||
case Intrinsic::x86_fma_vfmaddsub_ps:
|
||||
case Intrinsic::x86_fma_vfmaddsub_pd:
|
||||
case Intrinsic::x86_fma_vfmaddsub_ps_256:
|
||||
case Intrinsic::x86_fma_vfmaddsub_pd_256:
|
||||
case Intrinsic::x86_fma_vfmaddsub_ps_512:
|
||||
case Intrinsic::x86_fma_vfmaddsub_pd_512:
|
||||
return X86ISD::FMADDSUB;
|
||||
case Intrinsic::x86_fma_vfmsubadd_ps:
|
||||
case Intrinsic::x86_fma_vfmsubadd_pd:
|
||||
case Intrinsic::x86_fma_vfmsubadd_ps_256:
|
||||
case Intrinsic::x86_fma_vfmsubadd_pd_256:
|
||||
case Intrinsic::x86_fma_vfmsubadd_ps_512:
|
||||
case Intrinsic::x86_fma_vfmsubadd_pd_512:
|
||||
return X86ISD::FMSUBADD;
|
||||
}
|
||||
}
|
||||
|
||||
static SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) {
|
||||
SDLoc dl(Op);
|
||||
unsigned IntNo = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
|
||||
|
@ -14906,63 +14954,9 @@ static SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) {
|
|||
case Intrinsic::x86_fma_vfmaddsub_ps_512:
|
||||
case Intrinsic::x86_fma_vfmaddsub_pd_512:
|
||||
case Intrinsic::x86_fma_vfmsubadd_ps_512:
|
||||
case Intrinsic::x86_fma_vfmsubadd_pd_512: {
|
||||
unsigned Opc;
|
||||
switch (IntNo) {
|
||||
default: llvm_unreachable("Impossible intrinsic"); // Can't reach here.
|
||||
case Intrinsic::x86_fma_vfmadd_ps:
|
||||
case Intrinsic::x86_fma_vfmadd_pd:
|
||||
case Intrinsic::x86_fma_vfmadd_ps_256:
|
||||
case Intrinsic::x86_fma_vfmadd_pd_256:
|
||||
case Intrinsic::x86_fma_vfmadd_ps_512:
|
||||
case Intrinsic::x86_fma_vfmadd_pd_512:
|
||||
Opc = X86ISD::FMADD;
|
||||
break;
|
||||
case Intrinsic::x86_fma_vfmsub_ps:
|
||||
case Intrinsic::x86_fma_vfmsub_pd:
|
||||
case Intrinsic::x86_fma_vfmsub_ps_256:
|
||||
case Intrinsic::x86_fma_vfmsub_pd_256:
|
||||
case Intrinsic::x86_fma_vfmsub_ps_512:
|
||||
case Intrinsic::x86_fma_vfmsub_pd_512:
|
||||
Opc = X86ISD::FMSUB;
|
||||
break;
|
||||
case Intrinsic::x86_fma_vfnmadd_ps:
|
||||
case Intrinsic::x86_fma_vfnmadd_pd:
|
||||
case Intrinsic::x86_fma_vfnmadd_ps_256:
|
||||
case Intrinsic::x86_fma_vfnmadd_pd_256:
|
||||
case Intrinsic::x86_fma_vfnmadd_ps_512:
|
||||
case Intrinsic::x86_fma_vfnmadd_pd_512:
|
||||
Opc = X86ISD::FNMADD;
|
||||
break;
|
||||
case Intrinsic::x86_fma_vfnmsub_ps:
|
||||
case Intrinsic::x86_fma_vfnmsub_pd:
|
||||
case Intrinsic::x86_fma_vfnmsub_ps_256:
|
||||
case Intrinsic::x86_fma_vfnmsub_pd_256:
|
||||
case Intrinsic::x86_fma_vfnmsub_ps_512:
|
||||
case Intrinsic::x86_fma_vfnmsub_pd_512:
|
||||
Opc = X86ISD::FNMSUB;
|
||||
break;
|
||||
case Intrinsic::x86_fma_vfmaddsub_ps:
|
||||
case Intrinsic::x86_fma_vfmaddsub_pd:
|
||||
case Intrinsic::x86_fma_vfmaddsub_ps_256:
|
||||
case Intrinsic::x86_fma_vfmaddsub_pd_256:
|
||||
case Intrinsic::x86_fma_vfmaddsub_ps_512:
|
||||
case Intrinsic::x86_fma_vfmaddsub_pd_512:
|
||||
Opc = X86ISD::FMADDSUB;
|
||||
break;
|
||||
case Intrinsic::x86_fma_vfmsubadd_ps:
|
||||
case Intrinsic::x86_fma_vfmsubadd_pd:
|
||||
case Intrinsic::x86_fma_vfmsubadd_ps_256:
|
||||
case Intrinsic::x86_fma_vfmsubadd_pd_256:
|
||||
case Intrinsic::x86_fma_vfmsubadd_ps_512:
|
||||
case Intrinsic::x86_fma_vfmsubadd_pd_512:
|
||||
Opc = X86ISD::FMSUBADD;
|
||||
break;
|
||||
}
|
||||
|
||||
return DAG.getNode(Opc, dl, Op.getValueType(), Op.getOperand(1),
|
||||
Op.getOperand(2), Op.getOperand(3));
|
||||
}
|
||||
case Intrinsic::x86_fma_vfmsubadd_pd_512:
|
||||
return DAG.getNode(getOpcodeForFMAIntrinsic(IntNo), dl, Op.getValueType(),
|
||||
Op.getOperand(1), Op.getOperand(2), Op.getOperand(3));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue