diff mbox series

testsuite/arm: Add mve-vadd-scalar-1.c test

Message ID 1619791581-465-1-git-send-email-christophe.lyon@linaro.org
State New
Headers show
Series testsuite/arm: Add mve-vadd-scalar-1.c test | expand

Commit Message

Christophe Lyon April 30, 2021, 2:06 p.m. UTC
This patch adds a test for the scalar mode of vadd, precisely noting
that we do not yet use the T2 variants of vadd, which take a scalar as
final argument.

2021-04-22  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/testsuite/
	* gcc.target/arm/simd/mve-vadd-scalar-1: New.
---
 .../gcc.target/arm/simd/mve-vadd-scalar-1.c        | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c

Comments

Christophe Lyon May 10, 2021, 11:22 a.m. UTC | #1
Ping?

On Fri, 30 Apr 2021 at 16:06, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>
> This patch adds a test for the scalar mode of vadd, precisely noting
> that we do not yet use the T2 variants of vadd, which take a scalar as
> final argument.
>
> 2021-04-22  Christophe Lyon  <christophe.lyon@linaro.org>
>
>         gcc/testsuite/
>         * gcc.target/arm/simd/mve-vadd-scalar-1: New.
> ---
>  .../gcc.target/arm/simd/mve-vadd-scalar-1.c        | 47 ++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
>
> diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
> new file mode 100644
> index 0000000..bbf70e1
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
> @@ -0,0 +1,47 @@
> +/* { dg-do compile } */
> +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
> +/* { dg-add-options arm_v8_1m_mve_fp } */
> +/* { dg-additional-options "-O3" } */
> +
> +#include <stdint.h>
> +
> +#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME)                       \
> +  void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
> +                                                    TYPE##BITS##_t *a) { \
> +    int i;                                                             \
> +    for (i=0; i<NB; i++) {                                             \
> +      dest[i] = a[i] OP 1;                                             \
> +    }                                                                  \
> +}
> +
> +/* 128-bit vectors.  */
> +FUNC_IMM(s, int, 32, 4, +, vaddimm)
> +FUNC_IMM(u, uint, 32, 4, +, vaddimm)
> +FUNC_IMM(s, int, 16, 8, +, vaddimm)
> +FUNC_IMM(u, uint, 16, 8, +, vaddimm)
> +FUNC_IMM(s, int, 8, 16, +, vaddimm)
> +FUNC_IMM(u, uint, 8, 16, +, vaddimm)
> +
> +/* For the moment we do not select the T2 vadd variant operating on a scalar
> +   final argument.  */
> +/* { dg-final { scan-assembler-times {vadd\.i32  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
> +/* { dg-final { scan-assembler-times {vadd\.i16  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
> +/* { dg-final { scan-assembler-times {vadd\.i8  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
> +
> +void test_vaddimm_f32 (float * dest, float * a) {
> +  int i;
> +  for (i=0; i<4; i++) {
> +    dest[i] = a[i] + 5.0;
> +  }
> +}
> +/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
> +
> +/* Note that dest[i] = a[i] + 5.0f16 is not vectorized.  */
> +void test_vaddimm_f16 (__fp16 * dest, __fp16 * a) {
> +  int i;
> +  __fp16 b = 5.0f16;
> +  for (i=0; i<8; i++) {
> +    dest[i] = a[i] + b;
> +  }
> +}
> +/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
> --
> 2.7.4
>
Christophe Lyon May 17, 2021, 9:54 a.m. UTC | #2
ping?

