]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR target/108779 aarch64: Implement -mtp= option
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>
Fri, 21 Apr 2023 18:00:02 +0000 (19:00 +0100)
committerKyrylo Tkachov <kyrylo.tkachov@arm.com>
Fri, 21 Apr 2023 18:00:02 +0000 (19:00 +0100)
commit573624ec90c80d1a024ab405e2575785b869a833
tree77e49f2c683bab92b109e04abc4980071af156e3
parentf824216cdb078ea9de0980ae066a0e1e83494fd2
PR target/108779 aarch64: Implement -mtp= option

A user has requested that we support the -mtp= option in aarch64 GCC for changing
the TPIDR register to read for TLS accesses. I'm not a big fan of the option name,
but we already support it in the arm port and Clang supports it for AArch64 already,
where it accepts the 'el0', 'el1', 'el2', 'el3' values.

This patch implements the same functionality in GCC.

Bootstrapped and tested on aarch64-none-linux-gnu.
Confirmed with godbolt that the sequences and options are the same as what Clang accepts/generates.

gcc/ChangeLog:

PR target/108779
* config/aarch64/aarch64-opts.h (enum aarch64_tp_reg): Define.
* config/aarch64/aarch64-protos.h (aarch64_output_load_tp):
Define prototype.
* config/aarch64/aarch64.cc (aarch64_tpidr_register): Declare.
(aarch64_override_options_internal): Handle the above.
(aarch64_output_load_tp): New function.
* config/aarch64/aarch64.md (aarch64_load_tp_hard): Call
aarch64_output_load_tp.
* config/aarch64/aarch64.opt (aarch64_tp_reg): Define enum.
(mtp=): New option.
* doc/invoke.texi (AArch64 Options): Document -mtp=.

gcc/testsuite/ChangeLog:

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