-
Notifications
You must be signed in to change notification settings - Fork 15.3k
AMDGPU: Add pseudoinstruction for agpr or vgpr constants #130042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 | ||
| # RUN: llc -mtriple=amdgcn -mcpu=gfx90a -run-pass=postrapseudos %s -o - | FileCheck %s | ||
| # RUN: llc -mtriple=amdgcn -mcpu=gfx942 -run-pass=postrapseudos %s -o - | FileCheck %s | ||
|
|
||
| --- | ||
| name: av_mov_b32_imm_pseudo_agpr_0 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: av_mov_b32_imm_pseudo_agpr_0 | ||
| ; CHECK: $agpr0 = V_ACCVGPR_WRITE_B32_e64 0, implicit $exec | ||
| $agpr0 = AV_MOV_B32_IMM_PSEUDO 0, implicit $exec | ||
| ... | ||
|
|
||
| --- | ||
| name: av_mov_b32_imm_pseudo_agpr_64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: av_mov_b32_imm_pseudo_agpr_64 | ||
| ; CHECK: $agpr0 = V_ACCVGPR_WRITE_B32_e64 64, implicit $exec | ||
| $agpr0 = AV_MOV_B32_IMM_PSEUDO 64, implicit $exec | ||
| ... | ||
|
|
||
| --- | ||
| name: av_mov_b32_imm_pseudo_vgpr_0 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: av_mov_b32_imm_pseudo_vgpr_0 | ||
| ; CHECK: $vgpr0 = V_MOV_B32_e32 0, implicit $exec | ||
| $vgpr0 = AV_MOV_B32_IMM_PSEUDO 0, implicit $exec | ||
| ... | ||
|
|
||
| --- | ||
| name: av_mov_b32_imm_pseudo_vgpr_64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; CHECK-LABEL: name: av_mov_b32_imm_pseudo_vgpr_64 | ||
| ; CHECK: $vgpr0 = V_MOV_B32_e32 64, implicit $exec | ||
| $vgpr0 = AV_MOV_B32_IMM_PSEUDO 64, implicit $exec | ||
| ... | ||
|
|
||
| --- | ||
| name: av_mov_b32_imm_pseudo_agpr_vgpr | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| liveins: $vgpr0 | ||
| ; CHECK-LABEL: name: av_mov_b32_imm_pseudo_agpr_vgpr | ||
| ; CHECK: liveins: $vgpr0 | ||
| ; CHECK-NEXT: {{ $}} | ||
| ; CHECK-NEXT: $agpr1 = V_ACCVGPR_WRITE_B32_e64 $vgpr0, implicit $exec | ||
| $agpr1 = AV_MOV_B32_IMM_PSEUDO $vgpr0, implicit $exec | ||
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 | ||
| # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -simplify-mir -start-before=greedy,2 -stress-regalloc=3 -stop-after=postrapseudos -o - -verify-regalloc %s | FileCheck %s | ||
|
|
||
| # Compare results of using V_MOV_B32 vs. AV_MOV_B32_IMM_PSEUDO during | ||
| # allocation. | ||
|
|
||
| --- | ||
| name: av_mov_b32_split | ||
| tracksRegLiveness: true | ||
| machineFunctionInfo: | ||
| isEntryFunction: true | ||
| scratchRSrcReg: '$sgpr72_sgpr73_sgpr74_sgpr75' | ||
| stackPtrOffsetReg: '$sgpr32' | ||
| occupancy: 7 | ||
| body: | | ||
| bb.0: | ||
| liveins: $vgpr0, $sgpr4_sgpr5 | ||
|
|
||
| ; CHECK-LABEL: name: av_mov_b32_split | ||
| ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2, $sgpr4_sgpr5 | ||
| ; CHECK-NEXT: {{ $}} | ||
| ; CHECK-NEXT: renamable $agpr0 = V_ACCVGPR_WRITE_B32_e64 0, implicit $exec | ||
| ; CHECK-NEXT: renamable $agpr1 = V_ACCVGPR_WRITE_B32_e64 1, implicit $exec | ||
| ; CHECK-NEXT: renamable $agpr2 = V_ACCVGPR_WRITE_B32_e64 2, implicit $exec | ||
| ; CHECK-NEXT: $vgpr0 = V_ACCVGPR_READ_B32_e64 killed $agpr0, implicit $exec | ||
| ; CHECK-NEXT: renamable $agpr0 = V_ACCVGPR_WRITE_B32_e64 3, implicit $exec | ||
| ; CHECK-NEXT: $vgpr1 = V_ACCVGPR_READ_B32_e64 killed $agpr0, implicit $exec | ||
| ; CHECK-NEXT: renamable $agpr0 = V_ACCVGPR_WRITE_B32_e64 4, implicit $exec | ||
| ; CHECK-NEXT: $vgpr2 = V_ACCVGPR_READ_B32_e64 killed $agpr0, implicit $exec | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 $vgpr0, implicit $exec | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr0 | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr1 | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr2 | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 $vgpr1, implicit $exec | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr0 | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 $vgpr2, implicit $exec | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr0 | ||
| %0:vgpr_32 = AV_MOV_B32_IMM_PSEUDO 0, implicit $exec | ||
| %1:vgpr_32 = AV_MOV_B32_IMM_PSEUDO 1, implicit $exec | ||
| %2:vgpr_32 = AV_MOV_B32_IMM_PSEUDO 2, implicit $exec | ||
| %3:vgpr_32 = AV_MOV_B32_IMM_PSEUDO 3, implicit $exec | ||
| %4:vgpr_32 = AV_MOV_B32_IMM_PSEUDO 4, implicit $exec | ||
|
|
||
| %5:agpr_32 = COPY %0 | ||
| %6:agpr_32 = COPY %1 | ||
| %7:agpr_32 = COPY %2 | ||
| %8:agpr_32 = COPY %3 | ||
| %9:agpr_32 = COPY %4 | ||
|
|
||
| S_NOP 0, implicit %5 | ||
| S_NOP 0, implicit %6 | ||
| S_NOP 0, implicit %7 | ||
| S_NOP 0, implicit %8 | ||
| S_NOP 0, implicit %9 | ||
|
|
||
| ... | ||
|
|
||
| --- | ||
| name: v_mov_b32_split | ||
| tracksRegLiveness: true | ||
| machineFunctionInfo: | ||
| isEntryFunction: true | ||
| scratchRSrcReg: '$sgpr72_sgpr73_sgpr74_sgpr75' | ||
| stackPtrOffsetReg: '$sgpr32' | ||
| occupancy: 7 | ||
| body: | | ||
| bb.0: | ||
| liveins: $vgpr0, $sgpr4_sgpr5 | ||
|
|
||
| ; CHECK-LABEL: name: v_mov_b32_split | ||
| ; CHECK: liveins: $vgpr0, $vgpr3, $vgpr4, $vgpr5, $sgpr4_sgpr5 | ||
| ; CHECK-NEXT: {{ $}} | ||
| ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 0, implicit $exec | ||
| ; CHECK-NEXT: renamable $vgpr1 = V_MOV_B32_e32 1, implicit $exec | ||
| ; CHECK-NEXT: renamable $vgpr2 = V_MOV_B32_e32 2, implicit $exec | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr0, implicit $exec, implicit $exec | ||
| ; CHECK-NEXT: $vgpr3 = V_ACCVGPR_READ_B32_e64 killed $agpr0, implicit $exec | ||
| ; CHECK-NEXT: $agpr1 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr1, implicit $exec, implicit $exec | ||
| ; CHECK-NEXT: $agpr2 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr2, implicit $exec, implicit $exec | ||
| ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 3, implicit $exec | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr0, implicit $exec, implicit $exec | ||
| ; CHECK-NEXT: $vgpr4 = V_ACCVGPR_READ_B32_e64 killed $agpr0, implicit $exec | ||
| ; CHECK-NEXT: renamable $vgpr0 = V_MOV_B32_e32 4, implicit $exec | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 killed $vgpr0, implicit $exec, implicit $exec | ||
| ; CHECK-NEXT: $vgpr5 = V_ACCVGPR_READ_B32_e64 killed $agpr0, implicit $exec | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 $vgpr3, implicit $exec | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr0 | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr1 | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr2 | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 $vgpr4, implicit $exec | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr0 | ||
| ; CHECK-NEXT: $agpr0 = V_ACCVGPR_WRITE_B32_e64 $vgpr5, implicit $exec | ||
| ; CHECK-NEXT: S_NOP 0, implicit killed renamable $agpr0 | ||
| %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec | ||
| %1:vgpr_32 = V_MOV_B32_e32 1, implicit $exec | ||
| %2:vgpr_32 = V_MOV_B32_e32 2, implicit $exec | ||
| %3:vgpr_32 = V_MOV_B32_e32 3, implicit $exec | ||
| %4:vgpr_32 = V_MOV_B32_e32 4, implicit $exec | ||
|
|
||
| %5:agpr_32 = COPY %0 | ||
| %6:agpr_32 = COPY %1 | ||
| %7:agpr_32 = COPY %2 | ||
| %8:agpr_32 = COPY %3 | ||
| %9:agpr_32 = COPY %4 | ||
|
|
||
| S_NOP 0, implicit %5 | ||
| S_NOP 0, implicit %6 | ||
| S_NOP 0, implicit %7 | ||
| S_NOP 0, implicit %8 | ||
| S_NOP 0, implicit %9 | ||
|
|
||
| ... | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a AVDst_32 for the dst type? I'm trying to use a RegisterOperand instead of RegisterClass for all operands in instruction definitions because it makes it easier to swap out the underlying RegisterClass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a pseudo, this doesn't really benefit from RegisterOperand. For example this will now require dead code in the disassembler since AVDstOperand will emit the custom decoder method