Address issues found by Duncan during post-commit review of r177856.
[oota-llvm.git] / test / Transforms / InstCombine / and-fcmp.ll
1 ; RUN: opt < %s -instcombine -S | FileCheck %s
2
3 define zeroext i8 @t1(float %x, float %y) nounwind {
4        %a = fcmp ueq float %x, %y
5        %b = fcmp ord float %x, %y
6        %c = and i1 %a, %b
7        %retval = zext i1 %c to i8
8        ret i8 %retval
9 ; CHECK: t1
10 ; CHECK: fcmp oeq float %x, %y
11 ; CHECK-NOT: fcmp ueq float %x, %y
12 ; CHECK-NOT: fcmp ord float %x, %y
13 ; CHECK-NOT: and
14 }
15
16 define zeroext i8 @t2(float %x, float %y) nounwind {
17        %a = fcmp olt float %x, %y
18        %b = fcmp ord float %x, %y
19        %c = and i1 %a, %b
20        %retval = zext i1 %c to i8
21        ret i8 %retval
22 ; CHECK: t2
23 ; CHECK: fcmp olt float %x, %y
24 ; CHECK-NOT: fcmp ord float %x, %y
25 ; CHECK-NOT: and
26 }
27
28 define zeroext i8 @t3(float %x, float %y) nounwind {
29        %a = fcmp oge float %x, %y
30        %b = fcmp uno float %x, %y
31        %c = and i1 %a, %b
32        %retval = zext i1 %c to i8
33        ret i8 %retval
34 ; CHECK: t3
35 ; CHECK: ret i8 0
36 }
37
38 define zeroext i8 @t4(float %x, float %y) nounwind {
39        %a = fcmp one float %y, %x
40        %b = fcmp ord float %x, %y
41        %c = and i1 %a, %b
42        %retval = zext i1 %c to i8
43        ret i8 %retval
44 ; CHECK: t4
45 ; CHECK: fcmp one float %y, %x
46 ; CHECK-NOT: fcmp ord float %x, %y
47 ; CHECK-NOT: and
48 }
49
50 define zeroext i8 @t5(float %x, float %y) nounwind {
51        %a = fcmp ord float %x, %y
52        %b = fcmp uno float %x, %y
53        %c = and i1 %a, %b
54        %retval = zext i1 %c to i8
55        ret i8 %retval
56 ; CHECK: t5
57 ; CHECK: ret i8 0
58 }
59
60 define zeroext i8 @t6(float %x, float %y) nounwind {
61        %a = fcmp uno float %x, %y
62        %b = fcmp ord float %x, %y
63        %c = and i1 %a, %b
64        %retval = zext i1 %c to i8
65        ret i8 %retval
66 ; CHECK: t6
67 ; CHECK: ret i8 0
68 }
69
70 define zeroext i8 @t7(float %x, float %y) nounwind {
71        %a = fcmp uno float %x, %y
72        %b = fcmp ult float %x, %y
73        %c = and i1 %a, %b
74        %retval = zext i1 %c to i8
75        ret i8 %retval
76 ; CHECK: t7
77 ; CHECK: fcmp uno
78 ; CHECK-NOT: fcmp ult
79 }