1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=tahiti -run-pass=instruction-select -global-isel-abort=0 -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
3 # RUN: llc -march=amdgcn -mcpu=fiji -run-pass=instruction-select -global-isel-abort=0 -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
4 # RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=instruction-select -global-isel-abort=0 -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
10 tracksRegLiveness: true
15 ; GCN-LABEL: name: fneg_s32_ss
16 ; GCN: liveins: $sgpr0
17 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
18 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
19 ; GCN: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 [[COPY]], [[S_MOV_B32_]], implicit-def $scc
20 ; GCN: $sgpr0 = COPY [[S_XOR_B32_]]
21 %0:sgpr(s32) = COPY $sgpr0
22 %1:sgpr(s32) = G_FNEG %0
30 tracksRegLiveness: true
35 ; GCN-LABEL: name: fneg_s32_vv
36 ; GCN: liveins: $vgpr0
37 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
38 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
39 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec
40 ; GCN: $vgpr0 = COPY [[V_XOR_B32_e32_]]
41 %0:vgpr(s32) = COPY $vgpr0
42 %1:vgpr(s32) = G_FNEG %0
50 tracksRegLiveness: true
55 ; GCN-LABEL: name: fneg_s32_vs
56 ; GCN: liveins: $sgpr0
57 ; GCN: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
58 ; GCN: [[FNEG:%[0-9]+]]:vgpr_32(s32) = G_FNEG [[COPY]]
59 ; GCN: $vgpr0 = COPY [[FNEG]](s32)
60 %0:sgpr(s32) = COPY $sgpr0
61 %1:vgpr(s32) = G_FNEG %0
69 tracksRegLiveness: true
74 ; GCN-LABEL: name: fneg_s16_ss
75 ; GCN: liveins: $sgpr0
76 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
77 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
78 ; GCN: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 [[COPY]], [[S_MOV_B32_]], implicit-def $scc
79 ; GCN: $sgpr0 = COPY [[S_XOR_B32_]]
80 %0:sgpr(s32) = COPY $sgpr0
81 %1:sgpr(s16) = G_TRUNC %0
82 %2:sgpr(s16) = G_FNEG %1
83 %3:sgpr(s32) = G_ANYEXT %2
91 tracksRegLiveness: true
96 ; GCN-LABEL: name: fneg_s16_vv
97 ; GCN: liveins: $vgpr0
98 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
99 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
100 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec
101 ; GCN: $vgpr0 = COPY [[V_XOR_B32_e32_]]
102 %0:vgpr(s32) = COPY $vgpr0
103 %1:vgpr(s16) = G_TRUNC %0
104 %2:vgpr(s16) = G_FNEG %1
105 %3:vgpr(s32) = G_ANYEXT %2
112 regBankSelected: true
113 tracksRegLiveness: true
119 ; GCN-LABEL: name: fneg_s16_vs
120 ; GCN: liveins: $sgpr0
121 ; GCN: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
122 ; GCN: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
123 ; GCN: [[FNEG:%[0-9]+]]:vgpr_32(s16) = G_FNEG [[TRUNC]]
124 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32(s32) = COPY [[FNEG]](s16)
125 ; GCN: $vgpr0 = COPY [[COPY1]](s32)
126 %0:sgpr(s32) = COPY $sgpr0
127 %1:sgpr(s16) = G_TRUNC %0
128 %2:vgpr(s16) = G_FNEG %1
129 %3:vgpr(s32) = G_ANYEXT %2
136 regBankSelected: true
137 tracksRegLiveness: true
141 liveins: $sgpr0_sgpr1
142 ; GCN-LABEL: name: fneg_v2s16_ss
143 ; GCN: liveins: $sgpr0_sgpr1
144 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
145 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147516416
146 ; GCN: [[S_XOR_B32_:%[0-9]+]]:sreg_32 = S_XOR_B32 [[COPY]], [[S_MOV_B32_]], implicit-def $scc
147 ; GCN: $sgpr0 = COPY [[S_XOR_B32_]]
148 %0:sgpr(<2 x s16>) = COPY $sgpr0
149 %1:sgpr(<2 x s16>) = G_FNEG %0
156 regBankSelected: true
157 tracksRegLiveness: true
162 ; GCN-LABEL: name: fneg_v2s16_vv
163 ; GCN: liveins: $vgpr0
164 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
165 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147516416
166 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec
167 ; GCN: $vgpr0 = COPY [[V_XOR_B32_e32_]]
168 %0:vgpr(<2 x s16>) = COPY $vgpr0
169 %1:vgpr(<2 x s16>) = G_FNEG %0
176 regBankSelected: true
177 tracksRegLiveness: true
182 ; GCN-LABEL: name: fneg_v2s16_vs
183 ; GCN: liveins: $sgpr0
184 ; GCN: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
185 ; GCN: [[FNEG:%[0-9]+]]:vgpr_32(<2 x s16>) = G_FNEG [[COPY]]
186 ; GCN: $vgpr0 = COPY [[FNEG]](<2 x s16>)
187 %0:sgpr(<2 x s16>) = COPY $sgpr0
188 %1:vgpr(<2 x s16>) = G_FNEG %0
195 regBankSelected: true
196 tracksRegLiveness: true
200 liveins: $sgpr0_sgpr1
201 ; GCN-LABEL: name: fneg_s64_ss
202 ; GCN: liveins: $sgpr0_sgpr1
203 ; GCN: [[COPY:%[0-9]+]]:sgpr(s64) = COPY $sgpr0_sgpr1
204 ; GCN: [[FNEG:%[0-9]+]]:sreg_64_xexec(s64) = G_FNEG [[COPY]]
205 ; GCN: $sgpr0_sgpr1 = COPY [[FNEG]](s64)
206 %0:sgpr(s64) = COPY $sgpr0_sgpr1
207 %1:sgpr(s64) = G_FNEG %0
208 $sgpr0_sgpr1 = COPY %1
214 regBankSelected: true
215 tracksRegLiveness: true
219 liveins: $vgpr0_vgpr1
220 ; GCN-LABEL: name: fneg_s64_vv
221 ; GCN: liveins: $vgpr0_vgpr1
222 ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
223 ; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 2147483648, implicit $exec
224 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub1
225 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[COPY1]], [[V_MOV_B32_e32_]], implicit $exec
226 ; GCN: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
227 ; GCN: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY2]], %subreg.sub0, [[V_XOR_B32_e32_]], %subreg.sub1
228 ; GCN: $vgpr0_vgpr1 = COPY [[REG_SEQUENCE]]
229 %0:vgpr(s64) = COPY $vgpr0_vgpr1
230 %1:vgpr(s64) = G_FNEG %0
231 $vgpr0_vgpr1 = COPY %1
237 regBankSelected: true
238 tracksRegLiveness: true
242 liveins: $sgpr0_sgpr1
243 ; GCN-LABEL: name: fneg_s64_vs
244 ; GCN: liveins: $sgpr0_sgpr1
245 ; GCN: [[COPY:%[0-9]+]]:sgpr(s64) = COPY $sgpr0_sgpr1
246 ; GCN: [[FNEG:%[0-9]+]]:vreg_64(s64) = G_FNEG [[COPY]]
247 ; GCN: $vgpr0_vgpr1 = COPY [[FNEG]](s64)
248 %0:sgpr(s64) = COPY $sgpr0_sgpr1
249 %1:vgpr(s64) = G_FNEG %0
250 $vgpr0_vgpr1 = COPY %1
254 name: fneg_fabs_s32_ss
256 regBankSelected: true
257 tracksRegLiveness: true
261 liveins: $sgpr0_sgpr1
262 ; GCN-LABEL: name: fneg_fabs_s32_ss
263 ; GCN: liveins: $sgpr0_sgpr1
264 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
265 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
266 ; GCN: [[S_OR_B32_:%[0-9]+]]:sreg_32 = S_OR_B32 [[COPY]], [[S_MOV_B32_]], implicit-def $scc
267 ; GCN: $sgpr0 = COPY [[S_OR_B32_]]
268 %0:sgpr(s32) = COPY $sgpr0
269 %1:sgpr(s32) = G_FABS %0
270 %2:sgpr(s32) = G_FNEG %1
275 name: fneg_fabs_s32_vv
277 regBankSelected: true
278 tracksRegLiveness: true
283 ; GCN-LABEL: name: fneg_fabs_s32_vv
284 ; GCN: liveins: $vgpr0
285 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
286 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147483648
287 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec
288 ; GCN: $vgpr0 = COPY [[V_XOR_B32_e32_]]
289 %0:vgpr(s32) = COPY $vgpr0
290 %1:vgpr(s32) = G_FABS %0
291 %2:vgpr(s32) = G_FNEG %0
296 name: fneg_fabs_s32_vs
298 regBankSelected: true
299 tracksRegLiveness: true
304 ; GCN-LABEL: name: fneg_fabs_s32_vs
305 ; GCN: liveins: $sgpr0
306 ; GCN: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
307 ; GCN: [[FABS:%[0-9]+]]:vgpr_32(s32) = G_FABS [[COPY]]
308 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32(s16) = S_MOV_B32 2147483648
309 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32(s32) = V_XOR_B32_e32 [[S_MOV_B32_]](s16), [[FABS]](s32), implicit $exec
310 ; GCN: $vgpr0 = COPY [[V_XOR_B32_e32_]](s32)
311 %0:sgpr(s32) = COPY $sgpr0
312 %1:vgpr(s32) = G_FABS %0
313 %2:vgpr(s32) = G_FNEG %1
318 name: fneg_fabs_s16_ss
320 regBankSelected: true
321 tracksRegLiveness: true
326 ; GCN-LABEL: name: fneg_fabs_s16_ss
327 ; GCN: liveins: $sgpr0
328 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
329 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
330 ; GCN: [[S_OR_B32_:%[0-9]+]]:sreg_32 = S_OR_B32 [[COPY]], [[S_MOV_B32_]], implicit-def $scc
331 ; GCN: $sgpr0 = COPY [[S_OR_B32_]]
332 %0:sgpr(s32) = COPY $sgpr0
333 %1:sgpr(s16) = G_TRUNC %0
334 %2:sgpr(s16) = G_FABS %1
335 %3:sgpr(s16) = G_FNEG %2
336 %4:sgpr(s32) = G_ANYEXT %3
341 name: fneg_fabs_s16_vv
343 regBankSelected: true
344 tracksRegLiveness: true
349 ; GCN-LABEL: name: fneg_fabs_s16_vv
350 ; GCN: liveins: $vgpr0
351 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
352 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 32768
353 ; GCN: [[V_OR_B32_e32_:%[0-9]+]]:vgpr_32 = V_OR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec
354 ; GCN: [[COPY1:%[0-9]+]]:sreg_32 = COPY [[V_OR_B32_e32_]]
355 ; GCN: $vgpr0 = COPY [[COPY1]]
356 %0:vgpr(s32) = COPY $vgpr0
357 %1:vgpr(s16) = G_TRUNC %0
358 %2:vgpr(s16) = G_FABS %1
359 %3:vgpr(s16) = G_FNEG %2
360 %4:sgpr(s32) = G_ANYEXT %3
365 name: fneg_fabs_s16_vs
367 regBankSelected: true
368 tracksRegLiveness: true
374 ; GCN-LABEL: name: fneg_fabs_s16_vs
375 ; GCN: liveins: $sgpr0
376 ; GCN: [[COPY:%[0-9]+]]:sgpr(s32) = COPY $sgpr0
377 ; GCN: [[TRUNC:%[0-9]+]]:sgpr(s16) = G_TRUNC [[COPY]](s32)
378 ; GCN: [[FNEG:%[0-9]+]]:sgpr(s16) = G_FNEG [[TRUNC]]
379 ; GCN: [[FNEG1:%[0-9]+]]:vgpr_32(s16) = G_FNEG [[FNEG]]
380 ; GCN: [[COPY1:%[0-9]+]]:sreg_32(s32) = COPY [[FNEG1]](s16)
381 ; GCN: $vgpr0 = COPY [[COPY1]](s32)
382 %0:sgpr(s32) = COPY $sgpr0
383 %1:sgpr(s16) = G_TRUNC %0
384 %2:sgpr(s16) = G_FNEG %1
385 %3:vgpr(s16) = G_FNEG %2
386 %4:sgpr(s32) = G_ANYEXT %3
391 name: fneg_fabs_v2s16_ss
393 regBankSelected: true
394 tracksRegLiveness: true
398 liveins: $sgpr0_sgpr1
399 ; GCN-LABEL: name: fneg_fabs_v2s16_ss
400 ; GCN: liveins: $sgpr0_sgpr1
401 ; GCN: [[COPY:%[0-9]+]]:sreg_32 = COPY $sgpr0
402 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147516416
403 ; GCN: [[S_OR_B32_:%[0-9]+]]:sreg_32 = S_OR_B32 [[COPY]], [[S_MOV_B32_]], implicit-def $scc
404 ; GCN: $sgpr0 = COPY [[S_OR_B32_]]
405 %0:sgpr(<2 x s16>) = COPY $sgpr0
406 %1:sgpr(<2 x s16>) = G_FABS %0
407 %2:sgpr(<2 x s16>) = G_FNEG %1
412 name: fneg_fabs_v2s16_vv
414 regBankSelected: true
415 tracksRegLiveness: true
420 ; GCN-LABEL: name: fneg_fabs_v2s16_vv
421 ; GCN: liveins: $vgpr0
422 ; GCN: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
423 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 2147516416
424 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e32 [[S_MOV_B32_]], [[COPY]], implicit $exec
425 ; GCN: $vgpr0 = COPY [[V_XOR_B32_e32_]]
426 %0:vgpr(<2 x s16>) = COPY $vgpr0
427 %1:vgpr(<2 x s16>) = G_FABS %0
428 %2:vgpr(<2 x s16>) = G_FNEG %0
433 name: fneg_fabs_v2s16_vs
435 regBankSelected: true
436 tracksRegLiveness: true
441 ; GCN-LABEL: name: fneg_fabs_v2s16_vs
442 ; GCN: liveins: $sgpr0
443 ; GCN: [[COPY:%[0-9]+]]:sgpr(<2 x s16>) = COPY $sgpr0
444 ; GCN: [[FABS:%[0-9]+]]:vgpr_32(<2 x s16>) = G_FABS [[COPY]]
445 ; GCN: [[S_MOV_B32_:%[0-9]+]]:sreg_32(s16) = S_MOV_B32 2147516416
446 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32(<2 x s16>) = V_XOR_B32_e32 [[S_MOV_B32_]](s16), [[FABS]](<2 x s16>), implicit $exec
447 ; GCN: $vgpr0 = COPY [[V_XOR_B32_e32_]](<2 x s16>)
448 %0:sgpr(<2 x s16>) = COPY $sgpr0
449 %1:vgpr(<2 x s16>) = G_FABS %0
450 %2:vgpr(<2 x s16>) = G_FNEG %1
455 name: fneg_fabs_s64_ss
457 regBankSelected: true
458 tracksRegLiveness: true
462 liveins: $sgpr0_sgpr1
463 ; GCN-LABEL: name: fneg_fabs_s64_ss
464 ; GCN: liveins: $sgpr0_sgpr1
465 ; GCN: [[COPY:%[0-9]+]]:sgpr(s64) = COPY $sgpr0_sgpr1
466 ; GCN: [[FABS:%[0-9]+]]:sgpr(s64) = G_FABS [[COPY]]
467 ; GCN: [[FNEG:%[0-9]+]]:sreg_64_xexec(s64) = G_FNEG [[FABS]]
468 ; GCN: $sgpr0_sgpr1 = COPY [[FNEG]](s64)
469 %0:sgpr(s64) = COPY $sgpr0_sgpr1
470 %1:sgpr(s64) = G_FABS %0
471 %2:sgpr(s64) = G_FNEG %1
472 $sgpr0_sgpr1 = COPY %2
476 name: fneg_fabs_s64_vv
478 regBankSelected: true
479 tracksRegLiveness: true
483 liveins: $vgpr0_vgpr1
484 ; GCN-LABEL: name: fneg_fabs_s64_vv
485 ; GCN: liveins: $vgpr0_vgpr1
486 ; GCN: [[COPY:%[0-9]+]]:vreg_64 = COPY $vgpr0_vgpr1
487 ; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 2147483648, implicit $exec
488 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub1
489 ; GCN: [[V_OR_B32_e32_:%[0-9]+]]:vgpr_32 = V_OR_B32_e32 [[COPY1]], [[V_MOV_B32_e32_]], implicit $exec
490 ; GCN: [[COPY2:%[0-9]+]]:vgpr_32 = COPY [[COPY]].sub0
491 ; GCN: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY2]], %subreg.sub0, [[V_OR_B32_e32_]], %subreg.sub1
492 ; GCN: $vgpr0_vgpr1 = COPY [[REG_SEQUENCE]]
493 %0:vgpr(s64) = COPY $vgpr0_vgpr1
494 %1:vgpr(s64) = G_FABS %0
495 %2:vgpr(s64) = G_FNEG %1
496 $vgpr0_vgpr1 = COPY %2
500 name: fneg_fabs_s64_vs
502 regBankSelected: true
503 tracksRegLiveness: true
507 liveins: $sgpr0_sgpr1
508 ; GCN-LABEL: name: fneg_fabs_s64_vs
509 ; GCN: liveins: $sgpr0_sgpr1
510 ; GCN: [[COPY:%[0-9]+]]:sgpr(s64) = COPY $sgpr0_sgpr1
511 ; GCN: [[FABS:%[0-9]+]]:vreg_64(s64) = G_FABS [[COPY]]
512 ; GCN: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32(s32) = V_MOV_B32_e32 2147483648, implicit $exec
513 ; GCN: [[COPY1:%[0-9]+]]:vgpr_32(s32) = COPY [[FABS]].sub1(s64)
514 ; GCN: [[V_XOR_B32_e32_:%[0-9]+]]:vgpr_32(s16) = V_XOR_B32_e32 [[COPY1]](s32), [[V_MOV_B32_e32_]](s32), implicit $exec
515 ; GCN: [[COPY2:%[0-9]+]]:vgpr_32(s32) = COPY [[FABS]].sub0(s64)
516 ; GCN: [[REG_SEQUENCE:%[0-9]+]]:vreg_64(s64) = REG_SEQUENCE [[COPY2]](s32), %subreg.sub0, [[V_XOR_B32_e32_]](s16), %subreg.sub1
517 ; GCN: $vgpr0_vgpr1 = COPY [[REG_SEQUENCE]](s64)
518 %0:sgpr(s64) = COPY $sgpr0_sgpr1
519 %1:vgpr(s64) = G_FABS %0
520 %2:vgpr(s64) = G_FNEG %1
521 $vgpr0_vgpr1 = COPY %2