aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2016-07-05 13:58:47 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2016-07-05 13:58:47 +0000
commit4e96fbf3c1a8b44656f31b35632b84a91edc3d85 (patch)
tree1502cebba2c7257def73ac1d54c9fa952f0c1354 /llvm/lib/IR/AutoUpgrade.cpp
parentc54b108cf8d7d883e4d771dcb3b1171dce2f080b (diff)
downloadllvm-4e96fbf3c1a8b44656f31b35632b84a91edc3d85.zip
llvm-4e96fbf3c1a8b44656f31b35632b84a91edc3d85.tar.gz
llvm-4e96fbf3c1a8b44656f31b35632b84a91edc3d85.tar.bz2
[X86][AVX512] Autoupgrade the BROADCAST intrinsics
llvm-svn: 274550
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 10972e86..8fee0f3 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -224,6 +224,8 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
Name.startswith("avx2.pbroadcast") ||
Name.startswith("avx.vpermil.") ||
Name.startswith("sse2.pshuf") ||
+ Name.startswith("avx512.pbroadcast") ||
+ Name.startswith("avx512.mask.broadcast.s") ||
Name.startswith("avx512.mask.movddup") ||
Name.startswith("avx512.mask.movshdup") ||
Name.startswith("avx512.mask.movsldup") ||
@@ -909,13 +911,19 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
Rep = Builder.CreateShuffleVector(Load, UndefValue::get(Load->getType()),
Idxs);
} else if (IsX86 && (Name.startswith("avx2.pbroadcast") ||
- Name.startswith("avx2.vbroadcast"))) {
+ Name.startswith("avx2.vbroadcast") ||
+ Name.startswith("avx512.pbroadcast") ||
+ Name.startswith("avx512.mask.broadcast.s"))) {
// Replace vp?broadcasts with a vector shuffle.
Value *Op = CI->getArgOperand(0);
unsigned NumElts = CI->getType()->getVectorNumElements();
Type *MaskTy = VectorType::get(Type::getInt32Ty(C), NumElts);
Rep = Builder.CreateShuffleVector(Op, UndefValue::get(Op->getType()),
Constant::getNullValue(MaskTy));
+
+ if (CI->getNumArgOperands() == 3)
+ Rep = EmitX86Select(Builder, CI->getArgOperand(2), Rep,
+ CI->getArgOperand(1));
} else if (IsX86 && Name.startswith("avx512.mask.palignr.")) {
Rep = UpgradeX86PALIGNRIntrinsics(Builder, C, CI->getArgOperand(0),
CI->getArgOperand(1),