-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Allow shifting instead of masks if the types are legal. #162732
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
Closed
+40
−28
Closed
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 |
---|---|---|
|
@@ -103,16 +103,16 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind { | |
; SI: ; %bb.0: | ||
; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; SI-NEXT: v_sub_i32_e32 v1, vcc, 32, v1 | ||
; SI-NEXT: v_lshr_b32_e32 v1, -1, v1 | ||
; SI-NEXT: v_and_b32_e32 v0, v1, v0 | ||
; SI-NEXT: v_lshlrev_b32_e32 v0, v1, v0 | ||
; SI-NEXT: v_lshrrev_b32_e32 v0, v1, v0 | ||
; SI-NEXT: s_setpc_b64 s[30:31] | ||
; | ||
; VI-LABEL: bzhi32_c0: | ||
; VI: ; %bb.0: | ||
; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; VI-NEXT: v_sub_u32_e32 v1, vcc, 32, v1 | ||
; VI-NEXT: v_lshrrev_b32_e64 v1, v1, -1 | ||
; VI-NEXT: v_and_b32_e32 v0, v1, v0 | ||
; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0 | ||
; VI-NEXT: v_lshrrev_b32_e32 v0, v1, v0 | ||
; VI-NEXT: s_setpc_b64 s[30:31] | ||
%numhighbits = sub i32 32, %numlowbits | ||
%mask = lshr i32 -1, %numhighbits | ||
|
@@ -121,12 +121,23 @@ define i32 @bzhi32_c0(i32 %val, i32 %numlowbits) nounwind { | |
} | ||
|
||
define i32 @bzhi32_c0_clamp(i32 %val, i32 %numlowbits) nounwind { | ||
; GCN-LABEL: bzhi32_c0_clamp: | ||
; GCN: ; %bb.0: | ||
; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; GCN-NEXT: v_and_b32_e32 v1, 31, v1 | ||
; GCN-NEXT: v_bfe_u32 v0, v0, 0, v1 | ||
; GCN-NEXT: s_setpc_b64 s[30:31] | ||
; SI-LABEL: bzhi32_c0_clamp: | ||
; SI: ; %bb.0: | ||
; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; SI-NEXT: v_and_b32_e32 v1, 31, v1 | ||
; SI-NEXT: v_sub_i32_e32 v1, vcc, 32, v1 | ||
; SI-NEXT: v_lshlrev_b32_e32 v0, v1, v0 | ||
; SI-NEXT: v_lshrrev_b32_e32 v0, v1, v0 | ||
Comment on lines
+126
to
+130
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. Regression, broke a BFE pattern? |
||
; SI-NEXT: s_setpc_b64 s[30:31] | ||
; | ||
; VI-LABEL: bzhi32_c0_clamp: | ||
; VI: ; %bb.0: | ||
; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; VI-NEXT: v_and_b32_e32 v1, 31, v1 | ||
; VI-NEXT: v_sub_u32_e32 v1, vcc, 32, v1 | ||
; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0 | ||
; VI-NEXT: v_lshrrev_b32_e32 v0, v1, v0 | ||
; VI-NEXT: s_setpc_b64 s[30:31] | ||
%low5bits = and i32 %numlowbits, 31 | ||
%numhighbits = sub i32 32, %low5bits | ||
%mask = lshr i32 -1, %numhighbits | ||
|
@@ -139,16 +150,16 @@ define i32 @bzhi32_c1_indexzext(i32 %val, i8 %numlowbits) nounwind { | |
; SI: ; %bb.0: | ||
; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; SI-NEXT: v_sub_i32_e32 v1, vcc, 32, v1 | ||
; SI-NEXT: v_lshr_b32_e32 v1, -1, v1 | ||
; SI-NEXT: v_and_b32_e32 v0, v1, v0 | ||
; SI-NEXT: v_lshlrev_b32_e32 v0, v1, v0 | ||
; SI-NEXT: v_lshrrev_b32_e32 v0, v1, v0 | ||
; SI-NEXT: s_setpc_b64 s[30:31] | ||
; | ||
; VI-LABEL: bzhi32_c1_indexzext: | ||
; VI: ; %bb.0: | ||
; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; VI-NEXT: v_sub_u16_e32 v1, 32, v1 | ||
; VI-NEXT: v_lshrrev_b32_e64 v1, v1, -1 | ||
; VI-NEXT: v_and_b32_e32 v0, v1, v0 | ||
; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0 | ||
; VI-NEXT: v_lshrrev_b32_e32 v0, v1, v0 | ||
; VI-NEXT: s_setpc_b64 s[30:31] | ||
%numhighbits = sub i8 32, %numlowbits | ||
%sh_prom = zext i8 %numhighbits to i32 | ||
|
@@ -162,16 +173,16 @@ define i32 @bzhi32_c4_commutative(i32 %val, i32 %numlowbits) nounwind { | |
; SI: ; %bb.0: | ||
; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; SI-NEXT: v_sub_i32_e32 v1, vcc, 32, v1 | ||
; SI-NEXT: v_lshr_b32_e32 v1, -1, v1 | ||
; SI-NEXT: v_and_b32_e32 v0, v0, v1 | ||
; SI-NEXT: v_lshlrev_b32_e32 v0, v1, v0 | ||
; SI-NEXT: v_lshrrev_b32_e32 v0, v1, v0 | ||
; SI-NEXT: s_setpc_b64 s[30:31] | ||
; | ||
; VI-LABEL: bzhi32_c4_commutative: | ||
; VI: ; %bb.0: | ||
; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0) | ||
; VI-NEXT: v_sub_u32_e32 v1, vcc, 32, v1 | ||
; VI-NEXT: v_lshrrev_b32_e64 v1, v1, -1 | ||
; VI-NEXT: v_and_b32_e32 v0, v0, v1 | ||
; VI-NEXT: v_lshlrev_b32_e32 v0, v1, v0 | ||
; VI-NEXT: v_lshrrev_b32_e32 v0, v1, v0 | ||
; VI-NEXT: s_setpc_b64 s[30:31] | ||
%numhighbits = sub i32 32, %numlowbits | ||
%mask = lshr i32 -1, %numhighbits | ||
|
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.
This is a neutral change at best