summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/shift.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-01-04 09:28:29 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-01-04 09:28:29 +0000
commit148fd55ef3b47e224539eac7342c936bbf138ed5 (patch)
tree4f19b09970b69b29616410e8a4257d23e9bee156 /test/Transforms/InstCombine/shift.ll
parent515783466c24f9c5a9e6d9c7eb5ee7e4ab256358 (diff)
downloadllvm-148fd55ef3b47e224539eac7342c936bbf138ed5.tar.gz
llvm-148fd55ef3b47e224539eac7342c936bbf138ed5.tar.bz2
llvm-148fd55ef3b47e224539eac7342c936bbf138ed5.tar.xz
Teach instcombine all sorts of great stuff about shifts that have exact, nuw or
nsw bits on them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147528 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/shift.ll')
-rw-r--r--test/Transforms/InstCombine/shift.ll54
1 files changed, 54 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
index 0dd969b8c0..52310e34e0 100644
--- a/test/Transforms/InstCombine/shift.ll
+++ b/test/Transforms/InstCombine/shift.ll
@@ -560,3 +560,57 @@ define i32 @test47(i32 %a) {
; CHECK-NEXT: %z = lshr exact i32 %a, 2
; CHECK-NEXT: ret i32 %z
}
+
+define i32 @test48(i32 %x) {
+ %A = lshr exact i32 %x, 1
+ %B = shl i32 %A, 3
+ ret i32 %B
+; CHECK: @test48
+; CHECK-NEXT: %B = shl i32 %x, 2
+; CHECK-NEXT: ret i32 %B
+}
+
+define i32 @test49(i32 %x) {
+ %A = ashr exact i32 %x, 1
+ %B = shl i32 %A, 3
+ ret i32 %B
+; CHECK: @test49
+; CHECK-NEXT: %B = shl i32 %x, 2
+; CHECK-NEXT: ret i32 %B
+}
+
+define i32 @test50(i32 %x) {
+ %A = shl nsw i32 %x, 1
+ %B = ashr i32 %A, 3
+ ret i32 %B
+; CHECK: @test50
+; CHECK-NEXT: %B = ashr i32 %x, 2
+; CHECK-NEXT: ret i32 %B
+}
+
+define i32 @test51(i32 %x) {
+ %A = shl nuw i32 %x, 1
+ %B = lshr i32 %A, 3
+ ret i32 %B
+; CHECK: @test51
+; CHECK-NEXT: %B = lshr i32 %x, 2
+; CHECK-NEXT: ret i32 %B
+}
+
+define i32 @test52(i32 %x) {
+ %A = shl nsw i32 %x, 3
+ %B = ashr i32 %A, 1
+ ret i32 %B
+; CHECK: @test52
+; CHECK-NEXT: %B = shl nsw i32 %x, 2
+; CHECK-NEXT: ret i32 %B
+}
+
+define i32 @test53(i32 %x) {
+ %A = shl nuw i32 %x, 3
+ %B = lshr i32 %A, 1
+ ret i32 %B
+; CHECK: @test53
+; CHECK-NEXT: %B = shl nuw i32 %x, 2
+; CHECK-NEXT: ret i32 %B
+}