Debian Codegraph @

llvm/test/CodeGen/PowerPC/scalar_cmp.ll

raw
1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names \
3 ; RUN: -verify-machineinstrs --enable-no-signed-zeros-fp-math \
4 ; RUN: --enable-no-nans-fp-math --enable-no-infs-fp-math \
5 ; RUN: -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
6 ; RUN: --check-prefix=FAST-P8
7 ; RUN: llc -mcpu=pwr9 -ppc-asm-full-reg-names \
8 ; RUN: -verify-machineinstrs --enable-no-signed-zeros-fp-math \
9 ; RUN: --enable-no-nans-fp-math --enable-no-infs-fp-math \
10 ; RUN: -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
11 ; RUN: --check-prefix=FAST-P9
12 ; RUN: llc -mcpu=pwr8 -ppc-asm-full-reg-names -verify-machineinstrs \
13 ; RUN: -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
14 ; RUN: --check-prefix=NO-FAST-P8
15 ; RUN: llc -mcpu=pwr9 -ppc-asm-full-reg-names -verify-machineinstrs \
16 ; RUN: -mtriple=powerpc64le-unknown-unknown < %s | FileCheck %s \
17 ; RUN: --check-prefix=NO-FAST-P9
18
19 ; Test oeq
20 define float @select_oeq_float(float %a, float %b, float %c, float %d) {
21 ; FAST-P8-LABEL: select_oeq_float:
22 ; FAST-P8: # %bb.0: # %entry
23 ; FAST-P8-NEXT: xssubsp f0, f1, f2
24 ; FAST-P8-NEXT: xsnegdp f1, f0
25 ; FAST-P8-NEXT: fsel f0, f0, f3, f4
26 ; FAST-P8-NEXT: fsel f1, f1, f0, f4
27 ; FAST-P8-NEXT: blr
28 ;
29 ; FAST-P9-LABEL: select_oeq_float:
30 ; FAST-P9: # %bb.0: # %entry
31 ; FAST-P9-NEXT: xssubsp f0, f1, f2
32 ; FAST-P9-NEXT: xsnegdp f1, f0
33 ; FAST-P9-NEXT: fsel f0, f0, f3, f4
34 ; FAST-P9-NEXT: fsel f1, f1, f0, f4
35 ; FAST-P9-NEXT: blr
36 ;
37 ; NO-FAST-P8-LABEL: select_oeq_float:
38 ; NO-FAST-P8: # %bb.0: # %entry
39 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
40 ; NO-FAST-P8-NEXT: beq cr0, .LBB0_2
41 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
42 ; NO-FAST-P8-NEXT: fmr f3, f4
43 ; NO-FAST-P8-NEXT: .LBB0_2: # %entry
44 ; NO-FAST-P8-NEXT: fmr f1, f3
45 ; NO-FAST-P8-NEXT: blr
46 ;
47 ; NO-FAST-P9-LABEL: select_oeq_float:
48 ; NO-FAST-P9: # %bb.0: # %entry
49 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
50 ; NO-FAST-P9-NEXT: beq cr0, .LBB0_2
51 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
52 ; NO-FAST-P9-NEXT: fmr f3, f4
53 ; NO-FAST-P9-NEXT: .LBB0_2: # %entry
54 ; NO-FAST-P9-NEXT: fmr f1, f3
55 ; NO-FAST-P9-NEXT: blr
56 entry:
57 %cmp = fcmp oeq float %a, %b
58 %cond = select i1 %cmp, float %c, float %d
59 ret float %cond
60 }
61
62 define float @select_oeq_float_nsz(float %a, float %b, float %c, float %d) {
63 ; FAST-P8-LABEL: select_oeq_float_nsz:
64 ; FAST-P8: # %bb.0: # %entry
65 ; FAST-P8-NEXT: xssubsp f0, f2, f1
66 ; FAST-P8-NEXT: xssubsp f1, f1, f2
67 ; FAST-P8-NEXT: fsel f1, f1, f3, f4
68 ; FAST-P8-NEXT: fsel f1, f0, f1, f4
69 ; FAST-P8-NEXT: blr
70 ;
71 ; FAST-P9-LABEL: select_oeq_float_nsz:
72 ; FAST-P9: # %bb.0: # %entry
73 ; FAST-P9-NEXT: xssubsp f0, f2, f1
74 ; FAST-P9-NEXT: xssubsp f1, f1, f2
75 ; FAST-P9-NEXT: fsel f1, f1, f3, f4
76 ; FAST-P9-NEXT: fsel f1, f0, f1, f4
77 ; FAST-P9-NEXT: blr
78 ;
79 ; NO-FAST-P8-LABEL: select_oeq_float_nsz:
80 ; NO-FAST-P8: # %bb.0: # %entry
81 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
82 ; NO-FAST-P8-NEXT: beq cr0, .LBB1_2
83 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
84 ; NO-FAST-P8-NEXT: fmr f3, f4
85 ; NO-FAST-P8-NEXT: .LBB1_2: # %entry
86 ; NO-FAST-P8-NEXT: fmr f1, f3
87 ; NO-FAST-P8-NEXT: blr
88 ;
89 ; NO-FAST-P9-LABEL: select_oeq_float_nsz:
90 ; NO-FAST-P9: # %bb.0: # %entry
91 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
92 ; NO-FAST-P9-NEXT: beq cr0, .LBB1_2
93 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
94 ; NO-FAST-P9-NEXT: fmr f3, f4
95 ; NO-FAST-P9-NEXT: .LBB1_2: # %entry
96 ; NO-FAST-P9-NEXT: fmr f1, f3
97 ; NO-FAST-P9-NEXT: blr
98 entry:
99 %cmp = fcmp nsz oeq float %a, %b
100 %cond = select i1 %cmp, float %c, float %d
101 ret float %cond
102 }
103
104 define double @select_oeq_double(double %a, double %b, double %c, double %d) {
105 ; FAST-P8-LABEL: select_oeq_double:
106 ; FAST-P8: # %bb.0: # %entry
107 ; FAST-P8-NEXT: xssubdp f0, f1, f2
108 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
109 ; FAST-P8-NEXT: xsnegdp f0, f0
110 ; FAST-P8-NEXT: fsel f1, f0, f1, f4
111 ; FAST-P8-NEXT: blr
112 ;
113 ; FAST-P9-LABEL: select_oeq_double:
114 ; FAST-P9: # %bb.0: # %entry
115 ; FAST-P9-NEXT: xssubdp f0, f1, f2
116 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
117 ; FAST-P9-NEXT: xsnegdp f0, f0
118 ; FAST-P9-NEXT: fsel f1, f0, f1, f4
119 ; FAST-P9-NEXT: blr
120 ;
121 ; NO-FAST-P8-LABEL: select_oeq_double:
122 ; NO-FAST-P8: # %bb.0: # %entry
123 ; NO-FAST-P8-NEXT: xscmpudp cr0, f1, f2
124 ; NO-FAST-P8-NEXT: beq cr0, .LBB2_2
125 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
126 ; NO-FAST-P8-NEXT: fmr f3, f4
127 ; NO-FAST-P8-NEXT: .LBB2_2: # %entry
128 ; NO-FAST-P8-NEXT: fmr f1, f3
129 ; NO-FAST-P8-NEXT: blr
130 ;
131 ; NO-FAST-P9-LABEL: select_oeq_double:
132 ; NO-FAST-P9: # %bb.0: # %entry
133 ; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
134 ; NO-FAST-P9-NEXT: beq cr0, .LBB2_2
135 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
136 ; NO-FAST-P9-NEXT: fmr f3, f4
137 ; NO-FAST-P9-NEXT: .LBB2_2: # %entry
138 ; NO-FAST-P9-NEXT: fmr f1, f3
139 ; NO-FAST-P9-NEXT: blr
140 entry:
141 %cmp = fcmp oeq double %a, %b
142 %cond = select i1 %cmp, double %c, double %d
143 ret double %cond
144 }
145
146 define float @select_fast_oeq_float(float %a, float %b, float %c, float %d) {
147 ; FAST-P8-LABEL: select_fast_oeq_float:
148 ; FAST-P8: # %bb.0: # %entry
149 ; FAST-P8-NEXT: xssubsp f0, f2, f1
150 ; FAST-P8-NEXT: xssubsp f1, f1, f2
151 ; FAST-P8-NEXT: fsel f1, f1, f3, f4
152 ; FAST-P8-NEXT: fsel f1, f0, f1, f4
153 ; FAST-P8-NEXT: blr
154 ;
155 ; FAST-P9-LABEL: select_fast_oeq_float:
156 ; FAST-P9: # %bb.0: # %entry
157 ; FAST-P9-NEXT: xssubsp f0, f2, f1
158 ; FAST-P9-NEXT: xssubsp f1, f1, f2
159 ; FAST-P9-NEXT: fsel f1, f1, f3, f4
160 ; FAST-P9-NEXT: fsel f1, f0, f1, f4
161 ; FAST-P9-NEXT: blr
162 ;
163 ; NO-FAST-P8-LABEL: select_fast_oeq_float:
164 ; NO-FAST-P8: # %bb.0: # %entry
165 ; NO-FAST-P8-NEXT: xssubsp f0, f2, f1
166 ; NO-FAST-P8-NEXT: xssubsp f1, f1, f2
167 ; NO-FAST-P8-NEXT: fsel f1, f1, f3, f4
168 ; NO-FAST-P8-NEXT: fsel f1, f0, f1, f4
169 ; NO-FAST-P8-NEXT: blr
170 ;
171 ; NO-FAST-P9-LABEL: select_fast_oeq_float:
172 ; NO-FAST-P9: # %bb.0: # %entry
173 ; NO-FAST-P9-NEXT: xssubsp f0, f2, f1
174 ; NO-FAST-P9-NEXT: xssubsp f1, f1, f2
175 ; NO-FAST-P9-NEXT: fsel f1, f1, f3, f4
176 ; NO-FAST-P9-NEXT: fsel f1, f0, f1, f4
177 ; NO-FAST-P9-NEXT: blr
178 entry:
179 %cmp = fcmp nnan ninf nsz oeq float %a, %b
180 %cond = select i1 %cmp, float %c, float %d
181 ret float %cond
182 }
183
184 define double @select_fast_oeq_double(double %a, double %b, double %c, double %d) {
185 ; FAST-P8-LABEL: select_fast_oeq_double:
186 ; FAST-P8: # %bb.0: # %entry
187 ; FAST-P8-NEXT: xssubdp f0, f1, f2
188 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
189 ; FAST-P8-NEXT: xsnegdp f0, f0
190 ; FAST-P8-NEXT: fsel f1, f0, f1, f4
191 ; FAST-P8-NEXT: blr
192 ;
193 ; FAST-P9-LABEL: select_fast_oeq_double:
194 ; FAST-P9: # %bb.0: # %entry
195 ; FAST-P9-NEXT: xssubdp f0, f1, f2
196 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
197 ; FAST-P9-NEXT: xsnegdp f0, f0
198 ; FAST-P9-NEXT: fsel f1, f0, f1, f4
199 ; FAST-P9-NEXT: blr
200 ;
201 ; NO-FAST-P8-LABEL: select_fast_oeq_double:
202 ; NO-FAST-P8: # %bb.0: # %entry
203 ; NO-FAST-P8-NEXT: xssubdp f0, f1, f2
204 ; NO-FAST-P8-NEXT: fsel f1, f0, f3, f4
205 ; NO-FAST-P8-NEXT: xsnegdp f0, f0
206 ; NO-FAST-P8-NEXT: fsel f1, f0, f1, f4
207 ; NO-FAST-P8-NEXT: blr
208 ;
209 ; NO-FAST-P9-LABEL: select_fast_oeq_double:
210 ; NO-FAST-P9: # %bb.0: # %entry
211 ; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
212 ; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
213 ; NO-FAST-P9-NEXT: xsnegdp f0, f0
214 ; NO-FAST-P9-NEXT: fsel f1, f0, f1, f4
215 ; NO-FAST-P9-NEXT: blr
216 entry:
217 %cmp = fcmp nnan ninf nsz oeq double %a, %b
218 %cond = select i1 %cmp, double %c, double %d
219 ret double %cond
220 }
221
222
223 ; Test one
224 define float @select_one_float(float %a, float %b, float %c, float %d) {
225 ; FAST-P8-LABEL: select_one_float:
226 ; FAST-P8: # %bb.0: # %entry
227 ; FAST-P8-NEXT: xssubsp f0, f1, f2
228 ; FAST-P8-NEXT: xsnegdp f1, f0
229 ; FAST-P8-NEXT: fsel f0, f0, f4, f3
230 ; FAST-P8-NEXT: fsel f1, f1, f0, f3
231 ; FAST-P8-NEXT: blr
232 ;
233 ; FAST-P9-LABEL: select_one_float:
234 ; FAST-P9: # %bb.0: # %entry
235 ; FAST-P9-NEXT: xssubsp f0, f1, f2
236 ; FAST-P9-NEXT: xsnegdp f1, f0
237 ; FAST-P9-NEXT: fsel f0, f0, f4, f3
238 ; FAST-P9-NEXT: fsel f1, f1, f0, f3
239 ; FAST-P9-NEXT: blr
240 ;
241 ; NO-FAST-P8-LABEL: select_one_float:
242 ; NO-FAST-P8: # %bb.0: # %entry
243 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
244 ; NO-FAST-P8-NEXT: crnor 4*cr5+lt, un, eq
245 ; NO-FAST-P8-NEXT: bc 12, 4*cr5+lt, .LBB5_2
246 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
247 ; NO-FAST-P8-NEXT: fmr f3, f4
248 ; NO-FAST-P8-NEXT: .LBB5_2: # %entry
249 ; NO-FAST-P8-NEXT: fmr f1, f3
250 ; NO-FAST-P8-NEXT: blr
251 ;
252 ; NO-FAST-P9-LABEL: select_one_float:
253 ; NO-FAST-P9: # %bb.0: # %entry
254 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
255 ; NO-FAST-P9-NEXT: crnor 4*cr5+lt, un, eq
256 ; NO-FAST-P9-NEXT: bc 12, 4*cr5+lt, .LBB5_2
257 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
258 ; NO-FAST-P9-NEXT: fmr f3, f4
259 ; NO-FAST-P9-NEXT: .LBB5_2: # %entry
260 ; NO-FAST-P9-NEXT: fmr f1, f3
261 ; NO-FAST-P9-NEXT: blr
262 entry:
263 %cmp = fcmp one float %a, %b
264 %cond = select i1 %cmp, float %c, float %d
265 ret float %cond
266 }
267
268 define float @select_one_float_nsz(float %a, float %b, float %c, float %d) {
269 ; FAST-P8-LABEL: select_one_float_nsz:
270 ; FAST-P8: # %bb.0: # %entry
271 ; FAST-P8-NEXT: xssubsp f0, f2, f1
272 ; FAST-P8-NEXT: xssubsp f1, f1, f2
273 ; FAST-P8-NEXT: fsel f1, f1, f4, f3
274 ; FAST-P8-NEXT: fsel f1, f0, f1, f3
275 ; FAST-P8-NEXT: blr
276 ;
277 ; FAST-P9-LABEL: select_one_float_nsz:
278 ; FAST-P9: # %bb.0: # %entry
279 ; FAST-P9-NEXT: xssubsp f0, f2, f1
280 ; FAST-P9-NEXT: xssubsp f1, f1, f2
281 ; FAST-P9-NEXT: fsel f1, f1, f4, f3
282 ; FAST-P9-NEXT: fsel f1, f0, f1, f3
283 ; FAST-P9-NEXT: blr
284 ;
285 ; NO-FAST-P8-LABEL: select_one_float_nsz:
286 ; NO-FAST-P8: # %bb.0: # %entry
287 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
288 ; NO-FAST-P8-NEXT: crnor 4*cr5+lt, un, eq
289 ; NO-FAST-P8-NEXT: bc 12, 4*cr5+lt, .LBB6_2
290 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
291 ; NO-FAST-P8-NEXT: fmr f3, f4
292 ; NO-FAST-P8-NEXT: .LBB6_2: # %entry
293 ; NO-FAST-P8-NEXT: fmr f1, f3
294 ; NO-FAST-P8-NEXT: blr
295 ;
296 ; NO-FAST-P9-LABEL: select_one_float_nsz:
297 ; NO-FAST-P9: # %bb.0: # %entry
298 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
299 ; NO-FAST-P9-NEXT: crnor 4*cr5+lt, un, eq
300 ; NO-FAST-P9-NEXT: bc 12, 4*cr5+lt, .LBB6_2
301 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
302 ; NO-FAST-P9-NEXT: fmr f3, f4
303 ; NO-FAST-P9-NEXT: .LBB6_2: # %entry
304 ; NO-FAST-P9-NEXT: fmr f1, f3
305 ; NO-FAST-P9-NEXT: blr
306 entry:
307 %cmp = fcmp nsz one float %a, %b
308 %cond = select i1 %cmp, float %c, float %d
309 ret float %cond
310 }
311
312 define double @select_one_double(double %a, double %b, double %c, double %d) {
313 ; FAST-P8-LABEL: select_one_double:
314 ; FAST-P8: # %bb.0: # %entry
315 ; FAST-P8-NEXT: xssubdp f0, f1, f2
316 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
317 ; FAST-P8-NEXT: xsnegdp f0, f0
318 ; FAST-P8-NEXT: fsel f1, f0, f1, f3
319 ; FAST-P8-NEXT: blr
320 ;
321 ; FAST-P9-LABEL: select_one_double:
322 ; FAST-P9: # %bb.0: # %entry
323 ; FAST-P9-NEXT: xssubdp f0, f1, f2
324 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
325 ; FAST-P9-NEXT: xsnegdp f0, f0
326 ; FAST-P9-NEXT: fsel f1, f0, f1, f3
327 ; FAST-P9-NEXT: blr
328 ;
329 ; NO-FAST-P8-LABEL: select_one_double:
330 ; NO-FAST-P8: # %bb.0: # %entry
331 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
332 ; NO-FAST-P8-NEXT: crnor 4*cr5+lt, un, eq
333 ; NO-FAST-P8-NEXT: bc 12, 4*cr5+lt, .LBB7_2
334 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
335 ; NO-FAST-P8-NEXT: fmr f3, f4
336 ; NO-FAST-P8-NEXT: .LBB7_2: # %entry
337 ; NO-FAST-P8-NEXT: fmr f1, f3
338 ; NO-FAST-P8-NEXT: blr
339 ;
340 ; NO-FAST-P9-LABEL: select_one_double:
341 ; NO-FAST-P9: # %bb.0: # %entry
342 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
343 ; NO-FAST-P9-NEXT: crnor 4*cr5+lt, un, eq
344 ; NO-FAST-P9-NEXT: bc 12, 4*cr5+lt, .LBB7_2
345 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
346 ; NO-FAST-P9-NEXT: fmr f3, f4
347 ; NO-FAST-P9-NEXT: .LBB7_2: # %entry
348 ; NO-FAST-P9-NEXT: fmr f1, f3
349 ; NO-FAST-P9-NEXT: blr
350 entry:
351 %cmp = fcmp one double %a, %b
352 %cond = select i1 %cmp, double %c, double %d
353 ret double %cond
354 }
355
356 define float @select_fast_one_float(float %a, float %b, float %c, float %d) {
357 ; FAST-P8-LABEL: select_fast_one_float:
358 ; FAST-P8: # %bb.0: # %entry
359 ; FAST-P8-NEXT: xssubsp f0, f2, f1
360 ; FAST-P8-NEXT: xssubsp f1, f1, f2
361 ; FAST-P8-NEXT: fsel f1, f1, f4, f3
362 ; FAST-P8-NEXT: fsel f1, f0, f1, f3
363 ; FAST-P8-NEXT: blr
364 ;
365 ; FAST-P9-LABEL: select_fast_one_float:
366 ; FAST-P9: # %bb.0: # %entry
367 ; FAST-P9-NEXT: xssubsp f0, f2, f1
368 ; FAST-P9-NEXT: xssubsp f1, f1, f2
369 ; FAST-P9-NEXT: fsel f1, f1, f4, f3
370 ; FAST-P9-NEXT: fsel f1, f0, f1, f3
371 ; FAST-P9-NEXT: blr
372 ;
373 ; NO-FAST-P8-LABEL: select_fast_one_float:
374 ; NO-FAST-P8: # %bb.0: # %entry
375 ; NO-FAST-P8-NEXT: xssubsp f0, f2, f1
376 ; NO-FAST-P8-NEXT: xssubsp f1, f1, f2
377 ; NO-FAST-P8-NEXT: fsel f1, f1, f4, f3
378 ; NO-FAST-P8-NEXT: fsel f1, f0, f1, f3
379 ; NO-FAST-P8-NEXT: blr
380 ;
381 ; NO-FAST-P9-LABEL: select_fast_one_float:
382 ; NO-FAST-P9: # %bb.0: # %entry
383 ; NO-FAST-P9-NEXT: xssubsp f0, f2, f1
384 ; NO-FAST-P9-NEXT: xssubsp f1, f1, f2
385 ; NO-FAST-P9-NEXT: fsel f1, f1, f4, f3
386 ; NO-FAST-P9-NEXT: fsel f1, f0, f1, f3
387 ; NO-FAST-P9-NEXT: blr
388 entry:
389 %cmp = fcmp nnan ninf nsz one float %a, %b
390 %cond = select i1 %cmp, float %c, float %d
391 ret float %cond
392 }
393
394 define double @select_fast_one_double(double %a, double %b, double %c, double %d) {
395 ; FAST-P8-LABEL: select_fast_one_double:
396 ; FAST-P8: # %bb.0: # %entry
397 ; FAST-P8-NEXT: xssubdp f0, f1, f2
398 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
399 ; FAST-P8-NEXT: xsnegdp f0, f0
400 ; FAST-P8-NEXT: fsel f1, f0, f1, f3
401 ; FAST-P8-NEXT: blr
402 ;
403 ; FAST-P9-LABEL: select_fast_one_double:
404 ; FAST-P9: # %bb.0: # %entry
405 ; FAST-P9-NEXT: xssubdp f0, f1, f2
406 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
407 ; FAST-P9-NEXT: xsnegdp f0, f0
408 ; FAST-P9-NEXT: fsel f1, f0, f1, f3
409 ; FAST-P9-NEXT: blr
410 ;
411 ; NO-FAST-P8-LABEL: select_fast_one_double:
412 ; NO-FAST-P8: # %bb.0: # %entry
413 ; NO-FAST-P8-NEXT: xssubdp f0, f1, f2
414 ; NO-FAST-P8-NEXT: fsel f1, f0, f4, f3
415 ; NO-FAST-P8-NEXT: xsnegdp f0, f0
416 ; NO-FAST-P8-NEXT: fsel f1, f0, f1, f3
417 ; NO-FAST-P8-NEXT: blr
418 ;
419 ; NO-FAST-P9-LABEL: select_fast_one_double:
420 ; NO-FAST-P9: # %bb.0: # %entry
421 ; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
422 ; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
423 ; NO-FAST-P9-NEXT: xsnegdp f0, f0
424 ; NO-FAST-P9-NEXT: fsel f1, f0, f1, f3
425 ; NO-FAST-P9-NEXT: blr
426 entry:
427 %cmp = fcmp nnan ninf nsz one double %a, %b
428 %cond = select i1 %cmp, double %c, double %d
429 ret double %cond
430 }
431
432
433 ; Test oge
434 define float @select_oge_float(float %a, float %b, float %c, float %d) {
435 ; FAST-P8-LABEL: select_oge_float:
436 ; FAST-P8: # %bb.0: # %entry
437 ; FAST-P8-NEXT: xssubsp f0, f1, f2
438 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
439 ; FAST-P8-NEXT: blr
440 ;
441 ; FAST-P9-LABEL: select_oge_float:
442 ; FAST-P9: # %bb.0: # %entry
443 ; FAST-P9-NEXT: xssubsp f0, f1, f2
444 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
445 ; FAST-P9-NEXT: blr
446 ;
447 ; NO-FAST-P8-LABEL: select_oge_float:
448 ; NO-FAST-P8: # %bb.0: # %entry
449 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
450 ; NO-FAST-P8-NEXT: crnor 4*cr5+lt, un, lt
451 ; NO-FAST-P8-NEXT: bc 12, 4*cr5+lt, .LBB10_2
452 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
453 ; NO-FAST-P8-NEXT: fmr f3, f4
454 ; NO-FAST-P8-NEXT: .LBB10_2: # %entry
455 ; NO-FAST-P8-NEXT: fmr f1, f3
456 ; NO-FAST-P8-NEXT: blr
457 ;
458 ; NO-FAST-P9-LABEL: select_oge_float:
459 ; NO-FAST-P9: # %bb.0: # %entry
460 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
461 ; NO-FAST-P9-NEXT: crnor 4*cr5+lt, un, lt
462 ; NO-FAST-P9-NEXT: bc 12, 4*cr5+lt, .LBB10_2
463 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
464 ; NO-FAST-P9-NEXT: fmr f3, f4
465 ; NO-FAST-P9-NEXT: .LBB10_2: # %entry
466 ; NO-FAST-P9-NEXT: fmr f1, f3
467 ; NO-FAST-P9-NEXT: blr
468 entry:
469 %cmp = fcmp oge float %a, %b
470 %cond = select i1 %cmp, float %c, float %d
471 ret float %cond
472 }
473
474 define double @select_oge_double(double %a, double %b, double %c, double %d) {
475 ; FAST-P8-LABEL: select_oge_double:
476 ; FAST-P8: # %bb.0: # %entry
477 ; FAST-P8-NEXT: xssubdp f0, f1, f2
478 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
479 ; FAST-P8-NEXT: blr
480 ;
481 ; FAST-P9-LABEL: select_oge_double:
482 ; FAST-P9: # %bb.0: # %entry
483 ; FAST-P9-NEXT: xssubdp f0, f1, f2
484 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
485 ; FAST-P9-NEXT: blr
486 ;
487 ; NO-FAST-P8-LABEL: select_oge_double:
488 ; NO-FAST-P8: # %bb.0: # %entry
489 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
490 ; NO-FAST-P8-NEXT: crnor 4*cr5+lt, un, lt
491 ; NO-FAST-P8-NEXT: bc 12, 4*cr5+lt, .LBB11_2
492 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
493 ; NO-FAST-P8-NEXT: fmr f3, f4
494 ; NO-FAST-P8-NEXT: .LBB11_2: # %entry
495 ; NO-FAST-P8-NEXT: fmr f1, f3
496 ; NO-FAST-P8-NEXT: blr
497 ;
498 ; NO-FAST-P9-LABEL: select_oge_double:
499 ; NO-FAST-P9: # %bb.0: # %entry
500 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
501 ; NO-FAST-P9-NEXT: crnor 4*cr5+lt, un, lt
502 ; NO-FAST-P9-NEXT: bc 12, 4*cr5+lt, .LBB11_2
503 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
504 ; NO-FAST-P9-NEXT: fmr f3, f4
505 ; NO-FAST-P9-NEXT: .LBB11_2: # %entry
506 ; NO-FAST-P9-NEXT: fmr f1, f3
507 ; NO-FAST-P9-NEXT: blr
508 entry:
509 %cmp = fcmp oge double %a, %b
510 %cond = select i1 %cmp, double %c, double %d
511 ret double %cond
512 }
513
514 define float @select_fast_oge_float(float %a, float %b, float %c, float %d) {
515 ; FAST-P8-LABEL: select_fast_oge_float:
516 ; FAST-P8: # %bb.0: # %entry
517 ; FAST-P8-NEXT: xssubsp f0, f1, f2
518 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
519 ; FAST-P8-NEXT: blr
520 ;
521 ; FAST-P9-LABEL: select_fast_oge_float:
522 ; FAST-P9: # %bb.0: # %entry
523 ; FAST-P9-NEXT: xssubsp f0, f1, f2
524 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
525 ; FAST-P9-NEXT: blr
526 ;
527 ; NO-FAST-P8-LABEL: select_fast_oge_float:
528 ; NO-FAST-P8: # %bb.0: # %entry
529 ; NO-FAST-P8-NEXT: xssubsp f0, f1, f2
530 ; NO-FAST-P8-NEXT: fsel f1, f0, f3, f4
531 ; NO-FAST-P8-NEXT: blr
532 ;
533 ; NO-FAST-P9-LABEL: select_fast_oge_float:
534 ; NO-FAST-P9: # %bb.0: # %entry
535 ; NO-FAST-P9-NEXT: xssubsp f0, f1, f2
536 ; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
537 ; NO-FAST-P9-NEXT: blr
538 entry:
539 %cmp = fcmp nnan ninf nsz oge float %a, %b
540 %cond = select i1 %cmp, float %c, float %d
541 ret float %cond
542 }
543
544 define double @select_fast_oge_double(double %a, double %b, double %c, double %d) {
545 ; FAST-P8-LABEL: select_fast_oge_double:
546 ; FAST-P8: # %bb.0: # %entry
547 ; FAST-P8-NEXT: xssubdp f0, f1, f2
548 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
549 ; FAST-P8-NEXT: blr
550 ;
551 ; FAST-P9-LABEL: select_fast_oge_double:
552 ; FAST-P9: # %bb.0: # %entry
553 ; FAST-P9-NEXT: xssubdp f0, f1, f2
554 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
555 ; FAST-P9-NEXT: blr
556 ;
557 ; NO-FAST-P8-LABEL: select_fast_oge_double:
558 ; NO-FAST-P8: # %bb.0: # %entry
559 ; NO-FAST-P8-NEXT: xssubdp f0, f1, f2
560 ; NO-FAST-P8-NEXT: fsel f1, f0, f3, f4
561 ; NO-FAST-P8-NEXT: blr
562 ;
563 ; NO-FAST-P9-LABEL: select_fast_oge_double:
564 ; NO-FAST-P9: # %bb.0: # %entry
565 ; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
566 ; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
567 ; NO-FAST-P9-NEXT: blr
568 entry:
569 %cmp = fcmp nnan ninf nsz oge double %a, %b
570 %cond = select i1 %cmp, double %c, double %d
571 ret double %cond
572 }
573
574
575 ; Test olt
576 define float @select_olt_float(float %a, float %b, float %c, float %d) {
577 ; FAST-P8-LABEL: select_olt_float:
578 ; FAST-P8: # %bb.0: # %entry
579 ; FAST-P8-NEXT: xssubsp f0, f1, f2
580 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
581 ; FAST-P8-NEXT: blr
582 ;
583 ; FAST-P9-LABEL: select_olt_float:
584 ; FAST-P9: # %bb.0: # %entry
585 ; FAST-P9-NEXT: xssubsp f0, f1, f2
586 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
587 ; FAST-P9-NEXT: blr
588 ;
589 ; NO-FAST-P8-LABEL: select_olt_float:
590 ; NO-FAST-P8: # %bb.0: # %entry
591 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
592 ; NO-FAST-P8-NEXT: blt cr0, .LBB14_2
593 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
594 ; NO-FAST-P8-NEXT: fmr f3, f4
595 ; NO-FAST-P8-NEXT: .LBB14_2: # %entry
596 ; NO-FAST-P8-NEXT: fmr f1, f3
597 ; NO-FAST-P8-NEXT: blr
598 ;
599 ; NO-FAST-P9-LABEL: select_olt_float:
600 ; NO-FAST-P9: # %bb.0: # %entry
601 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
602 ; NO-FAST-P9-NEXT: blt cr0, .LBB14_2
603 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
604 ; NO-FAST-P9-NEXT: fmr f3, f4
605 ; NO-FAST-P9-NEXT: .LBB14_2: # %entry
606 ; NO-FAST-P9-NEXT: fmr f1, f3
607 ; NO-FAST-P9-NEXT: blr
608 entry:
609 %cmp = fcmp olt float %a, %b
610 %cond = select i1 %cmp, float %c, float %d
611 ret float %cond
612 }
613
614 define double @select_olt_double(double %a, double %b, double %c, double %d) {
615 ; FAST-P8-LABEL: select_olt_double:
616 ; FAST-P8: # %bb.0: # %entry
617 ; FAST-P8-NEXT: xssubdp f0, f1, f2
618 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
619 ; FAST-P8-NEXT: blr
620 ;
621 ; FAST-P9-LABEL: select_olt_double:
622 ; FAST-P9: # %bb.0: # %entry
623 ; FAST-P9-NEXT: xssubdp f0, f1, f2
624 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
625 ; FAST-P9-NEXT: blr
626 ;
627 ; NO-FAST-P8-LABEL: select_olt_double:
628 ; NO-FAST-P8: # %bb.0: # %entry
629 ; NO-FAST-P8-NEXT: xscmpudp cr0, f1, f2
630 ; NO-FAST-P8-NEXT: blt cr0, .LBB15_2
631 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
632 ; NO-FAST-P8-NEXT: fmr f3, f4
633 ; NO-FAST-P8-NEXT: .LBB15_2: # %entry
634 ; NO-FAST-P8-NEXT: fmr f1, f3
635 ; NO-FAST-P8-NEXT: blr
636 ;
637 ; NO-FAST-P9-LABEL: select_olt_double:
638 ; NO-FAST-P9: # %bb.0: # %entry
639 ; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
640 ; NO-FAST-P9-NEXT: blt cr0, .LBB15_2
641 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
642 ; NO-FAST-P9-NEXT: fmr f3, f4
643 ; NO-FAST-P9-NEXT: .LBB15_2: # %entry
644 ; NO-FAST-P9-NEXT: fmr f1, f3
645 ; NO-FAST-P9-NEXT: blr
646 entry:
647 %cmp = fcmp olt double %a, %b
648 %cond = select i1 %cmp, double %c, double %d
649 ret double %cond
650 }
651
652 define float @select_fast_olt_float(float %a, float %b, float %c, float %d) {
653 ; FAST-P8-LABEL: select_fast_olt_float:
654 ; FAST-P8: # %bb.0: # %entry
655 ; FAST-P8-NEXT: xssubsp f0, f1, f2
656 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
657 ; FAST-P8-NEXT: blr
658 ;
659 ; FAST-P9-LABEL: select_fast_olt_float:
660 ; FAST-P9: # %bb.0: # %entry
661 ; FAST-P9-NEXT: xssubsp f0, f1, f2
662 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
663 ; FAST-P9-NEXT: blr
664 ;
665 ; NO-FAST-P8-LABEL: select_fast_olt_float:
666 ; NO-FAST-P8: # %bb.0: # %entry
667 ; NO-FAST-P8-NEXT: xssubsp f0, f1, f2
668 ; NO-FAST-P8-NEXT: fsel f1, f0, f4, f3
669 ; NO-FAST-P8-NEXT: blr
670 ;
671 ; NO-FAST-P9-LABEL: select_fast_olt_float:
672 ; NO-FAST-P9: # %bb.0: # %entry
673 ; NO-FAST-P9-NEXT: xssubsp f0, f1, f2
674 ; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
675 ; NO-FAST-P9-NEXT: blr
676 entry:
677 %cmp = fcmp ninf nnan nsz olt float %a, %b
678 %cond = select i1 %cmp, float %c, float %d
679 ret float %cond
680 }
681
682 define double @select_fast_olt_double(double %a, double %b, double %c, double %d) {
683 ; FAST-P8-LABEL: select_fast_olt_double:
684 ; FAST-P8: # %bb.0: # %entry
685 ; FAST-P8-NEXT: xssubdp f0, f1, f2
686 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
687 ; FAST-P8-NEXT: blr
688 ;
689 ; FAST-P9-LABEL: select_fast_olt_double:
690 ; FAST-P9: # %bb.0: # %entry
691 ; FAST-P9-NEXT: xssubdp f0, f1, f2
692 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
693 ; FAST-P9-NEXT: blr
694 ;
695 ; NO-FAST-P8-LABEL: select_fast_olt_double:
696 ; NO-FAST-P8: # %bb.0: # %entry
697 ; NO-FAST-P8-NEXT: xssubdp f0, f1, f2
698 ; NO-FAST-P8-NEXT: fsel f1, f0, f4, f3
699 ; NO-FAST-P8-NEXT: blr
700 ;
701 ; NO-FAST-P9-LABEL: select_fast_olt_double:
702 ; NO-FAST-P9: # %bb.0: # %entry
703 ; NO-FAST-P9-NEXT: xssubdp f0, f1, f2
704 ; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
705 ; NO-FAST-P9-NEXT: blr
706 entry:
707 %cmp = fcmp nnan ninf nsz olt double %a, %b
708 %cond = select i1 %cmp, double %c, double %d
709 ret double %cond
710 }
711
712
713 ; Test ogt
714 define float @select_ogt_float(float %a, float %b, float %c, float %d) {
715 ; FAST-P8-LABEL: select_ogt_float:
716 ; FAST-P8: # %bb.0: # %entry
717 ; FAST-P8-NEXT: xssubsp f0, f2, f1
718 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
719 ; FAST-P8-NEXT: blr
720 ;
721 ; FAST-P9-LABEL: select_ogt_float:
722 ; FAST-P9: # %bb.0: # %entry
723 ; FAST-P9-NEXT: xssubsp f0, f2, f1
724 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
725 ; FAST-P9-NEXT: blr
726 ;
727 ; NO-FAST-P8-LABEL: select_ogt_float:
728 ; NO-FAST-P8: # %bb.0: # %entry
729 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
730 ; NO-FAST-P8-NEXT: bgt cr0, .LBB18_2
731 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
732 ; NO-FAST-P8-NEXT: fmr f3, f4
733 ; NO-FAST-P8-NEXT: .LBB18_2: # %entry
734 ; NO-FAST-P8-NEXT: fmr f1, f3
735 ; NO-FAST-P8-NEXT: blr
736 ;
737 ; NO-FAST-P9-LABEL: select_ogt_float:
738 ; NO-FAST-P9: # %bb.0: # %entry
739 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
740 ; NO-FAST-P9-NEXT: bgt cr0, .LBB18_2
741 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
742 ; NO-FAST-P9-NEXT: fmr f3, f4
743 ; NO-FAST-P9-NEXT: .LBB18_2: # %entry
744 ; NO-FAST-P9-NEXT: fmr f1, f3
745 ; NO-FAST-P9-NEXT: blr
746 entry:
747 %cmp = fcmp ogt float %a, %b
748 %cond = select i1 %cmp, float %c, float %d
749 ret float %cond
750 }
751
752 define double @select_ogt_double(double %a, double %b, double %c, double %d) {
753 ; FAST-P8-LABEL: select_ogt_double:
754 ; FAST-P8: # %bb.0: # %entry
755 ; FAST-P8-NEXT: xssubdp f0, f2, f1
756 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
757 ; FAST-P8-NEXT: blr
758 ;
759 ; FAST-P9-LABEL: select_ogt_double:
760 ; FAST-P9: # %bb.0: # %entry
761 ; FAST-P9-NEXT: xssubdp f0, f2, f1
762 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
763 ; FAST-P9-NEXT: blr
764 ;
765 ; NO-FAST-P8-LABEL: select_ogt_double:
766 ; NO-FAST-P8: # %bb.0: # %entry
767 ; NO-FAST-P8-NEXT: xscmpudp cr0, f1, f2
768 ; NO-FAST-P8-NEXT: bgt cr0, .LBB19_2
769 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
770 ; NO-FAST-P8-NEXT: fmr f3, f4
771 ; NO-FAST-P8-NEXT: .LBB19_2: # %entry
772 ; NO-FAST-P8-NEXT: fmr f1, f3
773 ; NO-FAST-P8-NEXT: blr
774 ;
775 ; NO-FAST-P9-LABEL: select_ogt_double:
776 ; NO-FAST-P9: # %bb.0: # %entry
777 ; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f2
778 ; NO-FAST-P9-NEXT: bgt cr0, .LBB19_2
779 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
780 ; NO-FAST-P9-NEXT: fmr f3, f4
781 ; NO-FAST-P9-NEXT: .LBB19_2: # %entry
782 ; NO-FAST-P9-NEXT: fmr f1, f3
783 ; NO-FAST-P9-NEXT: blr
784 entry:
785 %cmp = fcmp ogt double %a, %b
786 %cond = select i1 %cmp, double %c, double %d
787 ret double %cond
788 }
789
790 define float @select_fast_ogt_float(float %a, float %b, float %c, float %d) {
791 ; FAST-P8-LABEL: select_fast_ogt_float:
792 ; FAST-P8: # %bb.0: # %entry
793 ; FAST-P8-NEXT: xssubsp f0, f2, f1
794 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
795 ; FAST-P8-NEXT: blr
796 ;
797 ; FAST-P9-LABEL: select_fast_ogt_float:
798 ; FAST-P9: # %bb.0: # %entry
799 ; FAST-P9-NEXT: xssubsp f0, f2, f1
800 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
801 ; FAST-P9-NEXT: blr
802 ;
803 ; NO-FAST-P8-LABEL: select_fast_ogt_float:
804 ; NO-FAST-P8: # %bb.0: # %entry
805 ; NO-FAST-P8-NEXT: xssubsp f0, f2, f1
806 ; NO-FAST-P8-NEXT: fsel f1, f0, f4, f3
807 ; NO-FAST-P8-NEXT: blr
808 ;
809 ; NO-FAST-P9-LABEL: select_fast_ogt_float:
810 ; NO-FAST-P9: # %bb.0: # %entry
811 ; NO-FAST-P9-NEXT: xssubsp f0, f2, f1
812 ; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
813 ; NO-FAST-P9-NEXT: blr
814 entry:
815 %cmp = fcmp nnan ninf nsz ogt float %a, %b
816 %cond = select i1 %cmp, float %c, float %d
817 ret float %cond
818 }
819
820 define double @select_fast_ogt_double(double %a, double %b, double %c, double %d) {
821 ; FAST-P8-LABEL: select_fast_ogt_double:
822 ; FAST-P8: # %bb.0: # %entry
823 ; FAST-P8-NEXT: xssubdp f0, f2, f1
824 ; FAST-P8-NEXT: fsel f1, f0, f4, f3
825 ; FAST-P8-NEXT: blr
826 ;
827 ; FAST-P9-LABEL: select_fast_ogt_double:
828 ; FAST-P9: # %bb.0: # %entry
829 ; FAST-P9-NEXT: xssubdp f0, f2, f1
830 ; FAST-P9-NEXT: fsel f1, f0, f4, f3
831 ; FAST-P9-NEXT: blr
832 ;
833 ; NO-FAST-P8-LABEL: select_fast_ogt_double:
834 ; NO-FAST-P8: # %bb.0: # %entry
835 ; NO-FAST-P8-NEXT: xssubdp f0, f2, f1
836 ; NO-FAST-P8-NEXT: fsel f1, f0, f4, f3
837 ; NO-FAST-P8-NEXT: blr
838 ;
839 ; NO-FAST-P9-LABEL: select_fast_ogt_double:
840 ; NO-FAST-P9: # %bb.0: # %entry
841 ; NO-FAST-P9-NEXT: xssubdp f0, f2, f1
842 ; NO-FAST-P9-NEXT: fsel f1, f0, f4, f3
843 ; NO-FAST-P9-NEXT: blr
844 entry:
845 %cmp = fcmp nnan ninf nsz ogt double %a, %b
846 %cond = select i1 %cmp, double %c, double %d
847 ret double %cond
848 }
849
850
851 ; Test ole
852 define float @select_ole_float(float %a, float %b, float %c, float %d) {
853 ; FAST-P8-LABEL: select_ole_float:
854 ; FAST-P8: # %bb.0: # %entry
855 ; FAST-P8-NEXT: xssubsp f0, f2, f1
856 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
857 ; FAST-P8-NEXT: blr
858 ;
859 ; FAST-P9-LABEL: select_ole_float:
860 ; FAST-P9: # %bb.0: # %entry
861 ; FAST-P9-NEXT: xssubsp f0, f2, f1
862 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
863 ; FAST-P9-NEXT: blr
864 ;
865 ; NO-FAST-P8-LABEL: select_ole_float:
866 ; NO-FAST-P8: # %bb.0: # %entry
867 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
868 ; NO-FAST-P8-NEXT: crnor 4*cr5+lt, un, gt
869 ; NO-FAST-P8-NEXT: bc 12, 4*cr5+lt, .LBB22_2
870 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
871 ; NO-FAST-P8-NEXT: fmr f3, f4
872 ; NO-FAST-P8-NEXT: .LBB22_2: # %entry
873 ; NO-FAST-P8-NEXT: fmr f1, f3
874 ; NO-FAST-P8-NEXT: blr
875 ;
876 ; NO-FAST-P9-LABEL: select_ole_float:
877 ; NO-FAST-P9: # %bb.0: # %entry
878 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
879 ; NO-FAST-P9-NEXT: crnor 4*cr5+lt, un, gt
880 ; NO-FAST-P9-NEXT: bc 12, 4*cr5+lt, .LBB22_2
881 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
882 ; NO-FAST-P9-NEXT: fmr f3, f4
883 ; NO-FAST-P9-NEXT: .LBB22_2: # %entry
884 ; NO-FAST-P9-NEXT: fmr f1, f3
885 ; NO-FAST-P9-NEXT: blr
886 entry:
887 %cmp = fcmp ole float %a, %b
888 %cond = select i1 %cmp, float %c, float %d
889 ret float %cond
890 }
891
892 define double @select_ole_double(double %a, double %b, double %c, double %d) {
893 ; FAST-P8-LABEL: select_ole_double:
894 ; FAST-P8: # %bb.0: # %entry
895 ; FAST-P8-NEXT: xssubdp f0, f2, f1
896 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
897 ; FAST-P8-NEXT: blr
898 ;
899 ; FAST-P9-LABEL: select_ole_double:
900 ; FAST-P9: # %bb.0: # %entry
901 ; FAST-P9-NEXT: xssubdp f0, f2, f1
902 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
903 ; FAST-P9-NEXT: blr
904 ;
905 ; NO-FAST-P8-LABEL: select_ole_double:
906 ; NO-FAST-P8: # %bb.0: # %entry
907 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f2
908 ; NO-FAST-P8-NEXT: crnor 4*cr5+lt, un, gt
909 ; NO-FAST-P8-NEXT: bc 12, 4*cr5+lt, .LBB23_2
910 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
911 ; NO-FAST-P8-NEXT: fmr f3, f4
912 ; NO-FAST-P8-NEXT: .LBB23_2: # %entry
913 ; NO-FAST-P8-NEXT: fmr f1, f3
914 ; NO-FAST-P8-NEXT: blr
915 ;
916 ; NO-FAST-P9-LABEL: select_ole_double:
917 ; NO-FAST-P9: # %bb.0: # %entry
918 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f2
919 ; NO-FAST-P9-NEXT: crnor 4*cr5+lt, un, gt
920 ; NO-FAST-P9-NEXT: bc 12, 4*cr5+lt, .LBB23_2
921 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
922 ; NO-FAST-P9-NEXT: fmr f3, f4
923 ; NO-FAST-P9-NEXT: .LBB23_2: # %entry
924 ; NO-FAST-P9-NEXT: fmr f1, f3
925 ; NO-FAST-P9-NEXT: blr
926 entry:
927 %cmp = fcmp ole double %a, %b
928 %cond = select i1 %cmp, double %c, double %d
929 ret double %cond
930 }
931
932 define float @select_fast_ole_float(float %a, float %b, float %c, float %d) {
933 ; FAST-P8-LABEL: select_fast_ole_float:
934 ; FAST-P8: # %bb.0: # %entry
935 ; FAST-P8-NEXT: xssubsp f0, f2, f1
936 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
937 ; FAST-P8-NEXT: blr
938 ;
939 ; FAST-P9-LABEL: select_fast_ole_float:
940 ; FAST-P9: # %bb.0: # %entry
941 ; FAST-P9-NEXT: xssubsp f0, f2, f1
942 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
943 ; FAST-P9-NEXT: blr
944 ;
945 ; NO-FAST-P8-LABEL: select_fast_ole_float:
946 ; NO-FAST-P8: # %bb.0: # %entry
947 ; NO-FAST-P8-NEXT: xssubsp f0, f2, f1
948 ; NO-FAST-P8-NEXT: fsel f1, f0, f3, f4
949 ; NO-FAST-P8-NEXT: blr
950 ;
951 ; NO-FAST-P9-LABEL: select_fast_ole_float:
952 ; NO-FAST-P9: # %bb.0: # %entry
953 ; NO-FAST-P9-NEXT: xssubsp f0, f2, f1
954 ; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
955 ; NO-FAST-P9-NEXT: blr
956 entry:
957 %cmp = fcmp nnan ninf nsz ole float %a, %b
958 %cond = select i1 %cmp, float %c, float %d
959 ret float %cond
960 }
961
962 define double @select_fast_ole_double(double %a, double %b, double %c, double %d) {
963 ; FAST-P8-LABEL: select_fast_ole_double:
964 ; FAST-P8: # %bb.0: # %entry
965 ; FAST-P8-NEXT: xssubdp f0, f2, f1
966 ; FAST-P8-NEXT: fsel f1, f0, f3, f4
967 ; FAST-P8-NEXT: blr
968 ;
969 ; FAST-P9-LABEL: select_fast_ole_double:
970 ; FAST-P9: # %bb.0: # %entry
971 ; FAST-P9-NEXT: xssubdp f0, f2, f1
972 ; FAST-P9-NEXT: fsel f1, f0, f3, f4
973 ; FAST-P9-NEXT: blr
974 ;
975 ; NO-FAST-P8-LABEL: select_fast_ole_double:
976 ; NO-FAST-P8: # %bb.0: # %entry
977 ; NO-FAST-P8-NEXT: xssubdp f0, f2, f1
978 ; NO-FAST-P8-NEXT: fsel f1, f0, f3, f4
979 ; NO-FAST-P8-NEXT: blr
980 ;
981 ; NO-FAST-P9-LABEL: select_fast_ole_double:
982 ; NO-FAST-P9: # %bb.0: # %entry
983 ; NO-FAST-P9-NEXT: xssubdp f0, f2, f1
984 ; NO-FAST-P9-NEXT: fsel f1, f0, f3, f4
985 ; NO-FAST-P9-NEXT: blr
986 entry:
987 %cmp = fcmp nnan ninf nsz ole double %a, %b
988 %cond = select i1 %cmp, double %c, double %d
989 ret double %cond
990 }
991
992 ; Test RHS is 1.000000e+00
993 define double @onecmp1(double %a, double %y, double %z) {
994 ; FAST-P8-LABEL: onecmp1:
995 ; FAST-P8: # %bb.0: # %entry
996 ; FAST-P8-NEXT: vspltisw v2, -1
997 ; FAST-P8-NEXT: xvcvsxwdp vs0, vs34
998 ; FAST-P8-NEXT: xsadddp f0, f1, f0
999 ; FAST-P8-NEXT: fsel f1, f0, f2, f3
1000 ; FAST-P8-NEXT: blr
1001 ;
1002 ; FAST-P9-LABEL: onecmp1:
1003 ; FAST-P9: # %bb.0: # %entry
1004 ; FAST-P9-NEXT: vspltisw v2, -1
1005 ; FAST-P9-NEXT: xvcvsxwdp vs0, vs34
1006 ; FAST-P9-NEXT: xsadddp f0, f1, f0
1007 ; FAST-P9-NEXT: fsel f1, f0, f2, f3
1008 ; FAST-P9-NEXT: blr
1009 ;
1010 ; NO-FAST-P8-LABEL: onecmp1:
1011 ; NO-FAST-P8: # %bb.0: # %entry
1012 ; NO-FAST-P8-NEXT: vspltisw v2, 1
1013 ; NO-FAST-P8-NEXT: xvcvsxwdp vs0, vs34
1014 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f0
1015 ; NO-FAST-P8-NEXT: bc 12, lt, .LBB26_3
1016 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
1017 ; NO-FAST-P8-NEXT: fcmpu cr0, f1, f1
1018 ; NO-FAST-P8-NEXT: bc 12, un, .LBB26_3
1019 ; NO-FAST-P8-NEXT: # %bb.2: # %entry
1020 ; NO-FAST-P8-NEXT: fmr f3, f2
1021 ; NO-FAST-P8-NEXT: .LBB26_3: # %entry
1022 ; NO-FAST-P8-NEXT: fmr f1, f3
1023 ; NO-FAST-P8-NEXT: blr
1024 ;
1025 ; NO-FAST-P9-LABEL: onecmp1:
1026 ; NO-FAST-P9: # %bb.0: # %entry
1027 ; NO-FAST-P9-NEXT: vspltisw v2, 1
1028 ; NO-FAST-P9-NEXT: xvcvsxwdp vs0, vs34
1029 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f0
1030 ; NO-FAST-P9-NEXT: bc 12, lt, .LBB26_3
1031 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
1032 ; NO-FAST-P9-NEXT: fcmpu cr0, f1, f1
1033 ; NO-FAST-P9-NEXT: bc 12, un, .LBB26_3
1034 ; NO-FAST-P9-NEXT: # %bb.2: # %entry
1035 ; NO-FAST-P9-NEXT: fmr f3, f2
1036 ; NO-FAST-P9-NEXT: .LBB26_3: # %entry
1037 ; NO-FAST-P9-NEXT: fmr f1, f3
1038 ; NO-FAST-P9-NEXT: blr
1039 entry:
1040 %cmp = fcmp ult double %a, 1.000000e+00
1041 %z.y = select i1 %cmp, double %z, double %y
1042 ret double %z.y
1043 }
1044
1045 define double @onecmp2(double %a, double %y, double %z) {
1046 ; FAST-P8-LABEL: onecmp2:
1047 ; FAST-P8: # %bb.0: # %entry
1048 ; FAST-P8-NEXT: vspltisw v2, 1
1049 ; FAST-P8-NEXT: xvcvsxwdp vs0, vs34
1050 ; FAST-P8-NEXT: xssubdp f0, f0, f1
1051 ; FAST-P8-NEXT: fsel f1, f0, f3, f2
1052 ; FAST-P8-NEXT: blr
1053 ;
1054 ; FAST-P9-LABEL: onecmp2:
1055 ; FAST-P9: # %bb.0: # %entry
1056 ; FAST-P9-NEXT: vspltisw v2, 1
1057 ; FAST-P9-NEXT: xvcvsxwdp vs0, vs34
1058 ; FAST-P9-NEXT: xssubdp f0, f0, f1
1059 ; FAST-P9-NEXT: fsel f1, f0, f3, f2
1060 ; FAST-P9-NEXT: blr
1061 ;
1062 ; NO-FAST-P8-LABEL: onecmp2:
1063 ; NO-FAST-P8: # %bb.0: # %entry
1064 ; NO-FAST-P8-NEXT: vspltisw v2, 1
1065 ; NO-FAST-P8-NEXT: xvcvsxwdp vs0, vs34
1066 ; NO-FAST-P8-NEXT: xscmpudp cr0, f1, f0
1067 ; NO-FAST-P8-NEXT: bgt cr0, .LBB27_2
1068 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
1069 ; NO-FAST-P8-NEXT: fmr f2, f3
1070 ; NO-FAST-P8-NEXT: .LBB27_2: # %entry
1071 ; NO-FAST-P8-NEXT: fmr f1, f2
1072 ; NO-FAST-P8-NEXT: blr
1073 ;
1074 ; NO-FAST-P9-LABEL: onecmp2:
1075 ; NO-FAST-P9: # %bb.0: # %entry
1076 ; NO-FAST-P9-NEXT: vspltisw v2, 1
1077 ; NO-FAST-P9-NEXT: xvcvsxwdp vs0, vs34
1078 ; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f0
1079 ; NO-FAST-P9-NEXT: bgt cr0, .LBB27_2
1080 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
1081 ; NO-FAST-P9-NEXT: fmr f2, f3
1082 ; NO-FAST-P9-NEXT: .LBB27_2: # %entry
1083 ; NO-FAST-P9-NEXT: fmr f1, f2
1084 ; NO-FAST-P9-NEXT: blr
1085 entry:
1086 %cmp = fcmp ogt double %a, 1.000000e+00
1087 %y.z = select i1 %cmp, double %y, double %z
1088 ret double %y.z
1089 }
1090
1091 define double @onecmp3(double %a, double %y, double %z) {
1092 ; FAST-P8-LABEL: onecmp3:
1093 ; FAST-P8: # %bb.0: # %entry
1094 ; FAST-P8-NEXT: vspltisw v2, -1
1095 ; FAST-P8-NEXT: xvcvsxwdp vs0, vs34
1096 ; FAST-P8-NEXT: xsadddp f0, f1, f0
1097 ; FAST-P8-NEXT: fsel f1, f0, f2, f3
1098 ; FAST-P8-NEXT: xsnegdp f0, f0
1099 ; FAST-P8-NEXT: fsel f1, f0, f1, f3
1100 ; FAST-P8-NEXT: blr
1101 ;
1102 ; FAST-P9-LABEL: onecmp3:
1103 ; FAST-P9: # %bb.0: # %entry
1104 ; FAST-P9-NEXT: vspltisw v2, -1
1105 ; FAST-P9-NEXT: xvcvsxwdp vs0, vs34
1106 ; FAST-P9-NEXT: xsadddp f0, f1, f0
1107 ; FAST-P9-NEXT: fsel f1, f0, f2, f3
1108 ; FAST-P9-NEXT: xsnegdp f0, f0
1109 ; FAST-P9-NEXT: fsel f1, f0, f1, f3
1110 ; FAST-P9-NEXT: blr
1111 ;
1112 ; NO-FAST-P8-LABEL: onecmp3:
1113 ; NO-FAST-P8: # %bb.0: # %entry
1114 ; NO-FAST-P8-NEXT: vspltisw v2, 1
1115 ; NO-FAST-P8-NEXT: xvcvsxwdp vs0, vs34
1116 ; NO-FAST-P8-NEXT: xscmpudp cr0, f1, f0
1117 ; NO-FAST-P8-NEXT: beq cr0, .LBB28_2
1118 ; NO-FAST-P8-NEXT: # %bb.1: # %entry
1119 ; NO-FAST-P8-NEXT: fmr f2, f3
1120 ; NO-FAST-P8-NEXT: .LBB28_2: # %entry
1121 ; NO-FAST-P8-NEXT: fmr f1, f2
1122 ; NO-FAST-P8-NEXT: blr
1123 ;
1124 ; NO-FAST-P9-LABEL: onecmp3:
1125 ; NO-FAST-P9: # %bb.0: # %entry
1126 ; NO-FAST-P9-NEXT: vspltisw v2, 1
1127 ; NO-FAST-P9-NEXT: xvcvsxwdp vs0, vs34
1128 ; NO-FAST-P9-NEXT: xscmpudp cr0, f1, f0
1129 ; NO-FAST-P9-NEXT: beq cr0, .LBB28_2
1130 ; NO-FAST-P9-NEXT: # %bb.1: # %entry
1131 ; NO-FAST-P9-NEXT: fmr f2, f3
1132 ; NO-FAST-P9-NEXT: .LBB28_2: # %entry
1133 ; NO-FAST-P9-NEXT: fmr f1, f2
1134 ; NO-FAST-P9-NEXT: blr
1135 entry:
1136 %cmp = fcmp oeq double %a, 1.000000e+00
1137 %y.z = select i1 %cmp, double %y, double %z
1138 ret double %y.z
1139 }