-
Notifications
You must be signed in to change notification settings - Fork 45
Add RVC GPR Pair Constraint - cR
#102
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
This follows the notion of using `c` as a prefix to mean "RVC-compatible", and `R` to mean "GPR Pair". The Zclsd specification adds registers with this constraint, in particular the `c.ld` and `c.sd` instructions need it.
This denotes RVC-compatible GPR Pairs, which are used by the Zclsd extension. C API PR: riscv-non-isa/riscv-c-api-doc#102
This denotes RVC-compatible GPR Pairs, which are used by the Zclsd extension. C API PR: riscv-non-isa/riscv-c-api-doc#102
This denotes RVC-compatible GPR Pairs, which are used by the Zclsd extension. C API PR: riscv-non-isa/riscv-c-api-doc#102
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.
LGTM, it's reasonable and also trivial to implement, I saw you already implemented in LLVM and I believe it's also trivial to support on GCC side, although it's kinda late to GCC since it's become bug fix only development stage, so that may defer to GCC 16, but I think it's fine to moving forward here.
Sorry for missing your release window :( I figured this would be uncontroversial enough that I could add it to LLVM for our release. |
We discussed this briefly in today's SIG Toolchain call and agreed to land this. |
The patch has been sent, and will land once CI pass: https://gcc.gnu.org/pipermail/gcc-patches/2025-May/683737.html |
Thanks @kito-cheng! |
This commit introduces a new operand constraint `cR` for the RISC-V architecture, which allows the use of an even-odd RVC general purpose register (x8-x15) in inline asm. Ref: riscv-non-isa/riscv-c-api-doc#102 gcc/ChangeLog: * config/riscv/constraints.md (cR): New constraint. * doc/md.texi (Machine Constraints::RISC-V): Document the new cR constraint. gcc/testsuite/ChangeLog: * gcc.target/riscv/constraint-cR-pair.c: New test case.
This follows the notion of using
c
as a prefix to mean "RVC-compatible", andR
to mean "even-odd GPR Pair".The Zclsd specification adds registers with this constraint, in particular the
c.ld
andc.sd
instructions need it.