summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2016-09-09 13:35:36 +0000
committerJames Molloy <james.molloy@arm.com>2016-09-09 13:35:36 +0000
commit57d9dfa9ac7618aea8de6d1d1d940db6c7474737 (patch)
tree3ffd9c0c5df379168889f6cac3240cc838bc82fe /llvm/test/CodeGen/ARM
parent1454e90f86101a08445287635bf5c9b74497e1f7 (diff)
downloadbcm5719-llvm-57d9dfa9ac7618aea8de6d1d1d940db6c7474737.tar.gz
bcm5719-llvm-57d9dfa9ac7618aea8de6d1d1d940db6c7474737.zip
[ARM] ADD with a negative offset can become SUB for free
So model that directly in TTI::getIntImmCost(). llvm-svn: 281044
Diffstat (limited to 'llvm/test/CodeGen/ARM')
-rw-r--r--llvm/test/CodeGen/ARM/immcost.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/ARM/immcost.ll b/llvm/test/CodeGen/ARM/immcost.ll
index 43a4989e6bd..1b05ffbfac9 100644
--- a/llvm/test/CodeGen/ARM/immcost.ll
+++ b/llvm/test/CodeGen/ARM/immcost.ll
@@ -71,3 +71,20 @@ true:
ret:
ret void
}
+
+; CHECK: Function: test_add_neg
+; CHECK-NOT: Collect constant i32 -5
+define void @test_add_neg(i1 %cond, i32 %arg, i32 %arg2) {
+entry:
+ %a = add i32 %arg, -5
+ call void @g(i32 %a)
+ br i1 %cond, label %true, label %ret
+
+true:
+ %b = add i32 %arg2, -5
+ call void @g(i32 %b)
+ br label %ret
+
+ret:
+ ret void
+}
OpenPOWER on IntegriCloud