-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[AMDGPU] Use S_CSELECT
for uniform i1 ext
#69703
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,10 +29,12 @@ define amdgpu_kernel void @saddo_i64_zext(ptr addrspace(1) %out, i64 %a, i64 %b) | |
; SI-NEXT: s_mov_b32 s0, s4 | ||
; SI-NEXT: s_mov_b32 s1, s5 | ||
; SI-NEXT: s_xor_b64 s[4:5], s[6:7], vcc | ||
; SI-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[4:5] | ||
; SI-NEXT: v_mov_b32_e32 v1, s11 | ||
; SI-NEXT: v_add_i32_e32 v0, vcc, s10, v0 | ||
; SI-NEXT: v_addc_u32_e32 v1, vcc, 0, v1, vcc | ||
; SI-NEXT: s_and_b64 s[4:5], s[4:5], exec | ||
; SI-NEXT: s_cselect_b64 s[4:5], 1, 0 | ||
; SI-NEXT: s_add_u32 s4, s10, s4 | ||
; SI-NEXT: s_addc_u32 s5, s11, s5 | ||
; SI-NEXT: v_mov_b32_e32 v0, s4 | ||
; SI-NEXT: v_mov_b32_e32 v1, s5 | ||
Comment on lines
+36
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a bit unfortunate that we've moved the sext to SALU when the result is required in a VGPR anyway. SIFixSGPRCopies is supposed to be able to fix up cases like this by calling moveToVALU, but moving S_CSELECT to V_CNDMASK might be too difficult. |
||
; SI-NEXT: buffer_store_dwordx2 v[0:1], off, s[0:3], 0 | ||
; SI-NEXT: s_endpgm | ||
; | ||
|
@@ -45,15 +47,17 @@ define amdgpu_kernel void @saddo_i64_zext(ptr addrspace(1) %out, i64 %a, i64 %b) | |
; VI-NEXT: s_add_u32 s2, s6, s0 | ||
; VI-NEXT: v_mov_b32_e32 v2, s7 | ||
; VI-NEXT: s_addc_u32 s3, s7, s1 | ||
; VI-NEXT: v_cmp_lt_i64_e64 s[8:9], s[0:1], 0 | ||
; VI-NEXT: v_cmp_lt_i64_e32 vcc, s[2:3], v[1:2] | ||
; VI-NEXT: v_mov_b32_e32 v3, s3 | ||
; VI-NEXT: s_xor_b64 s[0:1], s[8:9], vcc | ||
; VI-NEXT: v_cndmask_b32_e64 v2, 0, 1, s[0:1] | ||
; VI-NEXT: v_add_u32_e32 v2, vcc, s2, v2 | ||
; VI-NEXT: v_cmp_lt_i64_e64 s[0:1], s[0:1], 0 | ||
; VI-NEXT: v_mov_b32_e32 v0, s4 | ||
; VI-NEXT: s_xor_b64 s[0:1], s[0:1], vcc | ||
; VI-NEXT: s_and_b64 s[0:1], s[0:1], exec | ||
; VI-NEXT: s_cselect_b64 s[0:1], 1, 0 | ||
; VI-NEXT: s_add_u32 s0, s2, s0 | ||
; VI-NEXT: s_addc_u32 s1, s3, s1 | ||
; VI-NEXT: v_mov_b32_e32 v3, s1 | ||
; VI-NEXT: v_mov_b32_e32 v1, s5 | ||
; VI-NEXT: v_addc_u32_e32 v3, vcc, 0, v3, vcc | ||
; VI-NEXT: v_mov_b32_e32 v2, s0 | ||
; VI-NEXT: flat_store_dwordx2 v[0:1], v[2:3] | ||
; VI-NEXT: s_endpgm | ||
; | ||
|
@@ -67,13 +71,15 @@ define amdgpu_kernel void @saddo_i64_zext(ptr addrspace(1) %out, i64 %a, i64 %b) | |
; GFX9-NEXT: s_add_u32 s0, s6, s2 | ||
; GFX9-NEXT: v_mov_b32_e32 v1, s7 | ||
; GFX9-NEXT: s_addc_u32 s1, s7, s3 | ||
; GFX9-NEXT: v_cmp_lt_i64_e64 s[8:9], s[2:3], 0 | ||
; GFX9-NEXT: v_cmp_lt_i64_e32 vcc, s[0:1], v[0:1] | ||
; GFX9-NEXT: v_cmp_lt_i64_e64 s[2:3], s[2:3], 0 | ||
; GFX9-NEXT: s_xor_b64 s[2:3], s[2:3], vcc | ||
; GFX9-NEXT: s_and_b64 s[2:3], s[2:3], exec | ||
; GFX9-NEXT: s_cselect_b64 s[2:3], 1, 0 | ||
; GFX9-NEXT: s_add_u32 s0, s0, s2 | ||
; GFX9-NEXT: s_addc_u32 s1, s1, s3 | ||
; GFX9-NEXT: v_mov_b32_e32 v0, s0 | ||
; GFX9-NEXT: v_mov_b32_e32 v1, s1 | ||
; GFX9-NEXT: s_xor_b64 s[2:3], s[8:9], vcc | ||
; GFX9-NEXT: v_cndmask_b32_e64 v0, 0, 1, s[2:3] | ||
; GFX9-NEXT: v_add_co_u32_e32 v0, vcc, s0, v0 | ||
; GFX9-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v1, vcc | ||
; GFX9-NEXT: global_store_dwordx2 v2, v[0:1], s[4:5] | ||
; GFX9-NEXT: s_endpgm | ||
; | ||
|
@@ -87,11 +93,14 @@ define amdgpu_kernel void @saddo_i64_zext(ptr addrspace(1) %out, i64 %a, i64 %b) | |
; GFX10-NEXT: s_add_u32 s0, s6, s2 | ||
; GFX10-NEXT: s_addc_u32 s1, s7, s3 | ||
; GFX10-NEXT: v_cmp_lt_i64_e64 s2, s[2:3], 0 | ||
; GFX10-NEXT: v_cmp_lt_i64_e64 s3, s[0:1], s[6:7] | ||
; GFX10-NEXT: s_xor_b32 s2, s2, s3 | ||
; GFX10-NEXT: v_cndmask_b32_e64 v0, 0, 1, s2 | ||
; GFX10-NEXT: v_add_co_u32 v0, s0, s0, v0 | ||
; GFX10-NEXT: v_add_co_ci_u32_e64 v1, s0, s1, 0, s0 | ||
; GFX10-NEXT: v_cmp_lt_i64_e64 s6, s[0:1], s[6:7] | ||
; GFX10-NEXT: s_xor_b32 s2, s2, s6 | ||
; GFX10-NEXT: s_and_b32 s2, s2, exec_lo | ||
; GFX10-NEXT: s_cselect_b64 s[2:3], 1, 0 | ||
; GFX10-NEXT: s_add_u32 s0, s0, s2 | ||
; GFX10-NEXT: s_addc_u32 s1, s1, s3 | ||
; GFX10-NEXT: v_mov_b32_e32 v0, s0 | ||
; GFX10-NEXT: v_mov_b32_e32 v1, s1 | ||
; GFX10-NEXT: global_store_dwordx2 v2, v[0:1], s[4:5] | ||
; GFX10-NEXT: s_endpgm | ||
; | ||
|
@@ -100,18 +109,20 @@ define amdgpu_kernel void @saddo_i64_zext(ptr addrspace(1) %out, i64 %a, i64 %b) | |
; GFX11-NEXT: s_clause 0x1 | ||
; GFX11-NEXT: s_load_b128 s[4:7], s[0:1], 0x24 | ||
; GFX11-NEXT: s_load_b64 s[0:1], s[0:1], 0x34 | ||
; GFX11-NEXT: v_mov_b32_e32 v2, 0 | ||
; GFX11-NEXT: s_waitcnt lgkmcnt(0) | ||
; GFX11-NEXT: s_add_u32 s2, s6, s0 | ||
; GFX11-NEXT: s_addc_u32 s3, s7, s1 | ||
; GFX11-NEXT: v_cmp_lt_i64_e64 s0, s[0:1], 0 | ||
; GFX11-NEXT: v_cmp_lt_i64_e64 s1, s[2:3], s[6:7] | ||
; GFX11-NEXT: v_cmp_lt_i64_e64 s6, s[2:3], s[6:7] | ||
; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(SALU_CYCLE_1) | ||
; GFX11-NEXT: s_xor_b32 s0, s0, s1 | ||
; GFX11-NEXT: v_cndmask_b32_e64 v0, 0, 1, s0 | ||
; GFX11-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1) | ||
; GFX11-NEXT: v_add_co_u32 v0, s0, s2, v0 | ||
; GFX11-NEXT: v_add_co_ci_u32_e64 v1, null, s3, 0, s0 | ||
; GFX11-NEXT: s_xor_b32 s0, s0, s6 | ||
; GFX11-NEXT: s_and_b32 s0, s0, exec_lo | ||
; GFX11-NEXT: s_cselect_b64 s[0:1], 1, 0 | ||
; GFX11-NEXT: s_delay_alu instid0(SALU_CYCLE_1) | ||
; GFX11-NEXT: s_add_u32 s0, s2, s0 | ||
; GFX11-NEXT: s_addc_u32 s1, s3, s1 | ||
; GFX11-NEXT: v_mov_b32_e32 v0, s0 | ||
; GFX11-NEXT: v_dual_mov_b32 v2, 0 :: v_dual_mov_b32 v1, s1 | ||
; GFX11-NEXT: global_store_b64 v2, v[0:1], s[4:5] | ||
; GFX11-NEXT: s_nop 0 | ||
; GFX11-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS) | ||
|
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
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.
Should we do something similar for
sext
?