riscv64: Add Zba extension instructions#6087
Conversation
jameysharp
left a comment
There was a problem hiding this comment.
I have a few requests but for the most part I think this looks correct!
Co-authored-by: Jamey Sharp <jsharp@fastly.com>
|
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. |
jameysharp
left a comment
There was a problem hiding this comment.
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, rs2sh1add rd, rs1, rs2sh1add.uw rd, rs1, rs2sh2add rd, rs1, rs2sh2add.uw rd, rs1, rs2sh3add rd, rs1, rs2sh3add.uw rd, rs1, rs2slli.uw rd, rs1, immBesides directly matching the above, we also add the
zext.wmnemnoic which is essentiallyadd.uw rd, rs, zero.I've left this fuzzing overnight on a riscv64 machine and all seems ok so far.