mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
IRBuilder: add a CreateShuffleVector function that takes an ArrayRef of int
This is a convenience function to ease mask creation of ShuffleVectors in AutoUpgrade and other places. Differential Revision: http://reviews.llvm.org/D8184 llvm-svn: 232047
This commit is contained in:
parent
b58c185f5a
commit
1912cfcc7b
@ -1486,6 +1486,16 @@ public:
|
|||||||
return Insert(new ShuffleVectorInst(V1, V2, Mask), Name);
|
return Insert(new ShuffleVectorInst(V1, V2, Mask), Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Value *CreateShuffleVector(Value *V1, Value *V2, ArrayRef<int> IntMask,
|
||||||
|
const Twine &Name = "") {
|
||||||
|
size_t MaskSize = IntMask.size();
|
||||||
|
SmallVector<Constant*, 8> MaskVec(MaskSize);
|
||||||
|
for (size_t i = 0; i != MaskSize; ++i)
|
||||||
|
MaskVec[i] = getInt32(IntMask[i]);
|
||||||
|
Value *Mask = ConstantVector::get(MaskVec);
|
||||||
|
return CreateShuffleVector(V1, V2, Mask, Name);
|
||||||
|
}
|
||||||
|
|
||||||
Value *CreateExtractValue(Value *Agg,
|
Value *CreateExtractValue(Value *Agg,
|
||||||
ArrayRef<unsigned> Idxs,
|
ArrayRef<unsigned> Idxs,
|
||||||
const Twine &Name = "") {
|
const Twine &Name = "") {
|
||||||
|
@ -568,11 +568,9 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
|||||||
CI->getArgOperand(0),
|
CI->getArgOperand(0),
|
||||||
PointerType::getUnqual(VectorType::get(Type::getInt64Ty(C), 2)));
|
PointerType::getUnqual(VectorType::get(Type::getInt64Ty(C), 2)));
|
||||||
Value *Load = Builder.CreateLoad(Op);
|
Value *Load = Builder.CreateLoad(Op);
|
||||||
SmallVector<Constant *, 4> Idxs; // 0, 1, 0, 1.
|
int Idxs[4] = { 0, 1, 0, 1 };
|
||||||
for (unsigned i = 0; i != 4; ++i)
|
|
||||||
Idxs.push_back(Builder.getInt32(i & 1));
|
|
||||||
Rep = Builder.CreateShuffleVector(Load, UndefValue::get(Load->getType()),
|
Rep = Builder.CreateShuffleVector(Load, UndefValue::get(Load->getType()),
|
||||||
ConstantVector::get(Idxs));
|
Idxs);
|
||||||
} else if (Name == "llvm.x86.sse2.psll.dq") {
|
} else if (Name == "llvm.x86.sse2.psll.dq") {
|
||||||
// 128-bit shift left specified in bits.
|
// 128-bit shift left specified in bits.
|
||||||
unsigned Shift = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
|
unsigned Shift = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user