llvm-6502/test/Transforms/InstCombine/sitofp.ll
Chris Lattner 0c7a9a04e7 convert fptosi(sitofp x) -> x if the fp value has enough bits in its mantissa
to accurately represent the integer.  This triggers 9 times in 471.omnetpp,
though 8 of those seem to be inlined from the same place.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-19 20:25:04 +00:00

34 lines
696 B
LLVM

; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep sitofp
define i1 @test1(i8 %A) {
%B = sitofp i8 %A to double
%C = fcmp ult double %B, 128.0
ret i1 %C ; True!
}
define i1 @test2(i8 %A) {
%B = sitofp i8 %A to double
%C = fcmp ugt double %B, -128.1
ret i1 %C ; True!
}
define i1 @test3(i8 %A) {
%B = sitofp i8 %A to double
%C = fcmp ule double %B, 127.0
ret i1 %C ; true!
}
define i1 @test4(i8 %A) {
%B = sitofp i8 %A to double
%C = fcmp ult double %B, 127.0
ret i1 %C ; A != 127
}
define i32 @test5(i32 %A) {
%B = sitofp i32 %A to double
%C = fptosi double %B to i32
%D = uitofp i32 %C to double
%E = fptoui double %D to i32
ret i32 %E
}