[V3,0/6] aarch64: Add support for __arm_rsr and __arm_wsr ACLE function family

Message ID 20231102163852.1860658-1-victor.donascimento@arm.com
Headers
Series aarch64: Add support for __arm_rsr and __arm_wsr ACLE function family |

Message

Victor Do Nascimento Nov. 2, 2023, 4:38 p.m. UTC
  Implement changes resulting from upstream discussion about the
implementation as presented in V2 of this patch:

https://gcc.gnu.org/pipermail/gcc-patches/2023-October/633458.html

Note that patch 4/7 of the previous iteration of this series (Add
basic target_print_operand support for CONST_STRING) was resubmitted
and upstreamed separately due to its use in other work which had since
been submitted.

---

This patch series adds support for reading and writing to and from
system registers via the relevant ACLE-defined builtins [1].

The patch series makes a series of additions to the aarch64-specific
areas of the compiler to make this possible.

Firstly, a mechanism for defining system registers is established via a
new .def file and the new SYSREG macro.  This macro is the same as is
used in Binutils and system register entries are compatible with
either code-base.

Given the information contained in this system register definition
file, a compile-time validation mechanism is implemented, such that any
system register name passed as a string literal argument to these
builtins can be checked against known system registers and its use
for a given target architecture validated.

Finally, patterns for each of these builtins are added to the back-end
such that, if all validation criteria are met, the correct assembly is
emitted.

Thus, the following example of system register access is now valid for
GCC:

	long long old = __arm_rsr("trcseqstr");
	__arm_wsr("trcseqstr", new);

Testing:
 - Bootstrap/regtest on aarch64-linux-gnu done.

[1] https://arm-software.github.io/acle/main/acle.html

Victor Do Nascimento (6):
  aarch64: Sync system register information with Binutils
  aarch64: Add support for aarch64-sys-regs.def
  aarch64: Implement system register validation tools
  aarch64: Implement system register r/w arm ACLE intrinsic functions
  aarch64: Add front-end argument type checking for target builtins
  aarch64: Add system register duplication check selftest

 gcc/config/aarch64/aarch64-builtins.cc        |  222 ++++
 gcc/config/aarch64/aarch64-c.cc               |    4 +-
 gcc/config/aarch64/aarch64-protos.h           |    6 +
 gcc/config/aarch64/aarch64-sys-regs.def       | 1064 +++++++++++++++++
 gcc/config/aarch64/aarch64.cc                 |  244 ++++
 gcc/config/aarch64/aarch64.h                  |   22 +
 gcc/config/aarch64/aarch64.md                 |   18 +
 gcc/config/aarch64/arm_acle.h                 |   30 +
 gcc/config/aarch64/predicates.md              |    4 +
 gcc/testsuite/gcc.dg/pch/rwsr-pch.c           |    7 +
 gcc/testsuite/gcc.dg/pch/rwsr-pch.hs          |   10 +
 .../gcc.target/aarch64/acle/rwsr-1.c          |   29 +
 .../gcc.target/aarch64/acle/rwsr-2.c          |   25 +
 .../gcc.target/aarch64/acle/rwsr-3.c          |   18 +
 gcc/testsuite/gcc.target/aarch64/acle/rwsr.c  |  144 +++
 15 files changed, 1845 insertions(+), 2 deletions(-)
 create mode 100644 gcc/config/aarch64/aarch64-sys-regs.def
 create mode 100644 gcc/testsuite/gcc.dg/pch/rwsr-pch.c
 create mode 100644 gcc/testsuite/gcc.dg/pch/rwsr-pch.hs
 create mode 100644 gcc/testsuite/gcc.target/aarch64/acle/rwsr-1.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/acle/rwsr-2.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/acle/rwsr-3.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/acle/rwsr.c