1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
2 # RUN: llc -mtriple=amdgcn -mcpu=tonga -run-pass=si-fix-sgpr-copies --verify-machineinstrs -o - %s | FileCheck %s
4 # Copy to $sgpr0 is disconnected and becomes an IMPLICIT_DEF
5 # Inserted V_AND_B32 defines virtual register after use.
8 name: si_fix_sgpr_copies_breaks_function
9 tracksRegLiveness: true
16 ; CHECK-LABEL: name: si_fix_sgpr_copies_breaks_function
17 ; CHECK: liveins: $sgpr0
19 ; CHECK-NEXT: [[COPY:%[0-9]+]]:sgpr_32 = COPY $sgpr0
20 ; CHECK-NEXT: [[S_MOV_B32_:%[0-9]+]]:sreg_32 = S_MOV_B32 16
21 ; CHECK-NEXT: [[S_LSHR_B32_:%[0-9]+]]:sreg_32 = S_LSHR_B32 [[COPY]], killed [[S_MOV_B32_]], implicit-def dead $scc
22 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:sreg_32 = COPY killed [[S_LSHR_B32_]]
23 ; CHECK-NEXT: [[S_MOV_B32_1:%[0-9]+]]:sreg_32 = S_MOV_B32 -32768
24 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY killed [[S_MOV_B32_1]]
25 ; CHECK-NEXT: [[V_XOR_B32_e64_:%[0-9]+]]:vgpr_32 = V_XOR_B32_e64 killed [[COPY1]], [[COPY2]], implicit $exec
26 ; CHECK-NEXT: [[S_MOV_B32_2:%[0-9]+]]:sreg_32 = S_MOV_B32 65535
27 ; CHECK-NEXT: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF
28 ; CHECK-NEXT: [[V_AND_B32_e64_:%[0-9]+]]:vgpr_32 = V_AND_B32_e64 killed [[S_MOV_B32_2]], [[V_XOR_B32_e64_]], implicit $exec
29 ; CHECK-NEXT: $sgpr0 = V_READFIRSTLANE_B32 [[V_AND_B32_e64_]], implicit $exec
30 ; CHECK-NEXT: SI_RETURN_TO_EPILOG $sgpr0
31 %0:sgpr_32 = COPY $sgpr0
32 %2:sreg_32 = S_MOV_B32 16
33 %3:sreg_32 = S_LSHR_B32 %0, killed %2, implicit-def dead $scc
34 %4:sreg_32 = COPY killed %3
35 %5:sreg_32 = S_MOV_B32 -32768
36 %7:vgpr_32 = COPY killed %5
37 %6:vgpr_32 = V_XOR_B32_e64 killed %4, %7, implicit $exec
38 %8:sreg_32 = S_MOV_B32 65535
40 %9:sreg_32 = S_AND_B32 killed %8, killed %10, implicit-def dead $scc
42 SI_RETURN_TO_EPILOG $sgpr0