| 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, 0xde, 0xbc, 0x9a, |
| 7 |
0x78, 0x56, 0x34, 0x12 }; |
| 8 |
VECT_VAR_DECL(expected,int,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 }; |
| 9 |
VECT_VAR_DECL(expected,int,32,2) [] = { 0x9abcdef0, 0x12345678 }; |
| 10 |
VECT_VAR_DECL(expected,int,64,1) [] = { 0x123456789abcdef0 }; |
| 11 |
VECT_VAR_DECL(expected,uint,8,8) [] = { 0xf0, 0xde, 0xbc, 0x9a, |
| 12 |
0x78, 0x56, 0x34, 0x12 }; |
| 13 |
VECT_VAR_DECL(expected,uint,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 }; |
| 14 |
VECT_VAR_DECL(expected,uint,32,2) [] = { 0x9abcdef0, 0x12345678 }; |
| 15 |
VECT_VAR_DECL(expected,uint,64,1) [] = { 0x123456789abcdef0 }; |
| 16 |
VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf0, 0xde, 0xbc, 0x9a, |
| 17 |
0x78, 0x56, 0x34, 0x12 }; |
| 18 |
VECT_VAR_DECL(expected,poly,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 }; |
| 19 |
#if MFLOAT8_SUPPORTED |
| 20 |
VECT_VAR_DECL(expected,hmfloat,8,8) [] = { 0xf0, 0xde, 0xbc, 0x9a, |
| 21 |
0x78, 0x56, 0x34, 0x12 }; |
| 22 |
#endif |
| 23 |
VECT_VAR_DECL(expected,hfloat,16,4) [] = { 0xdef0, 0x9abc, 0x5678, 0x1234 }; |
| 24 |
VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0x9abcdef0, 0x12345678 }; |
| 25 |
|
| 26 |
#define INSN_NAME vcreate |
| 27 |
#define TEST_MSG "VCREATE" |
| 28 |
|
| 29 |
#define FNNAME1(NAME) void exec_ ## NAME (void) |
| 30 |
#define FNNAME(NAME) FNNAME1(NAME) |
| 31 |
|
| 32 |
FNNAME (INSN_NAME) |
| 33 |
{ |
| 34 |
/* Basic test: y=vcreate(x), then store the result. */ |
| 35 |
#define TEST_VCREATE(T1, T2, W, N) \ |
| 36 |
VECT_VAR(vector_res, T1, W, N) = vcreate_##T2##W(VECT_VAR(val, T1, W, N)); \ |
| 37 |
vst1_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) |
| 38 |
|
| 39 |
#define DECL_VAL(VAR, T1, W, N) \ |
| 40 |
uint64_t VECT_VAR(VAR, T1, W, N) |
| 41 |
|
| 42 |
DECL_VAL(val, int, 8, 8); |
| 43 |
DECL_VAL(val, int, 16, 4); |
| 44 |
DECL_VAL(val, int, 32, 2); |
| 45 |
DECL_VAL(val, int, 64, 1); |
| 46 |
MFLOAT8_ONLY(DECL_VAL(val, mfloat, 8, 8);) |
| 47 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 48 |
DECL_VAL(val, float, 16, 4); |
| 49 |
#endif |
| 50 |
DECL_VAL(val, float, 32, 2); |
| 51 |
DECL_VAL(val, uint, 8, 8); |
| 52 |
DECL_VAL(val, uint, 16, 4); |
| 53 |
DECL_VAL(val, uint, 32, 2); |
| 54 |
DECL_VAL(val, uint, 64, 1); |
| 55 |
DECL_VAL(val, poly, 8, 8); |
| 56 |
DECL_VAL(val, poly, 16, 4); |
| 57 |
|
| 58 |
DECL_VARIABLE(vector_res, int, 8, 8); |
| 59 |
DECL_VARIABLE(vector_res, int, 16, 4); |
| 60 |
DECL_VARIABLE(vector_res, int, 32, 2); |
| 61 |
DECL_VARIABLE(vector_res, int, 64, 1); |
| 62 |
MFLOAT8_ONLY(DECL_VARIABLE(vector_res, mfloat, 8, 8);) |
| 63 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 64 |
DECL_VARIABLE(vector_res, float, 16, 4); |
| 65 |
#endif |
| 66 |
DECL_VARIABLE(vector_res, float, 32, 2); |
| 67 |
DECL_VARIABLE(vector_res, uint, 8, 8); |
| 68 |
DECL_VARIABLE(vector_res, uint, 16, 4); |
| 69 |
DECL_VARIABLE(vector_res, uint, 32, 2); |
| 70 |
DECL_VARIABLE(vector_res, uint, 64, 1); |
| 71 |
DECL_VARIABLE(vector_res, poly, 8, 8); |
| 72 |
DECL_VARIABLE(vector_res, poly, 16, 4); |
| 73 |
|
| 74 |
clean_results (); |
| 75 |
|
| 76 |
/* Initialize input values arbitrarily. */ |
| 77 |
VECT_VAR(val, int, 8, 8) = 0x123456789abcdef0LL; |
| 78 |
VECT_VAR(val, int, 16, 4) = 0x123456789abcdef0LL; |
| 79 |
VECT_VAR(val, int, 32, 2) = 0x123456789abcdef0LL; |
| 80 |
VECT_VAR(val, int, 64, 1) = 0x123456789abcdef0LL; |
| 81 |
MFLOAT8_ONLY(VECT_VAR(val, mfloat, 8, 8) = 0x123456789abcdef0LL;) |
| 82 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 83 |
VECT_VAR(val, float, 16, 4) = 0x123456789abcdef0LL; |
| 84 |
#endif |
| 85 |
VECT_VAR(val, float, 32, 2) = 0x123456789abcdef0LL; |
| 86 |
VECT_VAR(val, uint, 8, 8) = 0x123456789abcdef0ULL; |
| 87 |
VECT_VAR(val, uint, 16, 4) = 0x123456789abcdef0ULL; |
| 88 |
VECT_VAR(val, uint, 32, 2) = 0x123456789abcdef0ULL; |
| 89 |
VECT_VAR(val, uint, 64, 1) = 0x123456789abcdef0ULL; |
| 90 |
VECT_VAR(val, poly, 8, 8) = 0x123456789abcdef0ULL; |
| 91 |
VECT_VAR(val, poly, 16, 4) = 0x123456789abcdef0ULL; |
| 92 |
|
| 93 |
TEST_VCREATE(int, s, 8, 8); |
| 94 |
TEST_VCREATE(int, s, 16, 4); |
| 95 |
TEST_VCREATE(int, s, 32, 2); |
| 96 |
MFLOAT8_ONLY(TEST_VCREATE(mfloat, mf, 8, 8);) |
| 97 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 98 |
TEST_VCREATE(float, f, 16, 4); |
| 99 |
#endif |
| 100 |
TEST_VCREATE(float, f, 32, 2); |
| 101 |
TEST_VCREATE(int, s, 64, 1); |
| 102 |
TEST_VCREATE(uint, u, 8, 8); |
| 103 |
TEST_VCREATE(uint, u, 16, 4); |
| 104 |
TEST_VCREATE(uint, u, 32, 2); |
| 105 |
TEST_VCREATE(uint, u, 64, 1); |
| 106 |
TEST_VCREATE(poly, p, 8, 8); |
| 107 |
TEST_VCREATE(poly, p, 16, 4); |
| 108 |
|
| 109 |
CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, ""); |
| 110 |
CHECK(TEST_MSG, int, 16, 4, PRIx16, expected, ""); |
| 111 |
CHECK(TEST_MSG, int, 32, 2, PRIx32, expected, ""); |
| 112 |
CHECK(TEST_MSG, int, 64, 1, PRIx64, expected, ""); |
| 113 |
CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected, ""); |
| 114 |
CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, ""); |
| 115 |
CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, ""); |
| 116 |
CHECK(TEST_MSG, uint, 64, 1, PRIx64, expected, ""); |
| 117 |
CHECK_POLY(TEST_MSG, poly, 8, 8, PRIx8, expected, ""); |
| 118 |
CHECK_POLY(TEST_MSG, poly, 16, 4, PRIx16, expected, ""); |
| 119 |
MFLOAT8_ONLY(CHECK_FP(TEST_MSG, mfloat, 8, 8, PRIx16, expected, "");) |
| 120 |
#if defined (__ARM_FP16_FORMAT_IEEE) || defined (__ARM_FP16_FORMAT_ALTERNATIVE) |
| 121 |
CHECK_FP(TEST_MSG, float, 16, 4, PRIx16, expected, ""); |
| 122 |
#endif |
| 123 |
CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected, ""); |
| 124 |
} |
| 125 |
|
| 126 |
int main (void) |
| 127 |
{ |
| 128 |
exec_vcreate (); |
| 129 |
return 0; |
| 130 |
} |