diff options
author | Craig Topper <craig.topper@intel.com> | 2019-01-12 08:05:12 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2019-01-12 08:05:12 +0000 |
commit | 33b2cf50e32d96faa17cbd3ecbe16b6f9480dd5b (patch) | |
tree | 9a53051ca05f1ebcc58ca06baa1949c1b97c5236 /llvm/lib/Target/X86/X86ISelLowering.cpp | |
parent | 61aa940074da0ec60a105f1ab45b45bc9815633d (diff) | |
download | bcm5719-llvm-33b2cf50e32d96faa17cbd3ecbe16b6f9480dd5b.tar.gz bcm5719-llvm-33b2cf50e32d96faa17cbd3ecbe16b6f9480dd5b.zip |
[X86] Add ISD node for masked version of CVTPS2PH.
The 128-bit input produces 64-bits of output and fills the upper 64-bits with 0. The mask only applies to the lower elements. But we can't represent this with a vselect like we normally do.
This also avoids the need to have a special X86ISD::SELECT when avx512bw isn't enabled since vselect v8i16 isn't legal there.
Fixes another instruction for PR34877.
llvm-svn: 350994
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index b9c562008a4..c896e366578 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -21383,12 +21383,6 @@ static SDValue getVectorMaskingNode(SDValue Op, SDValue Mask, case X86ISD::VPSHUFBITQMB: case X86ISD::VFPCLASS: return DAG.getNode(ISD::AND, dl, VT, Op, VMask); - case X86ISD::CVTPS2PH: - // We can't use ISD::VSELECT here because it is not always "Legal" - // for the destination type. For example vpmovqb require only AVX512 - // and vselect that can operate on byte element type require BWI - OpcodeSelect = X86ISD::SELECT; - break; } if (PreservedSrc.isUndef()) PreservedSrc = getZeroVector(VT, Subtarget, DAG, dl); @@ -22068,9 +22062,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SDValue Mask = Op.getOperand(3); if (isAllOnesConstant(Mask)) - return getVectorMaskingNode(DAG.getNode(IntrData->Opc0, dl, - Op.getValueType(), Src), - Mask, PassThru, Subtarget, DAG); + return DAG.getNode(IntrData->Opc0, dl, Op.getValueType(), Src); MVT SrcVT = Src.getSimpleValueType(); MVT MaskVT = MVT::getVectorVT(MVT::i1, SrcVT.getVectorNumElements()); @@ -22078,6 +22070,22 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, return DAG.getNode(IntrData->Opc1, dl, Op.getValueType(), Src, PassThru, Mask); } + case CVTPS2PH_MASK: { + SDValue Src = Op.getOperand(1); + SDValue Rnd = Op.getOperand(2); + SDValue PassThru = Op.getOperand(3); + SDValue Mask = Op.getOperand(4); + + if (isAllOnesConstant(Mask)) + return DAG.getNode(IntrData->Opc0, dl, Op.getValueType(), Src, Rnd); + + MVT SrcVT = Src.getSimpleValueType(); + MVT MaskVT = MVT::getVectorVT(MVT::i1, SrcVT.getVectorNumElements()); + Mask = getMaskNode(Mask, MaskVT, Subtarget, DAG, dl); + return DAG.getNode(IntrData->Opc1, dl, Op.getValueType(), Src, Rnd, + PassThru, Mask); + + } default: break; } @@ -27365,6 +27373,7 @@ const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const { case X86ISD::SCALAR_SINT_TO_FP_RND: return "X86ISD::SCALAR_SINT_TO_FP_RND"; case X86ISD::SCALAR_UINT_TO_FP_RND: return "X86ISD::SCALAR_UINT_TO_FP_RND"; case X86ISD::CVTPS2PH: return "X86ISD::CVTPS2PH"; + case X86ISD::MCVTPS2PH: return "X86ISD::MCVTPS2PH"; case X86ISD::CVTPH2PS: return "X86ISD::CVTPH2PS"; case X86ISD::CVTPH2PS_RND: return "X86ISD::CVTPH2PS_RND"; case X86ISD::CVTP2SI: return "X86ISD::CVTP2SI"; |