aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-27 22:24:38 +0000
committerChris Lattner <sabre@nondot.org>2010-08-27 22:24:38 +0000
commit29cc0b3660dc75df06679c4c49cf91ffe24615ff (patch)
tree2fb2bb329305cd47145aed2f09dfe211a8462679 /test/Transforms
parentdbb350a5c73a7f205335685d17db42b120193e57 (diff)
downloadexternal_llvm-29cc0b3660dc75df06679c4c49cf91ffe24615ff.zip
external_llvm-29cc0b3660dc75df06679c4c49cf91ffe24615ff.tar.gz
external_llvm-29cc0b3660dc75df06679c4c49cf91ffe24615ff.tar.bz2
Implement a pretty general logical shift propagation
framework, which is good at ripping through bitfield operations. This generalize a bunch of the existing xforms that instcombine does, such as (x << c) >> c -> and to handle intermediate logical nodes. This is useful for ripping up the "promote to large integer" code produced by SRoA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112304 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/shift.ll21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
index 411d809..91a8ed7 100644
--- a/test/Transforms/InstCombine/shift.ll
+++ b/test/Transforms/InstCombine/shift.ll
@@ -130,8 +130,8 @@ define i8 @test13(i8 %A) {
;; D = ((B | 1234) << 4) === ((B << 4)|(1234 << 4)
define i32 @test14(i32 %A) {
; CHECK: @test14
-; CHECK-NEXT: or i32 %A, 19744
-; CHECK-NEXT: and i32
+; CHECK-NEXT: %B = and i32 %A, -19760
+; CHECK-NEXT: or i32 %B, 19744
; CHECK-NEXT: ret i32
%B = lshr i32 %A, 4 ; <i32> [#uses=1]
%C = or i32 %B, 1234 ; <i32> [#uses=1]
@@ -350,8 +350,8 @@ entry:
%tmp10 = lshr i32 %tmp917, 31
ret i32 %tmp10
; CHECK: @test29
-; CHECK: %tmp101 = lshr i64 %d18, 63
-; CHECK: %tmp10 = trunc i64 %tmp101 to i32
+; CHECK: %tmp916 = lshr i64 %d18, 63
+; CHECK: %tmp10 = trunc i64 %tmp916 to i32
}
@@ -412,3 +412,16 @@ define i1 @test35(i32 %X) {
; CHECK: ret i1 %tmp2
}
+define i128 @test36(i128 %A, i128 %B) {
+entry:
+ %tmp27 = shl i128 %A, 64
+ %tmp23 = shl i128 %B, 64
+ %ins = or i128 %tmp23, %tmp27
+ %tmp45 = lshr i128 %ins, 64
+ ret i128 %tmp45
+
+; CHECK: %tmp231 = or i128 %B, %A
+; CHECK: %ins = and i128 %tmp231, 18446744073709551615
+; CHECK: ret i128 %ins
+}
+