public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Christophe Lyon <clyon@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-830] testsuite/arm: Factorize and increase coverage in mve-sub_1.c
Date: Mon, 17 May 2021 11:59:17 +0000 (GMT)	[thread overview]
Message-ID: <20210517115917.9A3C4383541F@sourceware.org> (raw)

https://gcc.gnu.org/g:afa4401edd8a6a882848a6613d5441b0d0a10587

commit r12-830-gafa4401edd8a6a882848a6613d5441b0d0a10587
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date:   Mon May 17 11:59:01 2021 +0000

    testsuite/arm: Factorize and increase coverage in mve-sub_1.c
    
    Use a template macro to factorize the existing test functions.
    
    This patch also adds a version to check subtraction with __fp16 type.
    
    2021-05-17  Christophe Lyon  <christophe.lyon@linaro.org>
    
            gcc/testsuite/
            * gcc.target/arm/simd/mve-vsub_1.c: Factorize and add __fp16 test.

Diff:
---
 gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c | 60 +++++++++-----------------
 1 file changed, 21 insertions(+), 39 deletions(-)

diff --git a/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c b/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c
index 842e5c6a30b..5a6c34584cf 100644
--- a/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c
+++ b/gcc/testsuite/gcc.target/arm/simd/mve-vsub_1.c
@@ -5,60 +5,42 @@
 
 #include <stdint.h>
 
-void test_vsub_i32 (int32_t * dest, int32_t * a, int32_t * b) {
-  int i;
-  for (i=0; i<4; i++) {
-    dest[i] = a[i] - b[i];
-  }
+#define FUNC(SIGN, TYPE, BITS, NB, OP, NAME)				\
+  void test_ ## NAME ##_ ## SIGN ## BITS ## x ## NB (TYPE##BITS##_t * __restrict__ dest, \
+						     TYPE##BITS##_t *a, TYPE##BITS##_t *b) { \
+    int i;								\
+    for (i=0; i<NB; i++) {						\
+      dest[i] = a[i] OP b[i];						\
+    }									\
 }
 
-void test_vsub_i32_u (uint32_t * dest, uint32_t * a, uint32_t * b) {
-  int i;
-  for (i=0; i<4; i++) {
-    dest[i] = a[i] - b[i];
-  }
-}
+/* 128-bit vectors.  */
+FUNC(s, int, 32, 4, -, vsub)
+FUNC(u, uint, 32, 4, -, vsub)
+FUNC(s, int, 16, 8, -, vsub)
+FUNC(u, uint, 16, 8, -, vsub)
+FUNC(s, int, 8, 16, -, vsub)
+FUNC(u, uint, 8, 16, -, vsub)
 
 /* { dg-final { scan-assembler-times {vsub\.i32\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
-
-void test_vsub_i16 (int16_t * dest, int16_t * a, int16_t * b) {
-  int i;
-  for (i=0; i<8; i++) {
-    dest[i] = a[i] - b[i];
-  }
-}
-
-void test_vsub_i16_u (uint16_t * dest, uint16_t * a, uint16_t * b) {
-  int i;
-  for (i=0; i<8; i++) {
-    dest[i] = a[i] - b[i];
-  }
-}
-
 /* { dg-final { scan-assembler-times {vsub\.i16\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
+/* { dg-final { scan-assembler-times {vsub\.i8\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
 
-void test_vsub_i8 (int8_t * dest, int8_t * a, int8_t * b) {
-  int i;
-  for (i=0; i<16; i++) {
-    dest[i] = a[i] - b[i];
-  }
-}
-
-void test_vsub_i8_u (uint8_t * dest, uint8_t * a, uint8_t * b) {
+void test_vsub_f32 (float * dest, float * a, float * b) {
   int i;
-  for (i=0; i<16; i++) {
+  for (i=0; i<4; i++) {
     dest[i] = a[i] - b[i];
   }
 }
+/* { dg-final { scan-assembler-times {vsub\.f32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
 
-/* { dg-final { scan-assembler-times {vsub\.i8\tq[0-9]+, q[0-9]+, q[0-9]+} 2 } } */
 
-void test_vsub_f32 (float * dest, float * a, float * b) {
+void test_vsub_f16 (__fp16 * dest, __fp16 * a, __fp16 * b) {
   int i;
-  for (i=0; i<4; i++) {
+  for (i=0; i<8; i++) {
     dest[i] = a[i] - b[i];
   }
 }
 
-/* { dg-final { scan-assembler-times {vsub\.f32\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */
+/* { dg-final { scan-assembler-times {vsub\.f16\tq[0-9]+, q[0-9]+, q[0-9]+} 1 } } */


                 reply	other threads:[~2021-05-17 11:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210517115917.9A3C4383541F@sourceware.org \
    --to=clyon@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).