public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-830] testsuite/arm: Factorize and increase coverage in mve-sub_1.c
@ 2021-05-17 11:59 Christophe Lyon
0 siblings, 0 replies; only message in thread
From: Christophe Lyon @ 2021-05-17 11:59 UTC (permalink / raw)
To: gcc-cvs
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 } } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-17 11:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 11:59 [gcc r12-830] testsuite/arm: Factorize and increase coverage in mve-sub_1.c Christophe Lyon
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).