From: Torbjörn SVENSSON <[email protected]>

Only use the NEON-specific misalignment checks for vector modes.
Let the default hook handle non-vector modes.

        PR testsuite/124342
        PR testsuite/124619

gcc/ChangeLog:

        * config/arm/arm.cc (arm_builtin_support_vector_misalignment):
        Only use the NEON-specific path for vector modes.

Signed-off-by: Torbjörn SVENSSON <[email protected]>
Co-authored-by: Tamar Christina <[email protected]>
---
Changes since v1:

- Renamed define TEST_V2QI to TEST_V2QI_ALIGN
- Renamed define TEST_V2QI_2 to TEST_V2QI_UNALIGN

Changes since v2:

- Replaced all previous changes with a VECTOR_MODE_P check in 
arm_builtin_support_vector_misalignment

Changes since v3:

- Moved VECTOR_MODE_P check gate the entire NEON block. 


I've tested this change on top of r17-5280-gf27da74230644c.
Only FAIL/XPASS -> PASS/XFAIL changes are noted for NEON capable arm-none-eabi 
target, other targets are unaffected.

Ok for trunk and releases/gcc-16?


--



This is a forge pull request published on the gcc-patches mailing list mailing 
list
as requested by Torbjörn Svensson via Sourceware Forge 
<[email protected]>.
Forge discussion: https://forge.sourceware.org/gcc/gcc/pulls/215

Get it locally using:
```
git fetch forge-upstream "+refs/versioned_pull/215/*:refs/versioned_pull/215/*"
git switch -c "pr-215-v4" "refs/versioned_pull/215/4/head"
```
Or, download the patch at: https://forge.sourceware.org/gcc/gcc/pulls/215.diff
Created on: 2026-08-10 17:42:02+00:00
Latest update: 2026-11-19 09:00:57+00:00
Changes: 1 changed files, 2 additions, 1 deletions
Head revision: azoff/gcc ref pr/Wstringop-overflow commit 
c6accc6bbd6dd2c1deaa9c0efd1f1bfe7fa3f6dc 
Base revision: gcc/gcc ref trunk commit 
f27da74230644cda0b3391955a61781da7164988 r17-5280-gf27da74230644c
Merge base: f27da74230644cda0b3391955a61781da7164988
Requested Reviewers: rearnsha

Changed files:
- M: gcc/config/arm/arm.cc

 gcc/config/arm/arm.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index 940c689b21e0e..3cc8a84eb489a 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -29792,7 +29792,8 @@ arm_builtin_support_vector_misalignment (machine_mode 
mode,
                                         bool is_packed,
                                         bool is_gather_scatter)
 {
-  if (TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access)
+  if (TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access
+      && VECTOR_MODE_P (mode))
     {
       HOST_WIDE_INT align = GET_MODE_UNIT_SIZE (mode);
 

Range-diff against v3:
1:  7bcfd8279de10 ! 1:  c6accc6bbd6dd arm: Reject non-vector modes in vector 
misalignment hook [PR124342] [PR124619]
    @@ Metadata
     Author: Torbjörn SVENSSON <[email protected]>
     
      ## Commit message ##
    -    arm: Reject non-vector modes in vector misalignment hook [PR124342] 
[PR124619]
    +    arm: Limit NEON vector misalignment handling to vector modes 
[PR124342,PR124619]
     
    -    Do not report support for misaligned accesses in non-vector modes
    -    in the NEON path, except for the existing gather/scatter and packed
    -    access cases.
    +    Only use the NEON-specific misalignment checks for vector modes.
    +    Let the default hook handle non-vector modes.
     
                 PR testsuite/124342
                 PR testsuite/124619
    @@ Commit message
         gcc/ChangeLog:
     
                 * config/arm/arm.cc (arm_builtin_support_vector_misalignment):
    -            Return false for non-vector modes after handling gather/scatter
    -            and packed accesses.
    +            Only use the NEON-specific path for vector modes.
     
         Signed-off-by: Torbjörn SVENSSON <[email protected]>
         Co-authored-by: Tamar Christina <[email protected]>
     
      ## gcc/config/arm/arm.cc ##
     @@ gcc/config/arm/arm.cc: arm_builtin_support_vector_misalignment 
(machine_mode mode,
    -       if (is_packed)
    -         return align == 1;
    +                                    bool is_packed,
    +                                    bool is_gather_scatter)
    + {
    +-  if (TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access)
    ++  if (TARGET_NEON && !BYTES_BIG_ENDIAN && unaligned_access
    ++      && VECTOR_MODE_P (mode))
    +     {
    +       HOST_WIDE_INT align = GET_MODE_UNIT_SIZE (mode);
      
    -+      if (!VECTOR_MODE_P (mode))
    -+  return false;
    -+
    -       /* If the misalignment is unknown, we should be able to handle the 
access
    -    so long as it is not to a member of a packed data structure.  */
    -       if (misalignment == -1)
-- 
2.56.0

Reply via email to