-
Notifications
You must be signed in to change notification settings - Fork 1.4k
riscv64: Add Zba
extension instructions
#6087
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
Conversation
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 have a few requests but for the most part I think this looks correct!
Co-authored-by: Jamey Sharp <[email protected]>
Thanks for reviewing this! I've also added a bunch more rules to the Even with all those rules, I think they can still be generalized further. Especially the shifts with const imm, but I noticed that I could also cleanup the regular shift rules in the same way, so I've left those improvements for a future PR. |
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.
Looks great, thank you! One tiny whitespace fix but I think this is good to go.
A note for future work: the riscv64 implementation of Imm12::maybe_from_u64
has issues similar to the aarch64 version with assuming that the high bits of an iconst
are sign-extended, when we want them to be zero-extended instead. I don't think this is a correctness issue, just the immediate-operand rules may not always match when you expect them to.
I found another issue with the new shift rules, since they can have a i128 RHS we need to explicitly access the value regs. I've updated that commit, but I'm going to run the
🤔 Yeah, I should look into that. |
👋 Hey,
This PR adds the instructions present in the Zba extension to the RISC-V 64 backend. The Zba extension contains instructions for address generation.
Here's a quick summary:
add.uw rd, rs1, rs2
sh1add rd, rs1, rs2
sh1add.uw rd, rs1, rs2
sh2add rd, rs1, rs2
sh2add.uw rd, rs1, rs2
sh3add rd, rs1, rs2
sh3add.uw rd, rs1, rs2
slli.uw rd, rs1, imm
Besides directly matching the above, we also add the
zext.w
mnemnoic which is essentiallyadd.uw rd, rs, zero
.I've left this fuzzing overnight on a riscv64 machine and all seems ok so far.