]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Adjust TARGET_SVE{2}
authorAlice Carlotti <alice.carlotti@arm.com>
Fri, 2 Jan 2026 16:58:09 +0000 (16:58 +0000)
committerAlice Carlotti <alice.carlotti@arm.com>
Mon, 23 Feb 2026 11:16:43 +0000 (11:16 +0000)
Many instructions that are currently gated on TARGET_SVE or TARGET_SVE2
are also available in streaming mode when non-streaming SVE is disabled.
The simplest way to reflect this is by updating the macros to include
"|| TARGET_STREAMING".

Any SVE/SVE2 instructions that aren't available in streaming mode
already have an explicit "&& TARGET_NONSTREAMING" in their condition, so
in this case the extra condition has no impact besides a marginal
performance loss.

There are two uses of TARGET_SVE{2} that need handling separately:

- In aarch64_adjust_generic_arch_tuning, we are using features as a
  proxy for tuning decisions, in which case we should treat
  non-streaming mode with SME enabled the same as if either SVE2 or
  streaming mode are enabled.

- In aarch64_update_cpp_builtins, streaming mode enablement is not a
  relevant condition for defining __ARM_FEATURE_* macros, so use an
  explicit feature flags check instead.

gcc/ChangeLog:

* config/aarch64/aarch64-c.cc (aarch64_update_cpp_builtins):
Replace TARGET_SVE{2} with explicit feature flag checks.
* config/aarch64/aarch64.cc
(aarch64_adjust_generic_arch_tuning): Add SME to SVE2 check.
* config/aarch64/aarch64.h (TARGET_SVE): Adjust condition.
(TARGET_SVE2): Ditto.

gcc/config/aarch64/aarch64-c.cc
gcc/config/aarch64/aarch64.cc
gcc/config/aarch64/aarch64.h

index dbe940a8ba9230cac1da00e765db91d1eacfdaba..a355cfdd1698a24ec70488d5b70384fd567c5ed1 100644 (file)
@@ -196,7 +196,7 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
 
   aarch64_def_or_undef (TARGET_AES && TARGET_SHA2, "__ARM_FEATURE_CRYPTO", pfile);
   aarch64_def_or_undef (TARGET_SIMD_RDMA, "__ARM_FEATURE_QRDMX", pfile);
-  aarch64_def_or_undef (TARGET_SVE, "__ARM_FEATURE_SVE", pfile);
+  aarch64_def_or_undef (AARCH64_HAVE_ISA (SVE), "__ARM_FEATURE_SVE", pfile);
   cpp_undef (pfile, "__ARM_FEATURE_SVE_BITS");
   cpp_undef (pfile, "__ARM_FEATURE_SVE_VECTOR_OPERATORS");
   cpp_undef (pfile, "__ARM_FEATURE_SVE_PREDICATE_OPERATORS");
@@ -221,9 +221,9 @@ aarch64_update_cpp_builtins (cpp_reader *pfile)
   aarch64_def_or_undef (TARGET_SVE_F64MM,
                        "__ARM_FEATURE_SVE_MATMUL_FP64", pfile);
   aarch64_def_or_undef (AARCH64_HAVE_ISA (SVE_B16B16)
-                       && (TARGET_SVE2 || TARGET_SME2),
+                       && (AARCH64_HAVE_ISA (SVE2) || TARGET_SME2),
                        "__ARM_FEATURE_SVE_B16B16", pfile);
-  aarch64_def_or_undef (TARGET_SVE2, "__ARM_FEATURE_SVE2", pfile);
+  aarch64_def_or_undef (AARCH64_HAVE_ISA (SVE2), "__ARM_FEATURE_SVE2", pfile);
   aarch64_def_or_undef (TARGET_SVE2_AES, "__ARM_FEATURE_SVE2_AES", pfile);
   aarch64_def_or_undef (TARGET_SVE2_BITPERM,
                        "__ARM_FEATURE_SVE2_BITPERM", pfile);
index c6ba4dc56a3a661537e557c63b80cce3c60e01f6..3f1b7dfb9d306cf1f5c5aafafbd750b3aef13b10 100644 (file)
@@ -19525,7 +19525,7 @@ aarch64_adjust_generic_arch_tuning (struct tune_params &current_tune)
   /* Neoverse V1 is the only core that is known to benefit from
      AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS.  There is therefore no
      point enabling it for SVE2 and above.  */
-  if (TARGET_SVE2)
+  if (TARGET_SVE2 || TARGET_SME)
     current_tune.extra_tuning_flags
       &= ~AARCH64_EXTRA_TUNE_CSE_SVE_VL_CONSTANTS;
   if (!AARCH64_HAVE_ISA(V8_8A))
index 21f9682ef97ced1a343c33acf6971848b5bd53d5..d61705d78f61924c1635d6fd9304fea23bb18aa2 100644 (file)
@@ -284,11 +284,11 @@ constexpr auto AARCH64_FL_DEFAULT_ISA_MODE ATTRIBUTE_UNUSED
 /* Dot Product is an optional extension to AdvSIMD enabled through +dotprod.  */
 #define TARGET_DOTPROD AARCH64_HAVE_ISA (DOTPROD)
 
-/* SVE instructions, enabled through +sve.  */
-#define TARGET_SVE AARCH64_HAVE_ISA (SVE)
+/* SVE instructions, enabled in non-streaming mode through +sve.  */
+#define TARGET_SVE (AARCH64_HAVE_ISA (SVE) || TARGET_STREAMING)
 
-/* SVE2 instructions, enabled through +sve2.  */
-#define TARGET_SVE2 AARCH64_HAVE_ISA (SVE2)
+/* SVE2 instructions, enabled in non-streaming mode through +sve2.  */
+#define TARGET_SVE2 (AARCH64_HAVE_ISA (SVE2) || TARGET_STREAMING)
 
 /* SVE2 AES instructions, enabled through +sve2-aes.  */
 #define TARGET_SVE2_AES (AARCH64_HAVE_ISA (SVE2) \