1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=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: liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
16 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
17 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
18 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
19 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
20 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
21 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
22 ; GCN-NEXT: $scc = COPY [[COPY4]]
23 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY2]], [[COPY3]], implicit $scc
24 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
25 %0:sgpr(s32) = COPY $sgpr0
26 %1:sgpr(s32) = COPY $sgpr1
27 %2:sgpr(s32) = COPY $sgpr2
28 %3:sgpr(s32) = COPY $sgpr3
29 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
30 %5:sgpr(s32) = G_SELECT %4, %2, %3
31 S_ENDPGM 0, implicit %5
42 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
44 ; GCN-LABEL: name: select_s64_scc
45 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
47 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
48 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
49 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
50 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
51 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
52 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
53 ; GCN-NEXT: $scc = COPY [[COPY4]]
54 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
55 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
56 %0:sgpr(s32) = COPY $sgpr0
57 %1:sgpr(s32) = COPY $sgpr1
58 %2:sgpr(s64) = COPY $sgpr2_sgpr3
59 %3:sgpr(s64) = COPY $sgpr4_sgpr5
60 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
61 %5:sgpr(s64) = G_SELECT %4, %2, %3
62 S_ENDPGM 0, implicit %5
73 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
75 ; GCN-LABEL: name: select_p0_scc
76 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
78 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
79 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
80 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
81 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
82 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
83 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
84 ; GCN-NEXT: $scc = COPY [[COPY4]]
85 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
86 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
87 %0:sgpr(s32) = COPY $sgpr0
88 %1:sgpr(s32) = COPY $sgpr1
89 %2:sgpr(p0) = COPY $sgpr2_sgpr3
90 %3:sgpr(p0) = COPY $sgpr4_sgpr5
91 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
92 %5:sgpr(p0) = G_SELECT %4, %2, %3
93 S_ENDPGM 0, implicit %5
100 regBankSelected: true
104 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
106 ; GCN-LABEL: name: select_p1_scc
107 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
109 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
110 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
111 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
112 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
113 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
114 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
115 ; GCN-NEXT: $scc = COPY [[COPY4]]
116 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
117 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
118 %0:sgpr(s32) = COPY $sgpr0
119 %1:sgpr(s32) = COPY $sgpr1
120 %2:sgpr(p1) = COPY $sgpr2_sgpr3
121 %3:sgpr(p1) = COPY $sgpr4_sgpr5
122 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
123 %5:sgpr(p1) = G_SELECT %4, %2, %3
124 S_ENDPGM 0, implicit %5
129 name: select_p999_scc
131 regBankSelected: true
135 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
137 ; GCN-LABEL: name: select_p999_scc
138 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
140 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
141 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
142 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
143 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
144 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
145 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
146 ; GCN-NEXT: $scc = COPY [[COPY4]]
147 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
148 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
149 %0:sgpr(s32) = COPY $sgpr0
150 %1:sgpr(s32) = COPY $sgpr1
151 %2:sgpr(p999) = COPY $sgpr2_sgpr3
152 %3:sgpr(p999) = COPY $sgpr4_sgpr5
153 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
154 %5:sgpr(p999) = G_SELECT %4, %2, %3
155 S_ENDPGM 0, implicit %5
160 name: select_v4s16_scc
162 regBankSelected: true
166 liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
168 ; GCN-LABEL: name: select_v4s16_scc
169 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2_sgpr3, $sgpr4_sgpr5
171 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
172 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
173 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_64 = COPY $sgpr2_sgpr3
174 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_64 = COPY $sgpr4_sgpr5
175 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
176 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
177 ; GCN-NEXT: $scc = COPY [[COPY4]]
178 ; GCN-NEXT: [[S_CSELECT_B64_:%[0-9]+]]:sreg_64 = S_CSELECT_B64 [[COPY2]], [[COPY3]], implicit $scc
179 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B64_]]
180 %0:sgpr(s32) = COPY $sgpr0
181 %1:sgpr(s32) = COPY $sgpr1
182 %2:sgpr(<4 x s16>) = COPY $sgpr2_sgpr3
183 %3:sgpr(<4 x s16>) = COPY $sgpr4_sgpr5
184 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
185 %5:sgpr(<4 x s16>) = G_SELECT %4, %2, %3
186 S_ENDPGM 0, implicit %5
193 regBankSelected: true
197 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
199 ; GCN-LABEL: name: select_s16_scc
200 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
202 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
203 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
204 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
205 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
206 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY2]], [[COPY3]], implicit-def $scc
207 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
208 ; GCN-NEXT: $scc = COPY [[COPY4]]
209 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY]], [[COPY1]], implicit $scc
210 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
211 %0:sgpr(s32) = COPY $sgpr0
212 %1:sgpr(s32) = COPY $sgpr1
213 %2:sgpr(s32) = COPY $sgpr2
214 %3:sgpr(s32) = COPY $sgpr3
215 %4:sgpr(s16) = G_TRUNC %0
216 %5:sgpr(s16) = G_TRUNC %1
217 %6:sgpr(s32) = G_ICMP intpred(eq), %2, %3
218 %7:sgpr(s16) = G_SELECT %6, %4, %5
219 S_ENDPGM 0, implicit %7
224 name: select_v2s16_scc
226 regBankSelected: true
230 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
232 ; GCN-LABEL: name: select_v2s16_scc
233 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
235 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
236 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
237 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
238 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
239 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
240 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
241 ; GCN-NEXT: $scc = COPY [[COPY4]]
242 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY2]], [[COPY3]], implicit $scc
243 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
244 %0:sgpr(s32) = COPY $sgpr0
245 %1:sgpr(s32) = COPY $sgpr1
246 %2:sgpr(<2 x s16>) = COPY $sgpr2
247 %3:sgpr(<2 x s16>) = COPY $sgpr3
248 %4:sgpr(s32) = G_ICMP intpred(eq), %0, %1
249 %5:sgpr(<2 x s16>) = G_SELECT %4, %2, %3
250 S_ENDPGM 0, implicit %5
257 regBankSelected: true
261 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
263 ; GCN-LABEL: name: select_s32_vcc
264 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
266 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
267 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
268 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
269 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
270 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
271 ; 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
272 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
273 %0:vgpr(s32) = COPY $vgpr0
274 %1:vgpr(s32) = COPY $vgpr1
275 %2:vgpr(s32) = COPY $vgpr2
276 %3:vgpr(s32) = COPY $vgpr3
277 %4:vcc(s1) = G_ICMP intpred(eq), %0, %1
278 %5:vgpr(s32) = G_SELECT %4, %2, %3
279 S_ENDPGM 0, implicit %5
286 regBankSelected: true
290 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
292 ; GCN-LABEL: name: select_s16_vcc
293 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
295 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
296 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
297 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
298 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
299 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY2]], [[COPY3]], implicit $exec
300 ; 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
301 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
302 %0:vgpr(s32) = COPY $vgpr0
303 %1:vgpr(s32) = COPY $vgpr1
304 %2:vgpr(s32) = COPY $vgpr2
305 %3:vgpr(s32) = COPY $vgpr3
306 %4:vgpr(s16) = G_TRUNC %0
307 %5:vgpr(s16) = G_TRUNC %1
308 %6:vcc(s1) = G_ICMP intpred(eq), %2, %3
309 %7:vgpr(s16) = G_SELECT %6, %4, %5
310 S_ENDPGM 0, implicit %7
315 name: select_v2s16_vcc
317 regBankSelected: true
321 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
323 ; GCN-LABEL: name: select_v2s16_vcc
324 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
326 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
327 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
328 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
329 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
330 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
331 ; 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
332 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
333 %0:vgpr(s32) = COPY $vgpr0
334 %1:vgpr(s32) = COPY $vgpr1
335 %2:vgpr(<2 x s16>) = COPY $vgpr2
336 %3:vgpr(<2 x s16>) = COPY $vgpr3
337 %4:vcc(s1) = G_ICMP intpred(eq), %0, %1
338 %5:vgpr(<2 x s16>) = G_SELECT %4, %2, %3
339 S_ENDPGM 0, implicit %5
346 regBankSelected: true
350 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
352 ; GCN-LABEL: name: select_p3_vcc
353 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
355 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
356 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
357 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
358 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
359 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
360 ; 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
361 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
362 %0:vgpr(s32) = COPY $vgpr0
363 %1:vgpr(s32) = COPY $vgpr1
364 %2:vgpr(p3) = COPY $vgpr2
365 %3:vgpr(p3) = COPY $vgpr3
366 %4:vcc(s1) = G_ICMP intpred(eq), %0, %1
367 %5:vgpr(p3) = G_SELECT %4, %2, %3
368 S_ENDPGM 0, implicit %5
372 # Fold source modifiers into VOP select
374 name: select_s32_vcc_fneg_lhs
376 regBankSelected: true
380 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
382 ; GCN-LABEL: name: select_s32_vcc_fneg_lhs
383 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
385 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
386 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
387 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
388 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
389 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
390 ; 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
391 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
392 %0:vgpr(s32) = COPY $vgpr0
393 %1:vgpr(s32) = COPY $vgpr1
394 %2:vgpr(s32) = COPY $vgpr2
395 %3:vgpr(s32) = COPY $vgpr3
396 %4:vgpr(s32) = G_FNEG %2
397 %5:vcc(s1) = G_ICMP intpred(eq), %0, %1
398 %6:vgpr(s32) = G_SELECT %5, %4, %3
399 S_ENDPGM 0, implicit %6
404 name: select_s32_vcc_fneg_rhs
406 regBankSelected: true
410 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
412 ; GCN-LABEL: name: select_s32_vcc_fneg_rhs
413 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
415 ; GCN-NEXT: [[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 1, [[COPY3]], 0, [[COPY2]], [[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_FNEG %3
427 %5:vcc(s1) = G_ICMP intpred(eq), %0, %1
428 %6:vgpr(s32) = G_SELECT %5, %2, %4
429 S_ENDPGM 0, implicit %6
434 name: select_s32_vcc_fneg_fabs_lhs
436 regBankSelected: true
440 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
442 ; GCN-LABEL: name: select_s32_vcc_fneg_fabs_lhs
443 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
445 ; GCN-NEXT: [[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: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
450 ; 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
451 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
452 %0:vgpr(s32) = COPY $vgpr0
453 %1:vgpr(s32) = COPY $vgpr1
454 %2:vgpr(s32) = COPY $vgpr2
455 %3:vgpr(s32) = COPY $vgpr3
456 %4:vgpr(s32) = G_FABS %3
457 %5:vgpr(s32) = G_FNEG %4
458 %6:vcc(s1) = G_ICMP intpred(eq), %0, %1
459 %7:vgpr(s32) = G_SELECT %6, %5, %2
460 S_ENDPGM 0, implicit %7
464 # Make sure we don't try to fold source modifiers into non-32 bit value.
466 name: select_s16_vcc_fneg_lhs
468 regBankSelected: true
472 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
474 ; GCN-LABEL: name: select_s16_vcc_fneg_lhs
475 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
477 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
478 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
479 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2
480 ; GCN-NEXT: [[COPY3:%[0-9]+]]:vgpr_32 = COPY $vgpr3
481 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
482 ; GCN-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY]], implicit $exec
483 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY2]], [[COPY3]], implicit $exec
484 ; 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
485 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
486 %0:vgpr(s32) = COPY $vgpr0
487 %1:vgpr(s32) = COPY $vgpr1
488 %2:vgpr(s32) = COPY $vgpr2
489 %3:vgpr(s32) = COPY $vgpr3
490 %4:vgpr(s16) = G_TRUNC %0
491 %5:vgpr(s16) = G_TRUNC %1
492 %6:vgpr(s16) = G_FNEG %4
493 %7:vcc(s1) = G_ICMP intpred(eq), %2, %3
494 %8:vgpr(s16) = G_SELECT %7, %6, %5
495 S_ENDPGM 0, implicit %8
500 # Make sure we don't try to fold source modifiers into a vector
502 name: select_v2s16_vcc_fneg_lhs
504 regBankSelected: true
508 liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
510 ; GCN-LABEL: name: select_v2s16_vcc_fneg_lhs
511 ; GCN: liveins: $vgpr0, $vgpr1, $vgpr2, $vgpr3
513 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
514 ; GCN-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1
515 ; GCN-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr3
516 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147516416
517 ; GCN-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 [[S_MOV_B32_]], [[COPY2]], implicit $exec
518 ; GCN-NEXT: [[V_CMP_EQ_U32_e64_:%[0-9]+]]:sreg_64_xexec = V_CMP_EQ_U32_e64 [[COPY]], [[COPY1]], implicit $exec
519 ; 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
520 ; GCN-NEXT: S_ENDPGM 0, implicit [[V_CNDMASK_B32_e64_]]
521 %0:vgpr(s32) = COPY $vgpr0
522 %1:vgpr(s32) = COPY $vgpr1
523 %2:vgpr(<2 x s16>) = COPY $vgpr2
524 %3:vgpr(<2 x s16>) = COPY $vgpr3
525 %4:vgpr(<2 x s16>) = G_FNEG %3
526 %5:vcc(s1) = G_ICMP intpred(eq), %0, %1
527 %6:vgpr(<2 x s16>) = G_SELECT %5, %4, %3
528 S_ENDPGM 0, implicit %6
532 # Make sure we don't try to fold source modifiers into a scalar select
535 name: select_s32_scc_fneg_lhs
537 regBankSelected: true
541 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
543 ; GCN-LABEL: name: select_s32_scc_fneg_lhs
544 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
546 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
547 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
548 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
549 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
550 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
551 ; GCN-NEXT: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 [[COPY2]], [[S_MOV_B32_]], implicit-def dead $scc
552 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
553 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
554 ; GCN-NEXT: $scc = COPY [[COPY4]]
555 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[S_XOR_B32_]], [[COPY3]], implicit $scc
556 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
557 %0:sgpr(s32) = COPY $sgpr0
558 %1:sgpr(s32) = COPY $sgpr1
559 %2:sgpr(s32) = COPY $sgpr2
560 %3:sgpr(s32) = COPY $sgpr3
561 %4:sgpr(s32) = G_FNEG %2
562 %5:sgpr(s32) = G_ICMP intpred(eq), %0, %1
563 %6:sgpr(s32) = G_SELECT %5, %4, %3
564 S_ENDPGM 0, implicit %6
569 name: select_s32_scc_fneg_rhs
571 regBankSelected: true
575 liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
577 ; GCN-LABEL: name: select_s32_scc_fneg_rhs
578 ; GCN: liveins: $sgpr0, $sgpr1, $sgpr2, $sgpr3
580 ; GCN-NEXT: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
581 ; GCN-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY $sgpr1
582 ; GCN-NEXT: [[COPY2:%[0-9]+]]:sreg_32 = COPY $sgpr2
583 ; GCN-NEXT: [[COPY3:%[0-9]+]]:sreg_32 = COPY $sgpr3
584 ; GCN-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
585 ; GCN-NEXT: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 [[COPY3]], [[S_MOV_B32_]], implicit-def dead $scc
586 ; GCN-NEXT: S_CMP_EQ_U32 [[COPY]], [[COPY1]], implicit-def $scc
587 ; GCN-NEXT: [[COPY4:%[0-9]+]]:sreg_32 = COPY $scc
588 ; GCN-NEXT: $scc = COPY [[COPY4]]
589 ; GCN-NEXT: [[S_CSELECT_B32_:%[0-9]+]]:sreg_32 = S_CSELECT_B32 [[COPY2]], [[S_XOR_B32_]], implicit $scc
590 ; GCN-NEXT: S_ENDPGM 0, implicit [[S_CSELECT_B32_]]
591 %0:sgpr(s32) = COPY $sgpr0
592 %1:sgpr(s32) = COPY $sgpr1
593 %2:sgpr(s32) = COPY $sgpr2
594 %3:sgpr(s32) = COPY $sgpr3
595 %4:sgpr(s32) = G_FNEG %3
596 %5:sgpr(s32) = G_ICMP intpred(eq), %0, %1
597 %6:sgpr(s32) = G_SELECT %5, %2, %4
598 S_ENDPGM 0, implicit %6