summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2014-08-14 17:13:24 +0000
committerAdam Nemet <anemet@apple.com>2014-08-14 17:13:24 +0000
commit6f31063dcfdc0e8298237228eac6acd906b8eb27 (patch)
treec58d7885f39698f5aea1c6f31c89bfcca4c3ed9b
parent2e91ee58fe2f804c948fe569a8696cce82a28890 (diff)
downloadbcm5719-llvm-6f31063dcfdc0e8298237228eac6acd906b8eb27.tar.gz
bcm5719-llvm-6f31063dcfdc0e8298237228eac6acd906b8eb27.zip
[AVX512] Break out the logic to lower masking intrinsics
No functional change. This will be used by the FMA intrinsic lowering as well and hopefully many more. llvm-svn: 215661
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp34
1 files changed, 21 insertions, 13 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 89c70497e5d..c1c56cab50c 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -14224,6 +14224,21 @@ static SDValue getTargetVShiftNode(unsigned Opc, SDLoc dl, MVT VT,
return DAG.getNode(Opc, dl, VT, SrcOp, ShAmt);
}
+/// \brief Return (vselect \p Mask, \p Op, \p PreservedSrc) along with the
+/// necessary casting for \p Mask when lowering masking intrinsics.
+static SDValue getVectorMaskingNode(SDValue Op, SDValue Mask,
+ SDValue PreservedSrc, SelectionDAG &DAG) {
+ EVT VT = Op.getValueType();
+ EVT MaskVT = EVT::getVectorVT(*DAG.getContext(),
+ MVT::i1, VT.getVectorNumElements());
+ SDLoc dl(Op);
+
+ assert(MaskVT.isSimple() && "invalid mask type");
+ return DAG.getNode(ISD::VSELECT, dl, VT,
+ DAG.getNode(ISD::BITCAST, dl, MaskVT, Mask),
+ Op, PreservedSrc);
+}
+
static SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) {
SDLoc dl(Op);
unsigned IntNo = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
@@ -14602,20 +14617,13 @@ static SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) {
return DAG.getNode(ISD::FSQRT, dl, Op.getValueType(), Op.getOperand(1));
case Intrinsic::x86_avx512_mask_valign_q_512:
- case Intrinsic::x86_avx512_mask_valign_d_512: {
- EVT VT = Op.getValueType();
- EVT MaskVT = EVT::getVectorVT(*DAG.getContext(),
- MVT::i1, VT.getVectorNumElements());
- assert(MaskVT.isSimple() && "invalid valign mask type");
+ case Intrinsic::x86_avx512_mask_valign_d_512:
// Vector source operands are swapped.
- return DAG.getNode(ISD::VSELECT, dl, VT,
- DAG.getNode(ISD::BITCAST, dl, MaskVT,
- Op.getOperand(5)),
- DAG.getNode(X86ISD::VALIGN, dl, VT,
- Op.getOperand(2), Op.getOperand(1),
- Op.getOperand(3)),
- Op.getOperand(4));
- }
+ return getVectorMaskingNode(DAG.getNode(X86ISD::VALIGN, dl,
+ Op.getValueType(), Op.getOperand(2),
+ Op.getOperand(1),
+ Op.getOperand(3)),
+ Op.getOperand(5), Op.getOperand(4), DAG);
// ptest and testp intrinsics. The intrinsic these come from are designed to
// return an integer value, not just an instruction so lower it to the ptest
OpenPOWER on IntegriCloud