]> git.ipfire.org Git - thirdparty/gcc.git/commit
arm: Extend -mtp= arguments
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Tue, 13 Jun 2023 09:17:24 +0000 (10:17 +0100)
committerKyrylo Tkachov <kyrylo.tkachov@arm.com>
Tue, 13 Jun 2023 09:17:24 +0000 (10:17 +0100)
commitcca8d9e5be2ffffd6ef7276234e1097763b15e19
treec1f9a583d39d711dbd324f41835fbb7434a39fac
parent4389a2d2d0cc639cbeeb8453dc20bf315316d4e3
arm: Extend -mtp= arguments

After discussing the -mtp= option with Arm's LLVM developers we'd like to extend
the functionality of the option somewhat.
There are actually 3 system registers that can be accessed for the thread pointer
in aarch32: tpidrurw, tpidruro, tpidrprw.  They are all read through the CP15 co-processor
mechanism. The current -mtp=cp15 option reads the tpidruro register.
This patch extends -mtp to allow for the above three explicit tpidr names and
keeps -mtp=cp15 as an alias of -mtp=tpidruro for backwards compatibility.

Bootstrapped and tested on arm-none-linux-gnueabihf.

gcc/ChangeLog:

* config/arm/arm-opts.h (enum arm_tp_type): Remove TP_CP15.
Add TP_TPIDRURW, TP_TPIDRURO, TP_TPIDRPRW values.
* config/arm/arm-protos.h (arm_output_load_tpidr): Declare prototype.
* config/arm/arm.cc (arm_option_reconfigure_globals): Replace TP_CP15
with TP_TPIDRURO.
(arm_output_load_tpidr): Define.
* config/arm/arm.h (TARGET_HARD_TP): Define in terms of TARGET_SOFT_TP.
* config/arm/arm.md (load_tp_hard): Call arm_output_load_tpidr to output
assembly.
(reload_tp_hard): Likewise.
* config/arm/arm.opt (tpidrurw, tpidruro, tpidrprw): New values for
arm_tp_type.
* doc/invoke.texi (Arm Options, mtp): Document new values.

gcc/testsuite/ChangeLog:

* gcc.target/arm/mtp.c: New test.
* gcc.target/arm/mtp_1.c: New test.
* gcc.target/arm/mtp_2.c: New test.
* gcc.target/arm/mtp_3.c: New test.
* gcc.target/arm/mtp_4.c: New test.
12 files changed:
gcc/config/arm/arm-opts.h
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.cc
gcc/config/arm/arm.h
gcc/config/arm/arm.md
gcc/config/arm/arm.opt
gcc/doc/invoke.texi
gcc/testsuite/gcc.target/arm/mtp.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mtp_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mtp_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mtp_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/arm/mtp_4.c [new file with mode: 0644]