2 /* { dg-skip-if "" { arm*-*-* } } */
5 #include "arm-neon-ref.h"
6 #include "compute-ref-data.h"
8 /* Expected results. */
9 VECT_VAR_DECL(expected
,int,8,8) [] = { 0xf0, 0xf2, 0xf4, 0xf6,
10 0x11, 0x11, 0x11, 0x11 };
11 VECT_VAR_DECL(expected
,int,16,4) [] = { 0xfff0, 0xfff2, 0x22, 0x22 };
12 VECT_VAR_DECL(expected
,int,32,2) [] = { 0xfffffff0, 0x33 };
13 VECT_VAR_DECL(expected
,int,64,1) [] = { 0xfffffffffffffff0 };
14 VECT_VAR_DECL(expected
,uint
,8,8) [] = { 0xf0, 0xf2, 0xf4, 0xf6,
15 0x55, 0x55, 0x55, 0x55 };
16 VECT_VAR_DECL(expected
,uint
,16,4) [] = { 0xfff0, 0xfff2, 0x66, 0x66 };
17 VECT_VAR_DECL(expected
,uint
,32,2) [] = { 0xfffffff0, 0x77 };
18 VECT_VAR_DECL(expected
,uint
,64,1) [] = { 0xfffffffffffffff0 };
19 VECT_VAR_DECL(expected
,poly
,8,8) [] = { 0xf0, 0xf2, 0xf4, 0xf6,
20 0x55, 0x55, 0x55, 0x55 };
21 VECT_VAR_DECL(expected
,poly
,16,4) [] = { 0xfff0, 0xfff2, 0x66, 0x66 };
22 VECT_VAR_DECL(expected
,hfloat
,32,2) [] = { 0xc1800000, 0x42066666 };
23 #if defined (FP16_SUPPORTED)
24 VECT_VAR_DECL (expected
, hfloat
, 16, 4) [] = { 0xcc00, 0xcb00,
27 VECT_VAR_DECL(expected
,int,8,16) [] = { 0xf0, 0xf2, 0xf4, 0xf6,
28 0xf8, 0xfa, 0xfc, 0xfe,
29 0x11, 0x11, 0x11, 0x11,
30 0x11, 0x11, 0x11, 0x11 };
31 VECT_VAR_DECL(expected
,int,16,8) [] = { 0xfff0, 0xfff2, 0xfff4, 0xfff6,
32 0x22, 0x22, 0x22, 0x22 };
33 VECT_VAR_DECL(expected
,int,32,4) [] = { 0xfffffff0, 0xfffffff2,
35 VECT_VAR_DECL(expected
,int,64,2) [] = { 0xfffffffffffffff0,
37 VECT_VAR_DECL(expected
,uint
,8,16) [] = { 0xf0, 0xf2, 0xf4, 0xf6,
38 0xf8, 0xfa, 0xfc, 0xfe,
39 0x55, 0x55, 0x55, 0x55,
40 0x55, 0x55, 0x55, 0x55 };
41 VECT_VAR_DECL(expected
,uint
,16,8) [] = { 0xfff0, 0xfff2, 0xfff4, 0xfff6,
42 0x66, 0x66, 0x66, 0x66 };
43 VECT_VAR_DECL(expected
,uint
,32,4) [] = { 0xfffffff0, 0xfffffff2, 0x77, 0x77 };
44 VECT_VAR_DECL(expected
,uint
,64,2) [] = { 0xfffffffffffffff0,
46 VECT_VAR_DECL(expected
,poly
,8,16) [] = { 0xf0, 0xf2, 0xf4, 0xf6,
47 0xf8, 0xfa, 0xfc, 0xfe,
48 0x55, 0x55, 0x55, 0x55,
49 0x55, 0x55, 0x55, 0x55 };
50 VECT_VAR_DECL(expected
,poly
,16,8) [] = { 0xfff0, 0xfff2, 0xfff4, 0xfff6,
51 0x66, 0x66, 0x66, 0x66 };
52 #if defined (FP16_SUPPORTED)
53 VECT_VAR_DECL (expected
, hfloat
, 16, 8) [] = { 0xcc00, 0xcb00, 0xca00, 0xc900,
54 0x4b4d, 0x4b4d, 0x4b4d, 0x4b4d };
56 VECT_VAR_DECL(expected
,hfloat
,32,4) [] = { 0xc1800000, 0xc1600000,
57 0x42073333, 0x42073333 };
59 #define TEST_MSG "VUZP1"
60 void exec_vuzp_half (void)
62 #define TEST_VUZP(PART, Q, T1, T2, W, N) \
63 VECT_VAR(vector_res, T1, W, N) = \
64 vuzp##PART##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \
65 VECT_VAR(vector2, T1, W, N)); \
66 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
68 #define TEST_VUZP1(Q, T1, T2, W, N) TEST_VUZP(1, Q, T1, T2, W, N)
70 /* Input vector can only have 64 bits. */
71 DECL_VARIABLE_ALL_VARIANTS(vector
);
72 DECL_VARIABLE_ALL_VARIANTS(vector2
);
74 DECL_VARIABLE_ALL_VARIANTS(vector_res
);
77 /* We don't have vuzp1_T64x1, so set expected to the clean value. */
78 CLEAN(expected
, int, 64, 1);
79 CLEAN(expected
, uint
, 64, 1);
81 TEST_MACRO_ALL_VARIANTS_2_5(VLOAD
, vector
, buffer
);
82 #if defined (FP16_SUPPORTED)
83 VLOAD(vector
, buffer
, , float, f
, 16, 4);
84 VLOAD(vector
, buffer
, q
, float, f
, 16, 8);
86 VLOAD(vector
, buffer
, , float, f
, 32, 2);
87 VLOAD(vector
, buffer
, q
, float, f
, 32, 4);
88 VLOAD(vector
, buffer
, q
, float, f
, 64, 2);
90 /* Choose arbitrary initialization values. */
91 VDUP(vector2
, , int, s
, 8, 8, 0x11);
92 VDUP(vector2
, , int, s
, 16, 4, 0x22);
93 VDUP(vector2
, , int, s
, 32, 2, 0x33);
94 VDUP(vector2
, , uint
, u
, 8, 8, 0x55);
95 VDUP(vector2
, , uint
, u
, 16, 4, 0x66);
96 VDUP(vector2
, , uint
, u
, 32, 2, 0x77);
97 VDUP(vector2
, , poly
, p
, 8, 8, 0x55);
98 VDUP(vector2
, , poly
, p
, 16, 4, 0x66);
99 #if defined (FP16_SUPPORTED)
100 VDUP (vector2
, , float, f
, 16, 4, 14.6f
); /* 14.6f is 0x4b4d. */
102 VDUP(vector2
, , float, f
, 32, 2, 33.6f
);
104 VDUP(vector2
, q
, int, s
, 8, 16, 0x11);
105 VDUP(vector2
, q
, int, s
, 16, 8, 0x22);
106 VDUP(vector2
, q
, int, s
, 32, 4, 0x33);
107 VDUP(vector2
, q
, int, s
, 64, 2, 0x44);
108 VDUP(vector2
, q
, uint
, u
, 8, 16, 0x55);
109 VDUP(vector2
, q
, uint
, u
, 16, 8, 0x66);
110 VDUP(vector2
, q
, uint
, u
, 32, 4, 0x77);
111 VDUP(vector2
, q
, uint
, u
, 64, 2, 0x88);
112 VDUP(vector2
, q
, poly
, p
, 8, 16, 0x55);
113 VDUP(vector2
, q
, poly
, p
, 16, 8, 0x66);
114 #if defined (FP16_SUPPORTED)
115 VDUP (vector2
, q
, float, f
, 16, 8, 14.6f
);
117 VDUP(vector2
, q
, float, f
, 32, 4, 33.8f
);
118 VDUP(vector2
, q
, float, f
, 64, 2, 33.8f
);
120 TEST_VUZP1(, int, s
, 8, 8);
121 TEST_VUZP1(, int, s
, 16, 4);
122 TEST_VUZP1(, int, s
, 32, 2);
123 TEST_VUZP1(, uint
, u
, 8, 8);
124 TEST_VUZP1(, uint
, u
, 16, 4);
125 TEST_VUZP1(, uint
, u
, 32, 2);
126 TEST_VUZP1(, poly
, p
, 8, 8);
127 TEST_VUZP1(, poly
, p
, 16, 4);
128 #if defined (FP16_SUPPORTED)
129 TEST_VUZP1(, float, f
, 16, 4);
131 TEST_VUZP1(, float, f
, 32, 2);
133 TEST_VUZP1(q
, int, s
, 8, 16);
134 TEST_VUZP1(q
, int, s
, 16, 8);
135 TEST_VUZP1(q
, int, s
, 32, 4);
136 TEST_VUZP1(q
, int, s
, 64, 2);
137 TEST_VUZP1(q
, uint
, u
, 8, 16);
138 TEST_VUZP1(q
, uint
, u
, 16, 8);
139 TEST_VUZP1(q
, uint
, u
, 32, 4);
140 TEST_VUZP1(q
, uint
, u
, 64, 2);
141 TEST_VUZP1(q
, poly
, p
, 8, 16);
142 TEST_VUZP1(q
, poly
, p
, 16, 8);
143 #if defined (FP16_SUPPORTED)
144 TEST_VUZP1(q
, float, f
, 16, 8);
146 TEST_VUZP1(q
, float, f
, 32, 4);
147 TEST_VUZP1(q
, float, f
, 64, 2);
149 #if defined (FP16_SUPPORTED)
150 CHECK_RESULTS (TEST_MSG
, "");
152 CHECK_RESULTS_NO_FP16 (TEST_MSG
, "");
156 #define TEST_MSG "VUZP2"
158 #define TEST_VUZP2(Q, T1, T2, W, N) TEST_VUZP(2, Q, T1, T2, W, N)
160 /* Expected results. */
161 VECT_VAR_DECL(expected2
,int,8,8) [] = { 0xf1, 0xf3, 0xf5, 0xf7,
162 0x11, 0x11, 0x11, 0x11 };
163 VECT_VAR_DECL(expected2
,int,16,4) [] = { 0xfff1, 0xfff3, 0x22, 0x22 };
164 VECT_VAR_DECL(expected2
,int,32,2) [] = { 0xfffffff1, 0x33 };
165 VECT_VAR_DECL(expected2
,int,64,1) [] = { 0xfffffffffffffff1 };
166 VECT_VAR_DECL(expected2
,uint
,8,8) [] = { 0xf1, 0xf3, 0xf5, 0xf7,
167 0x55, 0x55, 0x55, 0x55 };
168 VECT_VAR_DECL(expected2
,uint
,16,4) [] = { 0xfff1, 0xfff3, 0x66, 0x66 };
169 VECT_VAR_DECL(expected2
,uint
,32,2) [] = { 0xfffffff1, 0x77 };
170 VECT_VAR_DECL(expected2
,uint
,64,1) [] = { 0xfffffffffffffff1 };
171 VECT_VAR_DECL(expected2
,poly
,8,8) [] = { 0xf1, 0xf3, 0xf5, 0xf7,
172 0x55, 0x55, 0x55, 0x55 };
173 VECT_VAR_DECL(expected2
,poly
,16,4) [] = { 0xfff1, 0xfff3, 0x66, 0x66 };
174 VECT_VAR_DECL(expected2
,hfloat
,32,2) [] = { 0xc1700000, 0x42066666 };
175 #if defined (FP16_SUPPORTED)
176 VECT_VAR_DECL (expected2
, hfloat
, 16, 4) [] = { 0xcb80, 0xca80,
179 VECT_VAR_DECL(expected2
,int,8,16) [] = { 0xf1, 0xf3, 0xf5, 0xf7,
180 0xf9, 0xfb, 0xfd, 0xff,
181 0x11, 0x11, 0x11, 0x11,
182 0x11, 0x11, 0x11, 0x11 };
183 VECT_VAR_DECL(expected2
,int,16,8) [] = { 0xfff1, 0xfff3, 0xfff5, 0xfff7,
184 0x22, 0x22, 0x22, 0x22 };
185 VECT_VAR_DECL(expected2
,int,32,4) [] = { 0xfffffff1, 0xfffffff3,
187 VECT_VAR_DECL(expected2
,int,64,2) [] = { 0xfffffffffffffff1,
189 VECT_VAR_DECL(expected2
,uint
,8,16) [] = { 0xf1, 0xf3, 0xf5, 0xf7,
190 0xf9, 0xfb, 0xfd, 0xff,
191 0x55, 0x55, 0x55, 0x55,
192 0x55, 0x55, 0x55, 0x55 };
193 VECT_VAR_DECL(expected2
,uint
,16,8) [] = { 0xfff1, 0xfff3, 0xfff5, 0xfff7,
194 0x66, 0x66, 0x66, 0x66 };
195 VECT_VAR_DECL(expected2
,uint
,32,4) [] = { 0xfffffff1, 0xfffffff3, 0x77, 0x77 };
196 VECT_VAR_DECL(expected2
,uint
,64,2) [] = { 0xfffffffffffffff1,
198 VECT_VAR_DECL(expected2
,poly
,8,16) [] = { 0xf1, 0xf3, 0xf5, 0xf7,
199 0xf9, 0xfb, 0xfd, 0xff,
200 0x55, 0x55, 0x55, 0x55,
201 0x55, 0x55, 0x55, 0x55 };
202 VECT_VAR_DECL(expected2
,poly
,16,8) [] = { 0xfff1, 0xfff3, 0xfff5, 0xfff7,
203 0x66, 0x66, 0x66, 0x66 };
204 #if defined (FP16_SUPPORTED)
205 VECT_VAR_DECL (expected2
, hfloat
, 16, 8) [] = { 0xcb80, 0xca80, 0xc980, 0xc880,
206 0x4b4d, 0x4b4d, 0x4b4d, 0x4b4d
209 VECT_VAR_DECL(expected2
,hfloat
,32,4) [] = { 0xc1700000, 0xc1500000,
210 0x42073333, 0x42073333 };
213 CLEAN(expected2
, int, 64, 1);
214 CLEAN(expected2
, uint
, 64, 1);
216 TEST_VUZP2(, int, s
, 8, 8);
217 TEST_VUZP2(, int, s
, 16, 4);
218 TEST_VUZP2(, int, s
, 32, 2);
219 TEST_VUZP2(, uint
, u
, 8, 8);
220 TEST_VUZP2(, uint
, u
, 16, 4);
221 TEST_VUZP2(, uint
, u
, 32, 2);
222 TEST_VUZP2(, poly
, p
, 8, 8);
223 TEST_VUZP2(, poly
, p
, 16, 4);
224 #if defined (FP16_SUPPORTED)
225 TEST_VUZP2(, float, f
, 16, 4);
227 TEST_VUZP2(, float, f
, 32, 2);
229 TEST_VUZP2(q
, int, s
, 8, 16);
230 TEST_VUZP2(q
, int, s
, 16, 8);
231 TEST_VUZP2(q
, int, s
, 32, 4);
232 TEST_VUZP2(q
, int, s
, 64, 2);
233 TEST_VUZP2(q
, uint
, u
, 8, 16);
234 TEST_VUZP2(q
, uint
, u
, 16, 8);
235 TEST_VUZP2(q
, uint
, u
, 32, 4);
236 TEST_VUZP2(q
, uint
, u
, 64, 2);
237 TEST_VUZP2(q
, poly
, p
, 8, 16);
238 TEST_VUZP2(q
, poly
, p
, 16, 8);
239 #if defined (FP16_SUPPORTED)
240 TEST_VUZP2(q
, float, f
, 16, 8);
242 TEST_VUZP2(q
, float, f
, 32, 4);
243 TEST_VUZP2(q
, float, f
, 64, 2);
245 CHECK_RESULTS_NAMED (TEST_MSG
, expected2
, "");
246 #if defined (FP16_SUPPORTED)
247 CHECK_FP(TEST_MSG
, float, 16, 4, PRIx16
, expected2
, "");
248 CHECK_FP(TEST_MSG
, float, 16, 8, PRIx16
, expected2
, "");