https://gcc.gnu.org/g:8ec0547e24972e7cf23e8096d0e8db3d2c44b45f

commit r17-2563-g8ec0547e24972e7cf23e8096d0e8db3d2c44b45f
Author: Alex Coplan <[email protected]>
Date:   Fri Jul 17 18:40:52 2026 +0100

    aarch64: Fix up TME deprecation warning
    
    This is a follow-up patch to Richard E's r17-2498-g17f084306c68c4 (#186
    on the Forge).  As Alice pointed out in her review:
    https://gcc.gnu.org/pipermail/gcc-patches/2026-July/724391.html
    the original patch missed things like +memtag+tme due to the string
    parsing approach.  This instead just inspects the parsed feature flags
    from aarch64_parse_extension to determine whether to warn in the target
    attribute/pragma case.
    
    +tme on the command line is handled as per Richard's original patch (no
    change there).
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64.cc (aarch64_handle_attr_isa_flags):
            Warn if +tme is enabled by the target attribute/pragma, relying
            on the feature flags from aarch64_parse_extension.
            (aarch64_process_target_attr): Drop +tme warning based on custom
            string parsing.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/deprecate-tme.c: New test.

Diff:
---
 gcc/config/aarch64/aarch64.cc                    |  8 ++++----
 gcc/testsuite/gcc.target/aarch64/deprecate-tme.c | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 40b68709dbb1..61562c94a553 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -20822,6 +20822,10 @@ aarch64_handle_attr_isa_flags (char *str)
 
   if (parse_res == AARCH_PARSE_OK)
     {
+      if (!TARGET_TME && (isa_flags & AARCH64_FL_TME))
+       warning (OPT_Wdeprecated,
+                "the architecture extension %<+tme%> is deprecated");
+
       aarch64_set_asm_isa_flags (isa_flags);
       return true;
     }
@@ -21083,10 +21087,6 @@ aarch64_process_target_attr (tree args)
     {
       num_attrs++;
 
-      if (strcmp (token, "+tme") == 0 && !TARGET_TME)
-       warning (OPT_Wdeprecated,
-                "the architecture extension %<+tme%> is deprecated");
-
       if (!aarch64_process_one_target_attr (token))
        {
          /* Check if token is possibly an arch extension without
diff --git a/gcc/testsuite/gcc.target/aarch64/deprecate-tme.c 
b/gcc/testsuite/gcc.target/aarch64/deprecate-tme.c
new file mode 100644
index 000000000000..b190c4d2c211
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/deprecate-tme.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+__attribute__((target("+tme")))
+void a(void) {} /* { dg-warning {'\+tme' is deprecated} } */
+
+__attribute__((target("+dotprod+tme")))
+void b(void) {} /* { dg-warning {'\+tme' is deprecated} } */
+
+#pragma GCC target ("+nothing+tme") /* { dg-warning {'\+tme' is deprecated} } 
*/
+
+void c(void) {}
+
+/* No warning here, we only want to warn when tme transitions from
+   disabled to enabled.  This helps keeps noise to a minimum.  */
+__attribute__((target("+tme")))
+void d(void) {}

Reply via email to