[PATCH] D132987: [PPC] Add RM as call preserved register
Nemanja Ivanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 27 19:03:52 PDT 2022
nemanjai added a comment.
I don't think we can safely do this.
While the ELFv2 ABI does state that limited access bits can only be modified by functions with specific attributes allowing for such a modification, this isn't implemented in LLVM. Actually, as far as I can tell, it is not implemented in GCC either. So a function that does something like this:
double test() {
fesetround(2);
return 88.88;
}
Neither Clang nor GCC add any code to save/restore the RN field of the FPSCR.
While a typical use of the rounding mode is to save it, modify it, do what is necessary, restore it; no guarantees are provided by the compiler so we can't safely assume that the rounding mode is preserved by the callee. Furthermore, I am not aware of any attributes or other machinery in LLVM to mark functions as special wrt. a specific register (as the ABI suggests).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132987/new/
https://reviews.llvm.org/D132987
More information about the llvm-commits
mailing list