Hi gcc-patches mailing list,
Karl Meakin via Sourceware Forge 
<[email protected]> has requested that the 
following forgejo pull request
be published on the mailing list.

Created on: 2026-07-20 12:49:31+00:00
Latest update: 2026-07-22 13:41:31+00:00
Changes: 0 changed files, 0 additions, 0 deletions
Head revision: karmea01/gcc-TEST ref km/neon-port-fix-pr126133 commit 
01443d664a96d3b7b3b8d2d7dea4d6a9f0e50a8b
Base revision: gcc/gcc ref trunk commit 
9cdb20d76ac54e68e5baa928919487addf3bfad2 r17-2594-g9cdb20d76ac54e
Merge base: 9cdb20d76ac54e68e5baa928919487addf3bfad2
Full diff url: https://forge.sourceware.org/gcc/gcc/pulls/194.diff
Discussion:  https://forge.sourceware.org/gcc/gcc/pulls/194
Requested Reviewers:

Make `aarch64_update_ipa_fn_target_info` more conservative, by setting
the `AARCH64_IPA_SM_FIXED` bit by default. The bit will only be unset if
the function is annotated with `[[arm::streaming_compatible]]`. This
matches the ACLE's specification which states that functions are by
default non-streaming.

This fixes PR 126133 by causing inlining to fail, even with
`[[gnu::always_inline]]`, because the target features do not match.

gcc/ChangeLog:

        * config/aarch64/aarch64.cc (aarch64_update_ipa_fn_target_info):
        set `AARCH64_IPA_SM_FIXED` when the call's decl is null.

gcc/testsuite/ChangeLog:

        * gcc.target/aarch64/pr126133-1.c: New test.
        * gcc.target/aarch64/pr126133-2.c: New test.
        * gcc.target/aarch64/pr126133-3.c: New test.


Changed files:
- A: gcc/testsuite/gcc.target/aarch64/pr126133-1.c
- A: gcc/testsuite/gcc.target/aarch64/pr126133-2.c
- A: gcc/testsuite/gcc.target/aarch64/pr126133-3.c
- M: gcc/config/aarch64/aarch64.cc


Karl Meakin (1):
  aarch64: Assume function's are non-streaming unless annotated
    [PR126133]

 gcc/config/aarch64/aarch64.cc                 | 15 ++++++-------
 gcc/testsuite/gcc.target/aarch64/pr126133-1.c | 19 +++++++++++++++++
 gcc/testsuite/gcc.target/aarch64/pr126133-2.c | 21 +++++++++++++++++++
 gcc/testsuite/gcc.target/aarch64/pr126133-3.c | 19 +++++++++++++++++
 4 files changed, 65 insertions(+), 9 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr126133-1.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr126133-2.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr126133-3.c

Range-diff against v1:
1:  bca9ef6d7cda ! 1:  01443d664a96 aarch64: treat functions with missing decl 
as non-streaming [PR126133]
    @@ Metadata
     Author: Karl Meakin <[email protected]>
     
      ## Commit message ##
    -    aarch64: treat functions with missing decl as non-streaming [PR126133]
    +    aarch64: Assume function's are non-streaming unless annotated 
[PR126133]
     
    -    Change `aarch64_update_ipa_fn_target_info` to set 
`AARCH64_IPA_SM_FIXED`
    -    when the call's decl is null.
    +    Make `aarch64_update_ipa_fn_target_info` more conservative, by setting
    +    the `AARCH64_IPA_SM_FIXED` bit by default. The bit will only be unset 
if
    +    the function is annotated with `[[arm::streaming_compatible]]`. This
    +    matches the ACLE's specification which states that functions are by
    +    default non-streaming.
     
    -    This fixes PR126133 by causing inlining to fail, even with
    -    `[[always_inline]]`, because the target features do not match.
    -
    -            PR 126133
    +    This fixes PR 126133 by causing inlining to fail, even with
    +    `[[gnu::always_inline]]`, because the target features do not match.
     
         gcc/ChangeLog:
     
                 * config/aarch64/aarch64.cc 
(aarch64_update_ipa_fn_target_info):
    +            set the `AARCH64_IPA_SM_FIXED` bit unless the function is
    +            annotated with `[[arm::streaming_compatible]]`.
     
         gcc/testsuite/ChangeLog:
     
    @@ gcc/config/aarch64/aarch64.cc: aarch64_update_ipa_fn_target_info 
(unsigned int &
        if (auto *call = dyn_cast<const gcall *> (stmt))
          {
     -      if (gimple_call_builtin_p (call, BUILT_IN_MD))
    -+      if (tree decl = gimple_call_fndecl (call))
    -   {
    -     /* The attributes on AArch64 builtins are supposed to be accurate.
    -        If the function isn't marked streaming-compatible then it
    -        needs whichever SM mode it selects.  */
    +-  {
    +-    /* The attributes on AArch64 builtins are supposed to be accurate.
    +-       If the function isn't marked streaming-compatible then it
    +-       needs whichever SM mode it selects.  */
     -    tree decl = gimple_call_fndecl (call);
    -     if (aarch64_fndecl_pstate_sm (decl) != 0)
    -       info |= AARCH64_IPA_SM_FIXED;
    -   }
    -+      /* All functions not otherwise annotated are considered 
non-streaming.  */
    -+      else
    +-    if (aarch64_fndecl_pstate_sm (decl) != 0)
    +-      info |= AARCH64_IPA_SM_FIXED;
    +-  }
    ++      /* Assume functions are non-streaming by default.
    ++  They are only streaming or streaming-compatible if they have the
    ++  corresponding attribute.  */
    ++      tree decl = gimple_call_fndecl (call);
    ++      if (!decl || aarch64_fndecl_pstate_sm (decl) != 0)
     +  info |= AARCH64_IPA_SM_FIXED;
          }
        return true;
    @@ gcc/testsuite/gcc.target/aarch64/pr126133-2.c (new)
     +
     +#define ALWAYS_INLINE [[gnu::always_inline]] inline
     +
    ++/* Gets expanded to addition early, so no error.
    ++   An error would be more correct though.  */
     +ALWAYS_INLINE
     +uint8x16_t
    -+add_helper (uint8x16_t x,uint8x16_t y) /* { dg-error "inlining failed" } 
*/
    ++add_helper (uint8x16_t x, uint8x16_t y)
     +{
     +  return vaddq_u8 (x, y);
     +}
-- 
2.54.0

Reply via email to