From 6fff10f9aa6dbb92ccc15d1b643f7148531d7458 Mon Sep 17 00:00:00 2001 From: Alan Lawrence Date: Fri, 5 Sep 2014 11:13:47 +0000 Subject: [PATCH] [PATCH AArch64 1/2] Add execution tests of vget_low and vget_high * gcc.target/aarch64/vget_high_1.c: New test. * gcc.target/aarch64/vget_low_1.c: Likewise. From-SVN: r214950 --- gcc/testsuite/ChangeLog | 5 ++ .../gcc.target/aarch64/vget_high_1.c | 60 +++++++++++++++++++ gcc/testsuite/gcc.target/aarch64/vget_low_1.c | 60 +++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/vget_high_1.c create mode 100644 gcc/testsuite/gcc.target/aarch64/vget_low_1.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 21570ea918f..b83edc2c877 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-05 Alan Lawrence + + * gcc.target/aarch64/vget_high_1.c: New test. + * gcc.target/aarch64/vget_low_1.c: Likewise. + 2014-09-05 Alan Lawrence * gcc.target/aarch64/simd/int_comparisons.x: New file. diff --git a/gcc/testsuite/gcc.target/aarch64/vget_high_1.c b/gcc/testsuite/gcc.target/aarch64/vget_high_1.c new file mode 100644 index 00000000000..4cb872da2cd --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vget_high_1.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -std=c99" } */ + +#include + +extern void abort (void); + +#define VARIANTS(VARIANT) \ +VARIANT (uint8_t, 8, uint8x8_t, uint8x16_t, u8) \ +VARIANT (uint16_t, 4, uint16x4_t, uint16x8_t, u16) \ +VARIANT (uint32_t, 2, uint32x2_t, uint32x4_t, u32) \ +VARIANT (uint64_t, 1, uint64x1_t, uint64x2_t, u64) \ +VARIANT (int8_t, 8, int8x8_t, int8x16_t, s8) \ +VARIANT (int16_t, 4, int16x4_t, int16x8_t, s16) \ +VARIANT (int32_t, 2, int32x2_t, int32x4_t, s32) \ +VARIANT (int64_t, 1, int64x1_t, int64x2_t, s64) \ +VARIANT (float32_t, 2, float32x2_t, float32x4_t, f32) \ +VARIANT (float64_t, 1, float64x1_t, float64x2_t, f64) + + +#define TESTMETH(BASETYPE, NUM64, TYPE64, TYPE128, SUFFIX) \ +int \ +test_vget_low_ ##SUFFIX (BASETYPE *data) \ +{ \ + BASETYPE temp [NUM64]; \ + TYPE128 vec = vld1q_##SUFFIX (data); \ + TYPE64 high = vget_high_##SUFFIX (vec); \ + vst1_##SUFFIX (temp, high); \ + for (int i = 0; i < NUM64; i++) \ + if (temp[i] != data[i + NUM64]) \ + return 1; \ + return 0; \ +} + +VARIANTS (TESTMETH) + +#define CHECK(BASETYPE, NUM64, TYPE64, TYPE128, SUFFIX) \ + if (test_vget_low_##SUFFIX (BASETYPE ## _ ## data) != 0) \ + abort (); + +int +main (int argc, char **argv) +{ + uint8_t uint8_t_data[16] = + { 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 }; + uint16_t uint16_t_data[8] = { 1, 22, 333, 4444, 55555, 6666, 777, 88 }; + uint32_t uint32_t_data[4] = { 65537, 11, 70000, 23 }; + uint64_t uint64_t_data[2] = { 0xdeadbeefcafebabeULL, 0x0123456789abcdefULL }; + int8_t int8_t_data[16] = + { -1, -3, -5, -7, 9, -11, -13, 15, -17, -19, 21, -23, 25, 27, -29, -31 }; + int16_t int16_t_data[8] = { -17, 19, 3, -999, 44048, 505, 9999, 1000}; + int32_t int32_t_data[4] = { 123456789, -987654321, -135792468, 975318642 }; + int64_t int64_t_data[2] = {0xfedcba9876543210LL, 0xdeadbabecafebeefLL }; + float32_t float32_t_data[4] = { 3.14159, 2.718, 1.414, 100.0 }; + float64_t float64_t_data[2] = { 1.01001000100001, 12345.6789 }; + + VARIANTS (CHECK); + + return 0; +} diff --git a/gcc/testsuite/gcc.target/aarch64/vget_low_1.c b/gcc/testsuite/gcc.target/aarch64/vget_low_1.c new file mode 100644 index 00000000000..f8016ef7312 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/vget_low_1.c @@ -0,0 +1,60 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -std=c99" } */ + +#include + +extern void abort (void); + +#define VARIANTS(VARIANT) \ +VARIANT (uint8_t, 8, uint8x8_t, uint8x16_t, u8) \ +VARIANT (uint16_t, 4, uint16x4_t, uint16x8_t, u16) \ +VARIANT (uint32_t, 2, uint32x2_t, uint32x4_t, u32) \ +VARIANT (uint64_t, 1, uint64x1_t, uint64x2_t, u64) \ +VARIANT (int8_t, 8, int8x8_t, int8x16_t, s8) \ +VARIANT (int16_t, 4, int16x4_t, int16x8_t, s16) \ +VARIANT (int32_t, 2, int32x2_t, int32x4_t, s32) \ +VARIANT (int64_t, 1, int64x1_t, int64x2_t, s64) \ +VARIANT (float32_t, 2, float32x2_t, float32x4_t, f32) \ +VARIANT (float64_t, 1, float64x1_t, float64x2_t, f64) + + +#define TESTMETH(BASETYPE, NUM64, TYPE64, TYPE128, SUFFIX) \ +int \ +test_vget_low_ ##SUFFIX (BASETYPE *data) \ +{ \ + BASETYPE temp [NUM64]; \ + TYPE128 vec = vld1q_##SUFFIX (data); \ + TYPE64 low = vget_low_##SUFFIX (vec); \ + vst1_##SUFFIX (temp, low); \ + for (int i = 0; i < NUM64; i++) \ + if (temp[i] != data[i]) \ + return 1; \ + return 0; \ +} + +VARIANTS (TESTMETH) + +#define CHECK(BASETYPE, NUM64, TYPE64, TYPE128, SUFFIX) \ + if (test_vget_low_##SUFFIX (BASETYPE ## _ ## data) != 0) \ + abort (); + +int +main (int argc, char **argv) +{ + uint8_t uint8_t_data[16] = + { 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 }; + uint16_t uint16_t_data[8] = { 1, 22, 333, 4444, 55555, 6666, 777, 88 }; + uint32_t uint32_t_data[4] = { 65537, 11, 70000, 23 }; + uint64_t uint64_t_data[2] = { 0xdeadbeefcafebabeULL, 0x0123456789abcdefULL }; + int8_t int8_t_data[16] = + { -1, -3, -5, -7, 9, -11, -13, 15, -17, -19, 21, -23, 25, 27, -29, -31 }; + int16_t int16_t_data[8] = { -17, 19, 3, -999, 44048, 505, 9999, 1000}; + int32_t int32_t_data[4] = { 123456789, -987654321, -135792468, 975318642 }; + int64_t int64_t_data[2] = {0xfedcba9876543210LL, 0xdeadbabecafebeefLL }; + float32_t float32_t_data[4] = { 3.14159, 2.718, 1.414, 100.0 }; + float64_t float64_t_data[2] = { 1.01001000100001, 12345.6789 }; + + VARIANTS (CHECK); + + return 0; +} -- 2.30.2