From 1952e64bfff315f4fbf373275ca52a8fc7d9fdb7 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 21 Nov 2017 06:28:15 +0000 Subject: [PATCH] [X86] Simplify type constraints for AVX2 masked gather. We don't need separate 32 and 64 node types. We can use SDTCisInt and SDTCisSameSizeAs to ensure the mask size the result type and is integer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318732 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86InstrFragmentsSIMD.td | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/Target/X86/X86InstrFragmentsSIMD.td b/lib/Target/X86/X86InstrFragmentsSIMD.td index 2dc29ca822d..6f25b30dba9 100644 --- a/lib/Target/X86/X86InstrFragmentsSIMD.td +++ b/lib/Target/X86/X86InstrFragmentsSIMD.td @@ -1104,72 +1104,67 @@ def masked_truncstore_us_vi32 : PatFrag<(ops node:$src1, node:$src2, node:$src3) // AVX2 special nodes // masked gather of AVX2 where mask elements are i32 -def avx2_x86_masked_gather_32 : SDNode<"X86ISD::MGATHER", +def avx2_x86_masked_gather : SDNode<"X86ISD::MGATHER", SDTypeProfile<2, 3, [ SDTCisVec<0>, SDTCisVec<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<1, 3>, - SDTCisPtrTy<4>, SDTCVecEltisVT<1, i32>, SDTCisSameNumEltsAs<0, 1>]>, + SDTCisPtrTy<4>, SDTCisInt<1>, SDTCisSameSizeAs<0, 1>, + SDTCisSameNumEltsAs<0, 1>]>, [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; -def avx2_masked_gather_32 : SDNode<"ISD::MGATHER", +def avx2_masked_gather : SDNode<"ISD::MGATHER", SDTypeProfile<2, 3, [ SDTCisVec<0>, SDTCisVec<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<1, 3>, - SDTCisPtrTy<4>, SDTCVecEltisVT<1, i32>, SDTCisSameNumEltsAs<0, 1>]>, - [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; - -// masked gather of AVX2 where mask elements are i64 -def avx2_masked_gather_64 : SDNode<"ISD::MGATHER", - SDTypeProfile<2, 3, [ - SDTCisVec<0>, SDTCisVec<1>, SDTCisSameAs<0, 2>, SDTCisSameAs<1, 3>, - SDTCisPtrTy<4>, SDTCVecEltisVT<1, i64>, SDTCisSameNumEltsAs<0, 1>]>, + SDTCisPtrTy<4>, SDTCisInt<1>, SDTCisSameSizeAs<0, 1>, + SDTCisSameNumEltsAs<0, 1>]>, [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; // dword gathers def avx2_mvpgatherdd_ps_xmm : PatFrag<(ops node:$src1, node:$src2, node:$src3), - (avx2_masked_gather_32 node:$src1, node:$src2, node:$src3) , [{ + (avx2_masked_gather node:$src1, node:$src2, node:$src3) , [{ MaskedGatherSDNode *Mgt = cast(N); return Mgt->getIndex().getValueType() == MVT::v4i32; }]>; def avx2_mvpgatherqd_ps_xmm : PatFrag<(ops node:$src1, node:$src2, node:$src3), - (avx2_x86_masked_gather_32 node:$src1, node:$src2, node:$src3) , [{ + (avx2_x86_masked_gather node:$src1, node:$src2, node:$src3) , [{ X86MaskedGatherSDNode *Mgt = cast(N); return Mgt->getIndex().getValueType() == MVT::v2i64; }]>; def avx2_mvpgatherdd_ps_ymm : PatFrag<(ops node:$src1, node:$src2, node:$src3), - (avx2_masked_gather_32 node:$src1, node:$src2, node:$src3) , [{ + (avx2_masked_gather node:$src1, node:$src2, node:$src3) , [{ MaskedGatherSDNode *Mgt = cast(N); return Mgt->getIndex().getValueType() == MVT::v8i32; }]>; def avx2_mvpgatherqd_ps_ymm : PatFrag<(ops node:$src1, node:$src2, node:$src3), - (avx2_masked_gather_32 node:$src1, node:$src2, node:$src3) , [{ + (avx2_masked_gather node:$src1, node:$src2, node:$src3) , [{ MaskedGatherSDNode *Mgt = cast(N); return Mgt->getIndex().getValueType() == MVT::v4i64; }]>; // qwords def avx2_mvpgatherdq_pd_xmm : PatFrag<(ops node:$src1, node:$src2, node:$src3), - (avx2_masked_gather_64 node:$src1, node:$src2, node:$src3) , [{ + (avx2_masked_gather node:$src1, node:$src2, node:$src3) , [{ MaskedGatherSDNode *Mgt = cast(N); return Mgt->getIndex().getValueType() == MVT::v2i32; }]>; def avx2_mvpgatherqq_pd_xmm : PatFrag<(ops node:$src1, node:$src2, node:$src3), - (avx2_masked_gather_64 node:$src1, node:$src2, node:$src3) , [{ + (avx2_masked_gather node:$src1, node:$src2, node:$src3) , [{ MaskedGatherSDNode *Mgt = dyn_cast(N); return Mgt->getIndex().getValueType() == MVT::v2i64 && Mgt->getMemoryVT().is128BitVector(); }]>; def avx2_mvpgatherdq_pd_ymm : PatFrag<(ops node:$src1, node:$src2, node:$src3), - (avx2_masked_gather_64 node:$src1, node:$src2, node:$src3) , [{ + (avx2_masked_gather node:$src1, node:$src2, node:$src3) , [{ MaskedGatherSDNode *Mgt = cast(N); return Mgt->getIndex().getValueType() == MVT::v4i32; }]>; def avx2_mvpgatherqq_pd_ymm : PatFrag<(ops node:$src1, node:$src2, node:$src3), - (avx2_masked_gather_64 node:$src1, node:$src2, node:$src3) , [{ + (avx2_masked_gather node:$src1, node:$src2, node:$src3) , [{ MaskedGatherSDNode *Mgt = cast(N); return Mgt->getIndex().getValueType() == MVT::v4i64; }]>; -- 2.11.0