Skip to content

Commit 16a05fa

Browse files
author
Victor Do Nascimento
committed
aarch64: Add march flags for +the and +d128 arch extensions
Given the introduction of optional 128-bit page table descriptor and translation hardening extension support with the Arm9.4-a architecture, this introduces the relevant flags to enable the reading and writing of 128-bit system registers. The `+d128' -march modifier enables the use of the following ACLE builtin functions: * __uint128_t __arm_rsr128(const char *special_register); * void __arm_wsr128(const char *special_register, __uint128_t value); and defines the __ARM_FEATURE_SYSREG128 macro to 1. Finally, the `rcwmask_el1' and `rcwsmask_el1' 128-bit system register implementations are also reliant on the enablement of the `+the' flag, which is thus also implemented in this patch. gcc/ChangeLog: * config/aarch64/aarch64-c.cc (__ARM_FEATURE_SYSREG128): New. * config/aarch64/aarch64-arches.def (armv8.9-a): New. (armv9.4-a): Likewise. * config/aarch64/aarch64-option-extensions.def (d128): Likewise. (the): Likewise. * config/aarch64/aarch64.h (AARCH64_ISA_V9_4A): Likewise. (AARCH64_ISA_V8_9A): Likewise. (TARGET_ARMV9_4): Likewise. (AARCH64_ISA_D128): Likewise. (AARCH64_ISA_THE): Likewise. (TARGET_D128): Likewise. * doc/invoke.texi (AArch64 Options): Document new -march flags and extensions.
1 parent 1bd15d8 commit 16a05fa

5 files changed

Lines changed: 29 additions & 0 deletions

File tree

gcc/config/aarch64/aarch64-arches.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ AARCH64_ARCH("armv8.5-a", generic_armv8_a, V8_5A, 8, (V8_4A, SB, SSBS
3939
AARCH64_ARCH("armv8.6-a", generic_armv8_a, V8_6A, 8, (V8_5A, I8MM, BF16))
4040
AARCH64_ARCH("armv8.7-a", generic_armv8_a, V8_7A, 8, (V8_6A, LS64))
4141
AARCH64_ARCH("armv8.8-a", generic_armv8_a, V8_8A, 8, (V8_7A, MOPS))
42+
AARCH64_ARCH("armv8.9-a", generic_armv8_a, V8_9A, 8, (V8_8A))
4243
AARCH64_ARCH("armv8-r", generic_armv8_a, V8R , 8, (V8_4A))
4344
AARCH64_ARCH("armv9-a", generic_armv9_a, V9A , 9, (V8_5A, SVE2))
4445
AARCH64_ARCH("armv9.1-a", generic_armv9_a, V9_1A, 9, (V8_6A, V9A))
4546
AARCH64_ARCH("armv9.2-a", generic_armv9_a, V9_2A, 9, (V8_7A, V9_1A))
4647
AARCH64_ARCH("armv9.3-a", generic_armv9_a, V9_3A, 9, (V8_8A, V9_2A))
48+
AARCH64_ARCH("armv9.4-a", generic_armv9_a, V9_4A, 9, (V8_9A, V9_3A))
4749

4850
#undef AARCH64_ARCH

gcc/config/aarch64/aarch64-c.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
254254
aarch64_def_or_undef (TARGET_LS64,
255255
"__ARM_FEATURE_LS64", pfile);
256256
aarch64_def_or_undef (AARCH64_ISA_RCPC, "__ARM_FEATURE_RCPC", pfile);
257+
aarch64_def_or_undef (TARGET_D128, "__ARM_FEATURE_SYSREG128", pfile);
257258

258259
aarch64_def_or_undef (TARGET_SME, "__ARM_FEATURE_SME", pfile);
259260
aarch64_def_or_undef (TARGET_SME_I16I64, "__ARM_FEATURE_SME_I16I64", pfile);

gcc/config/aarch64/aarch64-option-extensions.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,8 @@ AARCH64_OPT_EXTENSION("sme-f64f64", SME_F64F64, (SME), (), (), "")
159159

160160
AARCH64_OPT_EXTENSION("sme2", SME2, (SME), (), (), "sme2")
161161

162+
AARCH64_OPT_EXTENSION("d128", D128, (), (), (), "d128")
163+
164+
AARCH64_OPT_EXTENSION("the", THE, (), (), (), "the")
165+
162166
#undef AARCH64_OPT_EXTENSION

gcc/config/aarch64/aarch64.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,17 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF;
254254
#define AARCH64_ISA_PAUTH (aarch64_isa_flags & AARCH64_FL_PAUTH)
255255
#define AARCH64_ISA_V8_7A (aarch64_isa_flags & AARCH64_FL_V8_7A)
256256
#define AARCH64_ISA_V8_8A (aarch64_isa_flags & AARCH64_FL_V8_8A)
257+
#define AARCH64_ISA_V8_9A (aarch64_isa_flags & AARCH64_FL_V8_9A)
257258
#define AARCH64_ISA_V9A (aarch64_isa_flags & AARCH64_FL_V9A)
258259
#define AARCH64_ISA_V9_1A (aarch64_isa_flags & AARCH64_FL_V9_1A)
259260
#define AARCH64_ISA_V9_2A (aarch64_isa_flags & AARCH64_FL_V9_2A)
260261
#define AARCH64_ISA_V9_3A (aarch64_isa_flags & AARCH64_FL_V9_3A)
262+
#define AARCH64_ISA_V9_4A (aarch64_isa_flags & AARCH64_FL_V9_4A)
261263
#define AARCH64_ISA_MOPS (aarch64_isa_flags & AARCH64_FL_MOPS)
262264
#define AARCH64_ISA_LS64 (aarch64_isa_flags & AARCH64_FL_LS64)
263265
#define AARCH64_ISA_CSSC (aarch64_isa_flags & AARCH64_FL_CSSC)
266+
#define AARCH64_ISA_D128 (aarch64_isa_flags & AARCH64_FL_D128)
267+
#define AARCH64_ISA_THE (aarch64_isa_flags & AARCH64_FL_THE)
264268

265269
/* The current function is a normal non-streaming function. */
266270
#define TARGET_NON_STREAMING (AARCH64_ISA_SM_OFF)
@@ -450,6 +454,17 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF;
450454
/* ARMv8.1-A Adv.SIMD support. */
451455
#define TARGET_SIMD_RDMA (TARGET_SIMD && AARCH64_ISA_RDMA)
452456

457+
/* Armv9.4-A features. */
458+
#define TARGET_ARMV9_4 (AARCH64_ISA_V9_4A)
459+
460+
/* 128-bit System Registers and Instructions from Armv9.4-a are enabled
461+
through +d128. */
462+
#define TARGET_D128 (AARCH64_ISA_D128)
463+
464+
/* Armv8.9-A/9.4-A Translation Hardening Extension system registers are
465+
enabled through +the. */
466+
#define TARGET_THE (AARCH64_ISA_THE)
467+
453468
/* Standard register usage. */
454469

455470
/* 31 64-bit general purpose registers R0-R30:

gcc/doc/invoke.texi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21045,10 +21045,12 @@ and the features that they enable by default:
2104521045
@item @samp{armv8.6-a} @tab Armv8.6-A @tab @samp{armv8.5-a}, @samp{+bf16}, @samp{+i8mm}
2104621046
@item @samp{armv8.7-a} @tab Armv8.7-A @tab @samp{armv8.6-a}, @samp{+ls64}
2104721047
@item @samp{armv8.8-a} @tab Armv8.8-a @tab @samp{armv8.7-a}, @samp{+mops}
21048+
@item @samp{armv8.9-a} @tab Armv8.9-a @tab @samp{armv8.8-a}
2104821049
@item @samp{armv9-a} @tab Armv9-A @tab @samp{armv8.5-a}, @samp{+sve}, @samp{+sve2}
2104921050
@item @samp{armv9.1-a} @tab Armv9.1-A @tab @samp{armv9-a}, @samp{+bf16}, @samp{+i8mm}
2105021051
@item @samp{armv9.2-a} @tab Armv9.2-A @tab @samp{armv9.1-a}, @samp{+ls64}
2105121052
@item @samp{armv9.3-a} @tab Armv9.3-A @tab @samp{armv9.2-a}, @samp{+mops}
21053+
@item @samp{armv9.4-a} @tab Armv9.4-A @tab @samp{armv9.3-a}
2105221054
@item @samp{armv8-r} @tab Armv8-R @tab @samp{armv8-r}
2105321055
@end multitable
2105421056

@@ -21359,6 +21361,11 @@ Enable the FEAT_SME_I16I64 extension to SME.
2135921361
Enable the FEAT_SME_F64F64 extension to SME.
2136021362
+@item sme2
2136121363
Enable the Scalable Matrix Extension 2. This also enables SME instructions.
21364+
@item d128
21365+
Enable support for 128-bit system register read/write instructions.
21366+
@item the
21367+
Enable support for Armv8.9-a/9.4-a translation hardening extension.
21368+
2136221369
@end table
2136321370

2136421371
Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd},

0 commit comments

Comments
 (0)