diff mbox series

[Arm] : MVE: Add mve vec_duplicate pattern

Message ID 47b9ef15-0dea-7093-2320-b8f904069e0a@arm.com
State New
Headers show
Series [Arm] : MVE: Add mve vec_duplicate pattern | expand

Commit Message

Andre Vieira (lists) April 15, 2020, 7:42 a.m. UTC
Hi,

This patch fixes an ICE we were seeing due to a missing vec_duplicate 
pattern.

Regression tested on arm-none-eabi.

Is this OK for trunk?

gcc/ChangeLog:
2020-04-15  Andre Vieira  <andre.simoesdiasvieira@arm.com>

         * config/arm/mve.md (mve_vec_duplicate<mode>): New pattern.
         (V_sz_elem2): Remove unused mode attribute.

gcc/testsuite/ChangeLog:
2020-04-15  Andre Vieira <andre.simoesdiasvieira@arm.com>
             Srinath Parvathaneni <srinath.parvathaneni@arm.com>

         * gcc.target/arm/mve/intrinsics/mve_vec_duplicate.c: New test.

Comments

Kyrylo Tkachov April 15, 2020, 7:48 a.m. UTC | #1
> -----Original Message-----
> From: Andre Vieira (lists) <andre.simoesdiasvieira@arm.com>
> Sent: 15 April 2020 08:43
> To: gcc-patches@gcc.gnu.org
> Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>
> Subject: [PATCH][GCC][Arm]: MVE: Add mve vec_duplicate pattern
> 
> Hi,
> 
> This patch fixes an ICE we were seeing due to a missing vec_duplicate
> pattern.
> 
> Regression tested on arm-none-eabi.
> 
> Is this OK for trunk?

Ok.
Thanks,
Kyrill

> 
> gcc/ChangeLog:
> 2020-04-15  Andre Vieira  <andre.simoesdiasvieira@arm.com>
> 
>          * config/arm/mve.md (mve_vec_duplicate<mode>): New pattern.
>          (V_sz_elem2): Remove unused mode attribute.
> 
> gcc/testsuite/ChangeLog:
> 2020-04-15  Andre Vieira <andre.simoesdiasvieira@arm.com>
>              Srinath Parvathaneni <srinath.parvathaneni@arm.com>
> 
>          * gcc.target/arm/mve/intrinsics/mve_vec_duplicate.c: New test.
diff mbox series

Patch

diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md
index c49c14c4240838ce086f424f58726e2e94cf190e..047b4769a28daebdc0175804c578a0d11830a291 100644
--- a/gcc/config/arm/mve.md
+++ b/gcc/config/arm/mve.md
@@ -17,8 +17,6 @@ 
 ;; along with GCC; see the file COPYING3.  If not see
 ;; <http://www.gnu.org/licenses/>.
 
-(define_mode_attr V_sz_elem2 [(V16QI "s8") (V8HI "u16") (V4SI "u32")
-			      (V2DI "u64")])
 (define_mode_iterator MVE_types [V16QI V8HI V4SI V2DI TI V8HF V4SF V2DF])
 (define_mode_iterator MVE_VLD_ST [V16QI V8HI V4SI V8HF V4SF])
 (define_mode_iterator MVE_0 [V8HF V4SF])
@@ -11301,3 +11299,10 @@  (define_insn "mve_vshlcq_m_<supf><mode>"
  "vpst\;vshlct\t%q0, %1, %4"
  [(set_attr "type" "mve_move")
   (set_attr "length" "8")])
+
+(define_insn "*mve_vec_duplicate<mode>"
+ [(set (match_operand:MVE_VLD_ST 0 "s_register_operand" "=w")
+       (vec_duplicate:MVE_VLD_ST (match_operand:<V_elem> 1 "general_operand" "r")))]
+ "TARGET_HAVE_MVE || TARGET_HAVE_MVE_FLOAT"
+ "vdup.<V_sz_elem>\t%q0, %1"
+ [(set_attr "type" "mve_move")])
diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vec_duplicate.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vec_duplicate.c
new file mode 100644
index 0000000000000000000000000000000000000000..eda836151b3a16eb54ddebabf185be3cd8980acc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_vec_duplicate.c
@@ -0,0 +1,13 @@ 
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O2" } */
+
+#include "arm_mve.h"
+
+float32x4_t a;
+
+void foo (void)
+{
+  a = 1.41176471f - 0.47058824f * a;
+}
+