diff options
| author | Craig Topper <craig.topper@gmail.com> | 2012-06-13 07:18:53 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2012-06-13 07:18:53 +0000 |
| commit | 71dc02d6590b76604fb2df0f59ab4c5e6dd121c7 (patch) | |
| tree | c5af5def295a06f0dd070be2994ede514df3b85c /llvm/lib/VMCore/AutoUpgrade.cpp | |
| parent | 4e525e216d179d75cc36d611688961366faed50a (diff) | |
| download | bcm5719-llvm-71dc02d6590b76604fb2df0f59ab4c5e6dd121c7.tar.gz bcm5719-llvm-71dc02d6590b76604fb2df0f59ab4c5e6dd121c7.zip | |
Fix intrinsics for XOP frczss/sd instructions. These instructions only take one source register and zero the upper bits of the destination rather than preserving them.
llvm-svn: 158396
Diffstat (limited to 'llvm/lib/VMCore/AutoUpgrade.cpp')
| -rw-r--r-- | llvm/lib/VMCore/AutoUpgrade.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/AutoUpgrade.cpp b/llvm/lib/VMCore/AutoUpgrade.cpp index 4976c22ad53..5c2d63bc7c9 100644 --- a/llvm/lib/VMCore/AutoUpgrade.cpp +++ b/llvm/lib/VMCore/AutoUpgrade.cpp @@ -89,6 +89,19 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) { if (Name == "x86.sse41.ptestnzc") return UpgradeSSE41Function(F, Intrinsic::x86_sse41_ptestnzc, NewFn); } + // frcz.ss/sd may need to have an argument dropped + if (Name.startswith("x86.xop.vfrcz.ss") && F->arg_size() == 2) { + F->setName(Name + ".old"); + NewFn = Intrinsic::getDeclaration(F->getParent(), + Intrinsic::x86_xop_vfrcz_ss); + return true; + } + if (Name.startswith("x86.xop.vfrcz.sd") && F->arg_size() == 2) { + F->setName(Name + ".old"); + NewFn = Intrinsic::getDeclaration(F->getParent(), + Intrinsic::x86_xop_vfrcz_sd); + return true; + } // Fix the FMA4 intrinsics to remove the 4 if (Name.startswith("x86.fma4.")) { F->setName("llvm.x86.fma" + Name.substr(8)); @@ -282,9 +295,16 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { CI->eraseFromParent(); return; + case Intrinsic::x86_xop_vfrcz_ss: + case Intrinsic::x86_xop_vfrcz_sd: + CI->replaceAllUsesWith(Builder.CreateCall(NewFn, CI->getArgOperand(1), + Name)); + CI->eraseFromParent(); + return; + case Intrinsic::x86_sse41_ptestc: case Intrinsic::x86_sse41_ptestz: - case Intrinsic::x86_sse41_ptestnzc: + case Intrinsic::x86_sse41_ptestnzc: { // The arguments for these intrinsics used to be v4f32, and changed // to v2i64. This is purely a nop, since those are bitwise intrinsics. // So, the only thing required is a bitcast for both arguments. @@ -310,6 +330,7 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) { CI->eraseFromParent(); return; } + } } // This tests each Function to determine if it needs upgrading. When we find |

