1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s -mtriple=powerpc-unknown-linux -mattr=spe | FileCheck %s -check-prefix=SPE
4 define i32 @test_f32_oeq_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
5 ; SPE-LABEL: test_f32_oeq_s:
7 ; SPE-NEXT: efscmpeq cr0, r5, r6
8 ; SPE-NEXT: bclr 12, gt, 0
10 ; SPE-NEXT: ori r3, r4, 0
12 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"oeq", metadata !"fpexcept.strict") #0
13 %res = select i1 %cond, i32 %a, i32 %b
17 define i32 @test_f32_ogt_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
18 ; SPE-LABEL: test_f32_ogt_s:
20 ; SPE-NEXT: efscmpgt cr0, r5, r6
21 ; SPE-NEXT: bclr 12, gt, 0
23 ; SPE-NEXT: ori r3, r4, 0
25 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"ogt", metadata !"fpexcept.strict") #0
26 %res = select i1 %cond, i32 %a, i32 %b
30 define i32 @test_f32_oge_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
31 ; SPE-LABEL: test_f32_oge_s:
33 ; SPE-NEXT: efscmpeq cr0, r6, r6
34 ; SPE-NEXT: efscmpeq cr1, r5, r5
35 ; SPE-NEXT: crand 4*cr5+lt, 4*cr1+gt, gt
36 ; SPE-NEXT: efscmplt cr0, r5, r6
37 ; SPE-NEXT: crandc 4*cr5+lt, 4*cr5+lt, gt
38 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
40 ; SPE-NEXT: ori r3, r4, 0
42 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"oge", metadata !"fpexcept.strict") #0
43 %res = select i1 %cond, i32 %a, i32 %b
47 define i32 @test_f32_olt_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
48 ; SPE-LABEL: test_f32_olt_s:
50 ; SPE-NEXT: efscmplt cr0, r5, r6
51 ; SPE-NEXT: bclr 12, gt, 0
53 ; SPE-NEXT: ori r3, r4, 0
55 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"olt", metadata !"fpexcept.strict") #0
56 %res = select i1 %cond, i32 %a, i32 %b
60 define i32 @test_f32_ole_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
61 ; SPE-LABEL: test_f32_ole_s:
63 ; SPE-NEXT: efscmpeq cr0, r6, r6
64 ; SPE-NEXT: efscmpeq cr1, r5, r5
65 ; SPE-NEXT: crand 4*cr5+lt, 4*cr1+gt, gt
66 ; SPE-NEXT: efscmpgt cr0, r5, r6
67 ; SPE-NEXT: crandc 4*cr5+lt, 4*cr5+lt, gt
68 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
70 ; SPE-NEXT: ori r3, r4, 0
72 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"ole", metadata !"fpexcept.strict") #0
73 %res = select i1 %cond, i32 %a, i32 %b
77 define i32 @test_f32_one_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
78 ; SPE-LABEL: test_f32_one_s:
80 ; SPE-NEXT: efscmplt cr0, r5, r6
81 ; SPE-NEXT: efscmpgt cr1, r5, r6
82 ; SPE-NEXT: cror 4*cr5+lt, 4*cr1+gt, gt
83 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
85 ; SPE-NEXT: ori r3, r4, 0
87 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"one", metadata !"fpexcept.strict") #0
88 %res = select i1 %cond, i32 %a, i32 %b
92 define i32 @test_f32_ord_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
93 ; SPE-LABEL: test_f32_ord_s:
95 ; SPE-NEXT: efscmpeq cr0, r6, r6
96 ; SPE-NEXT: efscmpeq cr1, r5, r5
97 ; SPE-NEXT: crand 4*cr5+lt, 4*cr1+gt, gt
98 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
100 ; SPE-NEXT: ori r3, r4, 0
102 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"ord", metadata !"fpexcept.strict") #0
103 %res = select i1 %cond, i32 %a, i32 %b
107 define i32 @test_f32_ueq_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
108 ; SPE-LABEL: test_f32_ueq_s:
110 ; SPE-NEXT: efscmplt cr0, r5, r6
111 ; SPE-NEXT: efscmpgt cr1, r5, r6
112 ; SPE-NEXT: cror 4*cr5+lt, 4*cr1+gt, gt
113 ; SPE-NEXT: bc 12, 4*cr5+lt, .LBB7_1
116 ; SPE-NEXT: addi r3, r4, 0
118 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"ueq", metadata !"fpexcept.strict") #0
119 %res = select i1 %cond, i32 %a, i32 %b
123 define i32 @test_f32_ugt_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
124 ; SPE-LABEL: test_f32_ugt_s:
126 ; SPE-NEXT: efscmpeq cr0, r5, r5
127 ; SPE-NEXT: efscmpeq cr1, r6, r6
128 ; SPE-NEXT: crnand 4*cr5+lt, 4*cr1+gt, gt
129 ; SPE-NEXT: efscmpgt cr0, r5, r6
130 ; SPE-NEXT: cror 4*cr5+lt, gt, 4*cr5+lt
131 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
133 ; SPE-NEXT: ori r3, r4, 0
135 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"ugt", metadata !"fpexcept.strict") #0
136 %res = select i1 %cond, i32 %a, i32 %b
140 define i32 @test_f32_uge_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
141 ; SPE-LABEL: test_f32_uge_s:
143 ; SPE-NEXT: efscmplt cr0, r5, r6
144 ; SPE-NEXT: bc 12, gt, .LBB9_1
147 ; SPE-NEXT: addi r3, r4, 0
149 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"uge", metadata !"fpexcept.strict") #0
150 %res = select i1 %cond, i32 %a, i32 %b
154 define i32 @test_f32_ult_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
155 ; SPE-LABEL: test_f32_ult_s:
157 ; SPE-NEXT: efscmpeq cr0, r5, r5
158 ; SPE-NEXT: efscmpeq cr1, r6, r6
159 ; SPE-NEXT: crnand 4*cr5+lt, 4*cr1+gt, gt
160 ; SPE-NEXT: efscmplt cr0, r5, r6
161 ; SPE-NEXT: cror 4*cr5+lt, gt, 4*cr5+lt
162 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
164 ; SPE-NEXT: ori r3, r4, 0
166 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"ult", metadata !"fpexcept.strict") #0
167 %res = select i1 %cond, i32 %a, i32 %b
171 define i32 @test_f32_ule_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
172 ; SPE-LABEL: test_f32_ule_s:
174 ; SPE-NEXT: efscmpgt cr0, r5, r6
175 ; SPE-NEXT: bc 12, gt, .LBB11_1
177 ; SPE-NEXT: .LBB11_1:
178 ; SPE-NEXT: addi r3, r4, 0
180 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"ule", metadata !"fpexcept.strict") #0
181 %res = select i1 %cond, i32 %a, i32 %b
185 define i32 @test_f32_une_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
186 ; SPE-LABEL: test_f32_une_s:
188 ; SPE-NEXT: efscmpeq cr0, r5, r6
189 ; SPE-NEXT: bc 12, gt, .LBB12_1
191 ; SPE-NEXT: .LBB12_1:
192 ; SPE-NEXT: addi r3, r4, 0
194 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"une", metadata !"fpexcept.strict") #0
195 %res = select i1 %cond, i32 %a, i32 %b
199 define i32 @test_f32_uno_s(i32 %a, i32 %b, float %f1, float %f2) #0 {
200 ; SPE-LABEL: test_f32_uno_s:
202 ; SPE-NEXT: efscmpeq cr0, r5, r5
203 ; SPE-NEXT: efscmpeq cr1, r6, r6
204 ; SPE-NEXT: crnand 4*cr5+lt, 4*cr1+gt, gt
205 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
207 ; SPE-NEXT: ori r3, r4, 0
209 %cond = call i1 @llvm.experimental.constrained.fcmps.f32(float %f1, float %f2, metadata !"uno", metadata !"fpexcept.strict") #0
210 %res = select i1 %cond, i32 %a, i32 %b
214 define i32 @test_f64_oeq_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
215 ; SPE-LABEL: test_f64_oeq_s:
217 ; SPE-NEXT: evmergelo r7, r7, r8
218 ; SPE-NEXT: evmergelo r5, r5, r6
219 ; SPE-NEXT: efdcmpeq cr0, r5, r7
220 ; SPE-NEXT: bclr 12, gt, 0
222 ; SPE-NEXT: ori r3, r4, 0
224 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"oeq", metadata !"fpexcept.strict") #0
225 %res = select i1 %cond, i32 %a, i32 %b
229 define i32 @test_f64_ogt_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
230 ; SPE-LABEL: test_f64_ogt_s:
232 ; SPE-NEXT: evmergelo r7, r7, r8
233 ; SPE-NEXT: evmergelo r5, r5, r6
234 ; SPE-NEXT: efdcmpgt cr0, r5, r7
235 ; SPE-NEXT: bclr 12, gt, 0
237 ; SPE-NEXT: ori r3, r4, 0
239 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"ogt", metadata !"fpexcept.strict") #0
240 %res = select i1 %cond, i32 %a, i32 %b
244 define i32 @test_f64_oge_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
245 ; SPE-LABEL: test_f64_oge_s:
247 ; SPE-NEXT: evmergelo r5, r5, r6
248 ; SPE-NEXT: evmergelo r6, r7, r8
249 ; SPE-NEXT: efdcmpeq cr0, r6, r6
250 ; SPE-NEXT: efdcmpeq cr1, r5, r5
251 ; SPE-NEXT: efdcmplt cr5, r5, r6
252 ; SPE-NEXT: crand 4*cr5+lt, 4*cr1+gt, gt
253 ; SPE-NEXT: crandc 4*cr5+lt, 4*cr5+lt, 4*cr5+gt
254 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
256 ; SPE-NEXT: ori r3, r4, 0
258 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"oge", metadata !"fpexcept.strict") #0
259 %res = select i1 %cond, i32 %a, i32 %b
263 define i32 @test_f64_olt_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
264 ; SPE-LABEL: test_f64_olt_s:
266 ; SPE-NEXT: evmergelo r7, r7, r8
267 ; SPE-NEXT: evmergelo r5, r5, r6
268 ; SPE-NEXT: efdcmplt cr0, r5, r7
269 ; SPE-NEXT: bclr 12, gt, 0
271 ; SPE-NEXT: ori r3, r4, 0
273 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"olt", metadata !"fpexcept.strict") #0
274 %res = select i1 %cond, i32 %a, i32 %b
278 define i32 @test_f64_ole_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
279 ; SPE-LABEL: test_f64_ole_s:
281 ; SPE-NEXT: evmergelo r5, r5, r6
282 ; SPE-NEXT: evmergelo r6, r7, r8
283 ; SPE-NEXT: efdcmpeq cr0, r6, r6
284 ; SPE-NEXT: efdcmpeq cr1, r5, r5
285 ; SPE-NEXT: efdcmpgt cr5, r5, r6
286 ; SPE-NEXT: crand 4*cr5+lt, 4*cr1+gt, gt
287 ; SPE-NEXT: crandc 4*cr5+lt, 4*cr5+lt, 4*cr5+gt
288 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
290 ; SPE-NEXT: ori r3, r4, 0
292 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"ole", metadata !"fpexcept.strict") #0
293 %res = select i1 %cond, i32 %a, i32 %b
297 define i32 @test_f64_one_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
298 ; SPE-LABEL: test_f64_one_s:
300 ; SPE-NEXT: evmergelo r7, r7, r8
301 ; SPE-NEXT: evmergelo r5, r5, r6
302 ; SPE-NEXT: efdcmplt cr0, r5, r7
303 ; SPE-NEXT: efdcmpgt cr1, r5, r7
304 ; SPE-NEXT: cror 4*cr5+lt, 4*cr1+gt, gt
305 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
307 ; SPE-NEXT: ori r3, r4, 0
309 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"one", metadata !"fpexcept.strict") #0
310 %res = select i1 %cond, i32 %a, i32 %b
314 define i32 @test_f64_ord_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
315 ; SPE-LABEL: test_f64_ord_s:
317 ; SPE-NEXT: evmergelo r5, r5, r6
318 ; SPE-NEXT: evmergelo r6, r7, r8
319 ; SPE-NEXT: efdcmpeq cr0, r6, r6
320 ; SPE-NEXT: efdcmpeq cr1, r5, r5
321 ; SPE-NEXT: crand 4*cr5+lt, 4*cr1+gt, gt
322 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
324 ; SPE-NEXT: ori r3, r4, 0
326 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"ord", metadata !"fpexcept.strict") #0
327 %res = select i1 %cond, i32 %a, i32 %b
331 define i32 @test_f64_ueq_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
332 ; SPE-LABEL: test_f64_ueq_s:
334 ; SPE-NEXT: evmergelo r7, r7, r8
335 ; SPE-NEXT: evmergelo r5, r5, r6
336 ; SPE-NEXT: efdcmplt cr0, r5, r7
337 ; SPE-NEXT: efdcmpgt cr1, r5, r7
338 ; SPE-NEXT: cror 4*cr5+lt, 4*cr1+gt, gt
339 ; SPE-NEXT: bc 12, 4*cr5+lt, .LBB21_1
341 ; SPE-NEXT: .LBB21_1:
342 ; SPE-NEXT: addi r3, r4, 0
344 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"ueq", metadata !"fpexcept.strict") #0
345 %res = select i1 %cond, i32 %a, i32 %b
349 define i32 @test_f64_ugt_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
350 ; SPE-LABEL: test_f64_ugt_s:
352 ; SPE-NEXT: evmergelo r7, r7, r8
353 ; SPE-NEXT: evmergelo r5, r5, r6
354 ; SPE-NEXT: efdcmpeq cr0, r5, r5
355 ; SPE-NEXT: efdcmpeq cr1, r7, r7
356 ; SPE-NEXT: efdcmpgt cr5, r5, r7
357 ; SPE-NEXT: crnand 4*cr5+lt, 4*cr1+gt, gt
358 ; SPE-NEXT: cror 4*cr5+lt, 4*cr5+gt, 4*cr5+lt
359 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
361 ; SPE-NEXT: ori r3, r4, 0
363 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"ugt", metadata !"fpexcept.strict") #0
364 %res = select i1 %cond, i32 %a, i32 %b
368 define i32 @test_f64_uge_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
369 ; SPE-LABEL: test_f64_uge_s:
371 ; SPE-NEXT: evmergelo r7, r7, r8
372 ; SPE-NEXT: evmergelo r5, r5, r6
373 ; SPE-NEXT: efdcmplt cr0, r5, r7
374 ; SPE-NEXT: bc 12, gt, .LBB23_1
376 ; SPE-NEXT: .LBB23_1:
377 ; SPE-NEXT: addi r3, r4, 0
379 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"uge", metadata !"fpexcept.strict") #0
380 %res = select i1 %cond, i32 %a, i32 %b
384 define i32 @test_f64_ult_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
385 ; SPE-LABEL: test_f64_ult_s:
387 ; SPE-NEXT: evmergelo r7, r7, r8
388 ; SPE-NEXT: evmergelo r5, r5, r6
389 ; SPE-NEXT: efdcmpeq cr0, r5, r5
390 ; SPE-NEXT: efdcmpeq cr1, r7, r7
391 ; SPE-NEXT: efdcmplt cr5, r5, r7
392 ; SPE-NEXT: crnand 4*cr5+lt, 4*cr1+gt, gt
393 ; SPE-NEXT: cror 4*cr5+lt, 4*cr5+gt, 4*cr5+lt
394 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
396 ; SPE-NEXT: ori r3, r4, 0
398 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"ult", metadata !"fpexcept.strict") #0
399 %res = select i1 %cond, i32 %a, i32 %b
403 define i32 @test_f64_ule_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
404 ; SPE-LABEL: test_f64_ule_s:
406 ; SPE-NEXT: evmergelo r7, r7, r8
407 ; SPE-NEXT: evmergelo r5, r5, r6
408 ; SPE-NEXT: efdcmpgt cr0, r5, r7
409 ; SPE-NEXT: bc 12, gt, .LBB25_1
411 ; SPE-NEXT: .LBB25_1:
412 ; SPE-NEXT: addi r3, r4, 0
414 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"ule", metadata !"fpexcept.strict") #0
415 %res = select i1 %cond, i32 %a, i32 %b
419 define i32 @test_f64_une_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
420 ; SPE-LABEL: test_f64_une_s:
422 ; SPE-NEXT: evmergelo r7, r7, r8
423 ; SPE-NEXT: evmergelo r5, r5, r6
424 ; SPE-NEXT: efdcmpeq cr0, r5, r7
425 ; SPE-NEXT: bc 12, gt, .LBB26_1
427 ; SPE-NEXT: .LBB26_1:
428 ; SPE-NEXT: addi r3, r4, 0
430 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"une", metadata !"fpexcept.strict") #0
431 %res = select i1 %cond, i32 %a, i32 %b
435 define i32 @test_f64_uno_s(i32 %a, i32 %b, double %f1, double %f2) #0 {
436 ; SPE-LABEL: test_f64_uno_s:
438 ; SPE-NEXT: evmergelo r7, r7, r8
439 ; SPE-NEXT: evmergelo r5, r5, r6
440 ; SPE-NEXT: efdcmpeq cr0, r5, r5
441 ; SPE-NEXT: efdcmpeq cr1, r7, r7
442 ; SPE-NEXT: crnand 4*cr5+lt, 4*cr1+gt, gt
443 ; SPE-NEXT: bclr 12, 4*cr5+lt, 0
445 ; SPE-NEXT: ori r3, r4, 0
447 %cond = call i1 @llvm.experimental.constrained.fcmps.f64(double %f1, double %f2, metadata !"uno", metadata !"fpexcept.strict") #0
448 %res = select i1 %cond, i32 %a, i32 %b
452 attributes #0 = { strictfp nounwind }
454 declare i1 @llvm.experimental.constrained.fcmps.f32(float, float, metadata, metadata)
455 declare i1 @llvm.experimental.constrained.fcmps.f64(double, double, metadata, metadata)