2017-10-26 Tamar Christina <tamar.christina@arm.com>
authorTamar Christina <tamar.christina@arm.com>
Thu, 26 Oct 2017 09:59:14 +0000 (09:59 +0000)
committerTamar Christina <tnfchris@gcc.gnu.org>
Thu, 26 Oct 2017 09:59:14 +0000 (09:59 +0000)
* gcc.dg/vect/vect-reduc-dot-s8a.c
(dg-additional-options, dg-require-effective-target): Add +dotprod.
* gcc.dg/vect/vect-reduc-dot-u8a.c
(dg-additional-options, dg-require-effective-target): Add +dotprod.

From-SVN: r254101

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-reduc-dot-s8a.c
gcc/testsuite/gcc.dg/vect/vect-reduc-dot-u8a.c
gcc/testsuite/gcc.target/arm/simd/vdot-exec.c [new file with mode: 0644]

index 6d42152..d71ab16 100644 (file)
@@ -1,5 +1,12 @@
 2017-10-26  Tamar Christina  <tamar.christina@arm.com>
 
+       * gcc.dg/vect/vect-reduc-dot-s8a.c
+       (dg-additional-options, dg-require-effective-target): Add +dotprod.
+       * gcc.dg/vect/vect-reduc-dot-u8a.c
+       (dg-additional-options, dg-require-effective-target): Add +dotprod.
+
+2017-10-26  Tamar Christina  <tamar.christina@arm.com>
+
        * lib/target-supports.exp
        (check_effective_target_arm_v8_2a_dotprod_neon_ok_nocache): New.
        (check_effective_target_arm_v8_2a_dotprod_neon_ok): New.
index dc4f520..ac67474 100644 (file)
@@ -1,4 +1,7 @@
 /* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_dotprod_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-additional-options "-march=armv8.2-a+dotprod" { target { aarch64*-*-* } } } */
+/* { dg-add-options arm_v8_2a_dotprod_neon }  */
 
 #include <stdarg.h>
 #include "tree-vect.h"
index f3cc6c7..d020f64 100644 (file)
@@ -1,4 +1,7 @@
 /* { dg-require-effective-target vect_int } */
+/* { dg-require-effective-target arm_v8_2a_dotprod_neon_hw { target { aarch64*-*-* || arm*-*-* } } } */
+/* { dg-additional-options "-march=armv8.2-a+dotprod" { target { aarch64*-*-* } } } */
+/* { dg-add-options arm_v8_2a_dotprod_neon }  */
 
 #include <stdarg.h>
 #include "tree-vect.h"
diff --git a/gcc/testsuite/gcc.target/arm/simd/vdot-exec.c b/gcc/testsuite/gcc.target/arm/simd/vdot-exec.c
new file mode 100644 (file)
index 0000000..054f470
--- /dev/null
@@ -0,0 +1,55 @@
+/* { dg-do run } */
+/* { dg-additional-options "-O3" } */
+/* { dg-require-effective-target arm_v8_2a_dotprod_neon_hw } */
+/* { dg-add-options arm_v8_2a_dotprod_neon }  */
+
+#include <arm_neon.h>
+
+extern void abort();
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+# define ORDER(x, y) y
+#else
+# define ORDER(x, y) x - y
+#endif
+
+#define P(n1,n2) n1,n1,n1,n1,n2,n2,n2,n2
+#define ARR(nm, p, ty, ...) ty nm##_##p = { __VA_ARGS__ }
+#define TEST(t1, t2, t3, f, r1, r2, n1, n2) \
+       ARR(f, x, t1, r1);                  \
+       ARR(f, y, t2, r2);                  \
+       t3 f##_##r = {0};                   \
+       f##_##r = f (f##_##r, f##_##x, f##_##y);  \
+       if (f##_##r[0] != n1 || f##_##r[1] != n2)   \
+         abort ();
+
+#define TEST_LANE(t1, t2, t3, f, r1, r2, n1, n2, n3, n4) \
+       ARR(f, x, t1, r1);                  \
+       ARR(f, y, t2, r2);                  \
+       t3 f##_##rx = {0};                  \
+       f##_##rx = f (f##_##rx, f##_##x, f##_##y, ORDER (1, 0));  \
+       if (f##_##rx[0] != n1 || f##_##rx[1] != n2)   \
+         abort ();                                 \
+       t3 f##_##rx1 = {0};                         \
+       f##_##rx1 =  f (f##_##rx1, f##_##x, f##_##y, ORDER (1, 1));  \
+       if (f##_##rx1[0] != n3 || f##_##rx1[1] != n4)   \
+         abort (); \
+
+int
+main()
+{
+  TEST (uint8x8_t, uint8x8_t, uint32x2_t, vdot_u32, P(1,2), P(2,3), 8, 24);
+  TEST (int8x8_t, int8x8_t, int32x2_t, vdot_s32, P(1,2), P(-2,-3), -8, -24);
+
+  TEST (uint8x16_t, uint8x16_t, uint32x4_t, vdotq_u32, P(1,2), P(2,3), 8, 24);
+  TEST (int8x16_t, int8x16_t, int32x4_t, vdotq_s32, P(1,2), P(-2,-3), -8, -24);
+
+  TEST_LANE (uint8x8_t, uint8x8_t, uint32x2_t, vdot_lane_u32, P(1,2), P(2,3), 8, 16, 12, 24);
+
+  TEST_LANE (int8x8_t, int8x8_t, int32x2_t, vdot_lane_s32, P(1,2), P(-2,-3), -8, -16, -12, -24);
+
+  TEST_LANE (uint8x16_t, uint8x8_t, uint32x4_t, vdotq_lane_u32, P(1,2), P(2,3), 8, 16, 12, 24);
+  TEST_LANE (int8x16_t, int8x8_t, int32x4_t, vdotq_lane_s32, P(1,2), P(-2,-3), -8, -16, -12, -24);
+
+  return 0;
+}