| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py | |
| # RUN: llc -mtriple=amdgpu9.00-amd-amdhsa -passes='greedy<sgpr>,virt-reg-rewriter' %s -o - | FileCheck %s | |
| --- | | |
| define void @tuple_unused_csr() { ret void } | |
| define void @tuple_unused_lane() { ret void } | |
| declare void @callee() | |
| ... | |
| --- | |
| # SGPR48 is already used, but SGPR49 is not. The tuple must still incur a | |
| # first-use CSR cost, making rematerialization after the call cheaper. | |
| name: tuple_unused_csr | |
| tracksRegLiveness: true | |
| registers: | |
| - { id: 0, class: sgpr_32, preferred-register: '$sgpr48' } | |
| - { id: 1, class: sgpr_64, preferred-register: '$sgpr48_sgpr49' } | |
| body: | | |
| bb.0: | |
| liveins: $sgpr48 | |
| ; CHECK-LABEL: name: tuple_unused_csr | |
| ; CHECK: liveins: $sgpr48 | |
| ; CHECK-NEXT: {{ $}} | |
| ; CHECK-NEXT: S_NOP 0, implicit renamable $sgpr48 | |
| ; CHECK-NEXT: S_NOP 0, implicit renamable $sgpr48 | |
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $sgpr48 | |
| ; CHECK-NEXT: dead $sgpr30_sgpr31 = SI_CALL undef $sgpr4_sgpr5, @callee, csr_amdgpu | |
| ; CHECK-NEXT: renamable $sgpr0_sgpr1 = S_MOV_B64 1 | |
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $sgpr0_sgpr1 | |
| ; CHECK-NEXT: S_ENDPGM 0 | |
| %0:sgpr_32 = COPY $sgpr48 | |
| S_NOP 0, implicit %0 | |
| S_NOP 0, implicit %0 | |
| S_NOP 0, implicit %0 | |
| %1:sgpr_64 = S_MOV_B64 1 | |
| dead $sgpr30_sgpr31 = SI_CALL undef $sgpr4_sgpr5, @callee, csr_amdgpu | |
| S_NOP 0, implicit %1 | |
| S_ENDPGM 0 | |
| ... | |
| --- | |
| # Only sub0 is live, so assigning the tuple to SGPR48_SGPR49 does not use | |
| # SGPR49. Reusing SGPR48 incurs no first-use cost and needs no rematerialization. | |
| name: tuple_unused_lane | |
| tracksRegLiveness: true | |
| registers: | |
| - { id: 0, class: sgpr_32, preferred-register: '$sgpr48' } | |
| - { id: 1, class: sgpr_64, preferred-register: '$sgpr48_sgpr49' } | |
| body: | | |
| bb.0: | |
| liveins: $sgpr48 | |
| ; CHECK-LABEL: name: tuple_unused_lane | |
| ; CHECK: liveins: $sgpr48 | |
| ; CHECK-NEXT: {{ $}} | |
| ; CHECK-NEXT: S_NOP 0, implicit renamable $sgpr48 | |
| ; CHECK-NEXT: S_NOP 0, implicit renamable $sgpr48 | |
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $sgpr48 | |
| ; CHECK-NEXT: renamable $sgpr48 = S_MOV_B32 1 | |
| ; CHECK-NEXT: dead $sgpr30_sgpr31 = SI_CALL undef $sgpr4_sgpr5, @callee, csr_amdgpu | |
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $sgpr48 | |
| ; CHECK-NEXT: S_ENDPGM 0 | |
| %0:sgpr_32 = COPY $sgpr48 | |
| S_NOP 0, implicit %0 | |
| S_NOP 0, implicit %0 | |
| S_NOP 0, implicit %0 | |
| undef %1.sub0:sgpr_64 = S_MOV_B32 1 | |
| dead $sgpr30_sgpr31 = SI_CALL undef $sgpr4_sgpr5, @callee, csr_amdgpu | |
| S_NOP 0, implicit %1.sub0 | |
| S_ENDPGM 0 | |
| ... |