mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
[X86,IR] Remove unnecessary or unused LLVMContext parameter from some of the X86 intrinsic upgrade functions.
llvm-svn: 275138
This commit is contained in:
parent
804534ea05
commit
22685deaf4
@ -418,13 +418,13 @@ bool llvm::UpgradeGlobalVariable(GlobalVariable *GV) {
|
||||
|
||||
// Handles upgrading SSE2/AVX2/AVX512BW PSLLDQ intrinsics by converting them
|
||||
// to byte shuffles.
|
||||
static Value *UpgradeX86PSLLDQIntrinsics(IRBuilder<> &Builder, LLVMContext &C,
|
||||
static Value *UpgradeX86PSLLDQIntrinsics(IRBuilder<> &Builder,
|
||||
Value *Op, unsigned Shift) {
|
||||
Type *ResultTy = Op->getType();
|
||||
unsigned NumElts = ResultTy->getVectorNumElements() * 8;
|
||||
|
||||
// Bitcast from a 64-bit element type to a byte element type.
|
||||
Type *VecTy = VectorType::get(Type::getInt8Ty(C), NumElts);
|
||||
Type *VecTy = VectorType::get(Builder.getInt8Ty(), NumElts);
|
||||
Op = Builder.CreateBitCast(Op, VecTy, "cast");
|
||||
|
||||
// We'll be shuffling in zeroes.
|
||||
@ -452,14 +452,13 @@ static Value *UpgradeX86PSLLDQIntrinsics(IRBuilder<> &Builder, LLVMContext &C,
|
||||
|
||||
// Handles upgrading SSE2/AVX2/AVX512BW PSRLDQ intrinsics by converting them
|
||||
// to byte shuffles.
|
||||
static Value *UpgradeX86PSRLDQIntrinsics(IRBuilder<> &Builder, LLVMContext &C,
|
||||
Value *Op,
|
||||
static Value *UpgradeX86PSRLDQIntrinsics(IRBuilder<> &Builder, Value *Op,
|
||||
unsigned Shift) {
|
||||
Type *ResultTy = Op->getType();
|
||||
unsigned NumElts = ResultTy->getVectorNumElements() * 8;
|
||||
|
||||
// Bitcast from a 64-bit element type to a byte element type.
|
||||
Type *VecTy = VectorType::get(Type::getInt8Ty(C), NumElts);
|
||||
Type *VecTy = VectorType::get(Builder.getInt8Ty(), NumElts);
|
||||
Op = Builder.CreateBitCast(Op, VecTy, "cast");
|
||||
|
||||
// We'll be shuffling in zeroes.
|
||||
@ -516,7 +515,7 @@ static Value *EmitX86Select(IRBuilder<> &Builder, Value *Mask,
|
||||
return Builder.CreateSelect(Mask, Op0, Op1);
|
||||
}
|
||||
|
||||
static Value *UpgradeX86PALIGNRIntrinsics(IRBuilder<> &Builder, LLVMContext &C,
|
||||
static Value *UpgradeX86PALIGNRIntrinsics(IRBuilder<> &Builder,
|
||||
Value *Op0, Value *Op1, Value *Shift,
|
||||
Value *Passthru, Value *Mask) {
|
||||
unsigned ShiftVal = cast<llvm::ConstantInt>(Shift)->getZExtValue();
|
||||
@ -555,7 +554,7 @@ static Value *UpgradeX86PALIGNRIntrinsics(IRBuilder<> &Builder, LLVMContext &C,
|
||||
return EmitX86Select(Builder, Mask, Align, Passthru);
|
||||
}
|
||||
|
||||
static Value *UpgradeMaskedStore(IRBuilder<> &Builder, LLVMContext &C,
|
||||
static Value *UpgradeMaskedStore(IRBuilder<> &Builder,
|
||||
Value *Ptr, Value *Data, Value *Mask,
|
||||
bool Aligned) {
|
||||
// Cast the pointer to the right type.
|
||||
@ -575,7 +574,7 @@ static Value *UpgradeMaskedStore(IRBuilder<> &Builder, LLVMContext &C,
|
||||
return Builder.CreateMaskedStore(Data, Ptr, Align, Mask);
|
||||
}
|
||||
|
||||
static Value *UpgradeMaskedLoad(IRBuilder<> &Builder, LLVMContext &C,
|
||||
static Value *UpgradeMaskedLoad(IRBuilder<> &Builder,
|
||||
Value *Ptr, Value *Passthru, Value *Mask,
|
||||
bool Aligned) {
|
||||
// Cast the pointer to the right type.
|
||||
@ -796,7 +795,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
Name.startswith("avx512.mask.storeu.w.") ||
|
||||
Name.startswith("avx512.mask.storeu.d.") ||
|
||||
Name.startswith("avx512.mask.storeu.q."))) {
|
||||
UpgradeMaskedStore(Builder, C, CI->getArgOperand(0), CI->getArgOperand(1),
|
||||
UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
|
||||
CI->getArgOperand(2), /*Aligned*/false);
|
||||
|
||||
// Remove intrinsic.
|
||||
@ -807,7 +806,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
Name.startswith("avx512.mask.store.w.") ||
|
||||
Name.startswith("avx512.mask.store.d.") ||
|
||||
Name.startswith("avx512.mask.store.q."))) {
|
||||
UpgradeMaskedStore(Builder, C, CI->getArgOperand(0), CI->getArgOperand(1),
|
||||
UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
|
||||
CI->getArgOperand(2), /*Aligned*/true);
|
||||
|
||||
// Remove intrinsic.
|
||||
@ -818,7 +817,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
Name.startswith("avx512.mask.loadu.w.") ||
|
||||
Name.startswith("avx512.mask.loadu.d.") ||
|
||||
Name.startswith("avx512.mask.loadu.q."))) {
|
||||
Rep = UpgradeMaskedLoad(Builder, C, CI->getArgOperand(0),
|
||||
Rep = UpgradeMaskedLoad(Builder, CI->getArgOperand(0),
|
||||
CI->getArgOperand(1), CI->getArgOperand(2),
|
||||
/*Aligned*/false);
|
||||
} else if (IsX86 && (Name.startswith("avx512.mask.load.p") ||
|
||||
@ -826,7 +825,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
Name.startswith("avx512.mask.load.w.") ||
|
||||
Name.startswith("avx512.mask.load.d.") ||
|
||||
Name.startswith("avx512.mask.load.q."))) {
|
||||
Rep = UpgradeMaskedLoad(Builder, C, CI->getArgOperand(0),
|
||||
Rep = UpgradeMaskedLoad(Builder, CI->getArgOperand(0),
|
||||
CI->getArgOperand(1),CI->getArgOperand(2),
|
||||
/*Aligned*/true);
|
||||
} else if (IsX86 && Name.startswith("xop.vpcom")) {
|
||||
@ -947,7 +946,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
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),
|
||||
Rep = UpgradeX86PALIGNRIntrinsics(Builder, CI->getArgOperand(0),
|
||||
CI->getArgOperand(1),
|
||||
CI->getArgOperand(2),
|
||||
CI->getArgOperand(3),
|
||||
@ -956,26 +955,26 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||
Name == "avx2.psll.dq")) {
|
||||
// 128/256-bit shift left specified in bits.
|
||||
unsigned Shift = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
|
||||
Rep = UpgradeX86PSLLDQIntrinsics(Builder, C, CI->getArgOperand(0),
|
||||
Rep = UpgradeX86PSLLDQIntrinsics(Builder, CI->getArgOperand(0),
|
||||
Shift / 8); // Shift is in bits.
|
||||
} else if (IsX86 && (Name == "sse2.psrl.dq" ||
|
||||
Name == "avx2.psrl.dq")) {
|
||||
// 128/256-bit shift right specified in bits.
|
||||
unsigned Shift = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
|
||||
Rep = UpgradeX86PSRLDQIntrinsics(Builder, C, CI->getArgOperand(0),
|
||||
Rep = UpgradeX86PSRLDQIntrinsics(Builder, CI->getArgOperand(0),
|
||||
Shift / 8); // Shift is in bits.
|
||||
} else if (IsX86 && (Name == "sse2.psll.dq.bs" ||
|
||||
Name == "avx2.psll.dq.bs" ||
|
||||
Name == "avx512.psll.dq.512")) {
|
||||
// 128/256/512-bit shift left specified in bytes.
|
||||
unsigned Shift = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
|
||||
Rep = UpgradeX86PSLLDQIntrinsics(Builder, C, CI->getArgOperand(0), Shift);
|
||||
Rep = UpgradeX86PSLLDQIntrinsics(Builder, CI->getArgOperand(0), Shift);
|
||||
} else if (IsX86 && (Name == "sse2.psrl.dq.bs" ||
|
||||
Name == "avx2.psrl.dq.bs" ||
|
||||
Name == "avx512.psrl.dq.512")) {
|
||||
// 128/256/512-bit shift right specified in bytes.
|
||||
unsigned Shift = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
|
||||
Rep = UpgradeX86PSRLDQIntrinsics(Builder, C, CI->getArgOperand(0), Shift);
|
||||
Rep = UpgradeX86PSRLDQIntrinsics(Builder, CI->getArgOperand(0), Shift);
|
||||
} else if (IsX86 && (Name == "sse41.pblendw" ||
|
||||
Name.startswith("sse41.blendp") ||
|
||||
Name.startswith("avx.blend.p") ||
|
||||
|
Loading…
Reference in New Issue
Block a user