1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs \
3 ; RUN: -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | FileCheck %s
4 ; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown -verify-machineinstrs \
5 ; RUN: -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr < %s | FileCheck %s \
6 ; RUN: -check-prefix=CHECK-P8
8 @a_qp = common dso_local global fp128 0xL00000000000000000000000000000000, align 16
9 @b_qp = common dso_local global fp128 0xL00000000000000000000000000000000, align 16
11 ; Function Attrs: noinline nounwind optnone
12 define dso_local signext i32 @greater_qp() {
13 ; CHECK-LABEL: greater_qp:
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
16 ; CHECK-NEXT: li r4, 1
17 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
18 ; CHECK-NEXT: lxv v2, 0(r3)
19 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
20 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
21 ; CHECK-NEXT: lxv v3, 0(r3)
22 ; CHECK-NEXT: li r3, 0
23 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
24 ; CHECK-NEXT: iselgt r3, r4, r3
27 ; CHECK-P8-LABEL: greater_qp:
28 ; CHECK-P8: # %bb.0: # %entry
29 ; CHECK-P8-NEXT: mflr r0
30 ; CHECK-P8-NEXT: stdu r1, -32(r1)
31 ; CHECK-P8-NEXT: std r0, 48(r1)
32 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
33 ; CHECK-P8-NEXT: .cfi_offset lr, 16
34 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
35 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
36 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
37 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
38 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
39 ; CHECK-P8-NEXT: xxswapd v2, vs0
40 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
41 ; CHECK-P8-NEXT: xxswapd v3, vs0
42 ; CHECK-P8-NEXT: bl __gtkf2
44 ; CHECK-P8-NEXT: extsw r3, r3
45 ; CHECK-P8-NEXT: neg r3, r3
46 ; CHECK-P8-NEXT: rldicl r3, r3, 1, 63
47 ; CHECK-P8-NEXT: addi r1, r1, 32
48 ; CHECK-P8-NEXT: ld r0, 16(r1)
49 ; CHECK-P8-NEXT: mtlr r0
52 %0 = load fp128, ptr @a_qp, align 16
53 %1 = load fp128, ptr @b_qp, align 16
54 %cmp = fcmp ogt fp128 %0, %1
55 %conv = zext i1 %cmp to i32
59 ; Function Attrs: noinline nounwind optnone
60 define dso_local signext i32 @less_qp() {
61 ; CHECK-LABEL: less_qp:
62 ; CHECK: # %bb.0: # %entry
63 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
64 ; CHECK-NEXT: li r4, 1
65 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
66 ; CHECK-NEXT: lxv v2, 0(r3)
67 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
68 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
69 ; CHECK-NEXT: lxv v3, 0(r3)
70 ; CHECK-NEXT: li r3, 0
71 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
72 ; CHECK-NEXT: isellt r3, r4, r3
75 ; CHECK-P8-LABEL: less_qp:
76 ; CHECK-P8: # %bb.0: # %entry
77 ; CHECK-P8-NEXT: mflr r0
78 ; CHECK-P8-NEXT: stdu r1, -32(r1)
79 ; CHECK-P8-NEXT: std r0, 48(r1)
80 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
81 ; CHECK-P8-NEXT: .cfi_offset lr, 16
82 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
83 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
84 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
85 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
86 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
87 ; CHECK-P8-NEXT: xxswapd v2, vs0
88 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
89 ; CHECK-P8-NEXT: xxswapd v3, vs0
90 ; CHECK-P8-NEXT: bl __ltkf2
92 ; CHECK-P8-NEXT: rlwinm r3, r3, 1, 31, 31
93 ; CHECK-P8-NEXT: addi r1, r1, 32
94 ; CHECK-P8-NEXT: ld r0, 16(r1)
95 ; CHECK-P8-NEXT: mtlr r0
98 %0 = load fp128, ptr @a_qp, align 16
99 %1 = load fp128, ptr @b_qp, align 16
100 %cmp = fcmp olt fp128 %0, %1
101 %conv = zext i1 %cmp to i32
105 ; Function Attrs: noinline nounwind optnone
106 define dso_local signext i32 @greater_eq_qp() {
107 ; CHECK-LABEL: greater_eq_qp:
108 ; CHECK: # %bb.0: # %entry
109 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
110 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
111 ; CHECK-NEXT: lxv v2, 0(r3)
112 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
113 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
114 ; CHECK-NEXT: lxv v3, 0(r3)
115 ; CHECK-NEXT: li r3, 1
116 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
117 ; CHECK-NEXT: cror 4*cr5+lt, un, lt
118 ; CHECK-NEXT: isel r3, 0, r3, 4*cr5+lt
121 ; CHECK-P8-LABEL: greater_eq_qp:
122 ; CHECK-P8: # %bb.0: # %entry
123 ; CHECK-P8-NEXT: mflr r0
124 ; CHECK-P8-NEXT: stdu r1, -32(r1)
125 ; CHECK-P8-NEXT: std r0, 48(r1)
126 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
127 ; CHECK-P8-NEXT: .cfi_offset lr, 16
128 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
129 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
130 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
131 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
132 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
133 ; CHECK-P8-NEXT: xxswapd v2, vs0
134 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
135 ; CHECK-P8-NEXT: xxswapd v3, vs0
136 ; CHECK-P8-NEXT: bl __gekf2
138 ; CHECK-P8-NEXT: rlwinm r3, r3, 1, 31, 31
139 ; CHECK-P8-NEXT: xori r3, r3, 1
140 ; CHECK-P8-NEXT: addi r1, r1, 32
141 ; CHECK-P8-NEXT: ld r0, 16(r1)
142 ; CHECK-P8-NEXT: mtlr r0
145 %0 = load fp128, ptr @a_qp, align 16
146 %1 = load fp128, ptr @b_qp, align 16
147 %cmp = fcmp oge fp128 %0, %1
148 %conv = zext i1 %cmp to i32
152 ; Function Attrs: noinline nounwind optnone
153 define dso_local signext i32 @less_eq_qp() {
154 ; CHECK-LABEL: less_eq_qp:
155 ; CHECK: # %bb.0: # %entry
156 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
157 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
158 ; CHECK-NEXT: lxv v2, 0(r3)
159 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
160 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
161 ; CHECK-NEXT: lxv v3, 0(r3)
162 ; CHECK-NEXT: li r3, 1
163 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
164 ; CHECK-NEXT: cror 4*cr5+lt, un, gt
165 ; CHECK-NEXT: isel r3, 0, r3, 4*cr5+lt
168 ; CHECK-P8-LABEL: less_eq_qp:
169 ; CHECK-P8: # %bb.0: # %entry
170 ; CHECK-P8-NEXT: mflr r0
171 ; CHECK-P8-NEXT: stdu r1, -32(r1)
172 ; CHECK-P8-NEXT: std r0, 48(r1)
173 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
174 ; CHECK-P8-NEXT: .cfi_offset lr, 16
175 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
176 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
177 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
178 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
179 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
180 ; CHECK-P8-NEXT: xxswapd v2, vs0
181 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
182 ; CHECK-P8-NEXT: xxswapd v3, vs0
183 ; CHECK-P8-NEXT: bl __lekf2
185 ; CHECK-P8-NEXT: extsw r3, r3
186 ; CHECK-P8-NEXT: neg r3, r3
187 ; CHECK-P8-NEXT: rldicl r3, r3, 1, 63
188 ; CHECK-P8-NEXT: xori r3, r3, 1
189 ; CHECK-P8-NEXT: addi r1, r1, 32
190 ; CHECK-P8-NEXT: ld r0, 16(r1)
191 ; CHECK-P8-NEXT: mtlr r0
194 %0 = load fp128, ptr @a_qp, align 16
195 %1 = load fp128, ptr @b_qp, align 16
196 %cmp = fcmp ole fp128 %0, %1
197 %conv = zext i1 %cmp to i32
201 ; Function Attrs: noinline nounwind optnone
202 define dso_local signext i32 @equal_qp() {
203 ; CHECK-LABEL: equal_qp:
204 ; CHECK: # %bb.0: # %entry
205 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
206 ; CHECK-NEXT: li r4, 1
207 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
208 ; CHECK-NEXT: lxv v2, 0(r3)
209 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
210 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
211 ; CHECK-NEXT: lxv v3, 0(r3)
212 ; CHECK-NEXT: li r3, 0
213 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
214 ; CHECK-NEXT: iseleq r3, r4, r3
217 ; CHECK-P8-LABEL: equal_qp:
218 ; CHECK-P8: # %bb.0: # %entry
219 ; CHECK-P8-NEXT: mflr r0
220 ; CHECK-P8-NEXT: stdu r1, -32(r1)
221 ; CHECK-P8-NEXT: std r0, 48(r1)
222 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
223 ; CHECK-P8-NEXT: .cfi_offset lr, 16
224 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
225 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
226 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
227 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
228 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
229 ; CHECK-P8-NEXT: xxswapd v2, vs0
230 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
231 ; CHECK-P8-NEXT: xxswapd v3, vs0
232 ; CHECK-P8-NEXT: bl __eqkf2
234 ; CHECK-P8-NEXT: cntlzw r3, r3
235 ; CHECK-P8-NEXT: srwi r3, r3, 5
236 ; CHECK-P8-NEXT: addi r1, r1, 32
237 ; CHECK-P8-NEXT: ld r0, 16(r1)
238 ; CHECK-P8-NEXT: mtlr r0
241 %0 = load fp128, ptr @a_qp, align 16
242 %1 = load fp128, ptr @b_qp, align 16
243 %cmp = fcmp oeq fp128 %0, %1
244 %conv = zext i1 %cmp to i32
248 ; Function Attrs: noinline nounwind optnone
249 define dso_local signext i32 @not_greater_qp() {
250 ; CHECK-LABEL: not_greater_qp:
251 ; CHECK: # %bb.0: # %entry
252 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
253 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
254 ; CHECK-NEXT: lxv v2, 0(r3)
255 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
256 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
257 ; CHECK-NEXT: lxv v3, 0(r3)
258 ; CHECK-NEXT: li r3, 1
259 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
260 ; CHECK-NEXT: iselgt r3, 0, r3
263 ; CHECK-P8-LABEL: not_greater_qp:
264 ; CHECK-P8: # %bb.0: # %entry
265 ; CHECK-P8-NEXT: mflr r0
266 ; CHECK-P8-NEXT: stdu r1, -32(r1)
267 ; CHECK-P8-NEXT: std r0, 48(r1)
268 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
269 ; CHECK-P8-NEXT: .cfi_offset lr, 16
270 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
271 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
272 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
273 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
274 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
275 ; CHECK-P8-NEXT: xxswapd v2, vs0
276 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
277 ; CHECK-P8-NEXT: xxswapd v3, vs0
278 ; CHECK-P8-NEXT: bl __gtkf2
280 ; CHECK-P8-NEXT: extsw r3, r3
281 ; CHECK-P8-NEXT: neg r3, r3
282 ; CHECK-P8-NEXT: rldicl r3, r3, 1, 63
283 ; CHECK-P8-NEXT: xori r3, r3, 1
284 ; CHECK-P8-NEXT: addi r1, r1, 32
285 ; CHECK-P8-NEXT: ld r0, 16(r1)
286 ; CHECK-P8-NEXT: mtlr r0
289 %0 = load fp128, ptr @a_qp, align 16
290 %1 = load fp128, ptr @b_qp, align 16
291 %cmp = fcmp ogt fp128 %0, %1
292 %lnot = xor i1 %cmp, true
293 %lnot.ext = zext i1 %lnot to i32
297 ; Function Attrs: noinline nounwind optnone
298 define dso_local signext i32 @not_less_qp() {
299 ; CHECK-LABEL: not_less_qp:
300 ; CHECK: # %bb.0: # %entry
301 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
302 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
303 ; CHECK-NEXT: lxv v2, 0(r3)
304 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
305 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
306 ; CHECK-NEXT: lxv v3, 0(r3)
307 ; CHECK-NEXT: li r3, 1
308 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
309 ; CHECK-NEXT: isellt r3, 0, r3
312 ; CHECK-P8-LABEL: not_less_qp:
313 ; CHECK-P8: # %bb.0: # %entry
314 ; CHECK-P8-NEXT: mflr r0
315 ; CHECK-P8-NEXT: stdu r1, -32(r1)
316 ; CHECK-P8-NEXT: std r0, 48(r1)
317 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
318 ; CHECK-P8-NEXT: .cfi_offset lr, 16
319 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
320 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
321 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
322 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
323 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
324 ; CHECK-P8-NEXT: xxswapd v2, vs0
325 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
326 ; CHECK-P8-NEXT: xxswapd v3, vs0
327 ; CHECK-P8-NEXT: bl __ltkf2
329 ; CHECK-P8-NEXT: rlwinm r3, r3, 1, 31, 31
330 ; CHECK-P8-NEXT: xori r3, r3, 1
331 ; CHECK-P8-NEXT: addi r1, r1, 32
332 ; CHECK-P8-NEXT: ld r0, 16(r1)
333 ; CHECK-P8-NEXT: mtlr r0
336 %0 = load fp128, ptr @a_qp, align 16
337 %1 = load fp128, ptr @b_qp, align 16
338 %cmp = fcmp olt fp128 %0, %1
339 %lnot = xor i1 %cmp, true
340 %lnot.ext = zext i1 %lnot to i32
344 ; Function Attrs: noinline nounwind optnone
345 define dso_local signext i32 @not_greater_eq_qp() {
346 ; CHECK-LABEL: not_greater_eq_qp:
347 ; CHECK: # %bb.0: # %entry
348 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
349 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
350 ; CHECK-NEXT: lxv v2, 0(r3)
351 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
352 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
353 ; CHECK-NEXT: lxv v3, 0(r3)
354 ; CHECK-NEXT: li r3, 1
355 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
356 ; CHECK-NEXT: crnor 4*cr5+lt, lt, un
357 ; CHECK-NEXT: isel r3, 0, r3, 4*cr5+lt
360 ; CHECK-P8-LABEL: not_greater_eq_qp:
361 ; CHECK-P8: # %bb.0: # %entry
362 ; CHECK-P8-NEXT: mflr r0
363 ; CHECK-P8-NEXT: stdu r1, -32(r1)
364 ; CHECK-P8-NEXT: std r0, 48(r1)
365 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
366 ; CHECK-P8-NEXT: .cfi_offset lr, 16
367 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
368 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
369 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
370 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
371 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
372 ; CHECK-P8-NEXT: xxswapd v2, vs0
373 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
374 ; CHECK-P8-NEXT: xxswapd v3, vs0
375 ; CHECK-P8-NEXT: bl __gekf2
377 ; CHECK-P8-NEXT: rlwinm r3, r3, 1, 31, 31
378 ; CHECK-P8-NEXT: addi r1, r1, 32
379 ; CHECK-P8-NEXT: ld r0, 16(r1)
380 ; CHECK-P8-NEXT: mtlr r0
383 %0 = load fp128, ptr @a_qp, align 16
384 %1 = load fp128, ptr @b_qp, align 16
385 %cmp = fcmp oge fp128 %0, %1
386 %lnot = xor i1 %cmp, true
387 %lnot.ext = zext i1 %lnot to i32
391 ; Function Attrs: noinline nounwind optnone
392 define dso_local signext i32 @not_less_eq_qp() {
393 ; CHECK-LABEL: not_less_eq_qp:
394 ; CHECK: # %bb.0: # %entry
395 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
396 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
397 ; CHECK-NEXT: lxv v2, 0(r3)
398 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
399 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
400 ; CHECK-NEXT: lxv v3, 0(r3)
401 ; CHECK-NEXT: li r3, 1
402 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
403 ; CHECK-NEXT: crnor 4*cr5+lt, gt, un
404 ; CHECK-NEXT: isel r3, 0, r3, 4*cr5+lt
407 ; CHECK-P8-LABEL: not_less_eq_qp:
408 ; CHECK-P8: # %bb.0: # %entry
409 ; CHECK-P8-NEXT: mflr r0
410 ; CHECK-P8-NEXT: stdu r1, -32(r1)
411 ; CHECK-P8-NEXT: std r0, 48(r1)
412 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
413 ; CHECK-P8-NEXT: .cfi_offset lr, 16
414 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
415 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
416 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
417 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
418 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
419 ; CHECK-P8-NEXT: xxswapd v2, vs0
420 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
421 ; CHECK-P8-NEXT: xxswapd v3, vs0
422 ; CHECK-P8-NEXT: bl __lekf2
424 ; CHECK-P8-NEXT: extsw r3, r3
425 ; CHECK-P8-NEXT: neg r3, r3
426 ; CHECK-P8-NEXT: rldicl r3, r3, 1, 63
427 ; CHECK-P8-NEXT: addi r1, r1, 32
428 ; CHECK-P8-NEXT: ld r0, 16(r1)
429 ; CHECK-P8-NEXT: mtlr r0
432 %0 = load fp128, ptr @a_qp, align 16
433 %1 = load fp128, ptr @b_qp, align 16
434 %cmp = fcmp ole fp128 %0, %1
435 %lnot = xor i1 %cmp, true
436 %lnot.ext = zext i1 %lnot to i32
440 ; Function Attrs: noinline nounwind optnone
441 define dso_local signext i32 @not_equal_qp() {
442 ; CHECK-LABEL: not_equal_qp:
443 ; CHECK: # %bb.0: # %entry
444 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
445 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
446 ; CHECK-NEXT: lxv v2, 0(r3)
447 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
448 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
449 ; CHECK-NEXT: lxv v3, 0(r3)
450 ; CHECK-NEXT: li r3, 1
451 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
452 ; CHECK-NEXT: iseleq r3, 0, r3
455 ; CHECK-P8-LABEL: not_equal_qp:
456 ; CHECK-P8: # %bb.0: # %entry
457 ; CHECK-P8-NEXT: mflr r0
458 ; CHECK-P8-NEXT: stdu r1, -32(r1)
459 ; CHECK-P8-NEXT: std r0, 48(r1)
460 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 32
461 ; CHECK-P8-NEXT: .cfi_offset lr, 16
462 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
463 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
464 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
465 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
466 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
467 ; CHECK-P8-NEXT: xxswapd v2, vs0
468 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
469 ; CHECK-P8-NEXT: xxswapd v3, vs0
470 ; CHECK-P8-NEXT: bl __nekf2
472 ; CHECK-P8-NEXT: cntlzw r3, r3
473 ; CHECK-P8-NEXT: srwi r3, r3, 5
474 ; CHECK-P8-NEXT: xori r3, r3, 1
475 ; CHECK-P8-NEXT: addi r1, r1, 32
476 ; CHECK-P8-NEXT: ld r0, 16(r1)
477 ; CHECK-P8-NEXT: mtlr r0
480 %0 = load fp128, ptr @a_qp, align 16
481 %1 = load fp128, ptr @b_qp, align 16
482 %cmp = fcmp une fp128 %0, %1
483 %conv = zext i1 %cmp to i32
487 ; Function Attrs: norecurse nounwind readonly
488 define fp128 @greater_sel_qp() {
489 ; CHECK-LABEL: greater_sel_qp:
490 ; CHECK: # %bb.0: # %entry
491 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
492 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
493 ; CHECK-NEXT: lxv v2, 0(r3)
494 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
495 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
496 ; CHECK-NEXT: lxv v3, 0(r3)
497 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
498 ; CHECK-NEXT: bgtlr cr0
499 ; CHECK-NEXT: # %bb.1: # %entry
500 ; CHECK-NEXT: vmr v2, v3
503 ; CHECK-P8-LABEL: greater_sel_qp:
504 ; CHECK-P8: # %bb.0: # %entry
505 ; CHECK-P8-NEXT: mflr r0
506 ; CHECK-P8-NEXT: stdu r1, -80(r1)
507 ; CHECK-P8-NEXT: std r0, 96(r1)
508 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 80
509 ; CHECK-P8-NEXT: .cfi_offset lr, 16
510 ; CHECK-P8-NEXT: .cfi_offset v30, -32
511 ; CHECK-P8-NEXT: .cfi_offset v31, -16
512 ; CHECK-P8-NEXT: li r3, 48
513 ; CHECK-P8-NEXT: stvx v30, r1, r3 # 16-byte Folded Spill
514 ; CHECK-P8-NEXT: li r3, 64
515 ; CHECK-P8-NEXT: stvx v31, r1, r3 # 16-byte Folded Spill
516 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
517 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
518 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
519 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
520 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
521 ; CHECK-P8-NEXT: xxswapd v31, vs0
522 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
523 ; CHECK-P8-NEXT: vmr v2, v31
524 ; CHECK-P8-NEXT: xxswapd v30, vs0
525 ; CHECK-P8-NEXT: vmr v3, v30
526 ; CHECK-P8-NEXT: bl __gtkf2
528 ; CHECK-P8-NEXT: cmpwi r3, 0
529 ; CHECK-P8-NEXT: bgt cr0, .LBB10_2
530 ; CHECK-P8-NEXT: # %bb.1: # %entry
531 ; CHECK-P8-NEXT: vmr v31, v30
532 ; CHECK-P8-NEXT: .LBB10_2: # %entry
533 ; CHECK-P8-NEXT: li r3, 64
534 ; CHECK-P8-NEXT: vmr v2, v31
535 ; CHECK-P8-NEXT: lvx v31, r1, r3 # 16-byte Folded Reload
536 ; CHECK-P8-NEXT: li r3, 48
537 ; CHECK-P8-NEXT: lvx v30, r1, r3 # 16-byte Folded Reload
538 ; CHECK-P8-NEXT: addi r1, r1, 80
539 ; CHECK-P8-NEXT: ld r0, 16(r1)
540 ; CHECK-P8-NEXT: mtlr r0
543 %0 = load fp128, ptr @a_qp, align 16
544 %1 = load fp128, ptr @b_qp, align 16
545 %cmp = fcmp ogt fp128 %0, %1
546 %cond = select i1 %cmp, fp128 %0, fp128 %1
550 ; Function Attrs: noinline nounwind optnone
551 define fp128 @less_sel_qp() {
552 ; CHECK-LABEL: less_sel_qp:
553 ; CHECK: # %bb.0: # %entry
554 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
555 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
556 ; CHECK-NEXT: lxv v2, 0(r3)
557 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
558 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
559 ; CHECK-NEXT: lxv v3, 0(r3)
560 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
561 ; CHECK-NEXT: bltlr cr0
562 ; CHECK-NEXT: # %bb.1: # %entry
563 ; CHECK-NEXT: vmr v2, v3
566 ; CHECK-P8-LABEL: less_sel_qp:
567 ; CHECK-P8: # %bb.0: # %entry
568 ; CHECK-P8-NEXT: mflr r0
569 ; CHECK-P8-NEXT: stdu r1, -80(r1)
570 ; CHECK-P8-NEXT: std r0, 96(r1)
571 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 80
572 ; CHECK-P8-NEXT: .cfi_offset lr, 16
573 ; CHECK-P8-NEXT: .cfi_offset v30, -32
574 ; CHECK-P8-NEXT: .cfi_offset v31, -16
575 ; CHECK-P8-NEXT: li r3, 48
576 ; CHECK-P8-NEXT: stvx v30, r1, r3 # 16-byte Folded Spill
577 ; CHECK-P8-NEXT: li r3, 64
578 ; CHECK-P8-NEXT: stvx v31, r1, r3 # 16-byte Folded Spill
579 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
580 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
581 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
582 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
583 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
584 ; CHECK-P8-NEXT: xxswapd v31, vs0
585 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
586 ; CHECK-P8-NEXT: vmr v2, v31
587 ; CHECK-P8-NEXT: xxswapd v30, vs0
588 ; CHECK-P8-NEXT: vmr v3, v30
589 ; CHECK-P8-NEXT: bl __ltkf2
591 ; CHECK-P8-NEXT: cmpwi r3, 0
592 ; CHECK-P8-NEXT: blt cr0, .LBB11_2
593 ; CHECK-P8-NEXT: # %bb.1: # %entry
594 ; CHECK-P8-NEXT: vmr v31, v30
595 ; CHECK-P8-NEXT: .LBB11_2: # %entry
596 ; CHECK-P8-NEXT: li r3, 64
597 ; CHECK-P8-NEXT: vmr v2, v31
598 ; CHECK-P8-NEXT: lvx v31, r1, r3 # 16-byte Folded Reload
599 ; CHECK-P8-NEXT: li r3, 48
600 ; CHECK-P8-NEXT: lvx v30, r1, r3 # 16-byte Folded Reload
601 ; CHECK-P8-NEXT: addi r1, r1, 80
602 ; CHECK-P8-NEXT: ld r0, 16(r1)
603 ; CHECK-P8-NEXT: mtlr r0
606 %0 = load fp128, ptr @a_qp, align 16
607 %1 = load fp128, ptr @b_qp, align 16
608 %cmp = fcmp olt fp128 %0, %1
609 %cond = select i1 %cmp, fp128 %0, fp128 %1
613 ; Function Attrs: noinline nounwind optnone
614 define fp128 @greater_eq_sel_qp() {
615 ; CHECK-LABEL: greater_eq_sel_qp:
616 ; CHECK: # %bb.0: # %entry
617 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
618 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
619 ; CHECK-NEXT: lxv v2, 0(r3)
620 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
621 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
622 ; CHECK-NEXT: lxv v3, 0(r3)
623 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
624 ; CHECK-NEXT: crnor 4*cr5+lt, un, lt
625 ; CHECK-NEXT: bclr 12, 4*cr5+lt, 0
626 ; CHECK-NEXT: # %bb.1: # %entry
627 ; CHECK-NEXT: vmr v2, v3
630 ; CHECK-P8-LABEL: greater_eq_sel_qp:
631 ; CHECK-P8: # %bb.0: # %entry
632 ; CHECK-P8-NEXT: mflr r0
633 ; CHECK-P8-NEXT: stdu r1, -80(r1)
634 ; CHECK-P8-NEXT: std r0, 96(r1)
635 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 80
636 ; CHECK-P8-NEXT: .cfi_offset lr, 16
637 ; CHECK-P8-NEXT: .cfi_offset v30, -32
638 ; CHECK-P8-NEXT: .cfi_offset v31, -16
639 ; CHECK-P8-NEXT: li r3, 48
640 ; CHECK-P8-NEXT: stvx v30, r1, r3 # 16-byte Folded Spill
641 ; CHECK-P8-NEXT: li r3, 64
642 ; CHECK-P8-NEXT: stvx v31, r1, r3 # 16-byte Folded Spill
643 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
644 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
645 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
646 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
647 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
648 ; CHECK-P8-NEXT: xxswapd v31, vs0
649 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
650 ; CHECK-P8-NEXT: vmr v2, v31
651 ; CHECK-P8-NEXT: xxswapd v30, vs0
652 ; CHECK-P8-NEXT: vmr v3, v30
653 ; CHECK-P8-NEXT: bl __gekf2
655 ; CHECK-P8-NEXT: cmpwi r3, -1
656 ; CHECK-P8-NEXT: bgt cr0, .LBB12_2
657 ; CHECK-P8-NEXT: # %bb.1: # %entry
658 ; CHECK-P8-NEXT: vmr v31, v30
659 ; CHECK-P8-NEXT: .LBB12_2: # %entry
660 ; CHECK-P8-NEXT: li r3, 64
661 ; CHECK-P8-NEXT: vmr v2, v31
662 ; CHECK-P8-NEXT: lvx v31, r1, r3 # 16-byte Folded Reload
663 ; CHECK-P8-NEXT: li r3, 48
664 ; CHECK-P8-NEXT: lvx v30, r1, r3 # 16-byte Folded Reload
665 ; CHECK-P8-NEXT: addi r1, r1, 80
666 ; CHECK-P8-NEXT: ld r0, 16(r1)
667 ; CHECK-P8-NEXT: mtlr r0
670 %0 = load fp128, ptr @a_qp, align 16
671 %1 = load fp128, ptr @b_qp, align 16
672 %cmp = fcmp oge fp128 %0, %1
673 %cond = select i1 %cmp, fp128 %0, fp128 %1
677 ; Function Attrs: noinline nounwind optnone
678 define fp128 @less_eq_sel_qp() {
679 ; CHECK-LABEL: less_eq_sel_qp:
680 ; CHECK: # %bb.0: # %entry
681 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
682 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
683 ; CHECK-NEXT: lxv v2, 0(r3)
684 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
685 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
686 ; CHECK-NEXT: lxv v3, 0(r3)
687 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
688 ; CHECK-NEXT: crnor 4*cr5+lt, un, gt
689 ; CHECK-NEXT: bclr 12, 4*cr5+lt, 0
690 ; CHECK-NEXT: # %bb.1: # %entry
691 ; CHECK-NEXT: vmr v2, v3
694 ; CHECK-P8-LABEL: less_eq_sel_qp:
695 ; CHECK-P8: # %bb.0: # %entry
696 ; CHECK-P8-NEXT: mflr r0
697 ; CHECK-P8-NEXT: stdu r1, -80(r1)
698 ; CHECK-P8-NEXT: std r0, 96(r1)
699 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 80
700 ; CHECK-P8-NEXT: .cfi_offset lr, 16
701 ; CHECK-P8-NEXT: .cfi_offset v30, -32
702 ; CHECK-P8-NEXT: .cfi_offset v31, -16
703 ; CHECK-P8-NEXT: li r3, 48
704 ; CHECK-P8-NEXT: stvx v30, r1, r3 # 16-byte Folded Spill
705 ; CHECK-P8-NEXT: li r3, 64
706 ; CHECK-P8-NEXT: stvx v31, r1, r3 # 16-byte Folded Spill
707 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
708 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
709 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
710 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
711 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
712 ; CHECK-P8-NEXT: xxswapd v31, vs0
713 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
714 ; CHECK-P8-NEXT: vmr v2, v31
715 ; CHECK-P8-NEXT: xxswapd v30, vs0
716 ; CHECK-P8-NEXT: vmr v3, v30
717 ; CHECK-P8-NEXT: bl __lekf2
719 ; CHECK-P8-NEXT: cmpwi r3, 1
720 ; CHECK-P8-NEXT: blt cr0, .LBB13_2
721 ; CHECK-P8-NEXT: # %bb.1: # %entry
722 ; CHECK-P8-NEXT: vmr v31, v30
723 ; CHECK-P8-NEXT: .LBB13_2: # %entry
724 ; CHECK-P8-NEXT: li r3, 64
725 ; CHECK-P8-NEXT: vmr v2, v31
726 ; CHECK-P8-NEXT: lvx v31, r1, r3 # 16-byte Folded Reload
727 ; CHECK-P8-NEXT: li r3, 48
728 ; CHECK-P8-NEXT: lvx v30, r1, r3 # 16-byte Folded Reload
729 ; CHECK-P8-NEXT: addi r1, r1, 80
730 ; CHECK-P8-NEXT: ld r0, 16(r1)
731 ; CHECK-P8-NEXT: mtlr r0
734 %0 = load fp128, ptr @a_qp, align 16
735 %1 = load fp128, ptr @b_qp, align 16
736 %cmp = fcmp ole fp128 %0, %1
737 %cond = select i1 %cmp, fp128 %0, fp128 %1
741 ; Function Attrs: noinline nounwind optnone
742 define fp128 @equal_sel_qp() {
743 ; CHECK-LABEL: equal_sel_qp:
744 ; CHECK: # %bb.0: # %entry
745 ; CHECK-NEXT: addis r3, r2, a_qp@toc@ha
746 ; CHECK-NEXT: addi r3, r3, a_qp@toc@l
747 ; CHECK-NEXT: lxv v2, 0(r3)
748 ; CHECK-NEXT: addis r3, r2, b_qp@toc@ha
749 ; CHECK-NEXT: addi r3, r3, b_qp@toc@l
750 ; CHECK-NEXT: lxv v3, 0(r3)
751 ; CHECK-NEXT: xscmpuqp cr0, v2, v3
752 ; CHECK-NEXT: beqlr cr0
753 ; CHECK-NEXT: # %bb.1: # %entry
754 ; CHECK-NEXT: vmr v2, v3
757 ; CHECK-P8-LABEL: equal_sel_qp:
758 ; CHECK-P8: # %bb.0: # %entry
759 ; CHECK-P8-NEXT: mflr r0
760 ; CHECK-P8-NEXT: stdu r1, -80(r1)
761 ; CHECK-P8-NEXT: std r0, 96(r1)
762 ; CHECK-P8-NEXT: .cfi_def_cfa_offset 80
763 ; CHECK-P8-NEXT: .cfi_offset lr, 16
764 ; CHECK-P8-NEXT: .cfi_offset v30, -32
765 ; CHECK-P8-NEXT: .cfi_offset v31, -16
766 ; CHECK-P8-NEXT: li r3, 48
767 ; CHECK-P8-NEXT: stvx v30, r1, r3 # 16-byte Folded Spill
768 ; CHECK-P8-NEXT: li r3, 64
769 ; CHECK-P8-NEXT: stvx v31, r1, r3 # 16-byte Folded Spill
770 ; CHECK-P8-NEXT: addis r3, r2, a_qp@toc@ha
771 ; CHECK-P8-NEXT: addi r3, r3, a_qp@toc@l
772 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
773 ; CHECK-P8-NEXT: addis r3, r2, b_qp@toc@ha
774 ; CHECK-P8-NEXT: addi r3, r3, b_qp@toc@l
775 ; CHECK-P8-NEXT: xxswapd v31, vs0
776 ; CHECK-P8-NEXT: lxvd2x vs0, 0, r3
777 ; CHECK-P8-NEXT: vmr v2, v31
778 ; CHECK-P8-NEXT: xxswapd v30, vs0
779 ; CHECK-P8-NEXT: vmr v3, v30
780 ; CHECK-P8-NEXT: bl __eqkf2
782 ; CHECK-P8-NEXT: cmplwi r3, 0
783 ; CHECK-P8-NEXT: beq cr0, .LBB14_2
784 ; CHECK-P8-NEXT: # %bb.1: # %entry
785 ; CHECK-P8-NEXT: vmr v31, v30
786 ; CHECK-P8-NEXT: .LBB14_2: # %entry
787 ; CHECK-P8-NEXT: li r3, 64
788 ; CHECK-P8-NEXT: vmr v2, v31
789 ; CHECK-P8-NEXT: lvx v31, r1, r3 # 16-byte Folded Reload
790 ; CHECK-P8-NEXT: li r3, 48
791 ; CHECK-P8-NEXT: lvx v30, r1, r3 # 16-byte Folded Reload
792 ; CHECK-P8-NEXT: addi r1, r1, 80
793 ; CHECK-P8-NEXT: ld r0, 16(r1)
794 ; CHECK-P8-NEXT: mtlr r0
797 %0 = load fp128, ptr @a_qp, align 16
798 %1 = load fp128, ptr @b_qp, align 16
799 %cmp = fcmp oeq fp128 %0, %1
800 %cond = select i1 %cmp, fp128 %0, fp128 %1