On Mon, 10 May 2021 at 13:22, Christophe Lyon
<christophe.lyon@linaro.org> wrote:
>
> Ping?
>
> On Fri, 30 Apr 2021 at 16:06, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> > This patch adds a test for the scalar mode of vadd, precisely noting
> > that we do not yet use the T2 variants of vadd, which take a scalar as
> > final argument.
> >
> > 2021-04-22  Christophe Lyon  <christophe.lyon@linaro.org>
> >
> >         gcc/testsuite/
> >         * gcc.target/arm/simd/mve-vadd-scalar-1: New.
> > ---
> >  .../gcc.target/arm/simd/mve-vadd-scalar-1.c        | 47 ++++++++++++++++++++++
> >  1 file changed, 47 insertions(+)
> >  create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
> >
> > diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
> > new file mode 100644
> > index 0000000..bbf70e1
> > --- /dev/null
> > +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
> > @@ -0,0 +1,47 @@
> > +/* { dg-do compile } */
> > +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
> > +/* { dg-add-options arm_v8_1m_mve_fp } */
> > +/* { dg-additional-options "-O3" } */
> > +
> > +#include <stdint.h>
> > +
> > +#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME)                       \
> > +  void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
> > +                                                    TYPE##BITS##_t *a) { \
> > +    int i;                                                             \
> > +    for (i=0; i<NB; i++) {                                             \
> > +      dest[i] = a[i] OP 1;                                             \
> > +    }                                                                  \
> > +}
> > +
> > +/* 128-bit vectors.  */
> > +FUNC_IMM(s, int, 32, 4, +, vaddimm)
> > +FUNC_IMM(u, uint, 32, 4, +, vaddimm)
> > +FUNC_IMM(s, int, 16, 8, +, vaddimm)
> > +FUNC_IMM(u, uint, 16, 8, +, vaddimm)
> > +FUNC_IMM(s, int, 8, 16, +, vaddimm)
> > +FUNC_IMM(u, uint, 8, 16, +, vaddimm)
> > +
> > +/* For the moment we do not select the T2 vadd variant operating on a scalar
> > +   final argument.  */
> > +/* { dg-final { scan-assembler-times {vadd\.i32  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
> > +/* { dg-final { scan-assembler-times {vadd\.i16  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
> > +/* { dg-final { scan-assembler-times {vadd\.i8  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
> > +
> > +void test_vaddimm_f32 (float * dest, float * a) {
> > +  int i;
> > +  for (i=0; i<4; i++) {
> > +    dest[i] = a[i] + 5.0;
> > +  }
> > +}
> > +/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
> > +
> > +/* Note that dest[i] = a[i] + 5.0f16 is not vectorized.  */
> > +void test_vaddimm_f16 (__fp16 * dest, __fp16 * a) {
> > +  int i;
> > +  __fp16 b = 5.0f16;
> > +  for (i=0; i<8; i++) {
> > +    dest[i] = a[i] + b;
> > +  }
> > +}
> > +/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
> > --
> > 2.7.4
> >
Kyrylo Tkachov May 17, 2021, 10:27 a.m. UTC | #3
> -----Original Message-----
> From: Gcc-patches <gcc-patches-bounces@gcc.gnu.org> On Behalf Of
> Christophe Lyon via Gcc-patches
> Sent: 17 May 2021 10:54
> To: gcc Patches <gcc-patches@gcc.gnu.org>
> Subject: Re: [PATCH] testsuite/arm: Add mve-vadd-scalar-1.c test
> 
> ping?
> 
> On Mon, 10 May 2021 at 13:22, Christophe Lyon
> <christophe.lyon@linaro.org> wrote:
> >
> > Ping?
> >
> > On Fri, 30 Apr 2021 at 16:06, Christophe Lyon
> > <christophe.lyon@linaro.org> wrote:
> > >
> > > This patch adds a test for the scalar mode of vadd, precisely noting
> > > that we do not yet use the T2 variants of vadd, which take a scalar as
> > > final argument.
> > >

Ok.
Thanks,
Kyrill

