| 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) [] = { 0xf8, 0xf9, 0xfa, 0xfb, |
| 7 |
0xfc, 0xfd, 0xfe, 0xff }; |
| 8 |
VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; |
| 9 |
VECT_VAR_DECL(expected,int,32,2) [] = { 0xfffffff2, 0xfffffff3 }; |
| 10 |
VECT_VAR_DECL(expected,int,64,1) [] = { 0xfffffffffffffff1 }; |
| 11 |
VECT_VAR_DECL(expected,uint,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, |
| 12 |
0xfc, 0xfd, 0xfe, 0xff }; |
| 13 |
VECT_VAR_DECL(expected,uint,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; |
| 14 |
VECT_VAR_DECL(expected,uint,32,2) [] = { 0xfffffff2, 0xfffffff3 }; |
| 15 |
VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff1 }; |
| 16 |
VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, |
| 17 |
0xfc, 0xfd, 0xfe, 0xff }; |
| 18 |
VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff4, 0xfff5, 0xfff6, 0xfff7 }; |
| 19 |
#if MFLOAT8_SUPPORTED |
| 20 |
VECT_VAR_DECL(expected,hmfloat,8,8) [] = { 0xf8, 0xf9, 0xfa, 0xfb, |
| 21 |
0xfc, 0xfd, 0xfe, 0xff }; |
| 22 |
#endif |
| 23 |
VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xca00, 0xc980, 0xc900, 0xc880 }; |
| 24 |
VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1600000, 0xc1500000 }; |
| 25 |
|
| 26 |
#define TEST_MSG "VGET_HIGH" |
| 27 |
void exec_vget_high (void) |
| 28 |
{ |
| 29 |
/* Basic test: vec64=vget_high(vec128), then store the result. */ |
| 30 |
#define TEST_VGET_HIGH(T1, T2, W, N, N2) \ |
| 31 |
VECT_VAR(vector64, T1, W, N) = \ |
| 32 |
vget_high_##T2##W(VECT_VAR(vector128, T1, W, N2)); \ |
| 33 |
vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector64, T1, W, N)) |
| 34 |
|
| 35 |
DECL_VARIABLE_64BITS_VARIANTS(vector64); |
| 36 |
DECL_VARIABLE_128BITS_VARIANTS(vector128); |
| 37 |
|
| 38 |
TEST_MACRO_128BITS_VARIANTS_2_5(VLOAD, vector128, buffer); |
| 39 |
MFLOAT8_ONLY(VLOAD(vector128, buffer, q, mfloat, mf, 8, 16);) |
| 40 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 41 |
VLOAD(vector128, buffer, q, float, f, 16, 8); |
| 42 |
#endif |
| 43 |
VLOAD(vector128, buffer, q, float, f, 32, 4); |
| 44 |
|
| 45 |
clean_results (); |
| 46 |
|
| 47 |
/* Execute the tests. */ |
| 48 |
TEST_VGET_HIGH(int, s, 8, 8, 16); |
| 49 |
TEST_VGET_HIGH(int, s, 16, 4, 8); |
| 50 |
TEST_VGET_HIGH(int, s, 32, 2, 4); |
| 51 |
TEST_VGET_HIGH(int, s, 64, 1, 2); |
| 52 |
TEST_VGET_HIGH(uint, u, 8, 8, 16); |
| 53 |
TEST_VGET_HIGH(uint, u, 16, 4, 8); |
| 54 |
TEST_VGET_HIGH(uint, u, 32, 2, 4); |
| 55 |
TEST_VGET_HIGH(uint, u, 64, 1, 2); |
| 56 |
TEST_VGET_HIGH(poly, p, 8, 8, 16); |
| 57 |
TEST_VGET_HIGH(poly, p, 16, 4, 8); |
| 58 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 59 |
TEST_VGET_HIGH(float, f, 16, 4, 8); |
| 60 |
#endif |
| 61 |
TEST_VGET_HIGH(float, f, 32, 2, 4); |
| 62 |
|
| 63 |
CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, ""); |
| 64 |
CHECK(TEST_MSG, int, 16, 4, PRIx16, expected, ""); |
| 65 |
CHECK(TEST_MSG, int, 32, 2, PRIx32, expected, ""); |
| 66 |
CHECK(TEST_MSG, int, 64, 1, PRIx64, expected, ""); |
| 67 |
CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected, ""); |
| 68 |
CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, ""); |
| 69 |
CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, ""); |
| 70 |
CHECK(TEST_MSG, uint, 64, 1, PRIx64, expected, ""); |
| 71 |
CHECK_POLY(TEST_MSG, poly, 8, 8, PRIx8, expected, ""); |
| 72 |
CHECK_POLY(TEST_MSG, poly, 16, 4, PRIx16, expected, ""); |
| 73 |
CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected, ""); |
| 74 |
} |
| 75 |
|
| 76 |
int main (void) |
| 77 |
{ |
| 78 |
exec_vget_high (); |
| 79 |
return 0; |
| 80 |
} |