-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[RISCV] Expand mul to shNadd x, (slli x, c) in DAGCombine #88524
Changes from 1 commit
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 |
---|---|---|
|
@@ -551,8 +551,9 @@ define i64 @add_mul_combine_infinite_loop(i64 %x) { | |
; RV32IMB-NEXT: sh3add a1, a1, a2 | ||
; RV32IMB-NEXT: sh1add a0, a0, a0 | ||
; RV32IMB-NEXT: slli a2, a0, 3 | ||
; RV32IMB-NEXT: addi a0, a2, 2047 | ||
; RV32IMB-NEXT: addi a0, a0, 1 | ||
; RV32IMB-NEXT: li a3, 1 | ||
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. Is this worse? 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. a) This test is really checking for a combine loop, and (b) zbs would produce a bset here and zba w/o zbs is mildly odd, and c) the overall better result would probably be (x*3+256)*8 (SH1ADD, ADDI, SHL) so we're not optimal either way. So yes, but I don't think we care. |
||
; RV32IMB-NEXT: slli a3, a3, 11 | ||
; RV32IMB-NEXT: sh3add a0, a0, a3 | ||
; RV32IMB-NEXT: sltu a2, a0, a2 | ||
; RV32IMB-NEXT: add a1, a1, a2 | ||
; RV32IMB-NEXT: ret | ||
|
@@ -561,8 +562,8 @@ define i64 @add_mul_combine_infinite_loop(i64 %x) { | |
; RV64IMB: # %bb.0: | ||
; RV64IMB-NEXT: addi a0, a0, 86 | ||
; RV64IMB-NEXT: sh1add a0, a0, a0 | ||
; RV64IMB-NEXT: li a1, -16 | ||
; RV64IMB-NEXT: sh3add a0, a0, a1 | ||
; RV64IMB-NEXT: slli a0, a0, 3 | ||
; RV64IMB-NEXT: addi a0, a0, -16 | ||
; RV64IMB-NEXT: ret | ||
%tmp0 = mul i64 %x, 24 | ||
%tmp1 = add i64 %tmp0, 2048 | ||
|
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.
imul is an X86 instruction name