public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2239] arm/98435: Missed optimization in expanding vector constructor.
@ 2021-07-12  7:55 Prathamesh Kulkarni
  0 siblings, 0 replies; only message in thread
From: Prathamesh Kulkarni @ 2021-07-12  7:55 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1e72c24d2f3b1427f5e117e371928e7af50d2036

commit r12-2239-g1e72c24d2f3b1427f5e117e371928e7af50d2036
Author: prathamesh.kulkarni <prathamesh.kulkarni@linaro.org>
Date:   Mon Jul 12 13:23:06 2021 +0530

    arm/98435: Missed optimization in expanding vector constructor.
    
    The patch moves vec_init pattern from neon.md to vec-common.md,
    and adjusts the mode to VDQX to accomodate binary floats. Also,
    the pattern is additionally gated on VALID_MVE_MODE.
    
    gcc/ChangeLog:
            PR target/98435
            * config/arm/neon.md (vec_init): Move to ...
            * config/arm/vec-common.md (vec_init): ... here.
            Change the pattern's mode to VDQX and gate it on VALID_MVE_MODE.
    
    gcc/testsuite/ChangeLog:
            PR target/98435
            * gcc.target/arm/simd/pr98435.c: New test.

Diff:
---
 gcc/config/arm/neon.md                      |  9 ---------
 gcc/config/arm/vec-common.md                |  9 +++++++++
 gcc/testsuite/gcc.target/arm/simd/pr98435.c | 15 +++++++++++++++
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index 81cc8d36d55..64365e0a909 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -458,15 +458,6 @@
   [(set_attr "type" "neon_store1_one_lane_q,neon_to_gp_q")]
 )
 
-(define_expand "vec_init<mode><V_elem_l>"
-  [(match_operand:VDQ 0 "s_register_operand")
-   (match_operand 1 "" "")]
-  "TARGET_NEON || TARGET_HAVE_MVE"
-{
-  neon_expand_vector_init (operands[0], operands[1]);
-  DONE;
-})
-
 ;; Doubleword and quadword arithmetic.
 
 ;; NOTE: some other instructions also support 64-bit integer
diff --git a/gcc/config/arm/vec-common.md b/gcc/config/arm/vec-common.md
index f90afa4cdb9..68de4f0f943 100644
--- a/gcc/config/arm/vec-common.md
+++ b/gcc/config/arm/vec-common.md
@@ -702,3 +702,12 @@
    DONE;
  }
 )
+
+(define_expand "vec_init<mode><V_elem_l>"
+  [(match_operand:VDQX 0 "s_register_operand")
+   (match_operand 1 "" "")]
+  "TARGET_NEON || (TARGET_HAVE_MVE && VALID_MVE_MODE (<MODE>mode))"
+{
+  neon_expand_vector_init (operands[0], operands[1]);
+  DONE;
+})
diff --git a/gcc/testsuite/gcc.target/arm/simd/pr98435.c b/gcc/testsuite/gcc.target/arm/simd/pr98435.c
new file mode 100644
index 00000000000..0af8633fd56
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/pr98435.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ffast-math" } */
+/* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
+/* { dg-add-options arm_v8_2a_bf16_neon } */
+/* { dg-additional-options "-mfloat-abi=softfp -march=armv8.2-a+bf16+fp16" } */
+
+#include <arm_neon.h>
+
+bfloat16x4_t f (bfloat16_t a)
+{
+  return (bfloat16x4_t) {a, a, a, a};
+}
+
+/* { dg-final { scan-assembler {\tvdup.16\td[0-9]+, r0} } } */
+/* { dg-final { scan-assembler {\tvmov\tr0, r1, d[0-9]+} } } */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-12  7:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12  7:55 [gcc r12-2239] arm/98435: Missed optimization in expanding vector constructor Prathamesh Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).