summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
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
commitb59008c6948ec1114fd1171d474e887549270db3 (patch)
treefd1d804a3f0cc023b2abe4fd4e74a05bf86bbf94 /llvm/test/Transforms
parent1c65a21ec454e989596c22dc7c36450ae723ed24 (diff)
downloadbcm5719-llvm-b59008c6948ec1114fd1171d474e887549270db3.tar.gz
bcm5719-llvm-b59008c6948ec1114fd1171d474e887549270db3.zip
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. llvm-svn: 147391
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/shift.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll
index 132d51a660b..0dd969b8c00 100644
--- a/llvm/test/Transforms/InstCombine/shift.ll
+++ b/llvm/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
+}
OpenPOWER on IntegriCloud