diff options
| author | Dan Gohman <gohman@apple.com> | 2009-08-11 20:47:47 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-08-11 20:47:47 +0000 |
| commit | dbae4db67a01a007646b0f9da5db408cc846906c (patch) | |
| tree | c5dedf8b691e8a6489b2873c59311093dae6ea30 /llvm/test/Transforms/InstCombine/exact-sdiv.ll | |
| parent | 9f94459d24d82504f0962dfe366a5b39576c4809 (diff) | |
| download | bcm5719-llvm-dbae4db67a01a007646b0f9da5db408cc846906c.tar.gz bcm5719-llvm-dbae4db67a01a007646b0f9da5db408cc846906c.zip | |
Optimize exact sdiv by a constant power of 2 to ashr.
llvm-svn: 78714
Diffstat (limited to 'llvm/test/Transforms/InstCombine/exact-sdiv.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/exact-sdiv.ll | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/exact-sdiv.ll b/llvm/test/Transforms/InstCombine/exact-sdiv.ll new file mode 100644 index 00000000000..9ed524f8ec7 --- /dev/null +++ b/llvm/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 +} |

