summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-11 20:47:47 +0000
committerDan Gohman <gohman@apple.com>2009-08-11 20:47:47 +0000
commit1bdf5dc835e74ff6710dbd452601542d19116d08 (patch)
tree665dd1efc0a54ac8cc90d80e29d238baf79221eb /test/Transforms
parent825b72b0571821bf2d378749f69d6c4cfb52d2f9 (diff)
downloadllvm-1bdf5dc835e74ff6710dbd452601542d19116d08.tar.gz
llvm-1bdf5dc835e74ff6710dbd452601542d19116d08.tar.bz2
llvm-1bdf5dc835e74ff6710dbd452601542d19116d08.tar.xz
Optimize exact sdiv by a constant power of 2 to ashr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/exact-sdiv.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/exact-sdiv.ll b/test/Transforms/InstCombine/exact-sdiv.ll
new file mode 100644
index 0000000000..9ed524f8ec
--- /dev/null
+++ b/test/Transforms/InstCombine/exact-sdiv.ll
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | FileCheck %s
+
+; CHECK: define i32 @foo
+; CHECK: sdiv i32 %x, 8
+define i32 @foo(i32 %x) {
+ %y = sdiv i32 %x, 8
+ ret i32 %y
+}
+
+; CHECK: define i32 @bar
+; CHECK: ashr i32 %x, 3
+define i32 @bar(i32 %x) {
+ %y = sdiv exact i32 %x, 8
+ ret i32 %y
+}