https://gcc.gnu.org/g:245fa626b8167c7841b4d271e3925f10d242b7dc

commit r17-6384-g245fa626b8167c7841b4d271e3925f10d242b7dc
Author: Kyrylo Tkachov <[email protected]>
Date:   Tue Nov 17 06:57:36 2026 -0800

    testsuite: Accept indexed addressing in aarch64 fneg-abs_3.c
    
    fneg-abs_3.c checks that fneg (fabs (x)) vectorizes to a single ORR with
    the sign-bit mask.  It also requires the post-incremented address
    "str q, [x0], 16".  The harness runs it with -mtune=generic, and since
    the ivopts register pressure estimate stopped charging for the number of
    registers used when enough are available (6d975812860 and the
    2c1e9720748..0d5fe4ed054 series), ivopts picks the index candidate
    instead of the pointer candidate for this tuning:
    
            .L3:
                    ldr     q31, [x0, x2]
                    orr     v31.4s, #128, lsl #24
                    str     q31, [x0, x2]
                    add     x2, x2, 16
                    cmp     x1, x2
                    bne     .L3
    
    The post-increment form is:
    
            .L3:
                    ldr     q31, [x0]
                    orr     v31.4s, #128, lsl #24
                    str     q31, [x0], 16
                    cmp     x1, x0
                    bne     .L3
    
    The indexed loop has one more scalar instruction per iteration.  The
    candidates tie in cost apart from the amortised setup of the loop bound
    "a + bnd * 16", which costs 1 under the cortexa57 extra costs used by
    -mtune=generic and 0 under the default generic-armv8-a tuning.  The
    default tuning still produces the post-increment loop.  Making ivopts
    model the folded increment is a separate middle-end problem, and the
    ORR is what this test is about.
    
    Accept either a register-offset or a post-incremented store address.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/fneg-abs_3.c: Accept register-offset and
            post-increment addressing in the check-function-bodies patterns.
    
    Signed-off-by: Kyrylo Tkachov <[email protected]>

Diff:
---
 gcc/testsuite/gcc.target/aarch64/fneg-abs_3.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.target/aarch64/fneg-abs_3.c 
b/gcc/testsuite/gcc.target/aarch64/fneg-abs_3.c
index b4652173a95d..baa00c2a1239 100644
--- a/gcc/testsuite/gcc.target/aarch64/fneg-abs_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/fneg-abs_3.c
@@ -10,9 +10,9 @@
 /*
 ** f1:
 **     ...
-**     ldr     q[0-9]+, \[x0\]
+**     ldr     q[0-9]+, \[x0(, x[0-9]+)?\]
 **     orr     v[0-9]+.4s, #128, lsl #24
-**     str     q[0-9]+, \[x0\], 16
+**     str     q[0-9]+, \[x0(, x[0-9]+\]|\], 16)
 **     ...
 */
 void f1 (float32_t *a, int n)
@@ -24,9 +24,9 @@ void f1 (float32_t *a, int n)
 /*
 ** f2:
 **     ...
-**     ldr     q[0-9]+, \[x0\]
+**     ldr     q[0-9]+, \[x0(, x[0-9]+)?\]
 **     orr     v[0-9]+.16b, v[0-9]+.16b, v[0-9]+.16b
-**     str     q[0-9]+, \[x0\], 16
+**     str     q[0-9]+, \[x0(, x[0-9]+\]|\], 16)
 **     ...
 */
 void f2 (float64_t *a, int n)

Reply via email to