aboutsummaryrefslogtreecommitdiffstats
path: root/test
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
commit8ef0968dc230f6fae8fcbd6dc4a5cb9ccc780b6b (patch)
tree4dcacc50d2c34a682fe9314c4b7a5c559e97d1b6 /test
parentb60182e99b97f31756b013022d94fcfb1aa0be73 (diff)
downloadexternal_llvm-8ef0968dc230f6fae8fcbd6dc4a5cb9ccc780b6b.zip
external_llvm-8ef0968dc230f6fae8fcbd6dc4a5cb9ccc780b6b.tar.gz
external_llvm-8ef0968dc230f6fae8fcbd6dc4a5cb9ccc780b6b.tar.bz2
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158900 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/ARM/divmod.ll16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/CodeGen/ARM/divmod.ll b/test/CodeGen/ARM/divmod.ll
index 49c4103..7fbf8f4 100644
--- a/test/CodeGen/ARM/divmod.ll
+++ b/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
+}