-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[MacroFusion][RISCV] Make commutable instructions fusible as possible #85214
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
Comments
FYI XiangShan supports both patterns. |
TBH it would be easy to support it in the hardware. I am not sure whether it is a real issue if the |
A few comments, personally as a XiangShan developer:
|
Thanks for your valuable reply!
No, the compiler can't control it all. So, there is no need to worry about over-design. :-) |
In #82738, the user raised an issue about commutable instructions.
I have created a PR (#82751) to fix it, but it comes another problem: what if the μ-arch can fuse the instruction pair only if
rs1
matches?For example, for
slli+add
fusion (see https://godbolt.org/z/xo6xEoPKe):The μ-arch may not check
rs2
, butadd
is commutable, we can't guarantee thatr0
will always be inrs1
.In InstCombine, we have
InstCombinerImpl::SimplifyAssociativeOrCommutative
:But do we need or have a way in backend to change the operands order of second instruction when it's commutable?
cc @dtcxzyw @topperc
The text was updated successfully, but these errors were encountered: