-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[DAG] visitFREEZE - enable SRA/SRL handling #148252
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
Changes from 2 commits
8387d02
4d9fb58
e71e5ce
baada86
792f37b
febded4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -204,7 +204,8 @@ define signext i32 @findLastSet_i32(i32 signext %a) nounwind { | |
; RV64I-NEXT: add a1, a1, a2 | ||
; RV64I-NEXT: slli a2, a1, 16 | ||
; RV64I-NEXT: add a1, a1, a2 | ||
; RV64I-NEXT: srliw a1, a1, 24 | ||
; RV64I-NEXT: slli a1, a1, 34 | ||
; RV64I-NEXT: srli a1, a1, 58 | ||
; RV64I-NEXT: xori a1, a1, 31 | ||
; RV64I-NEXT: addi a0, a0, -1 | ||
; RV64I-NEXT: or a0, a0, a1 | ||
|
@@ -231,17 +232,19 @@ define i32 @ctlz_lshr_i32(i32 signext %a) { | |
; RV64I-NEXT: srliw a0, a0, 1 | ||
; RV64I-NEXT: beqz a0, .LBB4_2 | ||
; RV64I-NEXT: # %bb.1: # %cond.false | ||
; RV64I-NEXT: srliw a1, a0, 1 | ||
; RV64I-NEXT: srli a1, a0, 1 | ||
; RV64I-NEXT: lui a2, 349525 | ||
; RV64I-NEXT: or a0, a0, a1 | ||
; RV64I-NEXT: addi a1, a2, 1365 | ||
; RV64I-NEXT: srliw a2, a0, 2 | ||
; RV64I-NEXT: srli a2, a0, 2 | ||
; RV64I-NEXT: or a0, a0, a2 | ||
; RV64I-NEXT: srliw a2, a0, 4 | ||
; RV64I-NEXT: srli a2, a0, 4 | ||
; RV64I-NEXT: or a0, a0, a2 | ||
; RV64I-NEXT: srliw a2, a0, 8 | ||
; RV64I-NEXT: slli a2, a0, 33 | ||
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. I think the issue here is that we moved a freeze in the entry block which allowed computeKnownBits to compute a value for the output of the block. Then an AssertZExt was emitted in the the cond.false block. This allowed us to remove some bits from the AND mask and our isel code for srliw doesn't use computeKnownBits to fill in missing bits. |
||
; RV64I-NEXT: srli a2, a2, 41 | ||
; RV64I-NEXT: or a0, a0, a2 | ||
; RV64I-NEXT: srliw a2, a0, 16 | ||
; RV64I-NEXT: slli a2, a0, 33 | ||
; RV64I-NEXT: srli a2, a2, 49 | ||
; RV64I-NEXT: or a0, a0, a2 | ||
; RV64I-NEXT: not a0, a0 | ||
; RV64I-NEXT: srli a2, a0, 1 | ||
|
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 spent some time with this yesterday. The issue is that we don't push the freeze up the pairs of slli+add. I was able to trick it a bit by emitting a freeze before the slli+add pairs are emitted in expandCTPOP.