summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/shift.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-12-31 21:30:22 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-12-31 21:30:22 +0000
commit57ed0948b87206beadce58c406f95dda345fe62c (patch)
treee95da1dd00faad0505c7d755dc296857db0195bf /test/Transforms/InstCombine/shift.ll
parentccc9a59614554bb91a932e64e64b9cc19e748442 (diff)
downloadllvm-57ed0948b87206beadce58c406f95dda345fe62c.tar.gz
llvm-57ed0948b87206beadce58c406f95dda345fe62c.tar.bz2
llvm-57ed0948b87206beadce58c406f95dda345fe62c.tar.xz
Make use of the exact bit when optimizing '(X >>exact 3) << 1' to eliminate the
'and' that would zero out the trailing bits, and to produce an exact shift ourselves. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147391 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/shift.ll')
-rw-r--r--test/Transforms/InstCombine/shift.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
index 132d51a660..0dd969b8c0 100644
--- a/test/Transforms/InstCombine/shift.ll
+++ b/test/Transforms/InstCombine/shift.ll
@@ -542,3 +542,21 @@ define i32 @test45(i32 %a) nounwind {
; CHECK-NEXT: %y = lshr i32 %a, 5
; CHECK-NEXT: ret i32 %y
}
+
+define i32 @test46(i32 %a) {
+ %y = ashr exact i32 %a, 3
+ %z = shl i32 %y, 1
+ ret i32 %z
+; CHECK: @test46
+; CHECK-NEXT: %z = ashr exact i32 %a, 2
+; CHECK-NEXT: ret i32 %z
+}
+
+define i32 @test47(i32 %a) {
+ %y = lshr exact i32 %a, 3
+ %z = shl i32 %y, 1
+ ret i32 %z
+; CHECK: @test47
+; CHECK-NEXT: %z = lshr exact i32 %a, 2
+; CHECK-NEXT: ret i32 %z
+}