aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2012-06-21 22:52:49 +0000
committerEvan Cheng <evan.cheng@apple.com>2012-06-21 22:52:49 +0000
commit2a5422b1a6955977d05af48222c86c77c7549484 (patch)
tree8615d9db28212cc9b74bb852b0b2baeca27a471d /test/Transforms
parent5791df830dd8bc91f44aff98446d5f74a96ae185 (diff)
downloadexternal_llvm-2a5422b1a6955977d05af48222c86c77c7549484.zip
external_llvm-2a5422b1a6955977d05af48222c86c77c7549484.tar.gz
external_llvm-2a5422b1a6955977d05af48222c86c77c7549484.tar.bz2
Look pass zext to strength reduce an udiv. Patch by David Majnemer. rdar://11721329
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/div-shift.ll23
-rw-r--r--test/Transforms/InstCombine/sdiv-shift.ll9
2 files changed, 23 insertions, 9 deletions
diff --git a/test/Transforms/InstCombine/div-shift.ll b/test/Transforms/InstCombine/div-shift.ll
new file mode 100644
index 0000000..a07f3ea
--- /dev/null
+++ b/test/Transforms/InstCombine/div-shift.ll
@@ -0,0 +1,23 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+define i32 @t1(i16 zeroext %x, i32 %y) nounwind {
+entry:
+; CHECK: t1
+; CHECK-NOT: sdiv
+; CHECK: lshr i32 %conv
+ %conv = zext i16 %x to i32
+ %s = shl i32 2, %y
+ %d = sdiv i32 %conv, %s
+ ret i32 %d
+}
+
+; rdar://11721329
+define i64 @t2(i64 %x, i32 %y) nounwind {
+; CHECK: t2
+; CHECK-NOT: udiv
+; CHECK: lshr i64 %x
+ %1 = shl i32 1, %y
+ %2 = zext i32 %1 to i64
+ %3 = udiv i64 %x, %2
+ ret i64 %3
+}
diff --git a/test/Transforms/InstCombine/sdiv-shift.ll b/test/Transforms/InstCombine/sdiv-shift.ll
deleted file mode 100644
index f4d2b36..0000000
--- a/test/Transforms/InstCombine/sdiv-shift.ll
+++ /dev/null
@@ -1,9 +0,0 @@
-; RUN: opt < %s -instcombine -S | not grep div
-
-define i32 @a(i16 zeroext %x, i32 %y) nounwind {
-entry:
- %conv = zext i16 %x to i32
- %s = shl i32 2, %y
- %d = sdiv i32 %conv, %s
- ret i32 %d
-}