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;
|
||||
}
|
||||
|
||||
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),
|
||||
CI->getArgOperand(2), /*Aligned*/false);
|
||||
|
||||
// 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);
|
||||
CI->getArgOperand(2), Aligned);
|
||||
|
||||
// Remove intrinsic.
|
||||
CI->eraseFromParent();
|
||||
|
@ -925,15 +918,12 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
|||
|
||||
Value *Rep;
|
||||
// Upgrade packed integer vector compare intrinsics to compare instructions.
|
||||
if (IsX86 && (Name.startswith("sse2.pcmpeq.") ||
|
||||
Name.startswith("avx2.pcmpeq."))) {
|
||||
Rep = Builder.CreateICmpEQ(CI->getArgOperand(0), CI->getArgOperand(1),
|
||||
"pcmpeq");
|
||||
Rep = Builder.CreateSExt(Rep, CI->getType(), "");
|
||||
} else if (IsX86 && (Name.startswith("sse2.pcmpgt.") ||
|
||||
Name.startswith("avx2.pcmpgt."))) {
|
||||
Rep = Builder.CreateICmpSGT(CI->getArgOperand(0), CI->getArgOperand(1),
|
||||
"pcmpgt");
|
||||
if (IsX86 && (Name.startswith("sse2.pcmp") ||
|
||||
Name.startswith("avx2.pcmp"))) {
|
||||
// "sse2.pcpmpeq." "sse2.pcmpgt." "avx2.pcmpeq." or "avx2.pcmpgt."
|
||||
bool CmpEq = Name[9] == 'e';
|
||||
Rep = Builder.CreateICmp(CmpEq ? ICmpInst::ICMP_EQ : ICmpInst::ICMP_SGT,
|
||||
CI->getArgOperand(0), CI->getArgOperand(1));
|
||||
Rep = Builder.CreateSExt(Rep, CI->getType(), "");
|
||||
} else if (IsX86 && (Name == "sse.add.ss" || Name == "sse2.add.sd")) {
|
||||
Type *I32Ty = Type::getInt32Ty(C);
|
||||
|
@ -971,10 +961,12 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
|
|||
Rep = Builder.CreateInsertElement(CI->getArgOperand(0),
|
||||
Builder.CreateFDiv(Elt0, Elt1),
|
||||
ConstantInt::get(I32Ty, 0));
|
||||
} else if (IsX86 && Name.startswith("avx512.mask.pcmpeq.")) {
|
||||
Rep = upgradeMaskedCompare(Builder, *CI, ICmpInst::ICMP_EQ);
|
||||
} else if (IsX86 && Name.startswith("avx512.mask.pcmpgt.")) {
|
||||
Rep = upgradeMaskedCompare(Builder, *CI, ICmpInst::ICMP_SGT);
|
||||
} else if (IsX86 && Name.startswith("avx512.mask.pcmp")) {
|
||||
// "avx512.mask.pcmpeq." or "avx512.mask.pcmpgt."
|
||||
bool CmpEq = Name[16] == 'e';
|
||||
Rep = upgradeMaskedCompare(Builder, *CI,
|
||||
CmpEq ? ICmpInst::ICMP_EQ
|
||||
: ICmpInst::ICMP_SGT);
|
||||
} else if (IsX86 && (Name == "sse41.pmaxsb" ||
|
||||
Name == "sse2.pmaxs.w" ||
|
||||
Name == "sse41.pmaxsd" ||
|
||||
|
|
Loading…
Reference in New Issue