summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/udivrem-change-width.ll
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-07-13 22:46:01 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-07-13 22:46:01 +0000
commit070a981ab7c9b1ba82af9acf5c3b94da8af48646 (patch)
tree1f27029d09615a6927994790194d23959c48cf5f /test/Transforms/InstCombine/udivrem-change-width.ll
parenta43c3aca851b10329f756b084d897e9dfb2d0729 (diff)
downloadllvm-070a981ab7c9b1ba82af9acf5c3b94da8af48646.tar.gz
llvm-070a981ab7c9b1ba82af9acf5c3b94da8af48646.tar.bz2
llvm-070a981ab7c9b1ba82af9acf5c3b94da8af48646.tar.xz
PR4548: optimize zext+udiv+trunc to udiv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/udivrem-change-width.ll')
-rw-r--r--test/Transforms/InstCombine/udivrem-change-width.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/udivrem-change-width.ll b/test/Transforms/InstCombine/udivrem-change-width.ll
new file mode 100644
index 0000000000..eb4ba66237
--- /dev/null
+++ b/test/Transforms/InstCombine/udivrem-change-width.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep zext
+; PR4548
+
+define i8 @udiv_i8(i8 %a, i8 %b) nounwind {
+ %conv = zext i8 %a to i32
+ %conv2 = zext i8 %b to i32
+ %div = udiv i32 %conv, %conv2
+ %conv3 = trunc i32 %div to i8
+ ret i8 %conv3
+}
+
+define i8 @urem_i8(i8 %a, i8 %b) nounwind {
+ %conv = zext i8 %a to i32
+ %conv2 = zext i8 %b to i32
+ %div = urem i32 %conv, %conv2
+ %conv3 = trunc i32 %div to i8
+ ret i8 %conv3
+}
+