diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2016-07-13 15:45:36 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2016-07-13 15:45:36 +0000 |
commit | a99368fa3540a82fd6aaf125a63a8b5c3b0674aa (patch) | |
tree | 6f04e5442a1fa6184b66a45c42e53311e084b28b | |
parent | 2404b1719241456b7c4a3f8c5f9ece18eebcfa48 (diff) | |
download | bcm5719-llvm-a99368fa3540a82fd6aaf125a63a8b5c3b0674aa.tar.gz bcm5719-llvm-a99368fa3540a82fd6aaf125a63a8b5c3b0674aa.zip |
[X86][AVX512] Add support for VPERMILPD/VPERMILPS variable shuffle mask comments
llvm-svn: 275272
-rw-r--r-- | llvm/lib/Target/X86/X86MCInstLower.cpp | 35 | ||||
-rw-r--r-- | llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll | 2 |
2 files changed, 27 insertions, 10 deletions
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp index 00a7c2540c4..217a37d6d10 100644 --- a/llvm/lib/Target/X86/X86MCInstLower.cpp +++ b/llvm/lib/Target/X86/X86MCInstLower.cpp @@ -1370,10 +1370,12 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) { } break; } - case X86::VPERMILPSrm: + case X86::VPERMILPDrm: - case X86::VPERMILPSYrm: - case X86::VPERMILPDYrm: { + case X86::VPERMILPDYrm: + case X86::VPERMILPDZ128rm: + case X86::VPERMILPDZ256rm: + case X86::VPERMILPDZrm: { if (!OutStreamer->isVerboseAsm()) break; assert(MI->getNumOperands() > 5 && @@ -1382,16 +1384,31 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) { const MachineOperand &SrcOp = MI->getOperand(1); const MachineOperand &MaskOp = MI->getOperand(5); - unsigned ElSize; - switch (MI->getOpcode()) { - default: llvm_unreachable("Invalid opcode"); - case X86::VPERMILPSrm: case X86::VPERMILPSYrm: ElSize = 32; break; - case X86::VPERMILPDrm: case X86::VPERMILPDYrm: ElSize = 64; break; + if (auto *C = getConstantFromPool(*MI, MaskOp)) { + SmallVector<int, 8> Mask; + DecodeVPERMILPMask(C, 64, Mask); + if (!Mask.empty()) + OutStreamer->AddComment(getShuffleComment(DstOp, SrcOp, SrcOp, Mask)); } + break; + } + + case X86::VPERMILPSrm: + case X86::VPERMILPSYrm: + case X86::VPERMILPSZ128rm: + case X86::VPERMILPSZ256rm: + case X86::VPERMILPSZrm: { + if (!OutStreamer->isVerboseAsm()) + break; + assert(MI->getNumOperands() > 5 && + "We should always have at least 5 operands!"); + const MachineOperand &DstOp = MI->getOperand(0); + const MachineOperand &SrcOp = MI->getOperand(1); + const MachineOperand &MaskOp = MI->getOperand(5); if (auto *C = getConstantFromPool(*MI, MaskOp)) { SmallVector<int, 16> Mask; - DecodeVPERMILPMask(C, ElSize, Mask); + DecodeVPERMILPMask(C, 32, Mask); if (!Mask.empty()) OutStreamer->AddComment(getShuffleComment(DstOp, SrcOp, SrcOp, Mask)); } diff --git a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll index 6d348bd39d6..baf1054170b 100644 --- a/llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll +++ b/llvm/test/CodeGen/X86/vector-shuffle-combining-avx512bw.ll @@ -442,7 +442,7 @@ define <8 x double> @combine_permvar_8f64_as_permpd_mask(<8 x double> %x0, <8 x define <16 x float> @combine_vpermilvar_16f32_230146759A8BCFDE(<16 x float> %x0) { ; CHECK-LABEL: combine_vpermilvar_16f32_230146759A8BCFDE: ; CHECK: # BB#0: -; CHECK-NEXT: vpermilps {{.*}}(%rip), %zmm0, %zmm0 +; CHECK-NEXT: vpermilps {{.*#+}} zmm0 = zmm0[2,3,0,1,4,6,7,5,9,10,8,11,12,15,13,14] ; CHECK-NEXT: retq %res0 = call <16 x float> @llvm.x86.avx512.mask.vpermilvar.ps.512(<16 x float> %x0, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 3, i32 2, i32 1, i32 0, i32 2, i32 3, i32 0, i32 1, i32 1, i32 0, i32 3, i32 2>, <16 x float> undef, i16 -1) %res1 = call <16 x float> @llvm.x86.avx512.mask.vpermilvar.ps.512(<16 x float> %res0, <16 x i32> <i32 2, i32 3, i32 0, i32 1, i32 3, i32 1, i32 0, i32 2, i32 3, i32 0, i32 2, i32 1, i32 1, i32 2, i32 0, i32 3>, <16 x float> undef, i16 -1) |