| 1 |
#include <arm_neon.h> |
| 2 |
#include "arm-neon-ref.h" |
| 3 |
#include "compute-ref-data.h" |
| 4 |
|
| 5 |
/* Expected results. */ |
| 6 |
VECT_VAR_DECL(expected,int,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, |
| 7 |
0xf4, 0xf5, 0xf6, 0xf7 }; |
| 8 |
VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; |
| 9 |
VECT_VAR_DECL(expected,int,32,2) [] = { 0xfffffff0, 0xfffffff1 }; |
| 10 |
VECT_VAR_DECL(expected,int,64,1) [] = { 0xfffffffffffffff0 }; |
| 11 |
VECT_VAR_DECL(expected,uint,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, |
| 12 |
0xf4, 0xf5, 0xf6, 0xf7 }; |
| 13 |
VECT_VAR_DECL(expected,uint,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; |
| 14 |
VECT_VAR_DECL(expected,uint,32,2) [] = { 0xfffffff0, 0xfffffff1 }; |
| 15 |
VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff0 }; |
| 16 |
VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf0, 0xf1, 0xf2, 0xf3, |
| 17 |
0xf4, 0xf5, 0xf6, 0xf7 }; |
| 18 |
VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff0, 0xfff1, 0xfff2, 0xfff3 }; |
| 19 |
VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xcc00, 0xcb80, 0xcb00, 0xca80 }; |
| 20 |
VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1800000, 0xc1700000 }; |
| 21 |
|
| 22 |
#define TEST_MSG "VGET_LOW" |
| 23 |
void exec_vget_low (void) |
| 24 |
{ |
| 25 |
/* Basic test: vec64=vget_low(vec128), then store the result. */ |
| 26 |
#define TEST_VGET_LOW(T1, T2, W, N, N2) \ |
| 27 |
VECT_VAR(vector64, T1, W, N) = \ |
| 28 |
vget_low_##T2##W(VECT_VAR(vector128, T1, W, N2)); \ |
| 29 |
vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector64, T1, W, N)) |
| 30 |
|
| 31 |
DECL_VARIABLE_64BITS_VARIANTS(vector64); |
| 32 |
DECL_VARIABLE_128BITS_VARIANTS(vector128); |
| 33 |
|
| 34 |
TEST_MACRO_128BITS_VARIANTS_2_5(VLOAD, vector128, buffer); |
| 35 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 36 |
VLOAD(vector128, buffer, q, float, f, 16, 8); |
| 37 |
#endif |
| 38 |
VLOAD(vector128, buffer, q, float, f, 32, 4); |
| 39 |
|
| 40 |
clean_results (); |
| 41 |
|
| 42 |
/* Execute the tests. */ |
| 43 |
TEST_VGET_LOW(int, s, 8, 8, 16); |
| 44 |
TEST_VGET_LOW(int, s, 16, 4, 8); |
| 45 |
TEST_VGET_LOW(int, s, 32, 2, 4); |
| 46 |
TEST_VGET_LOW(int, s, 64, 1, 2); |
| 47 |
TEST_VGET_LOW(uint, u, 8, 8, 16); |
| 48 |
TEST_VGET_LOW(uint, u, 16, 4, 8); |
| 49 |
TEST_VGET_LOW(uint, u, 32, 2, 4); |
| 50 |
TEST_VGET_LOW(uint, u, 64, 1, 2); |
| 51 |
TEST_VGET_LOW(poly, p, 8, 8, 16); |
| 52 |
TEST_VGET_LOW(poly, p, 16, 4, 8); |
| 53 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 54 |
TEST_VGET_LOW(float, f, 16, 4, 8); |
| 55 |
#endif |
| 56 |
TEST_VGET_LOW(float, f, 32, 2, 4); |
| 57 |
|
| 58 |
CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, ""); |
| 59 |
CHECK(TEST_MSG, int, 16, 4, PRIx16, expected, ""); |
| 60 |
CHECK(TEST_MSG, int, 32, 2, PRIx32, expected, ""); |
| 61 |
CHECK(TEST_MSG, int, 64, 1, PRIx64, expected, ""); |
| 62 |
CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected, ""); |
| 63 |
CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, ""); |
| 64 |
CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, ""); |
| 65 |
CHECK(TEST_MSG, uint, 64, 1, PRIx64, expected, ""); |
| 66 |
CHECK_POLY(TEST_MSG, poly, 8, 8, PRIx8, expected, ""); |
| 67 |
CHECK_POLY(TEST_MSG, poly, 16, 4, PRIx16, expected, ""); |
| 68 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 69 |
CHECK_FP(TEST_MSG, float, 16, 4, PRIx16, expected, ""); |
| 70 |
#endif |
| 71 |
CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected, ""); |
| 72 |
} |
| 73 |
|
| 74 |
int main (void) |
| 75 |
{ |
| 76 |
exec_vget_low (); |
| 77 |
return 0; |
| 78 |
} |