From: Alan Lawrence Date: Wed, 10 Sep 2014 13:20:47 +0000 (+0000) Subject: [AArch64 Testsuite] Add a test of the vst[234](q?) intrinics X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86b8825bfe502dfc6b4a8925801134e66741fd48;p=gcc.git [AArch64 Testsuite] Add a test of the vst[234](q?) intrinics * gcc.target/aarch64/vstN_1.c: New test. From-SVN: r215129 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 288f3356de1..0061c2c9692 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-09-10 Alan Lawrence + + * gcc.target/aarch64/vstN_1.c: New test. + 2014-09-10 Alan Lawrence * gcc.target/aarch64/vldN_lane_1.c: New test. diff --git a/gcc/testsuite/gcc.target/aarch64/vstN_1.c b/gcc/testsuite/gcc.target/aarch64/vstN_1.c new file mode 100644 index 00000000000..9c166b7c3bc --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vstN_1.c @@ -0,0 +1,76 @@ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +#include + +extern void abort (void); + +#define TESTMETH(BASE, ELTS, STRUCT, SUFFIX) \ +int __attribute__ ((noinline)) \ +test_vst##STRUCT##SUFFIX () \ +{ \ + BASE##_t src[ELTS * STRUCT]; \ + BASE##_t dest[ELTS * STRUCT]; \ + BASE##x##ELTS##x##STRUCT##_t vectors; \ + int i,j; \ + for (i = 0; i < STRUCT * ELTS; i++) \ + src [i] = (BASE##_t) 2*i + 1; \ + for (i = 0; i < STRUCT; i++) \ + vectors.val[i] = vld1##SUFFIX (&src[i*ELTS]); \ + asm volatile ("" : : : "memory"); \ + vst##STRUCT##SUFFIX (dest, vectors); \ + asm volatile ("" : : : "memory"); \ + for (i = 0; i < STRUCT; i++) \ + { \ + for (j = 0; j < ELTS; j++) \ + if (src[i*ELTS + j] != dest[i + STRUCT*j]) \ + return 1; \ + } \ + return 0; \ +} + +#define VARIANTS(VARIANT, STRUCT) \ +VARIANT (uint8, 8, STRUCT, _u8) \ +VARIANT (uint16, 4, STRUCT, _u16) \ +VARIANT (uint32, 2, STRUCT, _u32) \ +VARIANT (uint64, 1, STRUCT, _u64) \ +VARIANT (int8, 8, STRUCT, _s8) \ +VARIANT (int16, 4, STRUCT, _s16) \ +VARIANT (int32, 2, STRUCT, _s32) \ +VARIANT (int64, 1, STRUCT, _s64) \ +VARIANT (poly8, 8, STRUCT, _p8) \ +VARIANT (poly16, 4, STRUCT, _p16) \ +VARIANT (float32, 2, STRUCT, _f32) \ +VARIANT (float64, 1, STRUCT, _f64) \ +VARIANT (uint8, 16, STRUCT, q_u8) \ +VARIANT (uint16, 8, STRUCT, q_u16) \ +VARIANT (uint32, 4, STRUCT, q_u32) \ +VARIANT (uint64, 2, STRUCT, q_u64) \ +VARIANT (int8, 16, STRUCT, q_s8) \ +VARIANT (int16, 8, STRUCT, q_s16) \ +VARIANT (int32, 4, STRUCT, q_s32) \ +VARIANT (int64, 2, STRUCT, q_s64) \ +VARIANT (poly8, 16, STRUCT, q_p8) \ +VARIANT (poly16, 8, STRUCT, q_p16) \ +VARIANT (float32, 4, STRUCT, q_f32) \ +VARIANT (float64, 2, STRUCT, q_f64) + +/* Tests of vst2 and vst2q. */ +VARIANTS (TESTMETH, 2) +/* Tests of vst3 and vst3q. */ +VARIANTS (TESTMETH, 3) +/* Tests of vst4 and vst4q. */ +VARIANTS (TESTMETH, 4) + +#define CHECK(BASE, ELTS, STRUCT, SUFFIX) \ + if (test_vst##STRUCT##SUFFIX () != 0) \ + abort (); + +int +main (int argc, char **argv) +{ + VARIANTS (CHECK, 2) + VARIANTS (CHECK, 3) + VARIANTS (CHECK, 4) + return 0; +}