summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/ARM/divmod.ll
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2012-06-21 05:56:05 +0000
committerEvan Cheng <evan.cheng@apple.com>2012-06-21 05:56:05 +0000
commit8c2ad812384d840f6b2f20742bb5741c3a4f59f8 (patch)
tree8d0c3dba3e7c8993b98d32c038cfa08eba8a09e1 /llvm/test/CodeGen/ARM/divmod.ll
parent422080f547c0841d18a44d6395dc28e10c8ab467 (diff)
downloadbcm5719-llvm-8c2ad812384d840f6b2f20742bb5741c3a4f59f8.tar.gz
bcm5719-llvm-8c2ad812384d840f6b2f20742bb5741c3a4f59f8.zip
Emit a single _udivmodsi4 libcall instead of two separate _udivsi3 and
_umodsi3 libcalls if they have the same arguments. This optimization was apparently broken if one of the node was replaced in place. rdar://11714607 llvm-svn: 158900
Diffstat (limited to 'llvm/test/CodeGen/ARM/divmod.ll')
-rw-r--r--llvm/test/CodeGen/ARM/divmod.ll16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/test/CodeGen/ARM/divmod.ll b/llvm/test/CodeGen/ARM/divmod.ll
index 49c41037578..7fbf8f40903 100644
--- a/llvm/test/CodeGen/ARM/divmod.ll
+++ b/llvm/test/CodeGen/ARM/divmod.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=arm-apple-ios5.0 | FileCheck %s
+; RUN: llc < %s -mtriple=arm-apple-ios5.0 -mcpu=cortex-a8 | FileCheck %s
define void @foo(i32 %x, i32 %y, i32* nocapture %P) nounwind ssp {
entry:
@@ -56,3 +56,17 @@ bb1:
declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readnone
declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind
+
+; rdar://11714607
+define i32 @howmany(i32 %x, i32 %y) nounwind {
+entry:
+; CHECK: howmany:
+; CHECK: bl ___udivmodsi4
+; CHECK-NOT: ___udivsi3
+ %rem = urem i32 %x, %y
+ %div = udiv i32 %x, %y
+ %not.cmp = icmp ne i32 %rem, 0
+ %add = zext i1 %not.cmp to i32
+ %cond = add i32 %add, %div
+ ret i32 %cond
+}
OpenPOWER on IntegriCloud