]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Add GCS builtins
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 14 Nov 2024 16:15:07 +0000 (16:15 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 14 Nov 2024 16:15:07 +0000 (16:15 +0000)
commitaf166d3adc1e40bc8e6a21ce7f1319627817381a
treee9faa3d08ffbb14f1747b47ba4177c016fa60bd0
parent8a366df481a6f30600c59a2a5eb3418fcaab3f57
aarch64: Add GCS builtins

Add new builtins for GCS:

  void *__builtin_aarch64_gcspr (void)
  uint64_t __builtin_aarch64_gcspopm (void)
  void *__builtin_aarch64_gcsss (void *)

The builtins are always enabled, but should be used behind runtime
checks in case the target does not support GCS. They are thin
wrappers around the corresponding instructions.

The GCS pointer is modelled with void * type (normal stores do not
work on GCS memory, but it is writable via the gcsss operation or
via GCSSTR if enabled so not const) and an entry on the GCS is
modelled with uint64_t (since it has fixed size and can be a token
that's not a pointer).

gcc/ChangeLog:

* config/aarch64/aarch64-builtins.cc (enum aarch64_builtins): Add
AARCH64_BUILTIN_GCSPR, AARCH64_BUILTIN_GCSPOPM, AARCH64_BUILTIN_GCSSS.
(aarch64_init_gcs_builtins): New.
(aarch64_general_init_builtins): Call aarch64_init_gcs_builtins.
(aarch64_expand_gcs_builtin): New.
(aarch64_general_expand_builtin): Call aarch64_expand_gcs_builtin.

Co-authored-by: Richard Sandiford <richard.sandiford@arm.com>
gcc/config/aarch64/aarch64-builtins.cc