forked from OSchip/llvm-project
[X86][IR] Merge together some very similar AutoUpgrade handling. NFC
llvm-svn: 295562
This commit is contained in:
parent
b455a8331c
commit
aa49f14496
|
@ -905,18 +905,11 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsX86 && (Name.startswith("avx512.mask.storeu."))) {
|
if (IsX86 && (Name.startswith("avx512.mask.store"))) {
|
||||||
|
// "avx512.mask.storeu." or "avx512.mask.store."
|
||||||
|
bool Aligned = Name[17] != 'u'; // "avx512.mask.storeu".
|
||||||
UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
|
UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
|
||||||
CI->getArgOperand(2), /*Aligned*/false);
|
CI->getArgOperand(2), Aligned);
|
||||||
|
|
||||||
// Remove intrinsic.
|
|
||||||
CI->eraseFromParent();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsX86 && (Name.startswith("avx512.mask.store."))) {
|
|
||||||
UpgradeMaskedStore(Builder, CI->getArgOperand(0), CI->getArgOperand(1),
|
|
||||||
CI->getArgOperand(2), /*Aligned*/true);
|
|
||||||
|
|
||||||
// Remove intrinsic.
|
// Remove intrinsic.
|
||||||
CI->eraseFromParent();
|
CI->eraseFromParent();
|
||||||
|
@ -925,15 +918,12 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||||
|
|
||||||
Value *Rep;
|
Value *Rep;
|
||||||
// Upgrade packed integer vector compare intrinsics to compare instructions.
|
// Upgrade packed integer vector compare intrinsics to compare instructions.
|
||||||
if (IsX86 && (Name.startswith("sse2.pcmpeq.") ||
|
if (IsX86 && (Name.startswith("sse2.pcmp") ||
|
||||||
Name.startswith("avx2.pcmpeq."))) {
|
Name.startswith("avx2.pcmp"))) {
|
||||||
Rep = Builder.CreateICmpEQ(CI->getArgOperand(0), CI->getArgOperand(1),
|
// "sse2.pcpmpeq." "sse2.pcmpgt." "avx2.pcmpeq." or "avx2.pcmpgt."
|
||||||
"pcmpeq");
|
bool CmpEq = Name[9] == 'e';
|
||||||
Rep = Builder.CreateSExt(Rep, CI->getType(), "");
|
Rep = Builder.CreateICmp(CmpEq ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_SGT,
|
||||||
} else if (IsX86 && (Name.startswith("sse2.pcmpgt.") ||
|
CI->getArgOperand(0), CI->getArgOperand(1));
|
||||||
Name.startswith("avx2.pcmpgt."))) {
|
|
||||||
Rep = Builder.CreateICmpSGT(CI->getArgOperand(0), CI->getArgOperand(1),
|
|
||||||
"pcmpgt");
|
|
||||||
Rep = Builder.CreateSExt(Rep, CI->getType(), "");
|
Rep = Builder.CreateSExt(Rep, CI->getType(), "");
|
||||||
} else if (IsX86 && (Name == "sse.add.ss" || Name == "sse2.add.sd")) {
|
} else if (IsX86 && (Name == "sse.add.ss" || Name == "sse2.add.sd")) {
|
||||||
Type *I32Ty = Type::getInt32Ty(C);
|
Type *I32Ty = Type::getInt32Ty(C);
|
||||||
|
@ -971,10 +961,12 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
||||||
Rep = Builder.CreateInsertElement(CI->getArgOperand(0),
|
Rep = Builder.CreateInsertElement(CI->getArgOperand(0),
|
||||||
Builder.CreateFDiv(Elt0, Elt1),
|
Builder.CreateFDiv(Elt0, Elt1),
|
||||||
ConstantInt::get(I32Ty, 0));
|
ConstantInt::get(I32Ty, 0));
|
||||||
} else if (IsX86 && Name.startswith("avx512.mask.pcmpeq.")) {
|
} else if (IsX86 && Name.startswith("avx512.mask.pcmp")) {
|
||||||
Rep = upgradeMaskedCompare(Builder, *CI, ICmpInst::ICMP_EQ);
|
// "avx512.mask.pcmpeq." or "avx512.mask.pcmpgt."
|
||||||
} else if (IsX86 && Name.startswith("avx512.mask.pcmpgt.")) {
|
bool CmpEq = Name[16] == 'e';
|
||||||
Rep = upgradeMaskedCompare(Builder, *CI, ICmpInst::ICMP_SGT);
|
Rep = upgradeMaskedCompare(Builder, *CI,
|
||||||
|
CmpEq ? ICmpInst::ICMP_EQ
|
||||||
|
: ICmpInst::ICMP_SGT);
|
||||||
} else if (IsX86 && (Name == "sse41.pmaxsb" ||
|
} else if (IsX86 && (Name == "sse41.pmaxsb" ||
|
||||||
Name == "sse2.pmaxs.w" ||
|
Name == "sse2.pmaxs.w" ||
|
||||||
Name == "sse41.pmaxsd" ||
|
Name == "sse41.pmaxsd" ||
|
||||||
|
|
Loading…
Reference in New Issue