diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-11-16 16:00:48 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-11-16 16:00:48 +0000 |
commit | e9cdbf68e542bbb79597d6233dd2a339c89862a2 (patch) | |
tree | d38004354c7d6a76ed51ea01a8981b9abdcc1325 /test/Transforms/InstCombine/compare-signs.ll | |
parent | bd9f36f4db42f4b73caeb8cfe04e98f047d99375 (diff) | |
download | llvm-e9cdbf68e542bbb79597d6233dd2a339c89862a2.tar.gz llvm-e9cdbf68e542bbb79597d6233dd2a339c89862a2.tar.bz2 llvm-e9cdbf68e542bbb79597d6233dd2a339c89862a2.tar.xz |
InstCombine: fold (A >> C) == (B >> C) --> (A^B) < (1 << C) for constant Cs.
This is common in bitfield code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/compare-signs.ll')
-rw-r--r-- | test/Transforms/InstCombine/compare-signs.ll | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/Transforms/InstCombine/compare-signs.ll b/test/Transforms/InstCombine/compare-signs.ll index cdf95abcec..62cd5b3f94 100644 --- a/test/Transforms/InstCombine/compare-signs.ll +++ b/test/Transforms/InstCombine/compare-signs.ll @@ -24,9 +24,9 @@ define i32 @test3(i32 %a, i32 %b) nounwind readnone { ; CHECK-LABEL: @test3( entry: -; CHECK: xor i32 %a, %b -; CHECK: lshr i32 %0, 31 -; CHECK: xor i32 %1, 1 +; CHECK: [[XOR1:%.*]] = xor i32 %a, %b +; CHECK: [[SHIFT:%.*]] = lshr i32 [[XOR1]], 31 +; CHECK: [[XOR2:%.*]] = xor i32 [[SHIFT]], 1 %0 = lshr i32 %a, 31 ; <i32> [#uses=1] %1 = lshr i32 %b, 31 ; <i32> [#uses=1] %2 = icmp eq i32 %0, %1 ; <i1> [#uses=1] @@ -34,7 +34,7 @@ entry: ret i32 %3 ; CHECK-NOT: icmp ; CHECK-NOT: zext -; CHECK: ret i32 %2 +; CHECK: ret i32 [[XOR2]] } ; Variation on @test3: checking the 2nd bit in a situation where the 5th bit |