public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-832] testsuite/arm: Add mve-vadd-scalar-1.c test
@ 2021-05-17 12:02 Christophe Lyon
0 siblings, 0 replies; only message in thread
From: Christophe Lyon @ 2021-05-17 12:02 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:0ca93e302bf496b71bee839b3c121e1f7363fcf0
commit r12-832-g0ca93e302bf496b71bee839b3c121e1f7363fcf0
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date: Mon May 17 12:02:40 2021 +0000
testsuite/arm: Add mve-vadd-scalar-1.c test
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-05-17 Christophe Lyon <christophe.lyon@linaro.org>
gcc/testsuite/
* gcc.target/arm/simd/mve-vadd-scalar-1.c: New.
Diff:
---
.../gcc.target/arm/simd/mve-vadd-scalar-1.c | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)
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 00000000000..bbf70e14146
--- /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 *-*-* } } } */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-17 12:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17 12:02 [gcc r12-832] testsuite/arm: Add mve-vadd-scalar-1.c test 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).