mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 20:29:48 +00:00
832254e1c2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
24 lines
472 B
LLVM
24 lines
472 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
|
|
}
|