1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 00:12:50 +01:00
llvm-mirror/test/Transforms/InstCombine/shift-sra.ll
Reid Spencer 591bfa1e0b Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types.  This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
   shl i32 %X, 1
instead of
   shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.

llvm-svn: 33776
2007-02-02 02:16:23 +00:00

19 lines
559 B
LLVM

; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
; RUN: grep 'lshr i32' | wc -l | grep 2 &&
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep ashr
int %test1(int %X, ubyte %A) {
%Y = shr int %X, ubyte %A ; can be logical shift.
%Z = and int %Y, 1
ret int %Z
}
int %test2(ubyte %tmp) {
%tmp3 = cast ubyte %tmp to int
%tmp4 = add int %tmp3, 7
%tmp5 = ashr int %tmp4, ubyte 3 ; lshr
ret int %tmp5
}