-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[AMDGPU] Fix SIFixSGPRCopies handling of STRICT_WWM and friends #142122
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc -mtriple=amdgcn -mcpu=gfx1200 < %s | FileCheck %s | ||
|
||
define amdgpu_gs i32 @main() { | ||
; CHECK-LABEL: main: | ||
; CHECK: ; %bb.0: ; %bb | ||
; CHECK-NEXT: s_bitcmp1_b32 0, 0 | ||
; CHECK-NEXT: s_mov_b32 s0, 0 | ||
; CHECK-NEXT: s_cselect_b32 s1, -1, 0 | ||
; CHECK-NEXT: s_or_saveexec_b32 s2, -1 | ||
; CHECK-NEXT: v_cndmask_b32_e64 v0, 0, 1, s1 | ||
; CHECK-NEXT: s_delay_alu instid0(VALU_DEP_1) | ||
; CHECK-NEXT: v_readfirstlane_b32 s1, v0 | ||
; CHECK-NEXT: s_mov_b32 exec_lo, s2 | ||
; CHECK-NEXT: s_or_b32 s0, s0, s1 | ||
; CHECK-NEXT: s_wait_alu 0xfffe | ||
; CHECK-NEXT: s_bitcmp1_b32 s0, 0 | ||
; CHECK-NEXT: s_cselect_b32 s0, -1, 0 | ||
; CHECK-NEXT: s_wait_alu 0xfffe | ||
; CHECK-NEXT: s_xor_b32 s0, s0, -1 | ||
; CHECK-NEXT: s_wait_alu 0xfffe | ||
; CHECK-NEXT: v_cndmask_b32_e64 v1, 0, 1, s0 | ||
; CHECK-NEXT: s_delay_alu instid0(VALU_DEP_1) | ||
; CHECK-NEXT: v_readfirstlane_b32 s0, v1 | ||
; CHECK-NEXT: s_wait_alu 0xf1ff | ||
; CHECK-NEXT: ; return to shader part epilog | ||
bb: | ||
%i = call i1 @llvm.amdgcn.readfirstlane.i1(i1 false) | ||
br label %bb1 | ||
|
||
bb1: | ||
%i2 = zext i1 %i to i32 | ||
%i3 = call i32 @llvm.amdgcn.wwm.i32(i32 0) | ||
%i4 = call i32 @llvm.amdgcn.wwm.i32(i32 %i2) | ||
%i5 = trunc i32 %i4 to i1 | ||
%i6 = trunc i32 %i3 to i1 | ||
%i7 = or i1 %i6, %i5 | ||
%i8 = select i1 %i7, i32 0, i32 1 | ||
ret i32 %i8 | ||
} |
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,27 @@ | ||
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 | ||
# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -run-pass=si-fix-sgpr-copies %s -o - | FileCheck %s | ||
|
||
--- | ||
name: main | ||
tracksRegLiveness: true | ||
body: | | ||
bb.0: | ||
; CHECK-LABEL: name: main | ||
; CHECK: [[DEF:%[0-9]+]]:sreg_32 = IMPLICIT_DEF | ||
; CHECK-NEXT: [[DEF1:%[0-9]+]]:vgpr_32 = IMPLICIT_DEF | ||
; CHECK-NEXT: [[V_READFIRSTLANE_B32_:%[0-9]+]]:sgpr_32 = V_READFIRSTLANE_B32 [[DEF1]], implicit $exec | ||
; CHECK-NEXT: early-clobber %2:sreg_32 = STRICT_WWM killed undef [[V_READFIRSTLANE_B32_]], implicit $exec | ||
; CHECK-NEXT: [[S_OR_B32_:%[0-9]+]]:sreg_32 = S_OR_B32 killed undef [[DEF]], killed undef %2, implicit-def dead $scc | ||
; CHECK-NEXT: [[S_AND_B32_:%[0-9]+]]:sreg_32 = S_AND_B32 1, killed undef [[S_OR_B32_]], implicit-def dead $scc | ||
; CHECK-NEXT: S_CMP_EQ_U32 killed undef [[S_AND_B32_]], 1, implicit-def $scc | ||
; CHECK-NEXT: [[S_XOR_B32_:%[0-9]+]]:sreg_32_xm0_xexec = S_XOR_B32 killed undef [[S_AND_B32_]], killed undef [[S_AND_B32_]], implicit-def dead $scc | ||
; CHECK-NEXT: SI_RETURN_TO_EPILOG undef $sgpr0 | ||
%0:sreg_32 = IMPLICIT_DEF | ||
%1:vgpr_32 = IMPLICIT_DEF | ||
early-clobber %2:sreg_32 = STRICT_WWM killed undef %1, implicit $exec | ||
%3:sreg_32 = S_OR_B32 killed undef %0, killed undef %2, implicit-def dead $scc | ||
%4:sreg_32 = S_AND_B32 1, killed undef %3, implicit-def dead $scc | ||
S_CMP_EQ_U32 killed undef %4, 1, implicit-def $scc | ||
%5:sreg_32_xm0_xexec = S_XOR_B32 killed undef %4, killed undef %4, implicit-def dead $scc | ||
SI_RETURN_TO_EPILOG undef $sgpr0 | ||
... |
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.
Here is the code to switch into WWM which was missing before.