diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2010-01-31 04:29:12 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2010-01-31 04:29:12 +0000 |
commit | a2cc2875fca1945b4f4d6bf663920c40f5a79d69 (patch) | |
tree | ac80a0f4fd3cf8066cc7dbb26aeb0da4f93fc8c5 /llvm/test | |
parent | 6276b2506dd1b5f2babcad15ba5c80d6e77c66ec (diff) | |
download | bcm5719-llvm-a2cc2875fca1945b4f4d6bf663920c40f5a79d69.tar.gz bcm5719-llvm-a2cc2875fca1945b4f4d6bf663920c40f5a79d69.zip |
Simplify/generalize the xor+add->sign-extend instcombine.
llvm-svn: 94943
Diffstat (limited to 'llvm/test')
-rw-r--r-- | llvm/test/Transforms/InstCombine/signext.ll | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/llvm/test/Transforms/InstCombine/signext.ll b/llvm/test/Transforms/InstCombine/signext.ll index 1c52b62df4e..49384d6275e 100644 --- a/llvm/test/Transforms/InstCombine/signext.ll +++ b/llvm/test/Transforms/InstCombine/signext.ll @@ -8,8 +8,8 @@ define i32 @test1(i32 %x) { %tmp.3 = add i32 %tmp.2, 32768 ; <i32> [#uses=1] ret i32 %tmp.3 ; CHECK: @test1 -; CHECK: %sext1 = shl i32 %x, 16 -; CHECK: %tmp.3 = ashr i32 %sext1, 16 +; CHECK: %sext = shl i32 %x, 16 +; CHECK: %tmp.3 = ashr i32 %sext, 16 ; CHECK: ret i32 %tmp.3 } @@ -19,8 +19,8 @@ define i32 @test2(i32 %x) { %tmp.3 = add i32 %tmp.2, -32768 ; <i32> [#uses=1] ret i32 %tmp.3 ; CHECK: @test2 -; CHECK: %sext1 = shl i32 %x, 16 -; CHECK: %tmp.3 = ashr i32 %sext1, 16 +; CHECK: %sext = shl i32 %x, 16 +; CHECK: %tmp.3 = ashr i32 %sext, 16 ; CHECK: ret i32 %tmp.3 } @@ -50,8 +50,8 @@ define i32 @test5(i32 %x) { %tmp.3 = add i32 %tmp.2, -128 ; <i32> [#uses=1] ret i32 %tmp.3 ; CHECK: @test5 -; CHECK: %sext1 = shl i32 %x, 24 -; CHECK: %tmp.3 = ashr i32 %sext1, 24 +; CHECK: %sext = shl i32 %x, 24 +; CHECK: %tmp.3 = ashr i32 %sext, 24 ; CHECK: ret i32 %tmp.3 } @@ -74,3 +74,14 @@ define i32 @test7(i16 %P) { ; CHECK: %tmp.5 = sext i16 %P to i32 ; CHECK: ret i32 %tmp.5 } + +define i32 @test8(i32 %x) nounwind readnone { +entry: + %shr = lshr i32 %x, 5 ; <i32> [#uses=1] + %xor = xor i32 %shr, 67108864 ; <i32> [#uses=1] + %sub = add i32 %xor, -67108864 ; <i32> [#uses=1] + ret i32 %sub +; CHECK: @test8 +; CHECK: %sub = ashr i32 %x, 5 +; CHECK: ret i32 %sub +} |