aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-08-29 05:57:34 +0000
committerBob Wilson <bob.wilson@apple.com>2010-08-29 05:57:34 +0000
commit04d6c289ab28114af5471c4dc38cbf7b7127d3c3 (patch)
tree60f08d20f5b2177290252000aa305b07a43930d8 /lib/VMCore
parent63a75c13b110b89435ee5e30f1ce9ed57019ac5a (diff)
downloadexternal_llvm-04d6c289ab28114af5471c4dc38cbf7b7127d3c3.zip
external_llvm-04d6c289ab28114af5471c4dc38cbf7b7127d3c3.tar.gz
external_llvm-04d6c289ab28114af5471c4dc38cbf7b7127d3c3.tar.bz2
Remove NEON vaddl, vaddw, vsubl, and vsubw intrinsics. Instead, use llvm
IR add/sub operations with one or both operands sign- or zero-extended. Auto-upgrade the old intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112416 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/AutoUpgrade.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/lib/VMCore/AutoUpgrade.cpp b/lib/VMCore/AutoUpgrade.cpp
index 052fd2d..62a4625 100644
--- a/lib/VMCore/AutoUpgrade.cpp
+++ b/lib/VMCore/AutoUpgrade.cpp
@@ -79,8 +79,17 @@ static bool UpgradeIntrinsicFunction1(Function *F, Function *&NewFn) {
return true;
}
} else if (Name.compare(5, 9, "arm.neon.", 9) == 0) {
- if (Name.compare(14, 7, "vmovls.", 7) == 0 ||
- Name.compare(14, 7, "vmovlu.", 7) == 0) {
+ if (((Name.compare(14, 5, "vmovl", 5) == 0 ||
+ Name.compare(14, 5, "vaddl", 5) == 0 ||
+ Name.compare(14, 5, "vsubl", 5) == 0) &&
+ (Name.compare(19, 2, "s.", 2) == 0 ||
+ Name.compare(19, 2, "u.", 2) == 0)) ||
+
+ ((Name.compare(14, 5, "vaddw", 5) == 0 ||
+ Name.compare(14, 5, "vsubw", 5) == 0) &&
+ (Name.compare(19, 2, "s.", 2) == 0 ||
+ Name.compare(19, 2, "u.", 2) == 0))) {
+
// Calls to these are transformed into IR without intrinsics.
NewFn = 0;
return true;
@@ -371,6 +380,27 @@ void llvm::UpgradeIntrinsicCall(CallInst *CI, Function *NewFn) {
} else if (Name.compare(14, 7, "vmovlu.", 7) == 0) {
NewI = new ZExtInst(CI->getArgOperand(0), CI->getType(),
"upgraded." + CI->getName(), CI);
+
+ } else if (Name.compare(14, 4, "vadd", 4) == 0 ||
+ Name.compare(14, 4, "vsub", 4) == 0) {
+ // Extend one (vaddw/vsubw) or both (vaddl/vsubl) operands.
+ Value *V0 = CI->getArgOperand(0);
+ Value *V1 = CI->getArgOperand(1);
+ if (Name.at(19) == 's') {
+ if (Name.at(18) == 'l')
+ V0 = new SExtInst(CI->getArgOperand(0), CI->getType(), "", CI);
+ V1 = new SExtInst(CI->getArgOperand(1), CI->getType(), "", CI);
+ } else {
+ assert(Name.at(19) == 'u' && "unexpected vadd/vsub intrinsic");
+ if (Name.at(18) == 'l')
+ V0 = new ZExtInst(CI->getArgOperand(0), CI->getType(), "", CI);
+ V1 = new ZExtInst(CI->getArgOperand(1), CI->getType(), "", CI);
+ }
+ if (Name.compare(14, 4, "vadd", 4) == 0)
+ NewI = BinaryOperator::CreateAdd(V0, V1,"upgraded."+CI->getName(),CI);
+ else
+ NewI = BinaryOperator::CreateSub(V0, V1,"upgraded."+CI->getName(),CI);
+
} else {
llvm_unreachable("Unknown arm.neon function for CallInst upgrade.");
}