From bb5d97112a8272c608b18167de9255949129890c Mon Sep 17 00:00:00 2001 From: Jackson Woodruff Date: Wed, 13 Sep 2017 16:49:42 +0000 Subject: [PATCH] [AArch64, PATCH] Improve Neon store of zero Committed on behalf of Jackson Woodruff. --- gcc/ * config/aarch64/constraints.md (Umq): New constraint. * config/aarch64/aarch64-simd.md (*aarch64_simd_mov): Change to use Umq. (mov): Update condition. gcc/testsuite/ * gcc.target/aarch64/simd/vect_str_zero.c: Update testcase. From-SVN: r252387 --- gcc/ChangeLog | 7 +++++++ gcc/config/aarch64/aarch64-simd.md | 17 ++++++++++++----- gcc/config/aarch64/constraints.md | 8 ++++++++ gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/aarch64/simd/vect_str_zero.c | 6 ++++-- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e0257d9675..1f941d4e8e8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-09-13 Jackson Woodruff + + * config/aarch64/constraints.md (Umq): New constraint. + * config/aarch64/aarch64-simd.md (*aarch64_simd_mov): + Change to use Umq. + (mov): Update condition. + 2017-09-13 Kyrylo Tkachov * gimple-ssa-store-merging.c (sort_by_bitpos): Compare store order diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md index 8f045c21050..70e9339e275 100644 --- a/gcc/config/aarch64/aarch64-simd.md +++ b/gcc/config/aarch64/aarch64-simd.md @@ -23,10 +23,17 @@ (match_operand:VALL_F16 1 "general_operand" ""))] "TARGET_SIMD" " - if (GET_CODE (operands[0]) == MEM - && !(aarch64_simd_imm_zero (operands[1], mode) - && aarch64_legitimate_address_p (mode, operands[0], - PARALLEL, 1))) + /* Force the operand into a register if it is not an + immediate whose use can be replaced with xzr. + If the mode is 16 bytes wide, then we will be doing + a stp in DI mode, so we check the validity of that. + If the mode is 8 bytes wide, then we will do doing a + normal str, so the check need not apply. */ + if (GET_CODE (operands[0]) == MEM + && !(aarch64_simd_imm_zero (operands[1], mode) + && ((GET_MODE_SIZE (mode) == 16 + && aarch64_mem_pair_operand (operands[0], DImode)) + || GET_MODE_SIZE (mode) == 8))) operands[1] = force_reg (mode, operands[1]); " ) @@ -126,7 +133,7 @@ (define_insn "*aarch64_simd_mov" [(set (match_operand:VQ 0 "nonimmediate_operand" - "=w, Ump, m, w, ?r, ?w, ?r, w") + "=w, Umq, m, w, ?r, ?w, ?r, w") (match_operand:VQ 1 "general_operand" "m, Dz, w, w, w, r, r, Dn"))] "TARGET_SIMD diff --git a/gcc/config/aarch64/constraints.md b/gcc/config/aarch64/constraints.md index 9ce3d4efaf3..3649fb48a33 100644 --- a/gcc/config/aarch64/constraints.md +++ b/gcc/config/aarch64/constraints.md @@ -156,6 +156,14 @@ (and (match_code "mem") (match_test "REG_P (XEXP (op, 0))"))) +(define_memory_constraint "Umq" + "@internal + A memory address which uses a base register with an offset small enough for + a load/store pair operation in DI mode." + (and (match_code "mem") + (match_test "aarch64_legitimate_address_p (DImode, XEXP (op, 0), + PARALLEL, false)"))) + (define_memory_constraint "Ump" "@internal A memory address suitable for a load/store pair operation." diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1280e90308b..86d030de2d9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-09-13 Jackson Woodruff + + * gcc.target/aarch64/simd/vect_str_zero.c: Update testcase. + 2017-09-13 Marek Polacek PR c/82167 diff --git a/gcc/testsuite/gcc.target/aarch64/simd/vect_str_zero.c b/gcc/testsuite/gcc.target/aarch64/simd/vect_str_zero.c index 07198de1094..00cbf20a0b2 100644 --- a/gcc/testsuite/gcc.target/aarch64/simd/vect_str_zero.c +++ b/gcc/testsuite/gcc.target/aarch64/simd/vect_str_zero.c @@ -7,7 +7,7 @@ void f (uint32x4_t *p) { uint32x4_t x = { 0, 0, 0, 0}; - p[1] = x; + p[4] = x; /* { dg-final { scan-assembler "stp\txzr, xzr," } } */ } @@ -16,7 +16,9 @@ void g (float32x2_t *p) { float32x2_t x = {0.0, 0.0}; - p[0] = x; + p[400] = x; /* { dg-final { scan-assembler "str\txzr, " } } */ } + +/* { dg-final { scan-assembler-not "add\tx\[0-9\]\+, x0, \[0-9\]+" } } */