mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-17 18:10:31 +00:00
4d3ba7397f
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9674 91177308-0d34-0410-b5e6-96231b3b80d8
50 lines
960 B
LLVM
50 lines
960 B
LLVM
; This tests for various complex cast elimination cases instcombine should
|
|
; handle.
|
|
|
|
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep cast
|
|
|
|
bool %test1(int %X) {
|
|
%A = cast int %X to uint
|
|
%c = setne uint %A, 12 ; Convert to setne int %X, 12
|
|
ret bool %c
|
|
}
|
|
|
|
bool %test2(int %X, int %Y) {
|
|
%A = cast int %X to uint
|
|
%B = cast int %Y to uint
|
|
%c = setne uint %A, %B ; Convert to setne int %X, %Y
|
|
ret bool %c
|
|
}
|
|
|
|
int %test4(int %A) {
|
|
%B = cast int %A to uint
|
|
%C = shl uint %B, ubyte 2
|
|
%D = cast uint %C to int
|
|
ret int %D
|
|
}
|
|
|
|
short %test5(short %A) {
|
|
%B = cast short %A to uint
|
|
%C = and uint %B, 15
|
|
%D = cast uint %C to short
|
|
ret short %D
|
|
}
|
|
|
|
bool %test6(bool %A) {
|
|
%B = cast bool %A to int
|
|
%C = setne int %B, 0
|
|
ret bool %C
|
|
}
|
|
|
|
bool %test6a(bool %A) {
|
|
%B = cast bool %A to int
|
|
%C = setne int %B, -1 ; Always true!
|
|
ret bool %C
|
|
}
|
|
|
|
bool %test7(sbyte* %A) {
|
|
%B = cast sbyte* %A to int*
|
|
%C = seteq int* %B, null
|
|
ret bool %C
|
|
}
|