> > > 2021-04-22  Christophe Lyon  <christophe.lyon@linaro.org>
> > >
> > >         gcc/testsuite/
> > >         * gcc.target/arm/simd/mve-vadd-scalar-1: New.
> > > ---
> > >  .../gcc.target/arm/simd/mve-vadd-scalar-1.c        | 47
> ++++++++++++++++++++++
> > >  1 file changed, 47 insertions(+)
> > >  create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vadd-
> scalar-1.c
> > >
> > > diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
> b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
> > > new file mode 100644
> > > index 0000000..bbf70e1
> > > --- /dev/null
> > > +++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
> > > @@ -0,0 +1,47 @@
> > > +/* { dg-do compile } */
> > > +/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
> > > +/* { dg-add-options arm_v8_1m_mve_fp } */
> > > +/* { dg-additional-options "-O3" } */
> > > +
> > > +#include <stdint.h>
> > > +
> > > +#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME)                       \
> > > +  void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t *
> __restrict__ dest, \
> > > +                                                    TYPE##BITS##_t *a) { \
> > > +    int i;                                                             \
> > > +    for (i=0; i<NB; i++) {                                             \
> > > +      dest[i] = a[i] OP 1;                                             \
> > > +    }                                                                  \
> > > +}
> > > +
> > > +/* 128-bit vectors.  */
> > > +FUNC_IMM(s, int, 32, 4, +, vaddimm)
> > > +FUNC_IMM(u, uint, 32, 4, +, vaddimm)
> > > +FUNC_IMM(s, int, 16, 8, +, vaddimm)
> > > +FUNC_IMM(u, uint, 16, 8, +, vaddimm)
> > > +FUNC_IMM(s, int, 8, 16, +, vaddimm)
> > > +FUNC_IMM(u, uint, 8, 16, +, vaddimm)
> > > +
> > > +/* For the moment we do not select the T2 vadd variant operating on a
> scalar
> > > +   final argument.  */
> > > +/* { dg-final { scan-assembler-times {vadd\.i32  q[0-9]+, q[0-9]+, r[0-9]+}
> 2 { xfail *-*-* } } } */
> > > +/* { dg-final { scan-assembler-times {vadd\.i16  q[0-9]+, q[0-9]+, r[0-9]+}
> 2 { xfail *-*-* } } } */
> > > +/* { dg-final { scan-assembler-times {vadd\.i8  q[0-9]+, q[0-9]+, r[0-9]+}
> 2 { xfail *-*-* } } } */
> > > +
> > > +void test_vaddimm_f32 (float * dest, float * a) {
> > > +  int i;
> > > +  for (i=0; i<4; i++) {
> > > +    dest[i] = a[i] + 5.0;
> > > +  }
> > > +}
> > > +/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, r[0-9]+}
> 1 { xfail *-*-* } } } */
> > > +
> > > +/* Note that dest[i] = a[i] + 5.0f16 is not vectorized.  */
> > > +void test_vaddimm_f16 (__fp16 * dest, __fp16 * a) {
> > > +  int i;
> > > +  __fp16 b = 5.0f16;
> > > +  for (i=0; i<8; i++) {
> > > +    dest[i] = a[i] + b;
> > > +  }
> > > +}
> > > +/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, r[0-9]+}
> 1 { xfail *-*-* } } } */
> > > --
> > > 2.7.4
> > >
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
new file mode 100644
index 0000000..bbf70e1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vadd-scalar-1.c
@@ -0,0 +1,47 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_fp_ok } */
+/* { dg-add-options arm_v8_1m_mve_fp } */
+/* { dg-additional-options "-O3" } */
+
+#include <stdint.h>
+
+#define FUNC_IMM(SIGN, TYPE, BITS, NB, OP, NAME)			\
+  void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
+						     TYPE##BITS##_t *a) { \
+    int i;								\
+    for (i=0; i<NB; i++) {						\
+      dest[i] = a[i] OP 1;						\
+    }									\
+}
+
+/* 128-bit vectors.  */
+FUNC_IMM(s, int, 32, 4, +, vaddimm)
+FUNC_IMM(u, uint, 32, 4, +, vaddimm)
+FUNC_IMM(s, int, 16, 8, +, vaddimm)
+FUNC_IMM(u, uint, 16, 8, +, vaddimm)
+FUNC_IMM(s, int, 8, 16, +, vaddimm)
+FUNC_IMM(u, uint, 8, 16, +, vaddimm)
+
+/* For the moment we do not select the T2 vadd variant operating on a scalar
+   final argument.  */
+/* { dg-final { scan-assembler-times {vadd\.i32  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vadd\.i16  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+/* { dg-final { scan-assembler-times {vadd\.i8  q[0-9]+, q[0-9]+, r[0-9]+} 2 { xfail *-*-* } } } */
+
+void test_vaddimm_f32 (float * dest, float * a) {
+  int i;
+  for (i=0; i<4; i++) {
+    dest[i] = a[i] + 5.0;
+  }
+}
+/* { dg-final { scan-assembler-times {vadd\.f32 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */
+
+/* Note that dest[i] = a[i] + 5.0f16 is not vectorized.  */
+void test_vaddimm_f16 (__fp16 * dest, __fp16 * a) {
+  int i;
+  __fp16 b = 5.0f16;
+  for (i=0; i<8; i++) {
+    dest[i] = a[i] + b;
+  }
+}
+/* { dg-final { scan-assembler-times {vadd\.f16 q[0-9]+, q[0-9]+, r[0-9]+} 1 { xfail *-*-* } } } */