InstCombine: Don't assume that m_ZExt matches an Instruction
[oota-llvm.git] / test / Transforms / InstCombine / sitofp.ll
1 ; RUN: opt < %s -instcombine -S | not grep itofp
2
3 define i1 @test1(i8 %A) {
4   %B = sitofp i8 %A to double
5   %C = fcmp ult double %B, 128.0
6   ret i1 %C  ;  True!
7 }
8 define i1 @test2(i8 %A) {
9   %B = sitofp i8 %A to double
10   %C = fcmp ugt double %B, -128.1
11   ret i1 %C  ;  True!
12 }
13
14 define i1 @test3(i8 %A) {
15   %B = sitofp i8 %A to double
16   %C = fcmp ule double %B, 127.0
17   ret i1 %C  ;  true!
18 }
19
20 define i1 @test4(i8 %A) {
21   %B = sitofp i8 %A to double
22   %C = fcmp ult double %B, 127.0
23   ret i1 %C  ;  A != 127
24 }
25
26 define i32 @test5(i32 %A) {
27   %B = sitofp i32 %A to double
28   %C = fptosi double %B to i32
29   %D = uitofp i32 %C to double
30   %E = fptoui double %D to i32
31   ret i32 %E
32 }
33
34 define i32 @test6(i32 %A) {
35         %B = and i32 %A, 7              ; <i32> [#uses=1]
36         %C = and i32 %A, 32             ; <i32> [#uses=1]
37         %D = sitofp i32 %B to double            ; <double> [#uses=1]
38         %E = sitofp i32 %C to double            ; <double> [#uses=1]
39         %F = fadd double %D, %E         ; <double> [#uses=1]
40         %G = fptosi double %F to i32            ; <i32> [#uses=1]
41         ret i32 %G
42 }
43
44 define i32 @test7(i32 %a) nounwind {
45         %b = sitofp i32 %a to double            ; <double> [#uses=1]
46         %c = fptoui double %b to i32            ; <i32> [#uses=1]
47         ret i32 %c
48 }
49
50 define i32 @test8(i32 %a) nounwind {
51         %b = uitofp i32 %a to double            ; <double> [#uses=1]
52         %c = fptosi double %b to i32            ; <i32> [#uses=1]
53         ret i32 %c
54 }
55