1; RUN: llc < %s -march=mipsel -mcpu=mips32   | FileCheck %s -check-prefix=ALL -check-prefix=FCC -check-prefix=32-FCC
2; RUN: llc < %s -march=mipsel -mcpu=mips32r2 | FileCheck %s -check-prefix=ALL -check-prefix=FCC -check-prefix=32-FCC
3; RUN: llc < %s -march=mipsel -mcpu=mips32r6 | FileCheck %s -check-prefix=ALL -check-prefix=GPR -check-prefix=32-GPR
4; RUN: llc < %s -march=mips64el -mcpu=mips64   | FileCheck %s -check-prefix=ALL -check-prefix=FCC -check-prefix=64-FCC
5; RUN: llc < %s -march=mips64el -mcpu=mips64r2 | FileCheck %s -check-prefix=ALL -check-prefix=FCC -check-prefix=64-FCC
6; RUN: llc < %s -march=mips64el -mcpu=mips64r6 | FileCheck %s -check-prefix=ALL -check-prefix=GPR -check-prefix=64-GPR
7
8define void @func0(float %f2, float %f3) nounwind {
9entry:
10; ALL-LABEL: func0:
11
12; 32-FCC:        c.eq.s $f12, $f14
13; 64-FCC:        c.eq.s $f12, $f13
14; FCC:           bc1f   $BB0_2
15
16; 32-GPR:        cmp.eq.s $[[FGRCC:f[0-9]+]], $f12, $f14
17; 64-GPR:        cmp.eq.s $[[FGRCC:f[0-9]+]], $f12, $f13
18; GPR:           mfc1     $[[GPRCC:[0-9]+]], $[[FGRCC:f[0-9]+]]
19; FIXME: We ought to be able to transform not+bnez -> beqz
20; GPR:           not      $[[GPRCC]], $[[GPRCC]]
21; GPR:           bnez     $[[GPRCC]], $BB0_2
22
23  %cmp = fcmp oeq float %f2, %f3
24  br i1 %cmp, label %if.then, label %if.else
25
26if.then:                                          ; preds = %entry
27  tail call void (...) @g0() nounwind
28  br label %if.end
29
30if.else:                                          ; preds = %entry
31  tail call void (...) @g1() nounwind
32  br label %if.end
33
34if.end:                                           ; preds = %if.else, %if.then
35  ret void
36}
37
38declare void @g0(...)
39
40declare void @g1(...)
41
42define void @func1(float %f2, float %f3) nounwind {
43entry:
44; ALL-LABEL: func1:
45
46; 32-FCC:        c.olt.s $f12, $f14
47; 64-FCC:        c.olt.s $f12, $f13
48; FCC:           bc1f    $BB1_2
49
50; 32-GPR:        cmp.ule.s $[[FGRCC:f[0-9]+]], $f14, $f12
51; 64-GPR:        cmp.ule.s $[[FGRCC:f[0-9]+]], $f13, $f12
52; GPR:           mfc1     $[[GPRCC:[0-9]+]], $[[FGRCC:f[0-9]+]]
53; GPR-NOT:       not      $[[GPRCC]], $[[GPRCC]]
54; GPR:           bnez     $[[GPRCC]], $BB1_2
55
56  %cmp = fcmp olt float %f2, %f3
57  br i1 %cmp, label %if.then, label %if.else
58
59if.then:                                          ; preds = %entry
60  tail call void (...) @g0() nounwind
61  br label %if.end
62
63if.else:                                          ; preds = %entry
64  tail call void (...) @g1() nounwind
65  br label %if.end
66
67if.end:                                           ; preds = %if.else, %if.then
68  ret void
69}
70
71define void @func2(float %f2, float %f3) nounwind {
72entry:
73; ALL-LABEL: func2:
74
75; 32-FCC:        c.ole.s $f12, $f14
76; 64-FCC:        c.ole.s $f12, $f13
77; FCC:           bc1t    $BB2_2
78
79; 32-GPR:        cmp.ult.s $[[FGRCC:f[0-9]+]], $f14, $f12
80; 64-GPR:        cmp.ult.s $[[FGRCC:f[0-9]+]], $f13, $f12
81; GPR:           mfc1     $[[GPRCC:[0-9]+]], $[[FGRCC:f[0-9]+]]
82; GPR-NOT:       not      $[[GPRCC]], $[[GPRCC]]
83; GPR:           beqz     $[[GPRCC]], $BB2_2
84
85  %cmp = fcmp ugt float %f2, %f3
86  br i1 %cmp, label %if.else, label %if.then
87
88if.then:                                          ; preds = %entry
89  tail call void (...) @g0() nounwind
90  br label %if.end
91
92if.else:                                          ; preds = %entry
93  tail call void (...) @g1() nounwind
94  br label %if.end
95
96if.end:                                           ; preds = %if.else, %if.then
97  ret void
98}
99
100define void @func3(double %f2, double %f3) nounwind {
101entry:
102; ALL-LABEL: func3:
103
104; 32-FCC:        c.eq.d $f12, $f14
105; 64-FCC:        c.eq.d $f12, $f13
106; FCC:           bc1f $BB3_2
107
108; 32-GPR:        cmp.eq.d $[[FGRCC:f[0-9]+]], $f12, $f14
109; 64-GPR:        cmp.eq.d $[[FGRCC:f[0-9]+]], $f12, $f13
110; GPR:           mfc1     $[[GPRCC:[0-9]+]], $[[FGRCC:f[0-9]+]]
111; FIXME: We ought to be able to transform not+bnez -> beqz
112; GPR:           not      $[[GPRCC]], $[[GPRCC]]
113; GPR:           bnez     $[[GPRCC]], $BB3_2
114
115  %cmp = fcmp oeq double %f2, %f3
116  br i1 %cmp, label %if.then, label %if.else
117
118if.then:                                          ; preds = %entry
119  tail call void (...) @g0() nounwind
120  br label %if.end
121
122if.else:                                          ; preds = %entry
123  tail call void (...) @g1() nounwind
124  br label %if.end
125
126if.end:                                           ; preds = %if.else, %if.then
127  ret void
128}
129
130define void @func4(double %f2, double %f3) nounwind {
131entry:
132; ALL-LABEL: func4:
133
134; 32-FCC:        c.olt.d $f12, $f14
135; 64-FCC:        c.olt.d $f12, $f13
136; FCC:           bc1f $BB4_2
137
138; 32-GPR:        cmp.ule.d $[[FGRCC:f[0-9]+]], $f14, $f12
139; 64-GPR:        cmp.ule.d $[[FGRCC:f[0-9]+]], $f13, $f12
140; GPR:           mfc1     $[[GPRCC:[0-9]+]], $[[FGRCC:f[0-9]+]]
141; GPR-NOT:       not      $[[GPRCC]], $[[GPRCC]]
142; GPR:           bnez     $[[GPRCC]], $BB4_2
143
144  %cmp = fcmp olt double %f2, %f3
145  br i1 %cmp, label %if.then, label %if.else
146
147if.then:                                          ; preds = %entry
148  tail call void (...) @g0() nounwind
149  br label %if.end
150
151if.else:                                          ; preds = %entry
152  tail call void (...) @g1() nounwind
153  br label %if.end
154
155if.end:                                           ; preds = %if.else, %if.then
156  ret void
157}
158
159define void @func5(double %f2, double %f3) nounwind {
160entry:
161; ALL-LABEL: func5:
162
163; 32-FCC:        c.ole.d $f12, $f14
164; 64-FCC:        c.ole.d $f12, $f13
165; FCC:           bc1t $BB5_2
166
167; 32-GPR:        cmp.ult.d $[[FGRCC:f[0-9]+]], $f14, $f12
168; 64-GPR:        cmp.ult.d $[[FGRCC:f[0-9]+]], $f13, $f12
169; GPR:           mfc1     $[[GPRCC:[0-9]+]], $[[FGRCC:f[0-9]+]]
170; GPR-NOT:       not      $[[GPRCC]], $[[GPRCC]]
171; GPR:           beqz     $[[GPRCC]], $BB5_2
172
173  %cmp = fcmp ugt double %f2, %f3
174  br i1 %cmp, label %if.else, label %if.then
175
176if.then:                                          ; preds = %entry
177  tail call void (...) @g0() nounwind
178  br label %if.end
179
180if.else:                                          ; preds = %entry
181  tail call void (...) @g1() nounwind
182  br label %if.end
183
184if.end:                                           ; preds = %if.else, %if.then
185  ret void
186}
187