[Bug target/110320] ELFv2 pc-rel ABI extension allows using r2 as a volatile register
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 25 10:13:29 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110320
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by jeevitha <jeevitha@gcc.gnu.org>:
https://gcc.gnu.org/g:1bbb169fe6f91451a2754f0b86301551db76ceba
commit r14-6829-g1bbb169fe6f91451a2754f0b86301551db76ceba
Author: Jeevitha <jeevitha@linux.ibm.com>
Date: Mon Dec 25 04:06:54 2023 -0600
rs6000: Change GPR2 to volatile & non-fixed register for function that does
not use TOC [PR110320]
Normally, GPR2 is the TOC pointer and is defined as a fixed and
non-volatile
register. However, it can be used as volatile for PCREL addressing.
Therefore,
modified r2 to be non-fixed in FIXED_REGISTERS and set it to fixed if it is
not
PCREL and also when the user explicitly requests TOC or fixed. If the
register
r2 is fixed, it is made as non-volatile. Changes in register preservation
roles
can be accomplished with the help of available target hooks
(TARGET_CONDITIONAL_REGISTER_USAGE).
2023-12-24 Jeevitha Palanisamy <jeevitha@linux.ibm.com>
gcc/
PR target/110320
* config/rs6000/rs6000.cc (rs6000_conditional_register_usage):
Change
GPR2 to volatile and non-fixed register for PCREL.
* config/rs6000/rs6000.h (FIXED_REGISTERS): Modify GPR2 to not
fixed.
gcc/testsuite/
PR target/110320
* gcc.target/powerpc/pr110320-1.c: New testcase.
* gcc.target/powerpc/pr110320-2.c: New testcase.
* gcc.target/powerpc/pr110320-3.c: New testcase.
Co-authored-by: Peter Bergner <bergner@linux.ibm.com>
More information about the Gcc-bugs
mailing list