llvm-6502/test/Transforms/InstCombine/shift-simplify.ll
Chris Lattner a0141b90a3 Implement shift-simplify.ll:test3, turning:
(X << 31) <s 0  --> (X&1) != 0

This happens dozens of times in the CFE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39879 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-15 20:42:37 +00:00

31 lines
592 B
LLVM

; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: egrep {shl|lshr|ashr} | wc -l | grep 3
define i32 @test0(i32 %A, i32 %B, i32 %C) {
%X = shl i32 %A, %C
%Y = shl i32 %B, %C
%Z = and i32 %X, %Y
ret i32 %Z
}
define i32 @test1(i32 %A, i32 %B, i32 %C) {
%X = lshr i32 %A, %C
%Y = lshr i32 %B, %C
%Z = or i32 %X, %Y
ret i32 %Z
}
define i32 @test2(i32 %A, i32 %B, i32 %C) {
%X = ashr i32 %A, %C
%Y = ashr i32 %B, %C
%Z = xor i32 %X, %Y
ret i32 %Z
}
define i1 @test3(i32 %X) {
%tmp1 = shl i32 %X, 7
%tmp2 = icmp slt i32 %tmp1, 0
ret i1 %tmp2
}