diff options
author | Craig Topper <craig.topper@gmail.com> | 2016-11-07 00:13:39 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2016-11-07 00:13:39 +0000 |
commit | 7e545335d65a8fe8bf875544a35a03e105b595e9 (patch) | |
tree | fcb616fe42a0256f3d8afde599eb1a7c2e852925 /llvm/lib/IR/AutoUpgrade.cpp | |
parent | 6560d2c2d5d0f9967e9674c538ff75c873c7df22 (diff) | |
download | llvm-7e545335d65a8fe8bf875544a35a03e105b595e9.zip llvm-7e545335d65a8fe8bf875544a35a03e105b595e9.tar.gz llvm-7e545335d65a8fe8bf875544a35a03e105b595e9.tar.bz2 |
[AVX-512] Remove 128/256 masked pshufb intrinsics. Autoupgrade them to legacy intrinsics and a select.
llvm-svn: 286089
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r-- | llvm/lib/IR/AutoUpgrade.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp index 5c178cb..ee4fabd 100644 --- a/llvm/lib/IR/AutoUpgrade.cpp +++ b/llvm/lib/IR/AutoUpgrade.cpp @@ -244,6 +244,8 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { Name == "sse2.pminu.b" || Name == "sse41.pminuw" || Name == "sse41.pminud" || + Name == "avx512.mask.pshuf.b.128" || + Name == "avx512.mask.pshuf.b.256" || Name.startswith("avx2.pmax") || Name.startswith("avx2.pmin") || Name.startswith("avx512.mask.pmax") || @@ -1376,6 +1378,20 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { Rep = Builder.CreateFSub(CI->getArgOperand(0), CI->getArgOperand(1)); Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep, CI->getArgOperand(2)); + } else if (IsX86 && Name.startswith("avx512.mask.pshuf.b.")) { + VectorType *VecTy = cast<VectorType>(CI->getType()); + Intrinsic::ID IID; + if (VecTy->getPrimitiveSizeInBits() == 128) + IID = Intrinsic::x86_ssse3_pshuf_b_128; + else if (VecTy->getPrimitiveSizeInBits() == 256) + IID = Intrinsic::x86_avx2_pshuf_b; + else + llvm_unreachable("Unexpected intrinsic"); + + Rep = Builder.CreateCall(Intrinsic::getDeclaration(F->getParent(), IID), + { CI->getArgOperand(0), CI->getArgOperand(1) }); + Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep, + CI->getArgOperand(2)); } else if (IsX86 && Name == "avx512.mask.psll.d.128") { Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psll_d); } else if (IsX86 && Name == "avx512.mask.psll.d.256") { |