This is a summary of discussions relative to the merge request created by 
Richard Earnshaw (rearnsha) <[email protected]> titled
aarch64: deprecate the tme extension
since its creation.

Description: Arm has sunset the tme extension from the aarch64 architecture 
since
there are no known implementations.  Since this has been present in the
compiler for a while though, we need to go through a deprecation cycle.

This patch starts that process by:
 - removing it from the documentation
 - warning if the option is used during compilation
 - removing the tests for it.

gcc/ChangeLog:

        * config/aarch64/aarch64.cc (aarch64_override_options): Warn if
        +tme is used as an architecture feature
        * doc/invoke.texi (aarch64): Remove mentions of +tme.

gcc/testsuite/ChangeLog:

        * gcc.target/aarch64/pragma_cpp_predefs_2.c: Drop tests for TME.
        * gcc.target/aarch64/acle/tme.c: Removed.
        * gcc.target/aarch64/acle/tme_guard-1.c: Removed.
        * gcc.target/aarch64/acle/tme_guard-2.c: Removed.
        * gcc.target/aarch64/acle/tme_guard-3.c: Removed.
        * gcc.target/aarch64/acle/tme_guard-4.c: Removed.



The full and up to date discussion can be found at 
https://forge.sourceware.org/gcc/gcc/pulls/186

The merge request has been closed without being merged directly on the forge 
repository.


On 2026-07-14 16:21:29+00:00, Alex Coplan (acoplan) wrote:

I think this fails to warn if users use `+tme` in an attribute or target 
pragma. I tried the following testcases:
```
__attribute__((target("+tme")))
void f(void) {}
```
and:
```
#pragma GCC target ("+tme")
```
we should probably handle those cases too. Otherwise LGTM.


On 2026-07-17 12:25:54+00:00, Richard Earnshaw (rearnsha) wrote:

@acoplan wrote in 
https://forge.sourceware.org/gcc/gcc/pulls/186#issuecomment-6649:

> I think this fails to warn if users use `+tme` in an attribute or target 
> pragma. I tried the following testcases:
> 
> ```text
> __attribute__((target("+tme")))
> void f(void) {}
> ```
> 
> and:
> 
> ```text
> #pragma GCC target ("+tme")
> ```
> 
> we should probably handle those cases too. Otherwise LGTM.

The latest version attempts to address this, but there are limitations due to 
the way the backend is called with new information (there's no real validation 
hook for attributes).

I've hooked into the apply-attribute code to catch the case where TME gets 
enabled when this was previously not the case.  It handles most of the useful 
cases, but not all.  Most notably it doesn't catch the case where an attribute 
is added, but the current architecture already enables TME, so
```
#pragma GCC target ("+tme")
```
will generate a warning if compiled with `-march=armv8-a`, but not if compiled 
with `-march=arm8v-a+tme` (you'll still get a warning for the command-line 
option, but it will mask the code warning).

There seems to be nothing we can do about that with the current hooks; making 
the hook warn every time it is called and TME is enabled will simply flood the 
output with warnings that aren't helpful.  So this is the best compromise.

An additional issue is that precise location information is not available when 
the hook is called - it seems to be pretty close most of the time though, so we 
end up with warnings like:
```
test.c:3:1: warning: the architecture extension ‘+tme’ is deprecated 
[-Wdeprecated]
    3 | [[gnu::target("+tme")]] void e(void) {}
      | ^
```
but 
```
__attribute__((target("+tme")))
void f(void) {}
```
will warn as
```
test.c:6:1: warning: the architecture extension ‘+tme’ is deprecated 
[-Wdeprecated]
    6 | void f(void) {}
      | ^~~~
```
which is slightly confusing given that the attribute is on the preceding line.

On 2026-07-17 13:46:28+00:00, Alex Coplan (acoplan) <[email protected]> 
requested changes to the code:
We could probably do with a test for the deprecation warnings in the different 
scenarios. Otherwise LGTM.

> +++ gcc/config/aarch64/aarch64.cc
> @@ -21079,2 +21083,4 @@
>      {
>        num_attrs++;
> +
> +      if ((strcmp (token, "+tme") == 0) && !TARGET_TME)
Very minor nit, but the parens around strcmp aren't necessary.  Could also be 
more succint as:
```
if (!strcmp (token, "+tme") && !TARGET_TME)
```
but it's fine as is if you prefer, after all we don't expect this code to last 
too long :)
> +++ gcc/config/aarch64/aarch64.cc
> @@ -21079,2 +21083,4 @@
>      {
>        num_attrs++;
> +
> +      if ((strcmp (token, "+tme") == 0) && !TARGET_TME)
Sorry, the extra parenthesis came from when I was trying to test my sanity and 
should have been removed.  I'll fix that when committing.

Although legal, using !strcmp I find to be bad style.  strcmp doesn't return a 
boolean, and what's more the logic of !strcmp is too easily read as 'not a 
match'.  '==' is also consistently used throughout this file for string 
equality.


On 2026-07-17 15:43:33+00:00, Richard Earnshaw (rearnsha) wrote:

Committed

Reply via email to