-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
[compiler-rt][RISC-V] Save/Restore for E goes with ABI #95390
Conversation
This is a follow up to fix code added in #88252. Adding those reviewers too. |
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.
libgcc is as our compiler-rt is today. Switching to look at the ABI not the ISA makes sense to me, and sounds like an oversight in GCC that got mirrored to LLVM (after all, it's an unusual combination to use), but we need to match GCC's ABI for RVE save/restore libcalls, which is to always save all three registers.
When compiling for the ILP32E/LP64E ABIs, even on a RISC-V machine with `i`, we should be using the ILP32E/LP64E save/restore routines, so use the right preprocessor macro.
62e79f6
to
4f8212c
Compare
I'll split this into two PRs, one for the preprocessor macro, one for the changes to grouping. My feeling is that there is no specifically-intentional grouping for |
#95398 Is the other half of the Split, with the more controversial changes. |
(Though I believe the title is a bit outdated) |
Please notice, that gcc behaves differently with -march=rv32e and it then matches it's library implementation. |
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, I believe it's right change, and I know there is some strange situations will use rv32i/rv64i with ilp32e/lp64e ABI...
When compiling for the ILP32E/LP64E ABIs, even on a RISC-V machine with `i`, we should be using the ILP32E/LP64E save/restore routines, so use the right preprocessor macro.
When compiling for the ILP32E/LP64E ABIs, even on a RISC-V machine with
i
, we should be using the ILP32E/LP64E save/restore routines, so usethe right preprocessor macro.
Previous Description Below:
This makes two significant changes, which I believe are both bugfixes.
i
, we should be using the ILP32E/LP64E save/restore routines, so use the right preprocessor macro.I would expect (but haven't measured) that the majority of functions compiled for the ILP32E/LP64E ABIs will in fact use both callee-saved registers, and therefore there are still savings to be had, but I think those can come later, with more data (especially if those changes are just to the instruction sequences we use to save the registers, rather than the number and alignment of how this is done).
From what I can tell, this matches the CFI information that both clang and GCC emit: https://godbolt.org/z/ozY3z8Yx5