-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AMDGPU] Use s_cmovk_i32 instead of s_cselect_b32 when applicable #135232
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
Open
bababuck
wants to merge
3
commits into
llvm:main
Choose a base branch
from
bababuck:rbuchner/129984
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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
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,75 @@ | ||
| # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 | ||
| # RUN: llc -mtriple=amdgcn -mcpu=gfx900 -start-before=si-shrink-instructions -stop-before=si-post-ra-bundler -o - %s | FileCheck -check-prefix=GCN %s | ||
|
|
||
| --- | ||
| name: shrink-select-hint | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: shrink-select-hint | ||
| ; GCN: renamable $sgpr0 = S_MOV_B32 0 | ||
| ; GCN-NEXT: renamable $sgpr1 = S_MOV_B32 0 | ||
| ; GCN-NEXT: renamable $sgpr2 = S_MOV_B32 0 | ||
| ; GCN-NEXT: renamable $sgpr0 = S_ADD_U32 killed renamable $sgpr0, killed renamable $sgpr1, implicit-def $scc | ||
| ; GCN-NEXT: renamable $sgpr2 = S_CMOVK_I32 31744, implicit killed $scc | ||
| ; GCN-NEXT: S_ENDPGM 0, implicit killed renamable $sgpr2, implicit killed renamable $sgpr0 | ||
| %0:sgpr_32 = S_MOV_B32 0 | ||
| %1:sgpr_32 = S_MOV_B32 0 | ||
| %2:sgpr_32 = S_MOV_B32 0 | ||
| %3:sgpr_32 = S_ADD_U32 killed %0, %1, implicit-def $scc | ||
| %4:sgpr_32 = S_CSELECT_B32 %2, 31744, implicit $scc | ||
| S_ENDPGM 0, implicit %4, implicit %3 | ||
| ... | ||
| --- | ||
| name: shrink-select-b32 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: shrink-select-b32 | ||
| ; GCN: renamable $sgpr0 = S_CMOVK_I32 31744, implicit undef $scc | ||
| ; GCN-NEXT: S_ENDPGM 0, implicit killed renamable $sgpr0 | ||
| %0:sgpr_32 = IMPLICIT_DEF | ||
| $scc = IMPLICIT_DEF | ||
| %1:sgpr_32 = S_CSELECT_B32 %0, 31744, implicit $scc | ||
| S_ENDPGM 0, implicit %1 | ||
| ... | ||
| --- | ||
| name: shrink-select-b64 | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: shrink-select-b64 | ||
| ; GCN: renamable $sgpr0_sgpr1 = S_CSELECT_B64 undef renamable $sgpr0_sgpr1, 31744, implicit undef $scc | ||
| ; GCN-NEXT: S_ENDPGM 0, implicit killed renamable $sgpr0_sgpr1 | ||
| %0:sgpr_64 = IMPLICIT_DEF | ||
| $scc = IMPLICIT_DEF | ||
| %1:sgpr_64 = S_CSELECT_B64 %0, 31744, implicit $scc | ||
| S_ENDPGM 0, implicit %1 | ||
| ... | ||
| --- | ||
| name: shrink-select-non-kimm | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: shrink-select-non-kimm | ||
| ; GCN: renamable $sgpr0 = S_CSELECT_B32 undef renamable $sgpr0, 16, implicit undef $scc | ||
| ; GCN-NEXT: S_ENDPGM 0, implicit killed renamable $sgpr0 | ||
| %0:sgpr_32 = IMPLICIT_DEF | ||
| $scc = IMPLICIT_DEF | ||
| %1:sgpr_32 = S_CSELECT_B32 %0, 16, implicit $scc | ||
| S_ENDPGM 0, implicit %1 | ||
| ... | ||
| --- | ||
| name: shrink-select-reg | ||
| tracksRegLiveness: true | ||
| body: | | ||
| bb.0: | ||
| ; GCN-LABEL: name: shrink-select-reg | ||
| ; GCN: renamable $sgpr0 = S_CSELECT_B32 undef renamable $sgpr0, undef renamable $sgpr0, implicit undef $scc | ||
| ; GCN-NEXT: S_ENDPGM 0, implicit killed renamable $sgpr0 | ||
| %0:sgpr_32 = IMPLICIT_DEF | ||
| %1:sgpr_32 = IMPLICIT_DEF | ||
| $scc = IMPLICIT_DEF | ||
| %2:sgpr_32 = S_CSELECT_B32 %0, %1, implicit $scc | ||
| S_ENDPGM 0, implicit %2 | ||
| ... | ||
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.
Also the b64 versions, and tests with exotic operand types
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.
I expanded the tests to include b64. For operand types, an assertion fired when I tried to use a floating point operand, but I did add a case where the second operand is a register and one where the second operand is an immediate but not a K-Immediate.
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.
We don't use FP immediate, only ever use isImm