1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs -amdgpu-enable-delay-alu=0 < %s | FileCheck %s -check-prefixes=GCN,GFX11
3 ; RUN: llc -march=amdgcn -mcpu=gfx1100 -verify-machineinstrs -amdgpu-enable-delay-alu=0 -enable-no-nans-fp-math < %s | FileCheck %s -check-prefixes=GCN,GFX11NONANS
5 ; The tests check the following optimization of DAGCombiner:
6 ; CMP(A,C)||CMP(B,C) => CMP(MIN/MAX(A,B), C)
7 ; CMP(A,C)&&CMP(B,C) => CMP(MIN/MAX(A,B), C)
9 define i1 @test1(i32 %arg1, i32 %arg2) {
12 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
13 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
14 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, 0x3e8, v0
15 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
16 ; GCN-NEXT: s_setpc_b64 s[30:31]
17 %cmp1 = icmp slt i32 %arg1, 1000
18 %cmp2 = icmp slt i32 %arg2, 1000
19 %or = or i1 %cmp1, %cmp2
23 define i1 @test2(i32 %arg1, i32 %arg2) {
26 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
27 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
28 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, 0x3e8, v0
29 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
30 ; GCN-NEXT: s_setpc_b64 s[30:31]
31 %cmp1 = icmp ult i32 %arg1, 1000
32 %cmp2 = icmp ult i32 %arg2, 1000
33 %or = or i1 %cmp1, %cmp2
37 define i1 @test3(i32 %arg1, i32 %arg2) {
40 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
41 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
42 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, 0x3e9, v0
43 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
44 ; GCN-NEXT: s_setpc_b64 s[30:31]
45 %cmp1 = icmp sle i32 %arg1, 1000
46 %cmp2 = icmp sle i32 %arg2, 1000
47 %or = or i1 %cmp1, %cmp2
51 define i1 @test4(i32 %arg1, i32 %arg2) {
54 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
55 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
56 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, 0x3e9, v0
57 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
58 ; GCN-NEXT: s_setpc_b64 s[30:31]
59 %cmp1 = icmp ule i32 %arg1, 1000
60 %cmp2 = icmp ule i32 %arg2, 1000
61 %or = or i1 %cmp1, %cmp2
65 define i1 @test5(i32 %arg1, i32 %arg2) {
68 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
69 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
70 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, 0x3e8, v0
71 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
72 ; GCN-NEXT: s_setpc_b64 s[30:31]
73 %cmp1 = icmp sgt i32 %arg1, 1000
74 %cmp2 = icmp sgt i32 %arg2, 1000
75 %or = or i1 %cmp1, %cmp2
79 define i1 @test6(i32 %arg1, i32 %arg2) {
82 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
83 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
84 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, 0x3e8, v0
85 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
86 ; GCN-NEXT: s_setpc_b64 s[30:31]
87 %cmp1 = icmp ugt i32 %arg1, 1000
88 %cmp2 = icmp ugt i32 %arg2, 1000
89 %or = or i1 %cmp1, %cmp2
93 define i1 @test7(i32 %arg1, i32 %arg2) {
96 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
97 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
98 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, 0x3e7, v0
99 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
100 ; GCN-NEXT: s_setpc_b64 s[30:31]
101 %cmp1 = icmp sge i32 %arg1, 1000
102 %cmp2 = icmp sge i32 %arg2, 1000
103 %or = or i1 %cmp1, %cmp2
107 define i1 @test8(i32 %arg1, i32 %arg2) {
110 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
111 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
112 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, 0x3e7, v0
113 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
114 ; GCN-NEXT: s_setpc_b64 s[30:31]
115 %cmp1 = icmp uge i32 %arg1, 1000
116 %cmp2 = icmp uge i32 %arg2, 1000
117 %or = or i1 %cmp1, %cmp2
121 define i1 @test9(i32 %arg1, i32 %arg2, i32 %arg3) {
124 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
125 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
126 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, v0, v2
127 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
128 ; GCN-NEXT: s_setpc_b64 s[30:31]
129 %cmp1 = icmp slt i32 %arg1, %arg3
130 %cmp2 = icmp slt i32 %arg2, %arg3
131 %or = or i1 %cmp1, %cmp2
135 define i1 @test10(i32 %arg1, i32 %arg2, i32 %arg3) {
138 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
139 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
140 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v2
141 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
142 ; GCN-NEXT: s_setpc_b64 s[30:31]
143 %cmp1 = icmp ult i32 %arg1, %arg3
144 %cmp2 = icmp ult i32 %arg2, %arg3
145 %or = or i1 %cmp1, %cmp2
149 define i1 @test11(i32 %arg1, i32 %arg2, i32 %arg3) {
152 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
153 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
154 ; GCN-NEXT: v_cmp_le_i32_e32 vcc_lo, v0, v2
155 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
156 ; GCN-NEXT: s_setpc_b64 s[30:31]
157 %cmp1 = icmp sle i32 %arg1, %arg3
158 %cmp2 = icmp sle i32 %arg2, %arg3
159 %or = or i1 %cmp1, %cmp2
163 define i1 @test12(i32 %arg1, i32 %arg2, i32 %arg3) {
166 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
167 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
168 ; GCN-NEXT: v_cmp_le_u32_e32 vcc_lo, v0, v2
169 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
170 ; GCN-NEXT: s_setpc_b64 s[30:31]
171 %cmp1 = icmp ule i32 %arg1, %arg3
172 %cmp2 = icmp ule i32 %arg2, %arg3
173 %or = or i1 %cmp1, %cmp2
177 define i1 @test13(i32 %arg1, i32 %arg2, i32 %arg3) {
180 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
181 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
182 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, v0, v2
183 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
184 ; GCN-NEXT: s_setpc_b64 s[30:31]
185 %cmp1 = icmp sgt i32 %arg1, %arg3
186 %cmp2 = icmp sgt i32 %arg2, %arg3
187 %or = or i1 %cmp1, %cmp2
191 define i1 @test14(i32 %arg1, i32 %arg2, i32 %arg3) {
194 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
195 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
196 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, v0, v2
197 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
198 ; GCN-NEXT: s_setpc_b64 s[30:31]
199 %cmp1 = icmp ugt i32 %arg1, %arg3
200 %cmp2 = icmp ugt i32 %arg2, %arg3
201 %or = or i1 %cmp1, %cmp2
205 define i1 @test15(i32 %arg1, i32 %arg2, i32 %arg3) {
208 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
209 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
210 ; GCN-NEXT: v_cmp_ge_i32_e32 vcc_lo, v0, v2
211 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
212 ; GCN-NEXT: s_setpc_b64 s[30:31]
213 %cmp1 = icmp sge i32 %arg1, %arg3
214 %cmp2 = icmp sge i32 %arg2, %arg3
215 %or = or i1 %cmp1, %cmp2
219 define i1 @test16(i32 %arg1, i32 %arg2, i32 %arg3) {
222 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
223 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
224 ; GCN-NEXT: v_cmp_ge_u32_e32 vcc_lo, v0, v2
225 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
226 ; GCN-NEXT: s_setpc_b64 s[30:31]
227 %cmp1 = icmp uge i32 %arg1, %arg3
228 %cmp2 = icmp uge i32 %arg2, %arg3
229 %or = or i1 %cmp1, %cmp2
233 define i1 @test17(i32 %arg1, i32 %arg2) {
236 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
237 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
238 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, 0x3e8, v0
239 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
240 ; GCN-NEXT: s_setpc_b64 s[30:31]
241 %cmp1 = icmp slt i32 %arg1, 1000
242 %cmp2 = icmp slt i32 %arg2, 1000
243 %and = and i1 %cmp1, %cmp2
247 define i1 @test18(i32 %arg1, i32 %arg2) {
250 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
251 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
252 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, 0x3e8, v0
253 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
254 ; GCN-NEXT: s_setpc_b64 s[30:31]
255 %cmp1 = icmp ult i32 %arg1, 1000
256 %cmp2 = icmp ult i32 %arg2, 1000
257 %and = and i1 %cmp1, %cmp2
261 define i1 @test19(i32 %arg1, i32 %arg2) {
264 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
265 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
266 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, 0x3e9, v0
267 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
268 ; GCN-NEXT: s_setpc_b64 s[30:31]
269 %cmp1 = icmp sle i32 %arg1, 1000
270 %cmp2 = icmp sle i32 %arg2, 1000
271 %and = and i1 %cmp1, %cmp2
275 define i1 @test20(i32 %arg1, i32 %arg2) {
278 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
279 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
280 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, 0x3e9, v0
281 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
282 ; GCN-NEXT: s_setpc_b64 s[30:31]
283 %cmp1 = icmp ule i32 %arg1, 1000
284 %cmp2 = icmp ule i32 %arg2, 1000
285 %and = and i1 %cmp1, %cmp2
289 define i1 @test21(i32 %arg1, i32 %arg2) {
292 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
293 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
294 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, 0x3e8, v0
295 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
296 ; GCN-NEXT: s_setpc_b64 s[30:31]
297 %cmp1 = icmp sgt i32 %arg1, 1000
298 %cmp2 = icmp sgt i32 %arg2, 1000
299 %and = and i1 %cmp1, %cmp2
303 define i1 @test22(i32 %arg1, i32 %arg2) {
306 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
307 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
308 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, 0x3e8, v0
309 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
310 ; GCN-NEXT: s_setpc_b64 s[30:31]
311 %cmp1 = icmp ugt i32 %arg1, 1000
312 %cmp2 = icmp ugt i32 %arg2, 1000
313 %and = and i1 %cmp1, %cmp2
317 define i1 @test23(i32 %arg1, i32 %arg2) {
320 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
321 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
322 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, 0x3e7, v0
323 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
324 ; GCN-NEXT: s_setpc_b64 s[30:31]
325 %cmp1 = icmp sge i32 %arg1, 1000
326 %cmp2 = icmp sge i32 %arg2, 1000
327 %and = and i1 %cmp1, %cmp2
331 define i1 @test24(i32 %arg1, i32 %arg2) {
334 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
335 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
336 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, 0x3e7, v0
337 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
338 ; GCN-NEXT: s_setpc_b64 s[30:31]
339 %cmp1 = icmp uge i32 %arg1, 1000
340 %cmp2 = icmp uge i32 %arg2, 1000
341 %and = and i1 %cmp1, %cmp2
345 define i1 @test25(i32 %arg1, i32 %arg2, i32 %arg3) {
348 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
349 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
350 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, v0, v2
351 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
352 ; GCN-NEXT: s_setpc_b64 s[30:31]
353 %cmp1 = icmp slt i32 %arg1, %arg3
354 %cmp2 = icmp slt i32 %arg2, %arg3
355 %and = and i1 %cmp1, %cmp2
359 define i1 @test26(i32 %arg1, i32 %arg2, i32 %arg3) {
362 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
363 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
364 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v2
365 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
366 ; GCN-NEXT: s_setpc_b64 s[30:31]
367 %cmp1 = icmp ult i32 %arg1, %arg3
368 %cmp2 = icmp ult i32 %arg2, %arg3
369 %and = and i1 %cmp1, %cmp2
373 define i1 @test27(i32 %arg1, i32 %arg2, i32 %arg3) {
376 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
377 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
378 ; GCN-NEXT: v_cmp_le_i32_e32 vcc_lo, v0, v2
379 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
380 ; GCN-NEXT: s_setpc_b64 s[30:31]
381 %cmp1 = icmp sle i32 %arg1, %arg3
382 %cmp2 = icmp sle i32 %arg2, %arg3
383 %and = and i1 %cmp1, %cmp2
387 define i1 @test28(i32 %arg1, i32 %arg2, i32 %arg3) {
390 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
391 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
392 ; GCN-NEXT: v_cmp_le_u32_e32 vcc_lo, v0, v2
393 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
394 ; GCN-NEXT: s_setpc_b64 s[30:31]
395 %cmp1 = icmp ule i32 %arg1, %arg3
396 %cmp2 = icmp ule i32 %arg2, %arg3
397 %and = and i1 %cmp1, %cmp2
401 define i1 @test29(i32 %arg1, i32 %arg2, i32 %arg3) {
404 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
405 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
406 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, v0, v2
407 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
408 ; GCN-NEXT: s_setpc_b64 s[30:31]
409 %cmp1 = icmp sgt i32 %arg1, %arg3
410 %cmp2 = icmp sgt i32 %arg2, %arg3
411 %and = and i1 %cmp1, %cmp2
415 define i1 @test30(i32 %arg1, i32 %arg2, i32 %arg3) {
418 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
419 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
420 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, v0, v2
421 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
422 ; GCN-NEXT: s_setpc_b64 s[30:31]
423 %cmp1 = icmp ugt i32 %arg1, %arg3
424 %cmp2 = icmp ugt i32 %arg2, %arg3
425 %and = and i1 %cmp1, %cmp2
429 define i1 @test31(i32 %arg1, i32 %arg2, i32 %arg3) {
432 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
433 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
434 ; GCN-NEXT: v_cmp_ge_i32_e32 vcc_lo, v0, v2
435 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
436 ; GCN-NEXT: s_setpc_b64 s[30:31]
437 %cmp1 = icmp sge i32 %arg1, %arg3
438 %cmp2 = icmp sge i32 %arg2, %arg3
439 %and = and i1 %cmp1, %cmp2
443 define i1 @test32(i32 %arg1, i32 %arg2, i32 %arg3) {
446 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
447 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
448 ; GCN-NEXT: v_cmp_ge_u32_e32 vcc_lo, v0, v2
449 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
450 ; GCN-NEXT: s_setpc_b64 s[30:31]
451 %cmp1 = icmp uge i32 %arg1, %arg3
452 %cmp2 = icmp uge i32 %arg2, %arg3
453 %and = and i1 %cmp1, %cmp2
457 define i1 @test33(i32 %arg1, i32 %arg2) {
460 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
461 ; GCN-NEXT: v_max_i32_e32 v1, 0x3e8, v1
462 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, v1, v0
463 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
464 ; GCN-NEXT: s_setpc_b64 s[30:31]
465 %cmp1 = icmp slt i32 %arg1, %arg2
466 %cmp2 = icmp slt i32 %arg1, 1000
467 %or = or i1 %cmp1, %cmp2
471 define amdgpu_gfx void @test34(i32 inreg %arg1, i32 inreg %arg2) {
474 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
475 ; GCN-NEXT: s_min_i32 s0, s4, s5
476 ; GCN-NEXT: v_mov_b32_e32 v0, 0
477 ; GCN-NEXT: s_cmpk_lt_i32 s0, 0x3e9
478 ; GCN-NEXT: v_mov_b32_e32 v1, 0
479 ; GCN-NEXT: s_cselect_b32 s0, -1, 0
480 ; GCN-NEXT: v_cndmask_b32_e64 v2, 0, 1, s0
481 ; GCN-NEXT: global_store_b8 v[0:1], v2, off dlc
482 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
483 ; GCN-NEXT: s_setpc_b64 s[30:31]
484 %cmp1 = icmp sle i32 %arg1, 1000
485 %cmp2 = icmp sle i32 %arg2, 1000
486 %or = or i1 %cmp1, %cmp2
487 store volatile i1 %or, ptr addrspace(1) null
491 define amdgpu_gfx void @test35(i32 inreg %arg1, i32 inreg %arg2) {
494 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
495 ; GCN-NEXT: s_max_i32 s0, s4, s5
496 ; GCN-NEXT: v_mov_b32_e32 v0, 0
497 ; GCN-NEXT: s_cmpk_gt_i32 s0, 0x3e8
498 ; GCN-NEXT: v_mov_b32_e32 v1, 0
499 ; GCN-NEXT: s_cselect_b32 s0, -1, 0
500 ; GCN-NEXT: v_cndmask_b32_e64 v2, 0, 1, s0
501 ; GCN-NEXT: global_store_b8 v[0:1], v2, off dlc
502 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
503 ; GCN-NEXT: s_setpc_b64 s[30:31]
504 %cmp1 = icmp sgt i32 %arg1, 1000
505 %cmp2 = icmp sgt i32 %arg2, 1000
506 %or = or i1 %cmp1, %cmp2
507 store volatile i1 %or, ptr addrspace(1) null
511 define amdgpu_gfx void @test36(i32 inreg %arg1, i32 inreg %arg2, i32 inreg %arg3) {
514 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
515 ; GCN-NEXT: s_min_u32 s0, s4, s5
516 ; GCN-NEXT: v_mov_b32_e32 v0, 0
517 ; GCN-NEXT: s_cmp_lt_u32 s0, s6
518 ; GCN-NEXT: v_mov_b32_e32 v1, 0
519 ; GCN-NEXT: s_cselect_b32 s0, -1, 0
520 ; GCN-NEXT: v_cndmask_b32_e64 v2, 0, 1, s0
521 ; GCN-NEXT: global_store_b8 v[0:1], v2, off dlc
522 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
523 ; GCN-NEXT: s_setpc_b64 s[30:31]
524 %cmp1 = icmp ult i32 %arg1, %arg3
525 %cmp2 = icmp ult i32 %arg2, %arg3
526 %or = or i1 %cmp1, %cmp2
527 store volatile i1 %or, ptr addrspace(1) null
531 define amdgpu_gfx void @test37(i32 inreg %arg1, i32 inreg %arg2, i32 inreg %arg3) {
534 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
535 ; GCN-NEXT: s_max_i32 s0, s4, s5
536 ; GCN-NEXT: v_mov_b32_e32 v0, 0
537 ; GCN-NEXT: s_cmp_ge_i32 s0, s6
538 ; GCN-NEXT: v_mov_b32_e32 v1, 0
539 ; GCN-NEXT: s_cselect_b32 s0, -1, 0
540 ; GCN-NEXT: v_cndmask_b32_e64 v2, 0, 1, s0
541 ; GCN-NEXT: global_store_b8 v[0:1], v2, off dlc
542 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
543 ; GCN-NEXT: s_setpc_b64 s[30:31]
544 %cmp1 = icmp sge i32 %arg1, %arg3
545 %cmp2 = icmp sge i32 %arg2, %arg3
546 %or = or i1 %cmp1, %cmp2
547 store volatile i1 %or, ptr addrspace(1) null
551 define amdgpu_gfx void @test38(i32 inreg %arg1, i32 inreg %arg2) {
554 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
555 ; GCN-NEXT: s_max_u32 s0, s4, s5
556 ; GCN-NEXT: v_mov_b32_e32 v0, 0
557 ; GCN-NEXT: s_cmpk_lt_u32 s0, 0x3e9
558 ; GCN-NEXT: v_mov_b32_e32 v1, 0
559 ; GCN-NEXT: s_cselect_b32 s0, -1, 0
560 ; GCN-NEXT: v_cndmask_b32_e64 v2, 0, 1, s0
561 ; GCN-NEXT: global_store_b8 v[0:1], v2, off dlc
562 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
563 ; GCN-NEXT: s_setpc_b64 s[30:31]
564 %cmp1 = icmp ule i32 %arg1, 1000
565 %cmp2 = icmp ule i32 %arg2, 1000
566 %and = and i1 %cmp1, %cmp2
567 store volatile i1 %and, ptr addrspace(1) null
571 define amdgpu_gfx void @test39(i32 inreg %arg1, i32 inreg %arg2) {
574 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
575 ; GCN-NEXT: s_min_i32 s0, s4, s5
576 ; GCN-NEXT: v_mov_b32_e32 v0, 0
577 ; GCN-NEXT: s_cmpk_gt_i32 s0, 0x3e7
578 ; GCN-NEXT: v_mov_b32_e32 v1, 0
579 ; GCN-NEXT: s_cselect_b32 s0, -1, 0
580 ; GCN-NEXT: v_cndmask_b32_e64 v2, 0, 1, s0
581 ; GCN-NEXT: global_store_b8 v[0:1], v2, off dlc
582 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
583 ; GCN-NEXT: s_setpc_b64 s[30:31]
584 %cmp1 = icmp sge i32 %arg1, 1000
585 %cmp2 = icmp sge i32 %arg2, 1000
586 %and = and i1 %cmp1, %cmp2
587 store volatile i1 %and, ptr addrspace(1) null
591 define amdgpu_gfx void @test40(i32 inreg %arg1, i32 inreg %arg2, i32 inreg %arg3) {
594 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
595 ; GCN-NEXT: s_max_i32 s0, s4, s5
596 ; GCN-NEXT: v_mov_b32_e32 v0, 0
597 ; GCN-NEXT: s_cmp_le_i32 s0, s6
598 ; GCN-NEXT: v_mov_b32_e32 v1, 0
599 ; GCN-NEXT: s_cselect_b32 s0, -1, 0
600 ; GCN-NEXT: v_cndmask_b32_e64 v2, 0, 1, s0
601 ; GCN-NEXT: global_store_b8 v[0:1], v2, off dlc
602 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
603 ; GCN-NEXT: s_setpc_b64 s[30:31]
604 %cmp1 = icmp sle i32 %arg1, %arg3
605 %cmp2 = icmp sle i32 %arg2, %arg3
606 %and = and i1 %cmp1, %cmp2
607 store volatile i1 %and, ptr addrspace(1) null
611 define amdgpu_gfx void @test41(i32 inreg %arg1, i32 inreg %arg2, i32 inreg %arg3) {
614 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
615 ; GCN-NEXT: s_min_u32 s0, s4, s5
616 ; GCN-NEXT: v_mov_b32_e32 v0, 0
617 ; GCN-NEXT: s_cmp_ge_u32 s0, s6
618 ; GCN-NEXT: v_mov_b32_e32 v1, 0
619 ; GCN-NEXT: s_cselect_b32 s0, -1, 0
620 ; GCN-NEXT: v_cndmask_b32_e64 v2, 0, 1, s0
621 ; GCN-NEXT: global_store_b8 v[0:1], v2, off dlc
622 ; GCN-NEXT: s_waitcnt_vscnt null, 0x0
623 ; GCN-NEXT: s_setpc_b64 s[30:31]
624 %cmp1 = icmp uge i32 %arg1, %arg3
625 %cmp2 = icmp uge i32 %arg2, %arg3
626 %and = and i1 %cmp1, %cmp2
627 store volatile i1 %and, ptr addrspace(1) null
631 define i1 @test42(i32 %arg1, i32 %arg2, i32 %arg3) {
634 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
635 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
636 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, v0, v2
637 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
638 ; GCN-NEXT: s_setpc_b64 s[30:31]
639 %cmp1 = icmp ult i32 %arg3, %arg1
640 %cmp2 = icmp ult i32 %arg3, %arg2
641 %or = and i1 %cmp1, %cmp2
645 define i1 @test43(i32 %arg1, i32 %arg2, i32 %arg3) {
648 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
649 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
650 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, v0, v2
651 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
652 ; GCN-NEXT: s_setpc_b64 s[30:31]
653 %cmp1 = icmp ult i32 %arg3, %arg1
654 %cmp2 = icmp ult i32 %arg3, %arg2
655 %or = or i1 %cmp1, %cmp2
659 define i1 @test44(i32 %arg1, i32 %arg2, i32 %arg3) {
662 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
663 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
664 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v2
665 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
666 ; GCN-NEXT: s_setpc_b64 s[30:31]
667 %cmp1 = icmp ugt i32 %arg3, %arg1
668 %cmp2 = icmp ugt i32 %arg3, %arg2
669 %or = and i1 %cmp1, %cmp2
673 define i1 @test45(i32 %arg1, i32 %arg2, i32 %arg3) {
676 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
677 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
678 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v2
679 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
680 ; GCN-NEXT: s_setpc_b64 s[30:31]
681 %cmp1 = icmp ugt i32 %arg3, %arg1
682 %cmp2 = icmp ugt i32 %arg3, %arg2
683 %or = or i1 %cmp1, %cmp2
687 define i1 @test46(i32 %arg1, i32 %arg2, i32 %arg3) {
690 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
691 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
692 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, v0, v2
693 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
694 ; GCN-NEXT: s_setpc_b64 s[30:31]
695 %cmp1 = icmp slt i32 %arg3, %arg1
696 %cmp2 = icmp sgt i32 %arg2, %arg3
697 %or = or i1 %cmp1, %cmp2
701 define i1 @test47(i32 %arg1, i32 %arg2, i32 %arg3) {
704 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
705 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
706 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, v0, v2
707 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
708 ; GCN-NEXT: s_setpc_b64 s[30:31]
709 %cmp1 = icmp sgt i32 %arg1, %arg3
710 %cmp2 = icmp slt i32 %arg3, %arg2
711 %or = or i1 %cmp1, %cmp2
715 define i1 @test48(i32 %arg1, i32 %arg2, i32 %arg3) {
718 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
719 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
720 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, v0, v2
721 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
722 ; GCN-NEXT: s_setpc_b64 s[30:31]
723 %cmp1 = icmp slt i32 %arg1, %arg3
724 %cmp2 = icmp sgt i32 %arg3, %arg2
725 %or = or i1 %cmp1, %cmp2
729 define i1 @test49(i32 %arg1, i32 %arg2, i32 %arg3) {
732 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
733 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
734 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, v0, v2
735 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
736 ; GCN-NEXT: s_setpc_b64 s[30:31]
737 %cmp1 = icmp sgt i32 %arg3, %arg1
738 %cmp2 = icmp slt i32 %arg2, %arg3
739 %or = or i1 %cmp1, %cmp2
743 define i1 @test50(i32 %arg1, i32 %arg2, i32 %arg3) {
746 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
747 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
748 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, v0, v2
749 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
750 ; GCN-NEXT: s_setpc_b64 s[30:31]
751 %cmp1 = icmp slt i32 %arg3, %arg1
752 %cmp2 = icmp sgt i32 %arg2, %arg3
753 %and = and i1 %cmp1, %cmp2
757 define i1 @test51(i32 %arg1, i32 %arg2, i32 %arg3) {
760 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
761 ; GCN-NEXT: v_min_i32_e32 v0, v0, v1
762 ; GCN-NEXT: v_cmp_gt_i32_e32 vcc_lo, v0, v2
763 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
764 ; GCN-NEXT: s_setpc_b64 s[30:31]
765 %cmp1 = icmp sgt i32 %arg1, %arg3
766 %cmp2 = icmp slt i32 %arg3, %arg2
767 %and = and i1 %cmp1, %cmp2
771 define i1 @test52(i32 %arg1, i32 %arg2, i32 %arg3) {
774 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
775 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
776 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, v0, v2
777 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
778 ; GCN-NEXT: s_setpc_b64 s[30:31]
779 %cmp1 = icmp slt i32 %arg1, %arg3
780 %cmp2 = icmp sgt i32 %arg3, %arg2
781 %and = and i1 %cmp1, %cmp2
785 define i1 @test53(i32 %arg1, i32 %arg2, i32 %arg3) {
788 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
789 ; GCN-NEXT: v_max_i32_e32 v0, v0, v1
790 ; GCN-NEXT: v_cmp_lt_i32_e32 vcc_lo, v0, v2
791 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
792 ; GCN-NEXT: s_setpc_b64 s[30:31]
793 %cmp1 = icmp sgt i32 %arg3, %arg1
794 %cmp2 = icmp slt i32 %arg2, %arg3
795 %and = and i1 %cmp1, %cmp2
799 define i1 @test54(float %arg1, float %arg2, float %arg3) #0 {
802 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
803 ; GCN-NEXT: v_min_f32_e32 v0, v0, v1
804 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
805 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
806 ; GCN-NEXT: s_setpc_b64 s[30:31]
807 %cmp1 = fcmp olt float %arg1, %arg3
808 %cmp2 = fcmp olt float %arg2, %arg3
809 %or1 = or i1 %cmp1, %cmp2
813 define i1 @test55(double %arg1, double %arg2, double %arg3) #0 {
816 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
817 ; GCN-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
818 ; GCN-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
819 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
820 ; GCN-NEXT: s_setpc_b64 s[30:31]
821 %cmp1 = fcmp ole double %arg1, %arg3
822 %cmp2 = fcmp ole double %arg2, %arg3
823 %or1 = or i1 %cmp1, %cmp2
827 define i1 @test56(double %arg1, double %arg2, double %arg3) #0 {
830 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
831 ; GCN-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
832 ; GCN-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
833 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
834 ; GCN-NEXT: s_setpc_b64 s[30:31]
835 %cmp1 = fcmp ogt double %arg1, %arg3
836 %cmp2 = fcmp ogt double %arg2, %arg3
837 %or1 = or i1 %cmp1, %cmp2
841 define i1 @test57(float %arg1, float %arg2, float %arg3) #0 {
844 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
845 ; GCN-NEXT: v_max_f32_e32 v0, v0, v1
846 ; GCN-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
847 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
848 ; GCN-NEXT: s_setpc_b64 s[30:31]
849 %cmp1 = fcmp oge float %arg1, %arg3
850 %cmp2 = fcmp oge float %arg2, %arg3
851 %or1 = or i1 %cmp1, %cmp2
855 define i1 @test58(double %arg1, double %arg2, double %arg3) #0 {
856 ; GFX11-LABEL: test58:
858 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
859 ; GFX11-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
860 ; GFX11-NEXT: v_cmp_nle_f64_e32 vcc_lo, v[0:1], v[4:5]
861 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
862 ; GFX11-NEXT: s_setpc_b64 s[30:31]
864 ; GFX11NONANS-LABEL: test58:
865 ; GFX11NONANS: ; %bb.0:
866 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
867 ; GFX11NONANS-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
868 ; GFX11NONANS-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
869 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
870 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
871 %cmp1 = fcmp ugt double %arg1, %arg3
872 %cmp2 = fcmp ugt double %arg2, %arg3
873 %and1 = and i1 %cmp1, %cmp2
877 define i1 @test59(float %arg1, float %arg2, float %arg3) #0 {
878 ; GFX11-LABEL: test59:
880 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
881 ; GFX11-NEXT: v_min_f32_e32 v0, v0, v1
882 ; GFX11-NEXT: v_cmp_nlt_f32_e32 vcc_lo, v0, v2
883 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
884 ; GFX11-NEXT: s_setpc_b64 s[30:31]
886 ; GFX11NONANS-LABEL: test59:
887 ; GFX11NONANS: ; %bb.0:
888 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
889 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
890 ; GFX11NONANS-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
891 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
892 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
893 %cmp1 = fcmp uge float %arg1, %arg3
894 %cmp2 = fcmp uge float %arg2, %arg3
895 %and1 = and i1 %cmp1, %cmp2
899 define i1 @test60(float %arg1, float %arg2, float %arg3) #0 {
900 ; GFX11-LABEL: test60:
902 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
903 ; GFX11-NEXT: v_max_f32_e32 v0, v0, v1
904 ; GFX11-NEXT: v_cmp_ngt_f32_e32 vcc_lo, v0, v2
905 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
906 ; GFX11-NEXT: s_setpc_b64 s[30:31]
908 ; GFX11NONANS-LABEL: test60:
909 ; GFX11NONANS: ; %bb.0:
910 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
911 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
912 ; GFX11NONANS-NEXT: v_cmp_le_f32_e32 vcc_lo, v0, v2
913 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
914 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
915 %cmp1 = fcmp ule float %arg1, %arg3
916 %cmp2 = fcmp ule float %arg2, %arg3
917 %and1 = and i1 %cmp1, %cmp2
921 define i1 @test61(double %arg1, double %arg2, double %arg3) #0 {
922 ; GFX11-LABEL: test61:
924 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
925 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
926 ; GFX11-NEXT: v_cmp_nge_f64_e32 vcc_lo, v[0:1], v[4:5]
927 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
928 ; GFX11-NEXT: s_setpc_b64 s[30:31]
930 ; GFX11NONANS-LABEL: test61:
931 ; GFX11NONANS: ; %bb.0:
932 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
933 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
934 ; GFX11NONANS-NEXT: v_cmp_lt_f64_e32 vcc_lo, v[0:1], v[4:5]
935 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
936 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
937 %cmp1 = fcmp ult double %arg1, %arg3
938 %cmp2 = fcmp ult double %arg2, %arg3
939 %and1 = and i1 %cmp1, %cmp2
943 define i1 @test62(float %arg1, float %arg2, float %arg3) {
946 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
947 ; GCN-NEXT: v_dual_add_f32 v0, 1.0, v0 :: v_dual_add_f32 v1, 2.0, v1
948 ; GCN-NEXT: v_min_f32_e32 v0, v0, v1
949 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
950 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
951 ; GCN-NEXT: s_setpc_b64 s[30:31]
952 %add1 = fadd nnan float %arg1, 1.0
953 %add2 = fadd nnan float %arg2, 2.0
954 %cmp1 = fcmp nnan olt float %add1, %arg3
955 %cmp2 = fcmp nnan olt float %add2, %arg3
956 %or1 = or i1 %cmp1, %cmp2
960 define i1 @test63(double %arg1, double %arg2, double %arg3) #0 {
963 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
964 ; GCN-NEXT: v_add_f64 v[0:1], v[0:1], 1.0
965 ; GCN-NEXT: v_add_f64 v[2:3], v[2:3], 2.0
966 ; GCN-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
967 ; GCN-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
968 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
969 ; GCN-NEXT: s_setpc_b64 s[30:31]
970 %add1 = fadd nnan double %arg1, 1.0
971 %add2 = fadd nnan double %arg2, 2.0
972 %cmp1 = fcmp nnan ole double %add1, %arg3
973 %cmp2 = fcmp nnan ole double %add2, %arg3
974 %or1 = or i1 %cmp1, %cmp2
978 define i1 @test64(double %arg1, double %arg2, double %arg3) #0 {
981 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
982 ; GCN-NEXT: v_add_f64 v[0:1], v[0:1], 1.0
983 ; GCN-NEXT: v_add_f64 v[2:3], v[2:3], 2.0
984 ; GCN-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
985 ; GCN-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
986 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
987 ; GCN-NEXT: s_setpc_b64 s[30:31]
988 %add1 = fadd nnan double %arg1, 1.0
989 %add2 = fadd nnan double %arg2, 2.0
990 %cmp1 = fcmp nnan ogt double %add1, %arg3
991 %cmp2 = fcmp nnan ogt double %add2, %arg3
992 %or1 = or i1 %cmp1, %cmp2
996 define i1 @test65(float %arg1, float %arg2, float %arg3) {
999 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1000 ; GCN-NEXT: v_dual_add_f32 v0, 1.0, v0 :: v_dual_add_f32 v1, 2.0, v1
1001 ; GCN-NEXT: v_max_f32_e32 v0, v0, v1
1002 ; GCN-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
1003 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1004 ; GCN-NEXT: s_setpc_b64 s[30:31]
1005 %add1 = fadd nnan float %arg1, 1.0
1006 %add2 = fadd nnan float %arg2, 2.0
1007 %cmp1 = fcmp nnan oge float %add1, %arg3
1008 %cmp2 = fcmp nnan oge float %add2, %arg3
1009 %or1 = or i1 %cmp1, %cmp2
1013 define i1 @test66(double %arg1, double %arg2, double %arg3) {
1014 ; GCN-LABEL: test66:
1016 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1017 ; GCN-NEXT: v_add_f64 v[0:1], v[0:1], 1.0
1018 ; GCN-NEXT: v_add_f64 v[2:3], v[2:3], 2.0
1019 ; GCN-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
1020 ; GCN-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
1021 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1022 ; GCN-NEXT: s_setpc_b64 s[30:31]
1023 %add1 = fadd nnan double %arg1, 1.0
1024 %add2 = fadd nnan double %arg2, 2.0
1025 %cmp1 = fcmp nnan ugt double %add1, %arg3
1026 %cmp2 = fcmp nnan ugt double %add2, %arg3
1027 %and1 = and i1 %cmp1, %cmp2
1031 define i1 @test67(float %arg1, float %arg2, float %arg3) #0 {
1032 ; GCN-LABEL: test67:
1034 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1035 ; GCN-NEXT: v_dual_add_f32 v0, 1.0, v0 :: v_dual_add_f32 v1, 2.0, v1
1036 ; GCN-NEXT: v_min_f32_e32 v0, v0, v1
1037 ; GCN-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
1038 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1039 ; GCN-NEXT: s_setpc_b64 s[30:31]
1040 %add1 = fadd nnan float %arg1, 1.0
1041 %add2 = fadd nnan float %arg2, 2.0
1042 %cmp1 = fcmp nnan uge float %add1, %arg3
1043 %cmp2 = fcmp nnan uge float %add2, %arg3
1044 %and1 = and i1 %cmp1, %cmp2
1048 define i1 @test68(float %arg1, float %arg2, float %arg3) #0 {
1049 ; GCN-LABEL: test68:
1051 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1052 ; GCN-NEXT: v_dual_add_f32 v0, 1.0, v0 :: v_dual_add_f32 v1, 2.0, v1
1053 ; GCN-NEXT: v_max_f32_e32 v0, v0, v1
1054 ; GCN-NEXT: v_cmp_le_f32_e32 vcc_lo, v0, v2
1055 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1056 ; GCN-NEXT: s_setpc_b64 s[30:31]
1057 %add1 = fadd nnan float %arg1, 1.0
1058 %add2 = fadd nnan float %arg2, 2.0
1059 %cmp1 = fcmp nnan ule float %add1, %arg3
1060 %cmp2 = fcmp nnan ule float %add2, %arg3
1061 %and1 = and i1 %cmp1, %cmp2
1065 define i1 @test69(double %arg1, double %arg2, double %arg3) {
1066 ; GCN-LABEL: test69:
1068 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1069 ; GCN-NEXT: v_add_f64 v[0:1], v[0:1], 1.0
1070 ; GCN-NEXT: v_add_f64 v[2:3], v[2:3], 2.0
1071 ; GCN-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
1072 ; GCN-NEXT: v_cmp_lt_f64_e32 vcc_lo, v[0:1], v[4:5]
1073 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1074 ; GCN-NEXT: s_setpc_b64 s[30:31]
1075 %add1 = fadd nnan double %arg1, 1.0
1076 %add2 = fadd nnan double %arg2, 2.0
1077 %cmp1 = fcmp nnan ult double %add1, %arg3
1078 %cmp2 = fcmp nnan ult double %add2, %arg3
1079 %and1 = and i1 %cmp1, %cmp2
1083 define i1 @test70(float %arg1, float %arg2, float %arg3) {
1084 ; GFX11-LABEL: test70:
1086 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1087 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
1088 ; GFX11-NEXT: v_min_f32_e32 v0, v0, v1
1089 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
1090 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1091 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1093 ; GFX11NONANS-LABEL: test70:
1094 ; GFX11NONANS: ; %bb.0:
1095 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1096 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
1097 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
1098 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1099 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1100 %var1 = call float @llvm.canonicalize.f32(float %arg1)
1101 %var2 = call float @llvm.canonicalize.f32(float %arg2)
1102 %cmp1 = fcmp olt float %var1, %arg3
1103 %cmp2 = fcmp olt float %var2, %arg3
1104 %or1 = or i1 %cmp1, %cmp2
1108 define i1 @test71(double %arg1, double %arg2, double %arg3) {
1109 ; GCN-LABEL: test71:
1111 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1112 ; GCN-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
1113 ; GCN-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
1114 ; GCN-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
1115 ; GCN-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
1116 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1117 ; GCN-NEXT: s_setpc_b64 s[30:31]
1118 %var1 = call double @llvm.canonicalize.f64(double %arg1)
1119 %var2 = call double @llvm.canonicalize.f64(double %arg2)
1120 %cmp1 = fcmp ole double %var1, %arg3
1121 %cmp2 = fcmp ole double %var2, %arg3
1122 %or1 = or i1 %cmp1, %cmp2
1126 define i1 @test72(double %arg1, double %arg2, double %arg3) {
1127 ; GCN-LABEL: test72:
1129 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1130 ; GCN-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
1131 ; GCN-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
1132 ; GCN-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
1133 ; GCN-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
1134 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1135 ; GCN-NEXT: s_setpc_b64 s[30:31]
1136 %var1 = call double @llvm.canonicalize.f64(double %arg1)
1137 %var2 = call double @llvm.canonicalize.f64(double %arg2)
1138 %cmp1 = fcmp ogt double %var1, %arg3
1139 %cmp2 = fcmp ogt double %var2, %arg3
1140 %or1 = or i1 %cmp1, %cmp2
1144 define i1 @test73(float %arg1, float %arg2, float %arg3) {
1145 ; GFX11-LABEL: test73:
1147 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1148 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
1149 ; GFX11-NEXT: v_max_f32_e32 v0, v0, v1
1150 ; GFX11-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
1151 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1152 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1154 ; GFX11NONANS-LABEL: test73:
1155 ; GFX11NONANS: ; %bb.0:
1156 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1157 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
1158 ; GFX11NONANS-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
1159 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1160 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1161 %var1 = call float @llvm.canonicalize.f32(float %arg1)
1162 %var2 = call float @llvm.canonicalize.f32(float %arg2)
1163 %cmp1 = fcmp oge float %var1, %arg3
1164 %cmp2 = fcmp oge float %var2, %arg3
1165 %or1 = or i1 %cmp1, %cmp2
1169 define i1 @test74(double %arg1, double %arg2, double %arg3) {
1170 ; GFX11-LABEL: test74:
1172 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1173 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
1174 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
1175 ; GFX11-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
1176 ; GFX11-NEXT: v_cmp_nle_f64_e32 vcc_lo, v[0:1], v[4:5]
1177 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1178 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1180 ; GFX11NONANS-LABEL: test74:
1181 ; GFX11NONANS: ; %bb.0:
1182 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1183 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
1184 ; GFX11NONANS-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
1185 ; GFX11NONANS-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
1186 ; GFX11NONANS-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
1187 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1188 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1189 %var1 = call double @llvm.canonicalize.f64(double %arg1)
1190 %var2 = call double @llvm.canonicalize.f64(double %arg2)
1191 %cmp1 = fcmp ugt double %var1, %arg3
1192 %cmp2 = fcmp ugt double %var2, %arg3
1193 %and1 = and i1 %cmp1, %cmp2
1197 define i1 @test75(float %arg1, float %arg2, float %arg3) {
1198 ; GFX11-LABEL: test75:
1200 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1201 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
1202 ; GFX11-NEXT: v_min_f32_e32 v0, v0, v1
1203 ; GFX11-NEXT: v_cmp_nlt_f32_e32 vcc_lo, v0, v2
1204 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1205 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1207 ; GFX11NONANS-LABEL: test75:
1208 ; GFX11NONANS: ; %bb.0:
1209 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1210 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
1211 ; GFX11NONANS-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
1212 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1213 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1214 %var1 = call float @llvm.canonicalize.f32(float %arg1)
1215 %var2 = call float @llvm.canonicalize.f32(float %arg2)
1216 %cmp1 = fcmp uge float %var1, %arg3
1217 %cmp2 = fcmp uge float %var2, %arg3
1218 %and1 = and i1 %cmp1, %cmp2
1222 define i1 @test76(float %arg1, float %arg2, float %arg3) {
1223 ; GFX11-LABEL: test76:
1225 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1226 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
1227 ; GFX11-NEXT: v_max_f32_e32 v0, v0, v1
1228 ; GFX11-NEXT: v_cmp_ngt_f32_e32 vcc_lo, v0, v2
1229 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1230 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1232 ; GFX11NONANS-LABEL: test76:
1233 ; GFX11NONANS: ; %bb.0:
1234 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1235 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
1236 ; GFX11NONANS-NEXT: v_cmp_le_f32_e32 vcc_lo, v0, v2
1237 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1238 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1239 %var1 = call float @llvm.canonicalize.f32(float %arg1)
1240 %var2 = call float @llvm.canonicalize.f32(float %arg2)
1241 %cmp1 = fcmp ule float %var1, %arg3
1242 %cmp2 = fcmp ule float %var2, %arg3
1243 %and1 = and i1 %cmp1, %cmp2
1247 define i1 @test77(double %arg1, double %arg2, double %arg3) {
1248 ; GFX11-LABEL: test77:
1250 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1251 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
1252 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
1253 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
1254 ; GFX11-NEXT: v_cmp_nge_f64_e32 vcc_lo, v[0:1], v[4:5]
1255 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1256 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1258 ; GFX11NONANS-LABEL: test77:
1259 ; GFX11NONANS: ; %bb.0:
1260 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1261 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
1262 ; GFX11NONANS-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
1263 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
1264 ; GFX11NONANS-NEXT: v_cmp_lt_f64_e32 vcc_lo, v[0:1], v[4:5]
1265 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1266 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1267 %var1 = call double @llvm.canonicalize.f64(double %arg1)
1268 %var2 = call double @llvm.canonicalize.f64(double %arg2)
1269 %cmp1 = fcmp ult double %var1, %arg3
1270 %cmp2 = fcmp ult double %var2, %arg3
1271 %and1 = and i1 %cmp1, %cmp2
1275 define i1 @test78(float %arg1, float %arg2, float %arg3) #0 {
1276 ; GCN-LABEL: test78:
1278 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1279 ; GCN-NEXT: v_min_f32_e32 v0, v0, v1
1280 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
1281 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1282 ; GCN-NEXT: s_setpc_b64 s[30:31]
1283 %cmp1 = fcmp olt float %arg1, %arg3
1284 %cmp2 = fcmp ogt float %arg3, %arg2
1285 %or1 = or i1 %cmp1, %cmp2
1289 define i1 @test79(float %arg1, float %arg2, float %arg3) #0 {
1290 ; GFX11-LABEL: test79:
1292 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1293 ; GFX11-NEXT: v_max_f32_e32 v0, v0, v1
1294 ; GFX11-NEXT: v_cmp_nge_f32_e32 vcc_lo, v0, v2
1295 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1296 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1298 ; GFX11NONANS-LABEL: test79:
1299 ; GFX11NONANS: ; %bb.0:
1300 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1301 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
1302 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
1303 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1304 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1305 %cmp1 = fcmp ult float %arg1, %arg3
1306 %cmp2 = fcmp ugt float %arg3, %arg2
1307 %and1 = and i1 %cmp1, %cmp2
1311 define i1 @test80(float %arg1, float %arg2, float %arg3) {
1312 ; GCN-LABEL: test80:
1314 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1315 ; GCN-NEXT: v_dual_add_f32 v0, 1.0, v0 :: v_dual_add_f32 v1, 2.0, v1
1316 ; GCN-NEXT: v_max_f32_e32 v0, v0, v1
1317 ; GCN-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
1318 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1319 ; GCN-NEXT: s_setpc_b64 s[30:31]
1320 %add1 = fadd nnan float %arg1, 1.0
1321 %add2 = fadd nnan float %arg2, 2.0
1322 %cmp1 = fcmp nnan oge float %add1, %arg3
1323 %cmp2 = fcmp nnan ole float %arg3, %add2
1324 %or1 = or i1 %cmp1, %cmp2
1328 define i1 @test81(double %arg1, double %arg2, double %arg3) {
1329 ; GCN-LABEL: test81:
1331 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1332 ; GCN-NEXT: v_add_f64 v[0:1], v[0:1], 1.0
1333 ; GCN-NEXT: v_add_f64 v[2:3], v[2:3], 2.0
1334 ; GCN-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
1335 ; GCN-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
1336 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1337 ; GCN-NEXT: s_setpc_b64 s[30:31]
1338 %add1 = fadd nnan double %arg1, 1.0
1339 %add2 = fadd nnan double %arg2, 2.0
1340 %cmp1 = fcmp nnan ugt double %add1, %arg3
1341 %cmp2 = fcmp nnan ult double %arg3, %add2
1342 %and1 = and i1 %cmp1, %cmp2
1346 define i1 @test82(double %arg1, double %arg2, double %arg3) {
1347 ; GCN-LABEL: test82:
1349 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1350 ; GCN-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
1351 ; GCN-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
1352 ; GCN-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
1353 ; GCN-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
1354 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1355 ; GCN-NEXT: s_setpc_b64 s[30:31]
1356 %var1 = call double @llvm.canonicalize.f64(double %arg1)
1357 %var2 = call double @llvm.canonicalize.f64(double %arg2)
1358 %cmp1 = fcmp ole double %var1, %arg3
1359 %cmp2 = fcmp oge double %arg3, %var2
1360 %or1 = or i1 %cmp1, %cmp2
1364 define i1 @test83(float %arg1, float %arg2, float %arg3) {
1365 ; GFX11-LABEL: test83:
1367 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1368 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
1369 ; GFX11-NEXT: v_max_f32_e32 v0, v0, v1
1370 ; GFX11-NEXT: v_cmp_ngt_f32_e32 vcc_lo, v0, v2
1371 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1372 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1374 ; GFX11NONANS-LABEL: test83:
1375 ; GFX11NONANS: ; %bb.0:
1376 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1377 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
1378 ; GFX11NONANS-NEXT: v_cmp_le_f32_e32 vcc_lo, v0, v2
1379 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1380 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1381 %var1 = call float @llvm.canonicalize.f32(float %arg1)
1382 %var2 = call float @llvm.canonicalize.f32(float %arg2)
1383 %cmp1 = fcmp ule float %var1, %arg3
1384 %cmp2 = fcmp uge float %arg3, %var2
1385 %and1 = and i1 %cmp1, %cmp2
1389 define i1 @test84(half %arg1, half %arg2, half %arg3) {
1390 ; GFX11-LABEL: test84:
1392 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1393 ; GFX11-NEXT: v_max_f16_e32 v0, v0, v0
1394 ; GFX11-NEXT: v_max_f16_e32 v1, v1, v1
1395 ; GFX11-NEXT: v_min_f16_e32 v0, v0, v1
1396 ; GFX11-NEXT: v_cmp_lt_f16_e32 vcc_lo, v0, v2
1397 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1398 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1400 ; GFX11NONANS-LABEL: test84:
1401 ; GFX11NONANS: ; %bb.0:
1402 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1403 ; GFX11NONANS-NEXT: v_min_f16_e32 v0, v0, v1
1404 ; GFX11NONANS-NEXT: v_cmp_lt_f16_e32 vcc_lo, v0, v2
1405 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1406 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1407 %var1 = call half @llvm.canonicalize.f16(half %arg1)
1408 %var2 = call half @llvm.canonicalize.f16(half %arg2)
1409 %cmp1 = fcmp olt half %var1, %arg3
1410 %cmp2 = fcmp olt half %var2, %arg3
1411 %or1 = or i1 %cmp1, %cmp2
1415 define <2 x i1> @test85(<2 x half> %arg1, <2 x half> %arg2, <2 x half> %arg3) {
1416 ; GFX11-LABEL: test85:
1418 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1419 ; GFX11-NEXT: v_pk_max_f16 v0, v0, v0
1420 ; GFX11-NEXT: v_pk_max_f16 v1, v1, v1
1421 ; GFX11-NEXT: v_pk_min_f16 v0, v0, v1
1422 ; GFX11-NEXT: v_lshrrev_b32_e32 v1, 16, v2
1423 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1424 ; GFX11-NEXT: v_cmp_le_f16_e32 vcc_lo, v0, v2
1425 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1426 ; GFX11-NEXT: v_cmp_le_f16_e32 vcc_lo, v3, v1
1427 ; GFX11-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
1428 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1430 ; GFX11NONANS-LABEL: test85:
1431 ; GFX11NONANS: ; %bb.0:
1432 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1433 ; GFX11NONANS-NEXT: v_pk_min_f16 v0, v0, v1
1434 ; GFX11NONANS-NEXT: v_lshrrev_b32_e32 v1, 16, v2
1435 ; GFX11NONANS-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1436 ; GFX11NONANS-NEXT: v_cmp_le_f16_e32 vcc_lo, v0, v2
1437 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1438 ; GFX11NONANS-NEXT: v_cmp_le_f16_e32 vcc_lo, v3, v1
1439 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
1440 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1441 %var1 = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %arg1)
1442 %var2 = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %arg2)
1443 %cmp1 = fcmp ole <2 x half> %var1, %arg3
1444 %cmp2 = fcmp ole <2 x half> %var2, %arg3
1445 %or1 = or <2 x i1> %cmp1, %cmp2
1449 define <2 x i1> @test86(<2 x half> %arg1, <2 x half> %arg2, <2 x half> %arg3) {
1450 ; GFX11-LABEL: test86:
1452 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1453 ; GFX11-NEXT: v_pk_max_f16 v0, v0, v0
1454 ; GFX11-NEXT: v_pk_max_f16 v1, v1, v1
1455 ; GFX11-NEXT: v_pk_max_f16 v0, v0, v1
1456 ; GFX11-NEXT: v_lshrrev_b32_e32 v1, 16, v2
1457 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1458 ; GFX11-NEXT: v_cmp_gt_f16_e32 vcc_lo, v0, v2
1459 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1460 ; GFX11-NEXT: v_cmp_gt_f16_e32 vcc_lo, v3, v1
1461 ; GFX11-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
1462 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1464 ; GFX11NONANS-LABEL: test86:
1465 ; GFX11NONANS: ; %bb.0:
1466 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1467 ; GFX11NONANS-NEXT: v_pk_max_f16 v0, v0, v1
1468 ; GFX11NONANS-NEXT: v_lshrrev_b32_e32 v1, 16, v2
1469 ; GFX11NONANS-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1470 ; GFX11NONANS-NEXT: v_cmp_gt_f16_e32 vcc_lo, v0, v2
1471 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1472 ; GFX11NONANS-NEXT: v_cmp_gt_f16_e32 vcc_lo, v3, v1
1473 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
1474 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1475 %var1 = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %arg1)
1476 %var2 = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %arg2)
1477 %cmp1 = fcmp ogt <2 x half> %var1, %arg3
1478 %cmp2 = fcmp ogt <2 x half> %var2, %arg3
1479 %or1 = or <2 x i1> %cmp1, %cmp2
1483 define i1 @test87(half %arg1, half %arg2, half %arg3) {
1484 ; GFX11-LABEL: test87:
1486 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1487 ; GFX11-NEXT: v_max_f16_e32 v0, v0, v0
1488 ; GFX11-NEXT: v_max_f16_e32 v1, v1, v1
1489 ; GFX11-NEXT: v_max_f16_e32 v0, v0, v1
1490 ; GFX11-NEXT: v_cmp_ge_f16_e32 vcc_lo, v0, v2
1491 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1492 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1494 ; GFX11NONANS-LABEL: test87:
1495 ; GFX11NONANS: ; %bb.0:
1496 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1497 ; GFX11NONANS-NEXT: v_max_f16_e32 v0, v0, v1
1498 ; GFX11NONANS-NEXT: v_cmp_ge_f16_e32 vcc_lo, v0, v2
1499 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1500 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1501 %var1 = call half @llvm.canonicalize.f16(half %arg1)
1502 %var2 = call half @llvm.canonicalize.f16(half %arg2)
1503 %cmp1 = fcmp oge half %var1, %arg3
1504 %cmp2 = fcmp oge half %var2, %arg3
1505 %or1 = or i1 %cmp1, %cmp2
1509 define <2 x i1> @test88(<2 x half> %arg1, <2 x half> %arg2, <2 x half> %arg3) {
1510 ; GFX11-LABEL: test88:
1512 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1513 ; GFX11-NEXT: v_pk_max_f16 v0, v0, v0
1514 ; GFX11-NEXT: v_pk_max_f16 v1, v1, v1
1515 ; GFX11-NEXT: v_pk_min_f16 v0, v0, v1
1516 ; GFX11-NEXT: v_lshrrev_b32_e32 v1, 16, v2
1517 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1518 ; GFX11-NEXT: v_cmp_nle_f16_e32 vcc_lo, v0, v2
1519 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1520 ; GFX11-NEXT: v_cmp_nle_f16_e32 vcc_lo, v3, v1
1521 ; GFX11-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
1522 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1524 ; GFX11NONANS-LABEL: test88:
1525 ; GFX11NONANS: ; %bb.0:
1526 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1527 ; GFX11NONANS-NEXT: v_pk_min_f16 v0, v0, v1
1528 ; GFX11NONANS-NEXT: v_lshrrev_b32_e32 v1, 16, v2
1529 ; GFX11NONANS-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1530 ; GFX11NONANS-NEXT: v_cmp_gt_f16_e32 vcc_lo, v0, v2
1531 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1532 ; GFX11NONANS-NEXT: v_cmp_gt_f16_e32 vcc_lo, v3, v1
1533 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
1534 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1535 %var1 = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %arg1)
1536 %var2 = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %arg2)
1537 %cmp1 = fcmp ugt <2 x half> %var1, %arg3
1538 %cmp2 = fcmp ugt <2 x half> %var2, %arg3
1539 %and1 = and <2 x i1> %cmp1, %cmp2
1543 define i1 @test89(half %arg1, half %arg2, half %arg3) {
1544 ; GFX11-LABEL: test89:
1546 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1547 ; GFX11-NEXT: v_max_f16_e32 v0, v0, v0
1548 ; GFX11-NEXT: v_max_f16_e32 v1, v1, v1
1549 ; GFX11-NEXT: v_min_f16_e32 v0, v0, v1
1550 ; GFX11-NEXT: v_cmp_nlt_f16_e32 vcc_lo, v0, v2
1551 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1552 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1554 ; GFX11NONANS-LABEL: test89:
1555 ; GFX11NONANS: ; %bb.0:
1556 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1557 ; GFX11NONANS-NEXT: v_min_f16_e32 v0, v0, v1
1558 ; GFX11NONANS-NEXT: v_cmp_ge_f16_e32 vcc_lo, v0, v2
1559 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1560 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1561 %var1 = call half @llvm.canonicalize.f16(half %arg1)
1562 %var2 = call half @llvm.canonicalize.f16(half %arg2)
1563 %cmp1 = fcmp uge half %var1, %arg3
1564 %cmp2 = fcmp uge half %var2, %arg3
1565 %and1 = and i1 %cmp1, %cmp2
1569 define i1 @test90(half %arg1, half %arg2, half %arg3) {
1570 ; GFX11-LABEL: test90:
1572 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1573 ; GFX11-NEXT: v_max_f16_e32 v0, v0, v0
1574 ; GFX11-NEXT: v_max_f16_e32 v1, v1, v1
1575 ; GFX11-NEXT: v_max_f16_e32 v0, v0, v1
1576 ; GFX11-NEXT: v_cmp_ngt_f16_e32 vcc_lo, v0, v2
1577 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1578 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1580 ; GFX11NONANS-LABEL: test90:
1581 ; GFX11NONANS: ; %bb.0:
1582 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1583 ; GFX11NONANS-NEXT: v_max_f16_e32 v0, v0, v1
1584 ; GFX11NONANS-NEXT: v_cmp_le_f16_e32 vcc_lo, v0, v2
1585 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1586 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1587 %var1 = call half @llvm.canonicalize.f16(half %arg1)
1588 %var2 = call half @llvm.canonicalize.f16(half %arg2)
1589 %cmp1 = fcmp ule half %var1, %arg3
1590 %cmp2 = fcmp ule half %var2, %arg3
1591 %and1 = and i1 %cmp1, %cmp2
1595 define <2 x i1> @test91(<2 x half> %arg1, <2 x half> %arg2, <2 x half> %arg3) {
1596 ; GFX11-LABEL: test91:
1598 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1599 ; GFX11-NEXT: v_pk_max_f16 v0, v0, v0
1600 ; GFX11-NEXT: v_pk_max_f16 v1, v1, v1
1601 ; GFX11-NEXT: v_pk_max_f16 v0, v0, v1
1602 ; GFX11-NEXT: v_lshrrev_b32_e32 v1, 16, v2
1603 ; GFX11-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1604 ; GFX11-NEXT: v_cmp_nge_f16_e32 vcc_lo, v0, v2
1605 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1606 ; GFX11-NEXT: v_cmp_nge_f16_e32 vcc_lo, v3, v1
1607 ; GFX11-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
1608 ; GFX11-NEXT: s_setpc_b64 s[30:31]
1610 ; GFX11NONANS-LABEL: test91:
1611 ; GFX11NONANS: ; %bb.0:
1612 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1613 ; GFX11NONANS-NEXT: v_pk_max_f16 v0, v0, v1
1614 ; GFX11NONANS-NEXT: v_lshrrev_b32_e32 v1, 16, v2
1615 ; GFX11NONANS-NEXT: v_lshrrev_b32_e32 v3, 16, v0
1616 ; GFX11NONANS-NEXT: v_cmp_lt_f16_e32 vcc_lo, v0, v2
1617 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1618 ; GFX11NONANS-NEXT: v_cmp_lt_f16_e32 vcc_lo, v3, v1
1619 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v1, 0, 1, vcc_lo
1620 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
1621 %var1 = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %arg1)
1622 %var2 = call <2 x half> @llvm.canonicalize.v2f16(<2 x half> %arg2)
1623 %cmp1 = fcmp ult <2 x half> %var1, %arg3
1624 %cmp2 = fcmp ult <2 x half> %var2, %arg3
1625 %and1 = and <2 x i1> %cmp1, %cmp2
1629 define i1 @test92(i32 %arg1, i32 %arg2, i32 %arg3, i32 %C) {
1630 ; GCN-LABEL: test92:
1632 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1633 ; GCN-NEXT: v_min3_u32 v0, v0, v1, v2
1634 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v3
1635 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1636 ; GCN-NEXT: s_setpc_b64 s[30:31]
1637 %cmp1 = icmp ult i32 %arg1, %C
1638 %cmp2 = icmp ult i32 %arg2, %C
1639 %cmp3 = icmp ult i32 %arg3, %C
1640 %or1 = or i1 %cmp1, %cmp2
1641 %or2 = or i1 %or1, %cmp3
1645 define i1 @test93(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %C) {
1646 ; GCN-LABEL: test93:
1648 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1649 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
1650 ; GCN-NEXT: v_max_u32_e32 v1, v2, v3
1651 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v4
1652 ; GCN-NEXT: v_cmp_gt_u32_e64 s0, v1, v4
1653 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
1654 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
1655 ; GCN-NEXT: s_setpc_b64 s[30:31]
1656 %cmp1 = icmp ult i32 %arg1, %C
1657 %cmp2 = icmp ult i32 %arg2, %C
1658 %cmp3 = icmp ugt i32 %arg3, %C
1659 %cmp4 = icmp ugt i32 %arg4, %C
1660 %or1 = or i1 %cmp1, %cmp2
1661 %or2 = or i1 %cmp3, %cmp4
1662 %or3 = or i1 %or1, %or2
1666 define i1 @test94(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %C) {
1667 ; GCN-LABEL: test94:
1669 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1670 ; GCN-NEXT: v_min_u32_e32 v2, v2, v3
1671 ; GCN-NEXT: v_min3_u32 v0, v0, v1, v2
1672 ; GCN-NEXT: v_min_u32_e32 v0, v0, v4
1673 ; GCN-NEXT: v_min3_u32 v0, v5, v6, v0
1674 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v8
1675 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1676 ; GCN-NEXT: s_setpc_b64 s[30:31]
1677 %cmp1 = icmp ult i32 %arg1, %C
1678 %cmp2 = icmp ult i32 %arg2, %C
1679 %or1 = or i1 %cmp1, %cmp2
1680 %cmp3 = icmp ult i32 %arg3, %C
1681 %cmp4 = icmp ult i32 %arg4, %C
1682 %or2 = or i1 %cmp3, %cmp4
1683 %cmp5 = icmp ult i32 %arg5, %C
1684 %or3 = or i1 %or1, %or2
1685 %or4 = or i1 %or3, %cmp5
1686 %cmp6 = icmp ult i32 %arg6, %C
1687 %cmp7 = icmp ult i32 %arg7, %C
1688 %or5 = or i1 %cmp6, %cmp7
1689 %cmp8 = icmp ult i32 %arg8, %C
1690 %or6 = or i1 %or5, %or4
1691 %or7 = or i1 %or6, %cmp8
1695 define i1 @test95(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %C) {
1696 ; GCN-LABEL: test95:
1698 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1699 ; GCN-NEXT: v_maxmin_u32 v0, v0, v1, v2
1700 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v4
1701 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1702 ; GCN-NEXT: s_setpc_b64 s[30:31]
1703 %cmp1 = icmp ult i32 %arg1, %C
1704 %cmp2 = icmp ult i32 %arg2, %C
1705 %cmp3 = icmp ult i32 %arg3, %C
1706 %and1 = and i1 %cmp1, %cmp2
1707 %or1 = or i1 %and1, %cmp3
1711 define i1 @test96(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %C) {
1712 ; GCN-LABEL: test96:
1714 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1715 ; GCN-NEXT: v_minmax_u32 v0, v0, v1, v2
1716 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v4
1717 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1718 ; GCN-NEXT: s_setpc_b64 s[30:31]
1719 %cmp1 = icmp ult i32 %arg1, %C
1720 %cmp2 = icmp ult i32 %arg2, %C
1721 %cmp3 = icmp ult i32 %arg3, %C
1722 %and1 = or i1 %cmp1, %cmp2
1723 %or1 = and i1 %and1, %cmp3
1727 define i1 @test97(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %C) {
1728 ; GCN-LABEL: test97:
1730 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1731 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
1732 ; GCN-NEXT: v_max3_u32 v0, v0, v2, v3
1733 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v4
1734 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1735 ; GCN-NEXT: s_setpc_b64 s[30:31]
1736 %cmp1 = icmp ult i32 %arg1, %C
1737 %cmp2 = icmp ult i32 %arg2, %C
1738 %cmp3 = icmp ult i32 %arg3, %C
1739 %cmp4 = icmp ult i32 %arg4, %C
1740 %or1 = or i1 %cmp1, %cmp2
1741 %and1 = and i1 %cmp3, %cmp4
1742 %and2 = and i1 %or1, %and1
1746 define i1 @test98(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %C) {
1747 ; GCN-LABEL: test98:
1749 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1750 ; GCN-NEXT: v_min_u32_e32 v2, v2, v3
1751 ; GCN-NEXT: v_minmax_u32 v0, v0, v1, v2
1752 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v4
1753 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1754 ; GCN-NEXT: s_setpc_b64 s[30:31]
1755 %cmp1 = icmp ult i32 %arg1, %C
1756 %cmp2 = icmp ult i32 %arg2, %C
1757 %cmp3 = icmp ult i32 %arg3, %C
1758 %cmp4 = icmp ult i32 %arg4, %C
1759 %or1 = or i1 %cmp1, %cmp2
1760 %or2 = or i1 %cmp3, %cmp4
1761 %and1 = and i1 %or1, %or2
1765 define i1 @test99(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %C) {
1766 ; GCN-LABEL: test99:
1768 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1769 ; GCN-NEXT: v_max_u32_e32 v2, v2, v3
1770 ; GCN-NEXT: v_min3_u32 v0, v0, v1, v2
1771 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v4
1772 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1773 ; GCN-NEXT: s_setpc_b64 s[30:31]
1774 %cmp1 = icmp ult i32 %arg1, %C
1775 %cmp2 = icmp ult i32 %arg2, %C
1776 %cmp3 = icmp ult i32 %arg3, %C
1777 %cmp4 = icmp ult i32 %arg4, %C
1778 %or1 = or i1 %cmp1, %cmp2
1779 %and1 = and i1 %cmp3, %cmp4
1780 %or2 = or i1 %or1, %and1
1784 define i1 @test100(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %C) {
1785 ; GCN-LABEL: test100:
1787 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1788 ; GCN-NEXT: v_max_u32_e32 v2, v2, v3
1789 ; GCN-NEXT: v_maxmin_u32 v0, v0, v1, v2
1790 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v4
1791 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1792 ; GCN-NEXT: s_setpc_b64 s[30:31]
1793 %cmp1 = icmp ult i32 %arg1, %C
1794 %cmp2 = icmp ult i32 %arg2, %C
1795 %cmp3 = icmp ult i32 %arg3, %C
1796 %cmp4 = icmp ult i32 %arg4, %C
1797 %and1 = and i1 %cmp1, %cmp2
1798 %and2 = and i1 %cmp3, %cmp4
1799 %or1 = or i1 %and1, %and2
1803 define i1 @test101(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %C) {
1804 ; GCN-LABEL: test101:
1806 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1807 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
1808 ; GCN-NEXT: v_minmax_u32 v1, v3, v4, v5
1809 ; GCN-NEXT: v_min3_u32 v0, v0, v2, v1
1810 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v6
1811 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1812 ; GCN-NEXT: s_setpc_b64 s[30:31]
1813 %cmp1 = icmp ult i32 %arg1, %C
1814 %cmp2 = icmp ult i32 %arg2, %C
1815 %cmp3 = icmp ult i32 %arg3, %C
1816 %and1 = and i1 %cmp1, %cmp2
1817 %or1 = or i1 %and1, %cmp3
1818 %cmp4 = icmp ult i32 %arg4, %C
1819 %cmp5 = icmp ult i32 %arg5, %C
1820 %cmp6 = icmp ult i32 %arg6, %C
1821 %or2 = or i1 %cmp4, %cmp5
1822 %and2 = and i1 %or2, %cmp6
1823 %or3 = or i1 %or1, %and2
1827 define i1 @test102(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %C) {
1828 ; GCN-LABEL: test102:
1830 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1831 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
1832 ; GCN-NEXT: v_min_u32_e32 v1, v2, v3
1833 ; GCN-NEXT: v_min3_u32 v0, v0, v5, v1
1834 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v6
1835 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
1836 ; GCN-NEXT: s_setpc_b64 s[30:31]
1837 %cmp1 = icmp ult i32 %arg1, %C
1838 %cmp2 = icmp ult i32 %arg2, %C
1839 %cmp3 = icmp ult i32 %arg3, %C
1840 %cmp4 = icmp ult i32 %arg4, %C
1841 %cmp5 = icmp ult i32 %arg5, %C
1842 %cmp6 = icmp ult i32 %arg6, %C
1843 %and1 = and i1 %cmp1, %cmp2
1844 %or1 = or i1 %cmp3, %cmp4
1845 %and2 = and i1 %cmp4, %cmp5
1846 %or2 = or i1 %and1, %cmp6
1847 %or3 = or i1 %or1, %and2
1848 %or4 = or i1 %or2, %or3
1852 define i1 @test103(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %C) {
1853 ; GCN-LABEL: test103:
1855 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1856 ; GCN-NEXT: v_max_u32_e32 v4, v4, v5
1857 ; GCN-NEXT: v_max_u32_e32 v2, v2, v3
1858 ; GCN-NEXT: v_maxmin_u32 v0, v0, v1, v4
1859 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, v2, v6
1860 ; GCN-NEXT: v_cmp_lt_u32_e64 s0, v0, v6
1861 ; GCN-NEXT: s_or_b32 s0, s0, vcc_lo
1862 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
1863 ; GCN-NEXT: s_setpc_b64 s[30:31]
1864 %cmp1 = icmp ult i32 %arg1, %C
1865 %cmp2 = icmp ult i32 %arg2, %C
1866 %cmp3 = icmp ugt i32 %arg3, %C
1867 %cmp4 = icmp ugt i32 %arg4, %C
1868 %cmp5 = icmp ult i32 %arg5, %C
1869 %cmp6 = icmp ult i32 %arg6, %C
1870 %and1 = and i1 %cmp1, %cmp2
1871 %or1 = or i1 %cmp3, %cmp4
1872 %and2 = and i1 %cmp5, %cmp6
1873 %or2 = or i1 %and1, %or1
1874 %or3 = or i1 %or2, %and2
1879 define i1 @test104(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9, i32 %arg10, i32 %C) {
1880 ; GCN-LABEL: test104:
1882 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1883 ; GCN-NEXT: v_min_u32_e32 v8, v8, v9
1884 ; GCN-NEXT: v_max_u32_e32 v2, v2, v3
1885 ; GCN-NEXT: v_min_u32_e32 v3, v4, v5
1886 ; GCN-NEXT: v_max_u32_e32 v4, v6, v7
1887 ; GCN-NEXT: v_min3_u32 v0, v0, v1, v8
1888 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, v2, v10
1889 ; GCN-NEXT: v_cmp_lt_u32_e64 s0, v3, v10
1890 ; GCN-NEXT: v_cmp_gt_u32_e64 s1, v4, v10
1891 ; GCN-NEXT: v_cmp_lt_u32_e64 s2, v0, v10
1892 ; GCN-NEXT: s_or_b32 s0, s0, s1
1893 ; GCN-NEXT: s_or_b32 s1, s2, vcc_lo
1894 ; GCN-NEXT: s_or_b32 s0, s0, s1
1895 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
1896 ; GCN-NEXT: s_setpc_b64 s[30:31]
1897 %cmp1 = icmp ult i32 %arg1, %C
1898 %cmp2 = icmp ult i32 %arg2, %C
1899 %cmp3 = icmp ugt i32 %arg3, %C
1900 %cmp4 = icmp ugt i32 %arg4, %C
1901 %cmp5 = icmp ult i32 %arg5, %C
1902 %cmp6 = icmp ult i32 %arg6, %C
1903 %cmp7 = icmp ugt i32 %arg7, %C
1904 %cmp8 = icmp ugt i32 %arg8, %C
1905 %cmp9 = icmp ult i32 %arg9, %C
1906 %cmp10 = icmp ult i32 %arg10, %C
1907 %or1 = or i1 %cmp1, %cmp2
1908 %or2 = or i1 %cmp3, %cmp4
1909 %or3 = or i1 %cmp5, %cmp6
1910 %or4 = or i1 %cmp7, %cmp8
1911 %or5 = or i1 %cmp9, %cmp10
1912 %or6 = or i1 %or1, %or2
1913 %or7 = or i1 %or3, %or4
1914 %or8 = or i1 %or5, %or6
1915 %or9 = or i1 %or7, %or8
1919 define i1 @test105(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9, i32 %arg10, i32 %C) {
1920 ; GCN-LABEL: test105:
1922 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1923 ; GCN-NEXT: v_max_u32_e32 v0, v0, v1
1924 ; GCN-NEXT: v_max_u32_e32 v1, v2, v3
1925 ; GCN-NEXT: v_max_u32_e32 v2, v4, v5
1926 ; GCN-NEXT: v_max_u32_e32 v3, v6, v7
1927 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v10
1928 ; GCN-NEXT: v_cmp_gt_u32_e64 s0, v1, v10
1929 ; GCN-NEXT: v_cmp_lt_u32_e64 s1, v2, v10
1930 ; GCN-NEXT: v_cmp_gt_u32_e64 s2, v3, v10
1931 ; GCN-NEXT: s_and_b32 s0, vcc_lo, s0
1932 ; GCN-NEXT: s_or_b32 s1, s2, s1
1933 ; GCN-NEXT: s_and_b32 s0, s0, s1
1934 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
1935 ; GCN-NEXT: s_setpc_b64 s[30:31]
1936 %cmp1 = icmp ult i32 %arg1, %C
1937 %cmp2 = icmp ult i32 %arg2, %C
1938 %cmp3 = icmp ugt i32 %arg3, %C
1939 %cmp4 = icmp ugt i32 %arg4, %C
1940 %cmp5 = icmp ult i32 %arg5, %C
1941 %cmp6 = icmp ult i32 %arg6, %C
1942 %cmp7 = icmp ugt i32 %arg7, %C
1943 %cmp8 = icmp ugt i32 %arg8, %C
1944 %and1 = and i1 %cmp1, %cmp2
1945 %or1 = or i1 %cmp3, %cmp4
1946 %and2 = and i1 %cmp5, %cmp6
1947 %or2 = or i1 %cmp7, %cmp8
1948 %and3 = and i1 %and1, %or1
1949 %or3 = or i1 %or2, %and2
1950 %or4 = and i1 %and3, %or3
1954 define i1 @test106(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4, i32 %arg5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9, i32 %arg10, i32 %arg11, i32 %arg12, i32 %C1, i32 %C2) {
1955 ; GCN-LABEL: test106:
1957 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
1958 ; GCN-NEXT: v_min_u32_e32 v6, v6, v7
1959 ; GCN-NEXT: v_min_u32_e32 v0, v0, v1
1960 ; GCN-NEXT: v_min_u32_e32 v1, v10, v11
1961 ; GCN-NEXT: v_min_u32_e32 v2, v2, v3
1962 ; GCN-NEXT: v_min3_u32 v3, v4, v5, v6
1963 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v12
1964 ; GCN-NEXT: v_min3_u32 v0, v8, v9, v1
1965 ; GCN-NEXT: v_cmp_lt_u32_e64 s0, v2, v13
1966 ; GCN-NEXT: v_cmp_lt_u32_e64 s1, v3, v13
1967 ; GCN-NEXT: v_cmp_lt_u32_e64 s2, v0, v12
1968 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
1969 ; GCN-NEXT: s_or_b32 s0, s0, s1
1970 ; GCN-NEXT: s_or_b32 s0, s2, s0
1971 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
1972 ; GCN-NEXT: s_setpc_b64 s[30:31]
1973 %cmp1 = icmp ult i32 %arg1, %C1
1974 %cmp2 = icmp ult i32 %arg2, %C1
1975 %cmp3 = icmp ult i32 %arg3, %C2
1976 %cmp4 = icmp ult i32 %arg4, %C2
1977 %cmp5 = icmp ult i32 %arg5, %C2
1978 %cmp6 = icmp ult i32 %arg6, %C2
1979 %cmp7 = icmp ult i32 %arg7, %C2
1980 %cmp8 = icmp ult i32 %arg8, %C2
1981 %cmp9 = icmp ult i32 %arg9, %C1
1982 %cmp10 = icmp ult i32 %arg10, %C1
1983 %cmp11 = icmp ult i32 %arg11, %C1
1984 %cmp12 = icmp ult i32 %arg12, %C1
1985 %or1 = or i1 %cmp1, %cmp2
1986 %or2 = or i1 %cmp3, %cmp4
1987 %or3 = or i1 %cmp5, %cmp6
1988 %or4 = or i1 %cmp7, %cmp8
1989 %or5 = or i1 %cmp9, %cmp10
1990 %or6 = or i1 %cmp11, %cmp12
1991 %or7 = or i1 %or1, %or2
1992 %or8 = or i1 %or3, %or4
1993 %or9 = or i1 %or5, %or6
1994 %or10 = or i1 %or7, %or8
1995 %or11 = or i1 %or9, %or10
1999 define i1 @test107(float %arg1, float %arg2, float %arg3, float %C) {
2000 ; GCN-LABEL: test107:
2002 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2003 ; GCN-NEXT: v_min3_f32 v0, v0, v1, v2
2004 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v3
2005 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2006 ; GCN-NEXT: s_setpc_b64 s[30:31]
2007 %cmp1 = fcmp olt float %arg1, %C
2008 %cmp2 = fcmp olt float %arg2, %C
2009 %cmp3 = fcmp olt float %arg3, %C
2010 %or1 = or i1 %cmp1, %cmp2
2011 %or2 = or i1 %or1, %cmp3
2015 define i1 @test108(float %arg1, float %arg2, float %arg3, float %C) {
2016 ; GFX11-LABEL: test108:
2018 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2019 ; GFX11-NEXT: v_max3_f32 v0, v0, v1, v2
2020 ; GFX11-NEXT: v_cmp_nge_f32_e32 vcc_lo, v0, v3
2021 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2022 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2024 ; GFX11NONANS-LABEL: test108:
2025 ; GFX11NONANS: ; %bb.0:
2026 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2027 ; GFX11NONANS-NEXT: v_max3_f32 v0, v0, v1, v2
2028 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v3
2029 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2030 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2031 %cmp1 = fcmp ult float %arg1, %C
2032 %cmp2 = fcmp ult float %arg2, %C
2033 %cmp3 = fcmp ult float %arg3, %C
2034 %and1 = and i1 %cmp1, %cmp2
2035 %and2 = and i1 %and1, %cmp3
2039 define i1 @test109(float %arg1, float %arg2, float %arg3, float %arg4, float %C) {
2040 ; GFX11-LABEL: test109:
2042 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2043 ; GFX11-NEXT: v_dual_max_f32 v1, v1, v1 :: v_dual_max_f32 v0, v0, v0
2044 ; GFX11-NEXT: v_dual_max_f32 v3, v3, v3 :: v_dual_max_f32 v2, v2, v2
2045 ; GFX11-NEXT: v_dual_min_f32 v0, v0, v1 :: v_dual_max_f32 v1, v2, v3
2046 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v4
2047 ; GFX11-NEXT: v_cmp_gt_f32_e64 s0, v1, v4
2048 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2049 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2050 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2052 ; GFX11NONANS-LABEL: test109:
2053 ; GFX11NONANS: ; %bb.0:
2054 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2055 ; GFX11NONANS-NEXT: v_dual_min_f32 v0, v0, v1 :: v_dual_max_f32 v1, v2, v3
2056 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v4
2057 ; GFX11NONANS-NEXT: v_cmp_gt_f32_e64 s0, v1, v4
2058 ; GFX11NONANS-NEXT: s_or_b32 s0, vcc_lo, s0
2059 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2060 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2061 %cmp1 = fcmp olt float %arg1, %C
2062 %cmp2 = fcmp olt float %arg2, %C
2063 %cmp3 = fcmp ogt float %arg3, %C
2064 %cmp4 = fcmp ogt float %arg4, %C
2065 %or1 = or i1 %cmp1, %cmp2
2066 %or2 = or i1 %cmp3, %cmp4
2067 %or3 = or i1 %or1, %or2
2071 define i1 @test110(float %arg1, float %arg2, float %arg3, float %arg4, float %C1, float %C2, float %C3, float %C4, float %C) #0 {
2072 ; GCN-LABEL: test110:
2074 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2075 ; GCN-NEXT: v_dual_add_f32 v0, v0, v4 :: v_dual_add_f32 v1, v1, v5
2076 ; GCN-NEXT: v_dual_add_f32 v2, v2, v6 :: v_dual_add_f32 v3, v3, v7
2077 ; GCN-NEXT: v_dual_max_f32 v0, v0, v1 :: v_dual_min_f32 v1, v2, v3
2078 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v8
2079 ; GCN-NEXT: v_cmp_gt_f32_e64 s0, v1, v8
2080 ; GCN-NEXT: s_and_b32 s0, vcc_lo, s0
2081 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2082 ; GCN-NEXT: s_setpc_b64 s[30:31]
2083 %add1 = fadd nnan float %arg1, %C1
2084 %add2 = fadd nnan float %arg2, %C2
2085 %add3 = fadd nnan float %arg3, %C3
2086 %add4 = fadd nnan float %arg4, %C4
2087 %cmp1 = fcmp nnan ult float %add1, %C
2088 %cmp2 = fcmp nnan ult float %add2, %C
2089 %cmp3 = fcmp nnan ugt float %add3, %C
2090 %cmp4 = fcmp nnan ugt float %add4, %C
2091 %or1 = and i1 %cmp1, %cmp2
2092 %or2 = and i1 %cmp3, %cmp4
2093 %or3 = and i1 %or1, %or2
2097 define i1 @test111(float %arg1, float %arg2, float %arg3, float %arg4, float %arg5, float %arg6, float %arg7, float %arg8, float %C) {
2098 ; GFX11-LABEL: test111:
2100 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2101 ; GFX11-NEXT: v_dual_max_f32 v3, v3, v3 :: v_dual_max_f32 v2, v2, v2
2102 ; GFX11-NEXT: v_dual_min_f32 v2, v2, v3 :: v_dual_max_f32 v3, v4, v4
2103 ; GFX11-NEXT: v_min3_f32 v0, v0, v1, v2
2104 ; GFX11-NEXT: v_min_f32_e32 v0, v0, v3
2105 ; GFX11-NEXT: v_min3_f32 v0, v5, v6, v0
2106 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v8
2107 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2108 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2110 ; GFX11NONANS-LABEL: test111:
2111 ; GFX11NONANS: ; %bb.0:
2112 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2113 ; GFX11NONANS-NEXT: v_min_f32_e32 v2, v2, v3
2114 ; GFX11NONANS-NEXT: v_min3_f32 v0, v0, v1, v2
2115 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v4
2116 ; GFX11NONANS-NEXT: v_min3_f32 v0, v5, v6, v0
2117 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v8
2118 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2119 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2120 %cmp1 = fcmp olt float %arg1, %C
2121 %cmp2 = fcmp olt float %arg2, %C
2122 %or1 = or i1 %cmp1, %cmp2
2123 %cmp3 = fcmp olt float %arg3, %C
2124 %cmp4 = fcmp olt float %arg4, %C
2125 %or2 = or i1 %cmp3, %cmp4
2126 %cmp5 = fcmp olt float %arg5, %C
2127 %or3 = or i1 %or1, %or2
2128 %or4 = or i1 %or3, %cmp5
2129 %cmp6 = fcmp olt float %arg6, %C
2130 %cmp7 = fcmp olt float %arg7, %C
2131 %or5 = or i1 %cmp6, %cmp7
2132 %cmp8 = fcmp olt float %arg8, %C
2133 %or6 = or i1 %or5, %or4
2134 %or7 = or i1 %or6, %cmp8
2138 define i1 @test112(float %arg1, float %arg2, float %arg3, float %arg4, float %arg5, float %arg6, float %arg7, float %arg8, float %C) {
2139 ; GFX11-LABEL: test112:
2141 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2142 ; GFX11-NEXT: v_dual_max_f32 v3, v3, v3 :: v_dual_max_f32 v2, v2, v2
2143 ; GFX11-NEXT: v_cmp_nge_f32_e32 vcc_lo, v4, v8
2144 ; GFX11-NEXT: v_dual_max_f32 v5, v5, v5 :: v_dual_min_f32 v2, v2, v3
2145 ; GFX11-NEXT: v_max_f32_e32 v3, v6, v6
2146 ; GFX11-NEXT: v_min3_f32 v0, v0, v1, v2
2147 ; GFX11-NEXT: v_min3_f32 v0, v0, v5, v3
2148 ; GFX11-NEXT: v_cmp_lt_f32_e64 s0, v0, v8
2149 ; GFX11-NEXT: s_or_b32 s0, s0, vcc_lo
2150 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2151 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2153 ; GFX11NONANS-LABEL: test112:
2154 ; GFX11NONANS: ; %bb.0:
2155 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2156 ; GFX11NONANS-NEXT: v_min_f32_e32 v2, v2, v3
2157 ; GFX11NONANS-NEXT: v_min3_f32 v0, v0, v1, v2
2158 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v4
2159 ; GFX11NONANS-NEXT: v_min3_f32 v0, v5, v6, v0
2160 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v8
2161 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2162 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2163 %cmp1 = fcmp olt float %arg1, %C
2164 %cmp2 = fcmp olt float %arg2, %C
2165 %or1 = or i1 %cmp1, %cmp2
2166 %cmp3 = fcmp olt float %arg3, %C
2167 %cmp4 = fcmp olt float %arg4, %C
2168 %or2 = or i1 %cmp3, %cmp4
2169 %cmp5 = fcmp ult float %arg5, %C
2170 %or3 = or i1 %or1, %or2
2171 %or4 = or i1 %or3, %cmp5
2172 %cmp6 = fcmp olt float %arg6, %C
2173 %cmp7 = fcmp olt float %arg7, %C
2174 %or5 = or i1 %cmp6, %cmp7
2175 %cmp8 = fcmp ult float %arg8, %C
2176 %or6 = or i1 %or5, %or4
2177 %or7 = or i1 %or6, %cmp8
2181 define i1 @test113(float %arg1, float %arg2, float %arg3, float %C) {
2182 ; GFX11-LABEL: test113:
2184 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2185 ; GFX11-NEXT: v_dual_max_f32 v1, v1, v1 :: v_dual_max_f32 v0, v0, v0
2186 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v2, v3
2187 ; GFX11-NEXT: v_max_f32_e32 v0, v0, v1
2188 ; GFX11-NEXT: v_cmp_nge_f32_e64 s0, v0, v3
2189 ; GFX11-NEXT: s_or_b32 s0, s0, vcc_lo
2190 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2191 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2193 ; GFX11NONANS-LABEL: test113:
2194 ; GFX11NONANS: ; %bb.0:
2195 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2196 ; GFX11NONANS-NEXT: v_maxmin_f32 v0, v0, v1, v2
2197 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v3
2198 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2199 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2200 %cmp1 = fcmp ult float %arg1, %C
2201 %cmp2 = fcmp ult float %arg2, %C
2202 %cmp3 = fcmp olt float %arg3, %C
2203 %and1 = and i1 %cmp1, %cmp2
2204 %or1 = or i1 %and1, %cmp3
2208 define i1 @test114(float %arg1, float %arg2, float %arg3, float %C) {
2209 ; GFX11-LABEL: test114:
2211 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2212 ; GFX11-NEXT: v_dual_max_f32 v1, v1, v1 :: v_dual_max_f32 v0, v0, v0
2213 ; GFX11-NEXT: v_cmp_nge_f32_e32 vcc_lo, v2, v3
2214 ; GFX11-NEXT: v_max_f32_e32 v0, v0, v1
2215 ; GFX11-NEXT: v_cmp_gt_f32_e64 s0, v0, v3
2216 ; GFX11-NEXT: s_and_b32 s0, s0, vcc_lo
2217 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2218 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2220 ; GFX11NONANS-LABEL: test114:
2221 ; GFX11NONANS: ; %bb.0:
2222 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2223 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
2224 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v2, v3
2225 ; GFX11NONANS-NEXT: v_cmp_gt_f32_e64 s0, v0, v3
2226 ; GFX11NONANS-NEXT: s_and_b32 s0, s0, vcc_lo
2227 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2228 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2229 %cmp1 = fcmp ogt float %arg1, %C
2230 %cmp2 = fcmp ogt float %arg2, %C
2231 %cmp3 = fcmp ult float %arg3, %C
2232 %and1 = or i1 %cmp1, %cmp2
2233 %or1 = and i1 %and1, %cmp3
2237 define i1 @test115(float %arg1, float %arg2, float %arg3, float %arg4, float %C) {
2238 ; GFX11-LABEL: test115:
2240 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2241 ; GFX11-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_max_f32 v1, v1, v1
2242 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v3, v3, v3
2243 ; GFX11-NEXT: v_dual_min_f32 v0, v0, v1 :: v_dual_max_f32 v1, v2, v3
2244 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v4
2245 ; GFX11-NEXT: v_cmp_nge_f32_e64 s0, v1, v4
2246 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2247 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2248 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2250 ; GFX11NONANS-LABEL: test115:
2251 ; GFX11NONANS: ; %bb.0:
2252 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2253 ; GFX11NONANS-NEXT: v_max_f32_e32 v2, v2, v3
2254 ; GFX11NONANS-NEXT: v_min3_f32 v0, v0, v1, v2
2255 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v4
2256 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2257 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2258 %cmp1 = fcmp olt float %arg1, %C
2259 %cmp2 = fcmp olt float %arg2, %C
2260 %var3 = call float @llvm.canonicalize.f32(float %arg3)
2261 %var4 = call float @llvm.canonicalize.f32(float %arg4)
2262 %cmp3 = fcmp ult float %var3, %C
2263 %cmp4 = fcmp ult float %var4, %C
2264 %or1 = or i1 %cmp1, %cmp2
2265 %and1 = and i1 %cmp3, %cmp4
2266 %or2 = or i1 %or1, %and1
2270 define i1 @test116(float %arg1, float %arg2, float %arg3, float %arg4, float %arg5, float %arg6, float %arg7, float %arg8, float %arg9, float %arg10, float %C) {
2271 ; GFX11-LABEL: test116:
2273 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2274 ; GFX11-NEXT: v_dual_max_f32 v9, v9, v9 :: v_dual_max_f32 v8, v8, v8
2275 ; GFX11-NEXT: v_dual_max_f32 v1, v1, v1 :: v_dual_max_f32 v0, v0, v0
2276 ; GFX11-NEXT: v_dual_max_f32 v3, v3, v3 :: v_dual_max_f32 v2, v2, v2
2277 ; GFX11-NEXT: v_dual_max_f32 v5, v5, v5 :: v_dual_max_f32 v4, v4, v4
2278 ; GFX11-NEXT: v_dual_max_f32 v7, v7, v7 :: v_dual_max_f32 v6, v6, v6
2279 ; GFX11-NEXT: v_min_f32_e32 v8, v8, v9
2280 ; GFX11-NEXT: v_dual_max_f32 v2, v2, v3 :: v_dual_min_f32 v3, v4, v5
2281 ; GFX11-NEXT: v_max_f32_e32 v4, v6, v7
2282 ; GFX11-NEXT: v_min3_f32 v0, v0, v1, v8
2283 ; GFX11-NEXT: v_cmp_gt_f32_e32 vcc_lo, v2, v10
2284 ; GFX11-NEXT: v_cmp_lt_f32_e64 s0, v3, v10
2285 ; GFX11-NEXT: v_cmp_gt_f32_e64 s1, v4, v10
2286 ; GFX11-NEXT: v_cmp_lt_f32_e64 s2, v0, v10
2287 ; GFX11-NEXT: s_or_b32 s0, s0, s1
2288 ; GFX11-NEXT: s_or_b32 s1, s2, vcc_lo
2289 ; GFX11-NEXT: s_or_b32 s0, s0, s1
2290 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2291 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2293 ; GFX11NONANS-LABEL: test116:
2294 ; GFX11NONANS: ; %bb.0:
2295 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2296 ; GFX11NONANS-NEXT: v_min_f32_e32 v8, v8, v9
2297 ; GFX11NONANS-NEXT: v_dual_max_f32 v2, v2, v3 :: v_dual_min_f32 v3, v4, v5
2298 ; GFX11NONANS-NEXT: v_max_f32_e32 v4, v6, v7
2299 ; GFX11NONANS-NEXT: v_min3_f32 v0, v0, v1, v8
2300 ; GFX11NONANS-NEXT: v_cmp_gt_f32_e32 vcc_lo, v2, v10
2301 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e64 s0, v3, v10
2302 ; GFX11NONANS-NEXT: v_cmp_gt_f32_e64 s1, v4, v10
2303 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e64 s2, v0, v10
2304 ; GFX11NONANS-NEXT: s_or_b32 s0, s0, s1
2305 ; GFX11NONANS-NEXT: s_or_b32 s1, s2, vcc_lo
2306 ; GFX11NONANS-NEXT: s_or_b32 s0, s0, s1
2307 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2308 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2309 %cmp1 = fcmp olt float %arg1, %C
2310 %cmp2 = fcmp olt float %arg2, %C
2311 %cmp3 = fcmp ogt float %arg3, %C
2312 %cmp4 = fcmp ogt float %arg4, %C
2313 %cmp5 = fcmp olt float %arg5, %C
2314 %cmp6 = fcmp olt float %arg6, %C
2315 %cmp7 = fcmp ogt float %arg7, %C
2316 %cmp8 = fcmp ogt float %arg8, %C
2317 %cmp9 = fcmp olt float %arg9, %C
2318 %cmp10 = fcmp olt float %arg10, %C
2319 %or1 = or i1 %cmp1, %cmp2
2320 %or2 = or i1 %cmp3, %cmp4
2321 %or3 = or i1 %cmp5, %cmp6
2322 %or4 = or i1 %cmp7, %cmp8
2323 %or5 = or i1 %cmp9, %cmp10
2324 %or6 = or i1 %or1, %or2
2325 %or7 = or i1 %or3, %or4
2326 %or8 = or i1 %or5, %or6
2327 %or9 = or i1 %or7, %or8
2331 define i1 @test117(float %arg1, float %arg2, float %arg3, float %arg4, float %arg5, float %arg6, float %arg7, float %arg8, float %arg9, float %arg10, float %arg11, float %arg12, float %C1, float %C2) {
2332 ; GFX11-LABEL: test117:
2334 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2335 ; GFX11-NEXT: v_dual_max_f32 v3, v3, v3 :: v_dual_max_f32 v6, v6, v6
2336 ; GFX11-NEXT: v_dual_max_f32 v7, v7, v7 :: v_dual_max_f32 v10, v10, v10
2337 ; GFX11-NEXT: v_dual_max_f32 v1, v1, v1 :: v_dual_max_f32 v0, v0, v0
2338 ; GFX11-NEXT: v_dual_max_f32 v11, v11, v11 :: v_dual_max_f32 v2, v2, v2
2339 ; GFX11-NEXT: v_min_f32_e32 v6, v6, v7
2340 ; GFX11-NEXT: v_dual_min_f32 v0, v0, v1 :: v_dual_min_f32 v1, v10, v11
2341 ; GFX11-NEXT: v_min_f32_e32 v2, v2, v3
2342 ; GFX11-NEXT: v_min3_f32 v3, v4, v5, v6
2343 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v12
2344 ; GFX11-NEXT: v_min3_f32 v0, v8, v9, v1
2345 ; GFX11-NEXT: v_cmp_lt_f32_e64 s0, v2, v13
2346 ; GFX11-NEXT: v_cmp_lt_f32_e64 s1, v3, v13
2347 ; GFX11-NEXT: v_cmp_lt_f32_e64 s2, v0, v12
2348 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2349 ; GFX11-NEXT: s_or_b32 s0, s0, s1
2350 ; GFX11-NEXT: s_or_b32 s0, s2, s0
2351 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2352 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2354 ; GFX11NONANS-LABEL: test117:
2355 ; GFX11NONANS: ; %bb.0:
2356 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2357 ; GFX11NONANS-NEXT: v_min_f32_e32 v6, v6, v7
2358 ; GFX11NONANS-NEXT: v_dual_min_f32 v0, v0, v1 :: v_dual_min_f32 v1, v10, v11
2359 ; GFX11NONANS-NEXT: v_min_f32_e32 v2, v2, v3
2360 ; GFX11NONANS-NEXT: v_min3_f32 v3, v4, v5, v6
2361 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v12
2362 ; GFX11NONANS-NEXT: v_min3_f32 v0, v8, v9, v1
2363 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e64 s0, v2, v13
2364 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e64 s1, v3, v13
2365 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e64 s2, v0, v12
2366 ; GFX11NONANS-NEXT: s_or_b32 s0, vcc_lo, s0
2367 ; GFX11NONANS-NEXT: s_or_b32 s0, s0, s1
2368 ; GFX11NONANS-NEXT: s_or_b32 s0, s2, s0
2369 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2370 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2371 %cmp1 = fcmp olt float %arg1, %C1
2372 %cmp2 = fcmp olt float %arg2, %C1
2373 %cmp3 = fcmp olt float %arg3, %C2
2374 %cmp4 = fcmp olt float %arg4, %C2
2375 %cmp5 = fcmp olt float %arg5, %C2
2376 %cmp6 = fcmp olt float %arg6, %C2
2377 %cmp7 = fcmp olt float %arg7, %C2
2378 %cmp8 = fcmp olt float %arg8, %C2
2379 %cmp9 = fcmp olt float %arg9, %C1
2380 %cmp10 = fcmp olt float %arg10, %C1
2381 %cmp11 = fcmp olt float %arg11, %C1
2382 %cmp12 = fcmp olt float %arg12, %C1
2383 %or1 = or i1 %cmp1, %cmp2
2384 %or2 = or i1 %cmp3, %cmp4
2385 %or3 = or i1 %cmp5, %cmp6
2386 %or4 = or i1 %cmp7, %cmp8
2387 %or5 = or i1 %cmp9, %cmp10
2388 %or6 = or i1 %cmp11, %cmp12
2389 %or7 = or i1 %or1, %or2
2390 %or8 = or i1 %or3, %or4
2391 %or9 = or i1 %or5, %or6
2392 %or10 = or i1 %or7, %or8
2393 %or11 = or i1 %or9, %or10
2398 define i1 @test118(float %arg1, float %arg2, float %arg3, float %arg4, float %C1, float %C2, float %C3, float %C4, float %C) #0 {
2399 ; GCN-LABEL: test118:
2401 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2402 ; GCN-NEXT: v_dual_add_f32 v0, v0, v4 :: v_dual_add_f32 v1, v1, v5
2403 ; GCN-NEXT: v_dual_add_f32 v2, v2, v6 :: v_dual_add_f32 v3, v3, v7
2404 ; GCN-NEXT: v_min_f32_e32 v0, v0, v1
2405 ; GCN-NEXT: v_max3_f32 v0, v0, v2, v3
2406 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v8
2407 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2408 ; GCN-NEXT: s_setpc_b64 s[30:31]
2409 %add1 = fadd nnan float %arg1, %C1
2410 %add2 = fadd nnan float %arg2, %C2
2411 %add3 = fadd nnan float %arg3, %C3
2412 %add4 = fadd nnan float %arg4, %C4
2413 %cmp1 = fcmp nnan ult float %add1, %C
2414 %cmp2 = fcmp nnan ult float %add2, %C
2415 %cmp3 = fcmp nnan ult float %add3, %C
2416 %cmp4 = fcmp nnan ult float %add4, %C
2417 %or1 = or i1 %cmp1, %cmp2
2418 %and1 = and i1 %cmp3, %cmp4
2419 %and2 = and i1 %or1, %and1
2423 define i1 @test119(float %arg1, float %arg2, float %arg3, float %arg4, float %C1, float %C2, float %C3, float %C4, float %C) #0 {
2424 ; GCN-LABEL: test119:
2426 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2427 ; GCN-NEXT: v_dual_add_f32 v2, v2, v6 :: v_dual_add_f32 v3, v3, v7
2428 ; GCN-NEXT: v_dual_add_f32 v0, v0, v4 :: v_dual_add_f32 v1, v1, v5
2429 ; GCN-NEXT: v_min_f32_e32 v2, v2, v3
2430 ; GCN-NEXT: v_minmax_f32 v0, v0, v1, v2
2431 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v8
2432 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2433 ; GCN-NEXT: s_setpc_b64 s[30:31]
2434 %add1 = fadd nnan float %arg1, %C1
2435 %add2 = fadd nnan float %arg2, %C2
2436 %add3 = fadd nnan float %arg3, %C3
2437 %add4 = fadd nnan float %arg4, %C4
2438 %cmp1 = fcmp nnan ult float %add1, %C
2439 %cmp2 = fcmp nnan ult float %add2, %C
2440 %cmp3 = fcmp nnan ult float %add3, %C
2441 %cmp4 = fcmp nnan ult float %add4, %C
2442 %or1 = or i1 %cmp1, %cmp2
2443 %and1 = or i1 %cmp3, %cmp4
2444 %and2 = and i1 %or1, %and1
2448 define i1 @test120(float %arg1, float %arg2, float %arg3, float %arg4, float %C1, float %C2, float %C3, float %C4, float %C) #0 {
2449 ; GCN-LABEL: test120:
2451 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2452 ; GCN-NEXT: v_dual_add_f32 v2, v2, v6 :: v_dual_add_f32 v3, v3, v7
2453 ; GCN-NEXT: v_dual_add_f32 v0, v0, v4 :: v_dual_add_f32 v1, v1, v5
2454 ; GCN-NEXT: v_max_f32_e32 v2, v2, v3
2455 ; GCN-NEXT: v_min3_f32 v0, v0, v1, v2
2456 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v8
2457 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2458 ; GCN-NEXT: s_setpc_b64 s[30:31]
2459 %add1 = fadd nnan float %arg1, %C1
2460 %add2 = fadd nnan float %arg2, %C2
2461 %add3 = fadd nnan float %arg3, %C3
2462 %add4 = fadd nnan float %arg4, %C4
2463 %cmp1 = fcmp nnan ult float %add1, %C
2464 %cmp2 = fcmp nnan ult float %add2, %C
2465 %cmp3 = fcmp nnan ult float %add3, %C
2466 %cmp4 = fcmp nnan ult float %add4, %C
2467 %or1 = or i1 %cmp1, %cmp2
2468 %and1 = and i1 %cmp3, %cmp4
2469 %and2 = or i1 %or1, %and1
2473 define i1 @test121(float %arg1, float %arg2, float %arg3, float %arg4, float %C1, float %C2, float %C3, float %C4, float %C) #0 {
2474 ; GCN-LABEL: test121:
2476 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2477 ; GCN-NEXT: v_dual_add_f32 v2, v2, v6 :: v_dual_add_f32 v3, v3, v7
2478 ; GCN-NEXT: v_dual_add_f32 v0, v0, v4 :: v_dual_add_f32 v1, v1, v5
2479 ; GCN-NEXT: v_max_f32_e32 v2, v2, v3
2480 ; GCN-NEXT: v_maxmin_f32 v0, v0, v1, v2
2481 ; GCN-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v8
2482 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2483 ; GCN-NEXT: s_setpc_b64 s[30:31]
2484 %add1 = fadd nnan float %arg1, %C1
2485 %add2 = fadd nnan float %arg2, %C2
2486 %add3 = fadd nnan float %arg3, %C3
2487 %add4 = fadd nnan float %arg4, %C4
2488 %cmp1 = fcmp nnan ult float %add1, %C
2489 %cmp2 = fcmp nnan ult float %add2, %C
2490 %cmp3 = fcmp nnan ult float %add3, %C
2491 %cmp4 = fcmp nnan ult float %add4, %C
2492 %or1 = and i1 %cmp1, %cmp2
2493 %and1 = and i1 %cmp3, %cmp4
2494 %and2 = or i1 %or1, %and1
2498 define i1 @test122(double %arg1, double %arg2, double %arg3) #1 {
2499 ; GCN-LABEL: test122:
2501 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2502 ; GCN-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
2503 ; GCN-NEXT: v_cmp_lt_f64_e32 vcc_lo, v[0:1], v[4:5]
2504 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2505 ; GCN-NEXT: s_setpc_b64 s[30:31]
2506 %cmp1 = fcmp ult double %arg1, %arg3
2507 %cmp2 = fcmp ult double %arg2, %arg3
2508 %or1 = or i1 %cmp1, %cmp2
2512 define i1 @test123(double %arg1, double %arg2, double %arg3) #1 {
2513 ; GCN-LABEL: test123:
2515 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2516 ; GCN-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
2517 ; GCN-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
2518 ; GCN-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
2519 ; GCN-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
2520 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2521 ; GCN-NEXT: s_setpc_b64 s[30:31]
2522 %var1 = call double @llvm.canonicalize.f64(double %arg1)
2523 %var2 = call double @llvm.canonicalize.f64(double %arg2)
2524 %cmp1 = fcmp ogt double %var1, %arg3
2525 %cmp2 = fcmp ogt double %var2, %arg3
2526 %or1 = and i1 %cmp1, %cmp2
2530 ; The optimization does not apply to the following tests.
2532 define i1 @test124(i32 %arg1, i64 %arg2) {
2533 ; GCN-LABEL: test124:
2535 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2536 ; GCN-NEXT: v_cmp_gt_i64_e32 vcc_lo, 0x3e8, v[1:2]
2537 ; GCN-NEXT: v_cmp_gt_i32_e64 s0, 0x3e8, v0
2538 ; GCN-NEXT: s_or_b32 s0, s0, vcc_lo
2539 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2540 ; GCN-NEXT: s_setpc_b64 s[30:31]
2541 %cmp1 = icmp slt i32 %arg1, 1000
2542 %cmp2 = icmp slt i64 %arg2, 1000
2543 %or = or i1 %cmp1, %cmp2
2547 define i1 @test125(i32 %arg1, i32 %arg2) {
2548 ; GCN-LABEL: test125:
2550 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2551 ; GCN-NEXT: v_cmp_eq_u32_e32 vcc_lo, 0x3e8, v0
2552 ; GCN-NEXT: v_cmp_eq_u32_e64 s0, 0x3e8, v1
2553 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2554 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2555 ; GCN-NEXT: s_setpc_b64 s[30:31]
2556 %cmp1 = icmp eq i32 %arg1, 1000
2557 %cmp2 = icmp eq i32 %arg2, 1000
2558 %or = or i1 %cmp1, %cmp2
2562 define i1 @test126(i32 %arg1, i32 %arg2) {
2563 ; GCN-LABEL: test126:
2565 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2566 ; GCN-NEXT: v_cmp_ne_u32_e32 vcc_lo, 0x3e8, v0
2567 ; GCN-NEXT: v_cmp_ne_u32_e64 s0, 0x3e8, v1
2568 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2569 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2570 ; GCN-NEXT: s_setpc_b64 s[30:31]
2571 %cmp1 = icmp ne i32 %arg1, 1000
2572 %cmp2 = icmp ne i32 %arg2, 1000
2573 %or = or i1 %cmp1, %cmp2
2577 define i1 @test127(i64 %arg1, i64 %arg2, i64 %arg3) {
2578 ; GCN-LABEL: test127:
2580 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2581 ; GCN-NEXT: v_cmp_lt_u64_e32 vcc_lo, v[0:1], v[4:5]
2582 ; GCN-NEXT: v_cmp_lt_u64_e64 s0, v[2:3], v[4:5]
2583 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2584 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2585 ; GCN-NEXT: s_setpc_b64 s[30:31]
2586 %cmp1 = icmp ult i64 %arg1, %arg3
2587 %cmp2 = icmp ult i64 %arg2, %arg3
2588 %or = or i1 %cmp1, %cmp2
2592 define i1 @test128(i32 %arg1, i32 %arg2, i32 %arg3) {
2593 ; GCN-LABEL: test128:
2595 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2596 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v2
2597 ; GCN-NEXT: v_cmp_lt_u32_e64 s0, v2, v1
2598 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2599 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2600 ; GCN-NEXT: s_setpc_b64 s[30:31]
2601 %cmp1 = icmp ult i32 %arg1, %arg3
2602 %cmp2 = icmp ult i32 %arg3, %arg2
2603 %or = or i1 %cmp1, %cmp2
2607 define i1 @test129(i32 %arg1, i32 %arg2, i32 %arg3) {
2608 ; GCN-LABEL: test129:
2610 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2611 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v2
2612 ; GCN-NEXT: v_cmp_le_u32_e64 s0, v1, v2
2613 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2614 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2615 ; GCN-NEXT: s_setpc_b64 s[30:31]
2616 %cmp1 = icmp ult i32 %arg1, %arg3
2617 %cmp2 = icmp ule i32 %arg2, %arg3
2618 %or = or i1 %cmp1, %cmp2
2622 define i1 @test130(i32 %arg1, i32 %arg2, i32 %arg3) {
2623 ; GCN-LABEL: test130:
2625 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2626 ; GCN-NEXT: v_cmp_le_u32_e32 vcc_lo, v2, v0
2627 ; GCN-NEXT: v_cmp_gt_u32_e64 s0, v1, v2
2628 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2629 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2630 ; GCN-NEXT: s_setpc_b64 s[30:31]
2631 %cmp1 = icmp ule i32 %arg3, %arg1
2632 %cmp2 = icmp ugt i32 %arg2, %arg3
2633 %or = or i1 %cmp1, %cmp2
2637 define i1 @test131(i16 %arg1, i32 %arg2) {
2638 ; GCN-LABEL: test131:
2640 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2641 ; GCN-NEXT: v_cmp_gt_u16_e32 vcc_lo, 10, v0
2642 ; GCN-NEXT: v_cmp_gt_u32_e64 s0, 10, v1
2643 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2644 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2645 ; GCN-NEXT: s_setpc_b64 s[30:31]
2646 %cmp1 = icmp ult i16 %arg1, 10
2647 %cmp2 = icmp ult i32 %arg2, 10
2648 %or = or i1 %cmp1, %cmp2
2652 define i1 @test132(i32 %arg1, i32 %arg2, i32 %arg3, i32 %arg4) {
2653 ; GCN-LABEL: test132:
2655 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2656 ; GCN-NEXT: v_cmp_lt_u32_e32 vcc_lo, v0, v2
2657 ; GCN-NEXT: v_cmp_lt_u32_e64 s0, v1, v2
2658 ; GCN-NEXT: v_cmp_lt_u32_e64 s1, v0, v3
2659 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2660 ; GCN-NEXT: s_or_b32 s1, s1, vcc_lo
2661 ; GCN-NEXT: s_or_b32 s0, s0, s1
2662 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2663 ; GCN-NEXT: s_setpc_b64 s[30:31]
2664 %cmp1 = icmp ult i32 %arg1, %arg3
2665 %cmp2 = icmp ult i32 %arg2, %arg3
2666 %or1 = or i1 %cmp1, %cmp2
2667 %cmp3 = icmp ult i32 %arg1, %arg4
2668 %or2 = or i1 %cmp3, %cmp1
2669 %or3 = or i1 %or1, %or2
2673 define i1 @test133(i32 %arg1, i32 %arg2) {
2674 ; GCN-LABEL: test133:
2676 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2677 ; GCN-NEXT: v_cmp_gt_u32_e32 vcc_lo, 0x64, v0
2678 ; GCN-NEXT: v_cmp_gt_u32_e64 s0, 0x3e8, v1
2679 ; GCN-NEXT: s_or_b32 s0, vcc_lo, s0
2680 ; GCN-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2681 ; GCN-NEXT: s_setpc_b64 s[30:31]
2682 %cmp1 = icmp ult i32 %arg1, 100
2683 %cmp2 = icmp ult i32 %arg2, 1000
2684 %or = or i1 %cmp1, %cmp2
2688 define i1 @test134(float %arg1, float %arg2, float %arg3) #0 {
2689 ; GFX11-LABEL: test134:
2691 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2692 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
2693 ; GFX11-NEXT: v_cmp_gt_f32_e64 s0, v2, v1
2694 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
2695 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2696 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2698 ; GFX11NONANS-LABEL: test134:
2699 ; GFX11NONANS: ; %bb.0:
2700 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2701 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
2702 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
2703 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2704 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2705 %cmp1 = fcmp olt float %arg1, %arg3
2706 %cmp2 = fcmp ogt float %arg3, %arg2
2707 %and1 = and i1 %cmp1, %cmp2
2711 define i1 @test135(float %arg1, float %arg2, float %arg3) #0 {
2712 ; GFX11-LABEL: test135:
2714 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2715 ; GFX11-NEXT: v_cmp_nge_f32_e32 vcc_lo, v0, v2
2716 ; GFX11-NEXT: v_cmp_nle_f32_e64 s0, v2, v1
2717 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2718 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2719 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2721 ; GFX11NONANS-LABEL: test135:
2722 ; GFX11NONANS: ; %bb.0:
2723 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2724 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
2725 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
2726 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2727 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2728 %cmp1 = fcmp ult float %arg1, %arg3
2729 %cmp2 = fcmp ugt float %arg3, %arg2
2730 %or1 = or i1 %cmp1, %cmp2
2734 define i1 @test136(double %arg1, double %arg2, double %arg3) {
2735 ; GFX11-LABEL: test136:
2737 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2738 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
2739 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
2740 ; GFX11-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
2741 ; GFX11-NEXT: v_cmp_ge_f64_e64 s0, v[4:5], v[2:3]
2742 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
2743 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2744 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2746 ; GFX11NONANS-LABEL: test136:
2747 ; GFX11NONANS: ; %bb.0:
2748 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2749 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
2750 ; GFX11NONANS-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
2751 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
2752 ; GFX11NONANS-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
2753 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2754 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2755 %var1 = call double @llvm.canonicalize.f64(double %arg1)
2756 %var2 = call double @llvm.canonicalize.f64(double %arg2)
2757 %cmp1 = fcmp ole double %var1, %arg3
2758 %cmp2 = fcmp oge double %arg3, %var2
2759 %and1 = and i1 %cmp1, %cmp2
2763 define i1 @test137(float %arg1, float %arg2, float %arg3) {
2764 ; GFX11-LABEL: test137:
2766 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2767 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
2768 ; GFX11-NEXT: v_cmp_ngt_f32_e32 vcc_lo, v0, v2
2769 ; GFX11-NEXT: v_cmp_nlt_f32_e64 s0, v2, v1
2770 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2771 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2772 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2774 ; GFX11NONANS-LABEL: test137:
2775 ; GFX11NONANS: ; %bb.0:
2776 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2777 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
2778 ; GFX11NONANS-NEXT: v_cmp_le_f32_e32 vcc_lo, v0, v2
2779 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2780 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2781 %var1 = call float @llvm.canonicalize.f32(float %arg1)
2782 %var2 = call float @llvm.canonicalize.f32(float %arg2)
2783 %cmp1 = fcmp ule float %var1, %arg3
2784 %cmp2 = fcmp uge float %arg3, %var2
2785 %or1 = or i1 %cmp1, %cmp2
2789 define i1 @test138(float %arg1, float %arg2, float %arg3) #0 {
2790 ; GFX11-LABEL: test138:
2792 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2793 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
2794 ; GFX11-NEXT: v_cmp_lt_f32_e64 s0, v1, v2
2795 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
2796 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2797 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2799 ; GFX11NONANS-LABEL: test138:
2800 ; GFX11NONANS: ; %bb.0:
2801 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2802 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
2803 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
2804 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2805 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2806 %cmp1 = fcmp olt float %arg1, %arg3
2807 %cmp2 = fcmp olt float %arg2, %arg3
2808 %and1 = and i1 %cmp1, %cmp2
2812 define i1 @test139(double %arg1, double %arg2, double %arg3) #0 {
2813 ; GFX11-LABEL: test139:
2815 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2816 ; GFX11-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
2817 ; GFX11-NEXT: v_cmp_le_f64_e64 s0, v[2:3], v[4:5]
2818 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
2819 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2820 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2822 ; GFX11NONANS-LABEL: test139:
2823 ; GFX11NONANS: ; %bb.0:
2824 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2825 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
2826 ; GFX11NONANS-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
2827 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2828 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2829 %cmp1 = fcmp ole double %arg1, %arg3
2830 %cmp2 = fcmp ole double %arg2, %arg3
2831 %and1 = and i1 %cmp1, %cmp2
2835 define i1 @test140(double %arg1, double %arg2, double %arg3) #0 {
2836 ; GFX11-LABEL: test140:
2838 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2839 ; GFX11-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
2840 ; GFX11-NEXT: v_cmp_gt_f64_e64 s0, v[2:3], v[4:5]
2841 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
2842 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2843 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2845 ; GFX11NONANS-LABEL: test140:
2846 ; GFX11NONANS: ; %bb.0:
2847 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2848 ; GFX11NONANS-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
2849 ; GFX11NONANS-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
2850 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2851 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2852 %cmp1 = fcmp ogt double %arg1, %arg3
2853 %cmp2 = fcmp ogt double %arg2, %arg3
2854 %and1 = and i1 %cmp1, %cmp2
2858 define i1 @test141(float %arg1, float %arg2, float %arg3) #0 {
2859 ; GFX11-LABEL: test141:
2861 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2862 ; GFX11-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
2863 ; GFX11-NEXT: v_cmp_ge_f32_e64 s0, v1, v2
2864 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
2865 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2866 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2868 ; GFX11NONANS-LABEL: test141:
2869 ; GFX11NONANS: ; %bb.0:
2870 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2871 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
2872 ; GFX11NONANS-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
2873 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2874 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2875 %cmp1 = fcmp oge float %arg1, %arg3
2876 %cmp2 = fcmp oge float %arg2, %arg3
2877 %and1 = and i1 %cmp1, %cmp2
2881 define i1 @test142(double %arg1, double %arg2, double %arg3) #0 {
2882 ; GFX11-LABEL: test142:
2884 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2885 ; GFX11-NEXT: v_cmp_nle_f64_e32 vcc_lo, v[0:1], v[4:5]
2886 ; GFX11-NEXT: v_cmp_nle_f64_e64 s0, v[2:3], v[4:5]
2887 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2888 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2889 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2891 ; GFX11NONANS-LABEL: test142:
2892 ; GFX11NONANS: ; %bb.0:
2893 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2894 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
2895 ; GFX11NONANS-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
2896 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2897 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2898 %cmp1 = fcmp ugt double %arg1, %arg3
2899 %cmp2 = fcmp ugt double %arg2, %arg3
2900 %or1 = or i1 %cmp1, %cmp2
2904 define i1 @test143(float %arg1, float %arg2, float %arg3) #0 {
2905 ; GFX11-LABEL: test143:
2907 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2908 ; GFX11-NEXT: v_cmp_nlt_f32_e32 vcc_lo, v0, v2
2909 ; GFX11-NEXT: v_cmp_nlt_f32_e64 s0, v1, v2
2910 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2911 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2912 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2914 ; GFX11NONANS-LABEL: test143:
2915 ; GFX11NONANS: ; %bb.0:
2916 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2917 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
2918 ; GFX11NONANS-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
2919 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2920 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2921 %cmp1 = fcmp uge float %arg1, %arg3
2922 %cmp2 = fcmp uge float %arg2, %arg3
2923 %or1 = or i1 %cmp1, %cmp2
2927 define i1 @test144(float %arg1, float %arg2, float %arg3) #0 {
2928 ; GFX11-LABEL: test144:
2930 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2931 ; GFX11-NEXT: v_cmp_ngt_f32_e32 vcc_lo, v0, v2
2932 ; GFX11-NEXT: v_cmp_ngt_f32_e64 s0, v1, v2
2933 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2934 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2935 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2937 ; GFX11NONANS-LABEL: test144:
2938 ; GFX11NONANS: ; %bb.0:
2939 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2940 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
2941 ; GFX11NONANS-NEXT: v_cmp_le_f32_e32 vcc_lo, v0, v2
2942 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2943 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2944 %cmp1 = fcmp ule float %arg1, %arg3
2945 %cmp2 = fcmp ule float %arg2, %arg3
2946 %or1 = or i1 %cmp1, %cmp2
2950 define i1 @test145(double %arg1, double %arg2, double %arg3) #0 {
2951 ; GFX11-LABEL: test145:
2953 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2954 ; GFX11-NEXT: v_cmp_nge_f64_e32 vcc_lo, v[0:1], v[4:5]
2955 ; GFX11-NEXT: v_cmp_nge_f64_e64 s0, v[2:3], v[4:5]
2956 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
2957 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2958 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2960 ; GFX11NONANS-LABEL: test145:
2961 ; GFX11NONANS: ; %bb.0:
2962 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2963 ; GFX11NONANS-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
2964 ; GFX11NONANS-NEXT: v_cmp_lt_f64_e32 vcc_lo, v[0:1], v[4:5]
2965 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2966 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2967 %cmp1 = fcmp ult double %arg1, %arg3
2968 %cmp2 = fcmp ult double %arg2, %arg3
2969 %or1 = or i1 %cmp1, %cmp2
2973 define i1 @test146(float %arg1, float %arg2, float %arg3) {
2974 ; GFX11-LABEL: test146:
2976 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2977 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
2978 ; GFX11-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
2979 ; GFX11-NEXT: v_cmp_lt_f32_e64 s0, v1, v2
2980 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
2981 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
2982 ; GFX11-NEXT: s_setpc_b64 s[30:31]
2984 ; GFX11NONANS-LABEL: test146:
2985 ; GFX11NONANS: ; %bb.0:
2986 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
2987 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
2988 ; GFX11NONANS-NEXT: v_cmp_lt_f32_e32 vcc_lo, v0, v2
2989 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
2990 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
2991 %var1 = call float @llvm.canonicalize.f32(float %arg1)
2992 %var2 = call float @llvm.canonicalize.f32(float %arg2)
2993 %cmp1 = fcmp olt float %var1, %arg3
2994 %cmp2 = fcmp olt float %var2, %arg3
2995 %and1 = and i1 %cmp1, %cmp2
2999 define i1 @test147(double %arg1, double %arg2, double %arg3) {
3000 ; GFX11-LABEL: test147:
3002 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3003 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
3004 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3005 ; GFX11-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
3006 ; GFX11-NEXT: v_cmp_le_f64_e64 s0, v[2:3], v[4:5]
3007 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
3008 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
3009 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3011 ; GFX11NONANS-LABEL: test147:
3012 ; GFX11NONANS: ; %bb.0:
3013 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3014 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
3015 ; GFX11NONANS-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3016 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
3017 ; GFX11NONANS-NEXT: v_cmp_le_f64_e32 vcc_lo, v[0:1], v[4:5]
3018 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
3019 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
3020 %var1 = call double @llvm.canonicalize.f64(double %arg1)
3021 %var2 = call double @llvm.canonicalize.f64(double %arg2)
3022 %cmp1 = fcmp ole double %var1, %arg3
3023 %cmp2 = fcmp ole double %var2, %arg3
3024 %and1 = and i1 %cmp1, %cmp2
3028 define i1 @test148(double %arg1, double %arg2, double %arg3) {
3029 ; GFX11-LABEL: test148:
3031 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3032 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
3033 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3034 ; GFX11-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
3035 ; GFX11-NEXT: v_cmp_gt_f64_e64 s0, v[2:3], v[4:5]
3036 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
3037 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
3038 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3040 ; GFX11NONANS-LABEL: test148:
3041 ; GFX11NONANS: ; %bb.0:
3042 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3043 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
3044 ; GFX11NONANS-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3045 ; GFX11NONANS-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
3046 ; GFX11NONANS-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
3047 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
3048 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
3049 %var1 = call double @llvm.canonicalize.f64(double %arg1)
3050 %var2 = call double @llvm.canonicalize.f64(double %arg2)
3051 %cmp1 = fcmp ogt double %var1, %arg3
3052 %cmp2 = fcmp ogt double %var2, %arg3
3053 %and1 = and i1 %cmp1, %cmp2
3057 define i1 @test149(float %arg1, float %arg2, float %arg3) {
3058 ; GFX11-LABEL: test149:
3060 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3061 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
3062 ; GFX11-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
3063 ; GFX11-NEXT: v_cmp_ge_f32_e64 s0, v1, v2
3064 ; GFX11-NEXT: s_and_b32 s0, vcc_lo, s0
3065 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
3066 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3068 ; GFX11NONANS-LABEL: test149:
3069 ; GFX11NONANS: ; %bb.0:
3070 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3071 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
3072 ; GFX11NONANS-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
3073 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
3074 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
3075 %var1 = call float @llvm.canonicalize.f32(float %arg1)
3076 %var2 = call float @llvm.canonicalize.f32(float %arg2)
3077 %cmp1 = fcmp oge float %var1, %arg3
3078 %cmp2 = fcmp oge float %var2, %arg3
3079 %and1 = and i1 %cmp1, %cmp2
3083 define i1 @test150(double %arg1, double %arg2, double %arg3) {
3084 ; GFX11-LABEL: test150:
3086 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3087 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
3088 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3089 ; GFX11-NEXT: v_cmp_nle_f64_e32 vcc_lo, v[0:1], v[4:5]
3090 ; GFX11-NEXT: v_cmp_nle_f64_e64 s0, v[2:3], v[4:5]
3091 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3092 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
3093 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3095 ; GFX11NONANS-LABEL: test150:
3096 ; GFX11NONANS: ; %bb.0:
3097 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3098 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
3099 ; GFX11NONANS-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3100 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[2:3]
3101 ; GFX11NONANS-NEXT: v_cmp_gt_f64_e32 vcc_lo, v[0:1], v[4:5]
3102 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
3103 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
3104 %var1 = call double @llvm.canonicalize.f64(double %arg1)
3105 %var2 = call double @llvm.canonicalize.f64(double %arg2)
3106 %cmp1 = fcmp ugt double %var1, %arg3
3107 %cmp2 = fcmp ugt double %var2, %arg3
3108 %or1 = or i1 %cmp1, %cmp2
3112 define i1 @test151(float %arg1, float %arg2, float %arg3) {
3113 ; GFX11-LABEL: test151:
3115 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3116 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
3117 ; GFX11-NEXT: v_cmp_nlt_f32_e32 vcc_lo, v0, v2
3118 ; GFX11-NEXT: v_cmp_nlt_f32_e64 s0, v1, v2
3119 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3120 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
3121 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3123 ; GFX11NONANS-LABEL: test151:
3124 ; GFX11NONANS: ; %bb.0:
3125 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3126 ; GFX11NONANS-NEXT: v_max_f32_e32 v0, v0, v1
3127 ; GFX11NONANS-NEXT: v_cmp_ge_f32_e32 vcc_lo, v0, v2
3128 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
3129 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
3130 %var1 = call float @llvm.canonicalize.f32(float %arg1)
3131 %var2 = call float @llvm.canonicalize.f32(float %arg2)
3132 %cmp1 = fcmp uge float %var1, %arg3
3133 %cmp2 = fcmp uge float %var2, %arg3
3134 %or1 = or i1 %cmp1, %cmp2
3138 define i1 @test152(float %arg1, float %arg2, float %arg3) {
3139 ; GFX11-LABEL: test152:
3141 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3142 ; GFX11-NEXT: v_dual_max_f32 v0, v0, v0 :: v_dual_max_f32 v1, v1, v1
3143 ; GFX11-NEXT: v_cmp_ngt_f32_e32 vcc_lo, v0, v2
3144 ; GFX11-NEXT: v_cmp_ngt_f32_e64 s0, v1, v2
3145 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3146 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
3147 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3149 ; GFX11NONANS-LABEL: test152:
3150 ; GFX11NONANS: ; %bb.0:
3151 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3152 ; GFX11NONANS-NEXT: v_min_f32_e32 v0, v0, v1
3153 ; GFX11NONANS-NEXT: v_cmp_le_f32_e32 vcc_lo, v0, v2
3154 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
3155 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
3156 %var1 = call float @llvm.canonicalize.f32(float %arg1)
3157 %var2 = call float @llvm.canonicalize.f32(float %arg2)
3158 %cmp1 = fcmp ule float %var1, %arg3
3159 %cmp2 = fcmp ule float %var2, %arg3
3160 %or1 = or i1 %cmp1, %cmp2
3164 define i1 @test153(double %arg1, double %arg2, double %arg3) {
3165 ; GFX11-LABEL: test153:
3167 ; GFX11-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3168 ; GFX11-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
3169 ; GFX11-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3170 ; GFX11-NEXT: v_cmp_nge_f64_e32 vcc_lo, v[0:1], v[4:5]
3171 ; GFX11-NEXT: v_cmp_nge_f64_e64 s0, v[2:3], v[4:5]
3172 ; GFX11-NEXT: s_or_b32 s0, vcc_lo, s0
3173 ; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0
3174 ; GFX11-NEXT: s_setpc_b64 s[30:31]
3176 ; GFX11NONANS-LABEL: test153:
3177 ; GFX11NONANS: ; %bb.0:
3178 ; GFX11NONANS-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
3179 ; GFX11NONANS-NEXT: v_max_f64 v[0:1], v[0:1], v[0:1]
3180 ; GFX11NONANS-NEXT: v_max_f64 v[2:3], v[2:3], v[2:3]
3181 ; GFX11NONANS-NEXT: v_min_f64 v[0:1], v[0:1], v[2:3]
3182 ; GFX11NONANS-NEXT: v_cmp_lt_f64_e32 vcc_lo, v[0:1], v[4:5]
3183 ; GFX11NONANS-NEXT: v_cndmask_b32_e64 v0, 0, 1, vcc_lo
3184 ; GFX11NONANS-NEXT: s_setpc_b64 s[30:31]
3185 %var1 = call double @llvm.canonicalize.f64(double %arg1)
3186 %var2 = call double @llvm.canonicalize.f64(double %arg2)
3187 %cmp1 = fcmp ult double %var1, %arg3
3188 %cmp2 = fcmp ult double %var2, %arg3
3189 %or1 = or i1 %cmp1, %cmp2
3193 declare double @llvm.canonicalize.f64(double)
3194 declare float @llvm.canonicalize.f32(float)
3195 declare half @llvm.canonicalize.f16(half)
3196 declare <2 x half> @llvm.canonicalize.v2f16(<2 x half>)
3198 attributes #0 = { nounwind "amdgpu-ieee"="false" }
3199 attributes #1 = { nounwind "unsafe-fp-math"="true" "no-nans-fp-math"="true" }