diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2016-07-04 14:19:05 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2016-07-04 14:19:05 +0000 |
| commit | 02d435d2f46359a07572353124354f3f41a92209 (patch) | |
| tree | 0ed81bafd5c55ebf76f1511e11fb38cdd198eeb8 /llvm/lib/IR | |
| parent | 97ef14c64ba06b10d792b5a14106b312f6aa162c (diff) | |
| download | bcm5719-llvm-02d435d2f46359a07572353124354f3f41a92209.tar.gz bcm5719-llvm-02d435d2f46359a07572353124354f3f41a92209.zip | |
[X86][AVX512] Autoupgrade the VPERMPD/VPERMQ intrinsics
llvm-svn: 274506
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 65cc2d4f858..160b5cadcbf 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -226,6 +226,8 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { Name.startswith("x86.avx512.mask.pshufl.w.") || Name.startswith("x86.avx512.mask.pshufh.w.") || Name.startswith("x86.avx512.mask.vpermil.p") || + Name.startswith("x86.avx512.mask.perm.df.") || + Name.startswith("x86.avx512.mask.perm.di.") || Name.startswith("x86.avx512.mask.punpckl") || Name.startswith("x86.avx512.mask.punpckh") || Name.startswith("x86.avx512.mask.unpckl.") || @@ -1006,6 +1008,22 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { Rep = Builder.CreateShuffleVector(Op0, UndefV, Idxs); } else if (Name == "llvm.stackprotectorcheck") { Rep = nullptr; + } else if (Name.startswith("llvm.x86.avx512.mask.perm.df.") || + Name.startswith("llvm.x86.avx512.mask.perm.di.")) { + Value *Op0 = CI->getArgOperand(0); + unsigned Imm = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue(); + VectorType *VecTy = cast<VectorType>(CI->getType()); + unsigned NumElts = VecTy->getNumElements(); + + SmallVector<uint32_t, 8> Idxs(NumElts); + for (unsigned i = 0; i != NumElts; ++i) + Idxs[i] = (i & ~0x3) + ((Imm >> (2 * (i & 0x3))) & 3); + + Rep = Builder.CreateShuffleVector(Op0, Op0, Idxs); + + if (CI->getNumArgOperands() == 4) + Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep, + CI->getArgOperand(2)); } else if (Name.startswith("llvm.x86.avx.vpermil.") || Name == "llvm.x86.sse2.pshuf.d" || Name.startswith("llvm.x86.avx512.mask.vpermil.p") || |

