From: Richard Sandiford Date: Tue, 5 Dec 2023 10:24:00 +0000 (+0000) Subject: aarch64: Add +sme2 X-Git-Tag: basepoints/gcc-15~3964 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b58b2205ffdce90878aefe2dccf0d24a1241779;p=thirdparty%2Fgcc.git aarch64: Add +sme2 gcc/ * doc/invoke.texi: Document +sme2. * doc/sourcebuild.texi: Document aarch64_sme2. * config/aarch64/aarch64-option-extensions.def (AARCH64_OPT_EXTENSION): Add sme2. * config/aarch64/aarch64.h (AARCH64_ISA_SME2, TARGET_SME2): New macros. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_aarch64_sme2): New target test. (check_effective_target_aarch64_asm_sme2_ok): Likewise. --- diff --git a/gcc/config/aarch64/aarch64-option-extensions.def b/gcc/config/aarch64/aarch64-option-extensions.def index 1480e498bbb0..c156d2ee76a1 100644 --- a/gcc/config/aarch64/aarch64-option-extensions.def +++ b/gcc/config/aarch64/aarch64-option-extensions.def @@ -157,4 +157,6 @@ AARCH64_OPT_EXTENSION("sme-i16i64", SME_I16I64, (SME), (), (), "") AARCH64_OPT_EXTENSION("sme-f64f64", SME_F64F64, (SME), (), (), "") +AARCH64_OPT_EXTENSION("sme2", SME2, (SME), (), (), "sme2") + #undef AARCH64_OPT_EXTENSION diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h index f9139a8e28f6..854eb7bedc9c 100644 --- a/gcc/config/aarch64/aarch64.h +++ b/gcc/config/aarch64/aarch64.h @@ -227,6 +227,7 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF; #define AARCH64_ISA_SME (aarch64_isa_flags & AARCH64_FL_SME) #define AARCH64_ISA_SME_I16I64 (aarch64_isa_flags & AARCH64_FL_SME_I16I64) #define AARCH64_ISA_SME_F64F64 (aarch64_isa_flags & AARCH64_FL_SME_F64F64) +#define AARCH64_ISA_SME2 (aarch64_isa_flags & AARCH64_FL_SME2) #define AARCH64_ISA_V8_3A (aarch64_isa_flags & AARCH64_FL_V8_3A) #define AARCH64_ISA_DOTPROD (aarch64_isa_flags & AARCH64_FL_DOTPROD) #define AARCH64_ISA_AES (aarch64_isa_flags & AARCH64_FL_AES) @@ -332,6 +333,9 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE = AARCH64_FL_SM_OFF; /* The FEAT_SME_F64F64 extension to SME, enabled through +sme-f64f64. */ #define TARGET_SME_F64F64 (AARCH64_ISA_SME_F64F64) +/* SME2 instructions, enabled through +sme2. */ +#define TARGET_SME2 (AARCH64_ISA_SME2) + /* ARMv8.3-A features. */ #define TARGET_ARMV8_3 (AARCH64_ISA_V8_3A) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 806babc3dfa7..f93128dbe2b3 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -21279,7 +21279,8 @@ Enable the Scalable Matrix Extension. Enable the FEAT_SME_I16I64 extension to SME. @item sme-f64f64 Enable the FEAT_SME_F64F64 extension to SME. - ++@item sme2 +Enable the Scalable Matrix Extension 2. This also enables SME instructions. @end table Feature @option{crypto} implies @option{aes}, @option{sha2}, and @option{simd}, diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index 123e73508b6a..c99090268541 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -2318,6 +2318,8 @@ Binutils installed on test system supports relocation types required by -fpic for AArch64 small memory model. @item aarch64_sme AArch64 target that generates instructions for SME. +@item aarch64_sme2 +AArch64 target that generates instructions for SME2. @item aarch64_sve_hw AArch64 target that is able to generate and execute SVE code (regardless of whether it does so by default). diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 986004bf13cf..3fcce6be49d6 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -4398,6 +4398,18 @@ proc check_effective_target_aarch64_sme { } { }] } +# Return 1 if this is an AArch64 target that generates instructions for SME. +proc check_effective_target_aarch64_sme2 { } { + if { ![istarget aarch64*-*-*] } { + return 0 + } + return [check_no_compiler_messages aarch64_sme2 assembly { + #if !defined (__ARM_FEATURE_SME2) + #error FOO + #endif + }] +} + # Return 1 if this is a compiler supporting ARC atomic operations proc check_effective_target_arc_atomic { } { return [check_no_compiler_messages arc_atomic assembly { @@ -11628,7 +11640,7 @@ proc check_effective_target_aarch64_tiny { } { foreach { aarch64_ext } { "fp" "simd" "crypto" "crc" "lse" "dotprod" "sve" "i8mm" "f32mm" "f64mm" "bf16" "sb" "sve2" "ls64" - "sme" "sme-i16i64" } { + "sme" "sme-i16i64" "sme2" } { eval [string map [list FUNC $aarch64_ext] { proc check_effective_target_aarch64_asm_FUNC_ok { } { if { [istarget aarch64*-*-*] } {