| 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) [] = { 0xf7, 0x11, 0x11, 0x11, |
| 7 |
0x11, 0x11, 0x11, 0x11 }; |
| 8 |
VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff3, 0x22, 0x22, 0x22 }; |
| 9 |
VECT_VAR_DECL(expected,int,32,2) [] = { 0xfffffff1, 0x33 }; |
| 10 |
VECT_VAR_DECL(expected,int,64,1) [] = { 0xfffffffffffffff0 }; |
| 11 |
VECT_VAR_DECL(expected,uint,8,8) [] = { 0xf6, 0xf7, 0x55, 0x55, |
| 12 |
0x55, 0x55, 0x55, 0x55 }; |
| 13 |
VECT_VAR_DECL(expected,uint,16,4) [] = { 0xfff2, 0xfff3, 0x66, 0x66 }; |
| 14 |
VECT_VAR_DECL(expected,uint,32,2) [] = { 0xfffffff1, 0x77 }; |
| 15 |
VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffffffffffff0 }; |
| 16 |
VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf6, 0xf7, 0x55, 0x55, |
| 17 |
0x55, 0x55, 0x55, 0x55 }; |
| 18 |
VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff2, 0xfff3, 0x66, 0x66 }; |
| 19 |
#if MFLOAT8_SUPPORTED |
| 20 |
VECT_VAR_DECL(expected,hmfloat,8,8) [] = { 0xf5, 0xf6, 0xf7, 0x77, |
| 21 |
0x77, 0x77, 0x77, 0x77 }; |
| 22 |
#endif |
| 23 |
#if defined (FP16_SUPPORTED) |
| 24 |
VECT_VAR_DECL (expected, hfloat, 16, 4) [] = { 0xcb00, 0xca80, |
| 25 |
0x4b4d, 0x4b4d }; |
| 26 |
#endif |
| 27 |
VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1700000, 0x42066666 }; |
| 28 |
VECT_VAR_DECL(expected,int,8,16) [] = { 0xfe, 0xff, 0x11, 0x11, |
| 29 |
0x11, 0x11, 0x11, 0x11, |
| 30 |
0x11, 0x11, 0x11, 0x11, |
| 31 |
0x11, 0x11, 0x11, 0x11 }; |
| 32 |
VECT_VAR_DECL(expected,int,16,8) [] = { 0xfff7, 0x22, 0x22, 0x22, |
| 33 |
0x22, 0x22, 0x22, 0x22 }; |
| 34 |
VECT_VAR_DECL(expected,int,32,4) [] = { 0xfffffff3, 0x33, 0x33, 0x33 }; |
| 35 |
VECT_VAR_DECL(expected,int,64,2) [] = { 0xfffffffffffffff1, 0x44 }; |
| 36 |
VECT_VAR_DECL(expected,uint,8,16) [] = { 0xfc, 0xfd, 0xfe, 0xff, |
| 37 |
0x55, 0x55, 0x55, 0x55, |
| 38 |
0x55, 0x55, 0x55, 0x55, |
| 39 |
0x55, 0x55, 0x55, 0x55 }; |
| 40 |
VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff6, 0xfff7, 0x66, 0x66, |
| 41 |
0x66, 0x66, 0x66, 0x66 }; |
| 42 |
VECT_VAR_DECL(expected,uint,32,4) [] = { 0xfffffff3, 0x77, 0x77, 0x77 }; |
| 43 |
VECT_VAR_DECL(expected,uint,64,2) [] = { 0xfffffffffffffff1, 0x88 }; |
| 44 |
VECT_VAR_DECL(expected,poly,8,16) [] = { 0xfc, 0xfd, 0xfe, 0xff, |
| 45 |
0x55, 0x55, 0x55, 0x55, |
| 46 |
0x55, 0x55, 0x55, 0x55, |
| 47 |
0x55, 0x55, 0x55, 0x55 }; |
| 48 |
VECT_VAR_DECL(expected,poly,16,8) [] = { 0xfff6, 0xfff7, 0x66, 0x66, |
| 49 |
0x66, 0x66, 0x66, 0x66 }; |
| 50 |
#if MFLOAT8_SUPPORTED |
| 51 |
VECT_VAR_DECL(expected,hmfloat,8,16) [] = { 0xf9, 0xfa, 0xfb, 0xfc, |
| 52 |
0xfd, 0xfe, 0xff, 0xaa, |
| 53 |
0xaa, 0xaa, 0xaa, 0xaa, |
| 54 |
0xaa, 0xaa, 0xaa, 0xaa }; |
| 55 |
#endif |
| 56 |
#if defined (FP16_SUPPORTED) |
| 57 |
VECT_VAR_DECL (expected, hfloat, 16, 8) [] = { 0xc880, 0x4b4d, |
| 58 |
0x4b4d, 0x4b4d, |
| 59 |
0x4b4d, 0x4b4d, |
| 60 |
0x4b4d, 0x4b4d }; |
| 61 |
#endif |
| 62 |
VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc1500000, 0x4204cccd, |
| 63 |
0x4204cccd, 0x4204cccd }; |
| 64 |
|
| 65 |
#define TEST_MSG "VEXT/VEXTQ" |
| 66 |
void exec_vext (void) |
| 67 |
{ |
| 68 |
/* vector_res = vext(vector1,vector2,offset), then store the result. */ |
| 69 |
#define TEST_VEXT(Q, T1, T2, W, N, V) \ |
| 70 |
VECT_VAR(vector_res, T1, W, N) = \ |
| 71 |
vext##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \ |
| 72 |
VECT_VAR(vector2, T1, W, N), \ |
| 73 |
V); \ |
| 74 |
vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N)) |
| 75 |
|
| 76 |
DECL_VARIABLE_ALL_VARIANTS(vector1); |
| 77 |
DECL_VARIABLE_ALL_VARIANTS(vector2); |
| 78 |
DECL_VARIABLE_ALL_VARIANTS(vector_res); |
| 79 |
|
| 80 |
clean_results (); |
| 81 |
|
| 82 |
TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector1, buffer); |
| 83 |
#if MFLOAT8_SUPPORTED |
| 84 |
VLOAD(vector1, buffer, , mfloat, mf, 8, 8); |
| 85 |
VLOAD(vector1, buffer, q, mfloat, mf, 8, 16); |
| 86 |
#endif |
| 87 |
#ifdef FP16_SUPPORTED |
| 88 |
VLOAD(vector1, buffer, , float, f, 16, 4); |
| 89 |
VLOAD(vector1, buffer, q, float, f, 16, 8); |
| 90 |
#endif |
| 91 |
VLOAD(vector1, buffer, , float, f, 32, 2); |
| 92 |
VLOAD(vector1, buffer, q, float, f, 32, 4); |
| 93 |
|
| 94 |
/* Choose arbitrary initialization values. */ |
| 95 |
VDUP(vector2, , int, s, 8, 8, 0x11); |
| 96 |
VDUP(vector2, , int, s, 16, 4, 0x22); |
| 97 |
VDUP(vector2, , int, s, 32, 2, 0x33); |
| 98 |
VDUP(vector2, , int, s, 64, 1, 0x44); |
| 99 |
VDUP(vector2, , uint, u, 8, 8, 0x55); |
| 100 |
VDUP(vector2, , uint, u, 16, 4, 0x66); |
| 101 |
VDUP(vector2, , uint, u, 32, 2, 0x77); |
| 102 |
VDUP(vector2, , uint, u, 64, 1, 0x88); |
| 103 |
VDUP(vector2, , poly, p, 8, 8, 0x55); |
| 104 |
VDUP(vector2, , poly, p, 16, 4, 0x66); |
| 105 |
MFLOAT8_ONLY(VDUP(vector2, , mfloat, mf, 8, 8, MFLOAT8(0x77))); |
| 106 |
#if defined (FP16_SUPPORTED) |
| 107 |
VDUP (vector2, , float, f, 16, 4, 14.6f); /* 14.6f is 0x4b4d. */ |
| 108 |
#endif |
| 109 |
VDUP(vector2, , float, f, 32, 2, 33.6f); |
| 110 |
|
| 111 |
VDUP(vector2, q, int, s, 8, 16, 0x11); |
| 112 |
VDUP(vector2, q, int, s, 16, 8, 0x22); |
| 113 |
VDUP(vector2, q, int, s, 32, 4, 0x33); |
| 114 |
VDUP(vector2, q, int, s, 64, 2, 0x44); |
| 115 |
VDUP(vector2, q, uint, u, 8, 16, 0x55); |
| 116 |
VDUP(vector2, q, uint, u, 16, 8, 0x66); |
| 117 |
VDUP(vector2, q, uint, u, 32, 4, 0x77); |
| 118 |
VDUP(vector2, q, uint, u, 64, 2, 0x88); |
| 119 |
VDUP(vector2, q, poly, p, 8, 16, 0x55); |
| 120 |
VDUP(vector2, q, poly, p, 16, 8, 0x66); |
| 121 |
MFLOAT8_ONLY(VDUP(vector2, q, mfloat, mf, 8, 16, MFLOAT8(0xaa))); |
| 122 |
#if defined (FP16_SUPPORTED) |
| 123 |
VDUP (vector2, q, float, f, 16, 8, 14.6f); |
| 124 |
#endif |
| 125 |
VDUP(vector2, q, float, f, 32, 4, 33.2f); |
| 126 |
|
| 127 |
/* Choose arbitrary extract offsets. */ |
| 128 |
TEST_VEXT(, int, s, 8, 8, 7); |
| 129 |
TEST_VEXT(, int, s, 16, 4, 3); |
| 130 |
TEST_VEXT(, int, s, 32, 2, 1); |
| 131 |
TEST_VEXT(, int, s, 64, 1, 0); |
| 132 |
TEST_VEXT(, uint, u, 8, 8, 6); |
| 133 |
TEST_VEXT(, uint, u, 16, 4, 2); |
| 134 |
TEST_VEXT(, uint, u, 32, 2, 1); |
| 135 |
TEST_VEXT(, uint, u, 64, 1, 0); |
| 136 |
TEST_VEXT(, poly, p, 8, 8, 6); |
| 137 |
TEST_VEXT(, poly, p, 16, 4, 2); |
| 138 |
MFLOAT8_ONLY(TEST_VEXT(, mfloat, mf, 8, 8, 5)); |
| 139 |
#if defined (FP16_SUPPORTED) |
| 140 |
TEST_VEXT(, float, f, 16, 4, 2); |
| 141 |
#endif |
| 142 |
TEST_VEXT(, float, f, 32, 2, 1); |
| 143 |
|
| 144 |
TEST_VEXT(q, int, s, 8, 16, 14); |
| 145 |
TEST_VEXT(q, int, s, 16, 8, 7); |
| 146 |
TEST_VEXT(q, int, s, 32, 4, 3); |
| 147 |
TEST_VEXT(q, int, s, 64, 2, 1); |
| 148 |
TEST_VEXT(q, uint, u, 8, 16, 12); |
| 149 |
TEST_VEXT(q, uint, u, 16, 8, 6); |
| 150 |
TEST_VEXT(q, uint, u, 32, 4, 3); |
| 151 |
TEST_VEXT(q, uint, u, 64, 2, 1); |
| 152 |
TEST_VEXT(q, poly, p, 8, 16, 12); |
| 153 |
TEST_VEXT(q, poly, p, 16, 8, 6); |
| 154 |
MFLOAT8_ONLY(TEST_VEXT(q, mfloat, mf, 8, 16, 9)); |
| 155 |
#if defined (FP16_SUPPORTED) |
| 156 |
TEST_VEXT(q, float, f, 16, 8, 7); |
| 157 |
#endif |
| 158 |
TEST_VEXT(q, float, f, 32, 4, 3); |
| 159 |
|
| 160 |
#if defined (FP16_SUPPORTED) |
| 161 |
CHECK_RESULTS (TEST_MSG, ""); |
| 162 |
#else |
| 163 |
CHECK_RESULTS_NO_FP16 (TEST_MSG, ""); |
| 164 |
#endif |
| 165 |
} |
| 166 |
|
| 167 |
int main (void) |
| 168 |
{ |
| 169 |
exec_vext (); |
| 170 |
return 0; |
| 171 |
} |