From: Kyrylo Tkachov <[email protected]>

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.

Committing to trunk as obvious.
Thanks,
Kyrill

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]>
---
 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 b4652173a95..baa00c2a123 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)
-- 
2.54.0 (Apple Git-157)

Reply via email to