1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=tahiti -run-pass=instruction-select -verify-machineinstrs -global-isel %s -o - | FileCheck %s -check-prefixes=GCN
11 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
13 ; GCN-LABEL: name: select_s32_scc
14 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
15 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
16 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
17 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
18 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
19 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
20 ; GCN-NEXT: $scc = COPY [[COPY4]]
21 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY2]], [[COPY3]], implicit $scc
22 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
23 %0:sgpr(s32) = COPY $sgpr0
24 %1:sgpr(s32) = COPY $sgpr1
25 %2:sgpr(s32) = COPY $sgpr2
26 %3:sgpr(s32) = COPY $sgpr3
27 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
28 %5:sgpr(s32) = G_SELECT %4, %2, %3
29 S_ENDPGM 0, implicit %5
40 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
42 ; GCN-LABEL: name: select_s64_scc
43 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
44 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
45 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
46 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
47 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
48 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
49 ; GCN-NEXT: $scc = COPY [[COPY4]]
50 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
51 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
52 %0:sgpr(s32) = COPY $sgpr0
53 %1:sgpr(s32) = COPY $sgpr1
54 %2:sgpr(s64) = COPY $sgpr2_sgpr3
55 %3:sgpr(s64) = COPY $sgpr4_sgpr5
56 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
57 %5:sgpr(s64) = G_SELECT %4, %2, %3
58 S_ENDPGM 0, implicit %5
69 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
71 ; GCN-LABEL: name: select_p0_scc
72 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
73 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
74 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
75 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
76 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
77 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
78 ; GCN-NEXT: $scc = COPY [[COPY4]]
79 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
80 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
81 %0:sgpr(s32) = COPY $sgpr0
82 %1:sgpr(s32) = COPY $sgpr1
83 %2:sgpr(p0) = COPY $sgpr2_sgpr3
84 %3:sgpr(p0) = COPY $sgpr4_sgpr5
85 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
86 %5:sgpr(p0) = G_SELECT %4, %2, %3
87 S_ENDPGM 0, implicit %5
98 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
100 ; GCN-LABEL: name: select_p1_scc
101 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
102 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
103 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
104 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
105 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
106 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
107 ; GCN-NEXT: $scc = COPY [[COPY4]]
108 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
109 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
110 %0:sgpr(s32) = COPY $sgpr0
111 %1:sgpr(s32) = COPY $sgpr1
112 %2:sgpr(p1) = COPY $sgpr2_sgpr3
113 %3:sgpr(p1) = COPY $sgpr4_sgpr5
114 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
115 %5:sgpr(p1) = G_SELECT %4, %2, %3
116 S_ENDPGM 0, implicit %5
121 name: select_p999_scc
123 regBankSelected: true
127 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
129 ; GCN-LABEL: name: select_p999_scc
130 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
131 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
132 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
133 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
134 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
135 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
136 ; GCN-NEXT: $scc = COPY [[COPY4]]
137 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
138 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
139 %0:sgpr(s32) = COPY $sgpr0
140 %1:sgpr(s32) = COPY $sgpr1
141 %2:sgpr(p999) = COPY $sgpr2_sgpr3
142 %3:sgpr(p999) = COPY $sgpr4_sgpr5
143 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
144 %5:sgpr(p999) = G_SELECT %4, %2, %3
145 S_ENDPGM 0, implicit %5
150 name: select_v4s16_scc
152 regBankSelected: true
156 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
158 ; GCN-LABEL: name: select_v4s16_scc
159 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
160 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
161 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
162 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
163 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
164 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
165 ; GCN-NEXT: $scc = COPY [[COPY4]]
166 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
167 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
168 %0:sgpr(s32) = COPY $sgpr0
169 %1:sgpr(s32) = COPY $sgpr1
170 %2:sgpr(<4 x s16>) = COPY $sgpr2_sgpr3
171 %3:sgpr(<4 x s16>) = COPY $sgpr4_sgpr5
172 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
173 %5:sgpr(<4 x s16>) = G_SELECT %4, %2, %3
174 S_ENDPGM 0, implicit %5
181 regBankSelected: true
185 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
187 ; GCN-LABEL: name: select_s16_scc
188 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
189 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
190 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
191 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
192 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY2]], [[COPY3]], implicit-def $scc
193 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
194 ; GCN-NEXT: $scc = COPY [[COPY4]]
195 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY]], [[COPY1]], implicit $scc
196 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
197 %0:sgpr(s32) = COPY $sgpr0
198 %1:sgpr(s32) = COPY $sgpr1
199 %2:sgpr(s32) = COPY $sgpr2
200 %3:sgpr(s32) = COPY $sgpr3
201 %4:sgpr(s16) = G_TRUNC %0
202 %5:sgpr(s16) = G_TRUNC %1
203 %6:sgpr(s32) = G_ICMP intpred(eq), %2, %3
204 %7:sgpr(s16) = G_SELECT %6, %4, %5
205 S_ENDPGM 0, implicit %7
210 name: select_v2s16_scc
212 regBankSelected: true
216 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
218 ; GCN-LABEL: name: select_v2s16_scc
219 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
220 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
221 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
222 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
223 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
224 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
225 ; GCN-NEXT: $scc = COPY [[COPY4]]
226 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY2]], [[COPY3]], implicit $scc
227 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
228 %0:sgpr(s32) = COPY $sgpr0
229 %1:sgpr(s32) = COPY $sgpr1
230 %2:sgpr(<2 x s16>) = COPY $sgpr2
231 %3:sgpr(<2 x s16>) = COPY $sgpr3
232 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
233 %5:sgpr(<2 x s16>) = G_SELECT %4, %2, %3
234 S_ENDPGM 0, implicit %5
241 regBankSelected: true
245 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
247 ; GCN-LABEL: name: select_s32_vcc
248 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
249 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
250 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
251 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
252 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
253 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[COPY3]], 0, [[COPY2]], [[V_CMP_EQ_U32_e64_]], implicit $exec
254 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
255 %0:vgpr(s32) = COPY $vgpr0
256 %1:vgpr(s32) = COPY $vgpr1
257 %2:vgpr(s32) = COPY $vgpr2
258 %3:vgpr(s32) = COPY $vgpr3
259 %4:vcc(s1) = G_ICMP intpred(eq), %0, %1
260 %5:vgpr(s32) = G_SELECT %4, %2, %3
261 S_ENDPGM 0, implicit %5
268 regBankSelected: true
272 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
274 ; GCN-LABEL: name: select_s16_vcc
275 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
276 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
277 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
278 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
279 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY2]], [[COPY3]], implicit $exec
280 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[COPY1]], 0, [[COPY]], [[V_CMP_EQ_U32_e64_]], implicit $exec
281 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
282 %0:vgpr(s32) = COPY $vgpr0
283 %1:vgpr(s32) = COPY $vgpr1
284 %2:vgpr(s32) = COPY $vgpr2
285 %3:vgpr(s32) = COPY $vgpr3
286 %4:vgpr(s16) = G_TRUNC %0
287 %5:vgpr(s16) = G_TRUNC %1
288 %6:vcc(s1) = G_ICMP intpred(eq), %2, %3
289 %7:vgpr(s16) = G_SELECT %6, %4, %5
290 S_ENDPGM 0, implicit %7
295 name: select_v2s16_vcc
297 regBankSelected: true
301 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
303 ; GCN-LABEL: name: select_v2s16_vcc
304 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
305 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
306 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
307 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
308 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
309 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[COPY3]], 0, [[COPY2]], [[V_CMP_EQ_U32_e64_]], implicit $exec
310 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
311 %0:vgpr(s32) = COPY $vgpr0
312 %1:vgpr(s32) = COPY $vgpr1
313 %2:vgpr(<2 x s16>) = COPY $vgpr2
314 %3:vgpr(<2 x s16>) = COPY $vgpr3
315 %4:vcc(s1) = G_ICMP intpred(eq), %0, %1
316 %5:vgpr(<2 x s16>) = G_SELECT %4, %2, %3
317 S_ENDPGM 0, implicit %5
324 regBankSelected: true
328 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
330 ; GCN-LABEL: name: select_p3_vcc
331 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
332 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
333 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
334 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
335 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
336 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[COPY3]], 0, [[COPY2]], [[V_CMP_EQ_U32_e64_]], implicit $exec
337 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
338 %0:vgpr(s32) = COPY $vgpr0
339 %1:vgpr(s32) = COPY $vgpr1
340 %2:vgpr(p3) = COPY $vgpr2
341 %3:vgpr(p3) = COPY $vgpr3
342 %4:vcc(s1) = G_ICMP intpred(eq), %0, %1
343 %5:vgpr(p3) = G_SELECT %4, %2, %3
344 S_ENDPGM 0, implicit %5
348 # Fold source modifiers into VOP select
350 name: select_s32_vcc_fneg_lhs
352 regBankSelected: true
356 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
358 ; GCN-LABEL: name: select_s32_vcc_fneg_lhs
359 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
360 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
361 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
362 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
363 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
364 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[COPY3]], 1, [[COPY2]], [[V_CMP_EQ_U32_e64_]], implicit $exec
365 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
366 %0:vgpr(s32) = COPY $vgpr0
367 %1:vgpr(s32) = COPY $vgpr1
368 %2:vgpr(s32) = COPY $vgpr2
369 %3:vgpr(s32) = COPY $vgpr3
370 %4:vgpr(s32) = G_FNEG %2
371 %5:vcc(s1) = G_ICMP intpred(eq), %0, %1
372 %6:vgpr(s32) = G_SELECT %5, %4, %3
373 S_ENDPGM 0, implicit %6
378 name: select_s32_vcc_fneg_rhs
380 regBankSelected: true
384 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
386 ; GCN-LABEL: name: select_s32_vcc_fneg_rhs
387 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
388 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
389 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
390 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
391 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
392 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 1, [[COPY3]], 0, [[COPY2]], [[V_CMP_EQ_U32_e64_]], implicit $exec
393 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
394 %0:vgpr(s32) = COPY $vgpr0
395 %1:vgpr(s32) = COPY $vgpr1
396 %2:vgpr(s32) = COPY $vgpr2
397 %3:vgpr(s32) = COPY $vgpr3
398 %4:vgpr(s32) = G_FNEG %3
399 %5:vcc(s1) = G_ICMP intpred(eq), %0, %1
400 %6:vgpr(s32) = G_SELECT %5, %2, %4
401 S_ENDPGM 0, implicit %6
406 name: select_s32_vcc_fneg_fabs_lhs
408 regBankSelected: true
412 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
414 ; GCN-LABEL: name: select_s32_vcc_fneg_fabs_lhs
415 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
416 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
417 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
418 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
419 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
420 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[COPY2]], 3, [[COPY3]], [[V_CMP_EQ_U32_e64_]], implicit $exec
421 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
422 %0:vgpr(s32) = COPY $vgpr0
423 %1:vgpr(s32) = COPY $vgpr1
424 %2:vgpr(s32) = COPY $vgpr2
425 %3:vgpr(s32) = COPY $vgpr3
426 %4:vgpr(s32) = G_FABS %3
427 %5:vgpr(s32) = G_FNEG %4
428 %6:vcc(s1) = G_ICMP intpred(eq), %0, %1
429 %7:vgpr(s32) = G_SELECT %6, %5, %2
430 S_ENDPGM 0, implicit %7
434 # Make sure we don't try to fold source modifiers into non-32 bit value.
436 name: select_s16_vcc_fneg_lhs
438 regBankSelected: true
442 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
444 ; GCN-LABEL: name: select_s16_vcc_fneg_lhs
445 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
446 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
447 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
448 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
449 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
450 ; GCN-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
451 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY2]], [[COPY3]], implicit $exec
452 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[COPY1]], 0, [[V_XOR_B32_e64_]], [[V_CMP_EQ_U32_e64_]], implicit $exec
453 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
454 %0:vgpr(s32) = COPY $vgpr0
455 %1:vgpr(s32) = COPY $vgpr1
456 %2:vgpr(s32) = COPY $vgpr2
457 %3:vgpr(s32) = COPY $vgpr3
458 %4:vgpr(s16) = G_TRUNC %0
459 %5:vgpr(s16) = G_TRUNC %1
460 %6:vgpr(s16) = G_FNEG %4
461 %7:vcc(s1) = G_ICMP intpred(eq), %2, %3
462 %8:vgpr(s16) = G_SELECT %7, %6, %5
463 S_ENDPGM 0, implicit %8
468 # Make sure we don't try to fold source modifiers into a vector
470 name: select_v2s16_vcc_fneg_lhs
472 regBankSelected: true
476 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
478 ; GCN-LABEL: name: select_v2s16_vcc_fneg_lhs
479 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
480 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
481 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr3
482 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147516416
483 ; GCN-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY2]], implicit $exec
484 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
485 ; GCN-NEXT: [[V_CNDMASK_B32_e64_:%[0-9]+]]:vgpr_32 = V_CNDMASK_B32_e64 0, [[COPY2]], 0, [[V_XOR_B32_e64_]], [[V_CMP_EQ_U32_e64_]], implicit $exec
486 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
487 %0:vgpr(s32) = COPY $vgpr0
488 %1:vgpr(s32) = COPY $vgpr1
489 %2:vgpr(<2 x s16>) = COPY $vgpr2
490 %3:vgpr(<2 x s16>) = COPY $vgpr3
491 %4:vgpr(<2 x s16>) = G_FNEG %3
492 %5:vcc(s1) = G_ICMP intpred(eq), %0, %1
493 %6:vgpr(<2 x s16>) = G_SELECT %5, %4, %3
494 S_ENDPGM 0, implicit %6
498 # Make sure we don't try to fold source modifiers into a scalar select
501 name: select_s32_scc_fneg_lhs
503 regBankSelected: true
507 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
509 ; GCN-LABEL: name: select_s32_scc_fneg_lhs
510 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
511 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
512 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
513 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
514 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
515 ; GCN-NEXT: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 [[COPY2]], [[S_MOV_B32_]], implicit-def $scc
516 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
517 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
518 ; GCN-NEXT: $scc = COPY [[COPY4]]
519 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[S_XOR_B32_]], [[COPY3]], implicit $scc
520 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
521 %0:sgpr(s32) = COPY $sgpr0
522 %1:sgpr(s32) = COPY $sgpr1
523 %2:sgpr(s32) = COPY $sgpr2
524 %3:sgpr(s32) = COPY $sgpr3
525 %4:sgpr(s32) = G_FNEG %2
526 %5:sgpr(s32) = G_ICMP intpred(eq), %0, %1
527 %6:sgpr(s32) = G_SELECT %5, %4, %3
528 S_ENDPGM 0, implicit %6
533 name: select_s32_scc_fneg_rhs
535 regBankSelected: true
539 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
541 ; GCN-LABEL: name: select_s32_scc_fneg_rhs
542 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
543 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
544 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
545 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
546 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
547 ; GCN-NEXT: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 [[COPY3]], [[S_MOV_B32_]], implicit-def $scc
548 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
549 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
550 ; GCN-NEXT: $scc = COPY [[COPY4]]
551 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY2]], [[S_XOR_B32_]], implicit $scc
552 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
553 %0:sgpr(s32) = COPY $sgpr0
554 %1:sgpr(s32) = COPY $sgpr1
555 %2:sgpr(s32) = COPY $sgpr2
556 %3:sgpr(s32) = COPY $sgpr3
557 %4:sgpr(s32) = G_FNEG %3
558 %5:sgpr(s32) = G_ICMP intpred(eq), %0, %1
559 %6:sgpr(s32) = G_SELECT %5, %2, %4
560 S_ENDPGM 0, implicit %6