summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2014-08-12 21:13:12 +0000
committerAdam Nemet <anemet@apple.com>2014-08-12 21:13:12 +0000
commitcee9d0a4608847acfe58ffc01be97bbc7ed88941 (patch)
tree44dfbf7264877ac881c8332b5a09486c90d9e1ff /llvm/lib
parent646f23b80934387d7b0873014bcd1aa6cf28372c (diff)
downloadbcm5719-llvm-cee9d0a4608847acfe58ffc01be97bbc7ed88941.tar.gz
bcm5719-llvm-cee9d0a4608847acfe58ffc01be97bbc7ed88941.zip
[AVX512] Handle valign masking intrinsic via C++ lowering
I think that this will scale better in most cases than adding a Pat<> for each mapping from the intrinsic DAG to the intruction (i.e. rri, rrik, rrikz). We can just lower to the SDNode and have the resulting DAG be matches by the DAG patterns. Alternatively (long term), we could keep the Pat<>s but generate them via the new AVX512_masking multiclass. The difficulty is that in order to formulate that we would have to concatenate DAGs. Currently this is only supported if the operators of the input DAGs are identical. llvm-svn: 215473
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp16
-rw-r--r--llvm/lib/Target/X86/X86InstrAVX512.td16
2 files changed, 16 insertions, 16 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index f7e4ac97542..2a8580584f4 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -14412,6 +14412,22 @@ static SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) {
case Intrinsic::x86_avx_sqrt_pd_256:
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");
+ // 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));
+ }
+
// 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
// or testp pattern and a setcc for the result.
diff --git a/llvm/lib/Target/X86/X86InstrAVX512.td b/llvm/lib/Target/X86/X86InstrAVX512.td
index 3383654ef61..02be95f48da 100644
--- a/llvm/lib/Target/X86/X86InstrAVX512.td
+++ b/llvm/lib/Target/X86/X86InstrAVX512.td
@@ -4509,22 +4509,6 @@ multiclass avx512_valign<string Suffix, RegisterClass RC, RegisterClass KRC,
def : Pat<(FloatVT (X86VAlign RC:$src1, RC:$src2, (i8 imm:$imm))),
(!cast<Instruction>(NAME##rri) RC:$src2, RC:$src1, imm:$imm)>;
- // Non-masking intrinsic call.
- def : Pat<(IntVT
- (!cast<Intrinsic>("int_x86_avx512_mask_valign_"##Suffix##"_512")
- RC:$src1, RC:$src2, imm:$src3,
- (IntVT (bitconvert (v16i32 immAllZerosV))), -1)),
- (!cast<Instruction>(NAME#rri) RC:$src1, RC:$src2, imm:$src3)>;
-
- // Masking intrinsic call.
- def : Pat<(IntVT
- (!cast<Intrinsic>("int_x86_avx512_mask_valign_"##Suffix##"_512")
- RC:$src1, RC:$src2, imm:$src3,
- RC:$src4, MRC:$mask)),
- (!cast<Instruction>(NAME#rrik) RC:$src4,
- (COPY_TO_REGCLASS MRC:$mask, KRC), RC:$src1,
- RC:$src2, imm:$src3)>;
-
let mayLoad = 1 in
def rmi : AVX512AIi8<0x03, MRMSrcMem, (outs RC:$dst),
(ins RC:$src1, x86memop:$src2, i8imm:$src3),
OpenPOWER on IntegriCloud