1 /*
2
3 Copyright (c) 2009, 2010, 2011, 2012, 2013 STMicroelectronics
4 Written by Christophe Lyon
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 THE SOFTWARE.
23
24 */
25
26 #define _AEABI_PORTABILITY_LEVEL 1
27 #undef _AEABI_PORTABLE
28 #if defined(__cplusplus)
29 #include <cstdio>
30 #include <cstdlib>
31 #else
32 #include <stdio.h>
33 #include <stdlib.h>
34 #endif
35
36 FILE* log_file = NULL;
37 FILE* ref_file = NULL;
38 FILE* gcc_tests_file = NULL;
39
40 #define LOGFILE "stm-arm-neon-ref.log"
41
cleanup(void)42 void cleanup (void)
43 {
44 if (log_file) fclose (log_file);
45 if (ref_file) fclose (ref_file);
46 if (gcc_tests_file) fclose (gcc_tests_file);
47 exit (1);
48 }
49
50 extern void exec_vld1(void);
51 extern void exec_vadd(void);
52 extern void exec_vld1_lane(void);
53 extern void exec_vld1_dup(void);
54 extern void exec_vdup(void);
55 extern void exec_vget_high(void);
56 extern void exec_vget_low(void);
57 extern void exec_vqdmlal_lane(void);
58 extern void exec_vqdmlsl_lane(void);
59 extern void exec_vqdmlal_n(void);
60 extern void exec_vqdmlsl_n(void);
61 extern void exec_vext(void);
62 extern void exec_vshr_n(void);
63 extern void exec_vshrn_n(void);
64 extern void exec_vrshrn_n(void);
65 extern void exec_vqrshrn_n(void);
66 extern void exec_vset_lane(void);
67 extern void exec_vget_lane(void);
68 extern void exec_vqsub(void);
69 extern void exec_vqdmulh(void);
70 extern void exec_vqdmulh_lane(void);
71 extern void exec_vqdmulh_n(void);
72 extern void exec_vqdmull(void);
73 extern void exec_vqdmlal(void);
74 extern void exec_vqdmlsl(void);
75 extern void exec_vceq(void);
76 extern void exec_vcge(void);
77 extern void exec_vcle(void);
78 extern void exec_vcgt(void);
79 extern void exec_vclt(void);
80 extern void exec_vbsl(void);
81 extern void exec_vshl(void);
82 extern void exec_vqshl(void);
83 extern void exec_vqshl_n(void);
84 extern void exec_vrshl(void);
85 extern void exec_vshl_n(void);
86 extern void exec_vldX(void);
87 extern void exec_vdup_lane(void);
88 extern void exec_vqdmull_lane(void);
89 extern void exec_vqdmull_n(void);
90 extern void exec_vst1_lane(void);
91 extern void exec_vsub(void);
92 extern void exec_vqadd(void);
93 extern void exec_vabs(void);
94 extern void exec_vqabs(void);
95 extern void exec_vcombine(void);
96 extern void exec_vmax(void);
97 extern void exec_vmin(void);
98 extern void exec_vneg(void);
99 extern void exec_vqneg(void);
100 extern void exec_vmlal(void);
101 extern void exec_vmlal_lane(void);
102 extern void exec_vmlal_n(void);
103 extern void exec_vmlsl(void);
104 extern void exec_vmlsl_lane(void);
105 extern void exec_vmlsl_n(void);
106 extern void exec_vmovl(void);
107 extern void exec_vmovn(void);
108 extern void exec_vmull(void);
109 extern void exec_vmull_lane(void);
110 extern void exec_vrev(void);
111 extern void exec_vsra_n(void);
112 extern void exec_vtrn(void);
113 extern void exec_vuzp(void);
114 extern void exec_vzip(void);
115 extern void exec_vreinterpret(void);
116 extern void exec_vqrdmulh(void);
117 extern void exec_vqrdmulh_lane(void);
118 extern void exec_vqrdmulh_n(void);
119 extern void exec_vqrshl(void);
120 extern void exec_vaba(void);
121 extern void exec_vabal(void);
122 extern void exec_vabd(void);
123 extern void exec_vabdl(void);
124 extern void exec_vand(void);
125 extern void exec_vorr(void);
126 extern void exec_vorn(void);
127 extern void exec_veor(void);
128 extern void exec_vbic(void);
129 extern void exec_vcreate(void);
130 extern void exec_vldX_lane(void);
131 extern void exec_vldX_dup(void);
132 extern void exec_vmla(void);
133 extern void exec_vmls(void);
134 extern void exec_vmul(void);
135 extern void exec_vmul_lane(void);
136 extern void exec_vmul_n(void);
137 extern void exec_vmull_n(void);
138 extern void exec_vmla_lane(void);
139 extern void exec_vmls_lane(void);
140 extern void exec_vmla_n(void);
141 extern void exec_vmls_n(void);
142 extern void exec_vsli_n(void);
143 extern void exec_vsri_n(void);
144 extern void exec_vtst(void);
145 extern void exec_vaddhn(void);
146 extern void exec_vraddhn(void);
147 extern void exec_vaddl(void);
148 extern void exec_vaddw(void);
149 extern void exec_vhadd(void);
150 extern void exec_vrhadd(void);
151 extern void exec_vhsub(void);
152 extern void exec_vsubl(void);
153 extern void exec_vsubw(void);
154 extern void exec_vsubhn(void);
155 extern void exec_vrsubhn(void);
156 extern void exec_vmvn(void);
157 extern void exec_vqmovn(void);
158 extern void exec_vqmovun(void);
159 extern void exec_vrshr_n(void);
160 extern void exec_vrsra_n(void);
161 extern void exec_vshll_n(void);
162 extern void exec_vpaddl(void);
163 extern void exec_vpadd(void);
164 extern void exec_vpadal(void);
165 extern void exec_vqshlu_n(void);
166 extern void exec_vclz(void);
167 extern void exec_vcls(void);
168 extern void exec_vcnt(void);
169 extern void exec_vqshrn_n(void);
170 extern void exec_vpmax(void);
171 extern void exec_vpmin(void);
172 extern void exec_vqshrun_n(void);
173 extern void exec_vqrshrun_n(void);
174 extern void exec_vstX_lane(void);
175 extern void exec_vtbX(void);
176 extern void exec_vrecpe(void);
177 extern void exec_vrsqrte(void);
178
179 extern void exec_vcage(void);
180 extern void exec_vcagt(void);
181 extern void exec_vcale(void);
182 extern void exec_vcalt(void);
183 extern void exec_vcvt(void);
184 extern void exec_vrecps(void);
185 extern void exec_vrsqrts(void);
186
187 #if defined(__ARMCC_VERSION) || !defined(__arm__)
188 extern void exec_integer(void); /* Integer (non-NEON) intrinsics */
189 extern void exec_dsp(void); /* DSP (non-NEON) intrinsics */
190 extern void exec_dspfns(void); /* DSP FNS (non-NEON/ITU) intrinsics */
191 #endif
192
193 #include "compute_ref_data.c"
194
main(void)195 int main (void)
196 {
197 #if defined(_MSC_VER)
198 /* When compiled with MSVC, force output of FP numbers with only 2
199 * digits for the exponent, for easier comparison of the results
200 * with GCC. */
201 _set_output_format(_TWO_DIGIT_EXPONENT);
202 #endif
203
204 log_file = fopen (LOGFILE, "w");
205 if (log_file == NULL) {
206 fprintf (stderr, "Error opening log file " LOGFILE "\n");
207 cleanup ();
208 }
209
210 ref_file = fopen (REFFILE, "w");
211 if (ref_file == NULL) {
212 fprintf (log_file, "Error opening ref file %s\n", REFFILE);
213 cleanup ();
214 }
215
216 gcc_tests_file = fopen (GCCTESTS_FILE, "w");
217 if (gcc_tests_file == NULL) {
218 fprintf (log_file, "Error opening GCC ref file %s\n", GCCTESTS_FILE);
219 cleanup ();
220 }
221
222 fprintf (log_file, "Computing refs....\n");
223
224 exec_vld1 ();
225 exec_vadd ();
226 exec_vld1_lane ();
227 exec_vld1_dup ();
228 exec_vdup ();
229 exec_vget_high ();
230 exec_vget_low ();
231 exec_vqdmlal_lane ();
232 exec_vqdmlsl_lane ();
233 exec_vqdmlal_n ();
234 exec_vqdmlsl_n ();
235 exec_vext ();
236 exec_vshr_n ();
237 exec_vshrn_n ();
238 exec_vrshrn_n ();
239 exec_vqrshrn_n ();
240 exec_vset_lane ();
241 exec_vget_lane ();
242 exec_vqsub ();
243 exec_vqdmulh ();
244 exec_vqdmulh_lane ();
245 exec_vqdmulh_n ();
246 exec_vqdmull ();
247 exec_vqdmlal ();
248 exec_vqdmlsl ();
249 exec_vceq ();
250 exec_vcge ();
251 exec_vcle ();
252 exec_vcgt ();
253 exec_vclt ();
254 exec_vbsl ();
255 exec_vshl ();
256 exec_vshl_n ();
257 exec_vqshl ();
258 exec_vqshl_n ();
259 exec_vrshl ();
260 exec_vldX ();
261 exec_vdup_lane ();
262 exec_vqdmull_lane ();
263 exec_vqdmull_n ();
264 exec_vst1_lane ();
265 exec_vsub ();
266 exec_vqadd ();
267 exec_vabs ();
268 exec_vqabs ();
269 exec_vcombine ();
270 exec_vmax ();
271 exec_vmin ();
272 exec_vneg ();
273 exec_vqneg ();
274 exec_vmlal ();
275 exec_vmlsl ();
276 exec_vmlal_lane ();
277 exec_vmlsl_lane ();
278 exec_vmlal_n ();
279 exec_vmlsl_n ();
280 exec_vmovl ();
281 exec_vmovn ();
282 exec_vmull ();
283 exec_vmull_lane ();
284 exec_vrev ();
285 exec_vsra_n ();
286 exec_vtrn ();
287 exec_vuzp ();
288 exec_vzip ();
289 exec_vreinterpret ();
290 exec_vqrdmulh ();
291 exec_vqrdmulh_lane ();
292 exec_vqrdmulh_n ();
293 exec_vqrshl ();
294 exec_vaba ();
295 exec_vabal ();
296 exec_vabd ();
297 exec_vabdl ();
298 exec_vand ();
299 exec_vorr ();
300 exec_vorn ();
301 exec_veor ();
302 exec_vbic ();
303 exec_vcreate ();
304 exec_vldX_lane ();
305 exec_vldX_dup ();
306 exec_vmla ();
307 exec_vmls ();
308 exec_vmul ();
309 exec_vmul_lane ();
310 exec_vmul_n ();
311 exec_vmull_n ();
312 exec_vmla_lane ();
313 exec_vmls_lane ();
314 exec_vmla_n ();
315 exec_vmls_n ();
316 exec_vsli_n ();
317 exec_vsri_n ();
318 exec_vtst ();
319 exec_vaddhn ();
320 exec_vraddhn ();
321 exec_vaddl ();
322 exec_vaddw ();
323 exec_vhadd ();
324 exec_vrhadd ();
325 exec_vhsub ();
326 exec_vsubl ();
327 exec_vsubw ();
328 exec_vsubhn ();
329 exec_vrsubhn ();
330 exec_vmvn ();
331 exec_vqmovn ();
332 exec_vqmovun ();
333 exec_vrshr_n ();
334 exec_vrsra_n ();
335 exec_vshll_n ();
336 exec_vpaddl ();
337 exec_vpadd ();
338 exec_vpadal ();
339 exec_vqshlu_n ();
340 exec_vclz ();
341 exec_vcls ();
342 exec_vcnt ();
343 exec_vqshrn_n ();
344 exec_vpmax ();
345 exec_vpmin ();
346 exec_vqshrun_n ();
347 exec_vqrshrun_n ();
348 exec_vstX_lane ();
349 exec_vtbX ();
350 exec_vrecpe ();
351 exec_vrsqrte ();
352
353 exec_vcage ();
354 exec_vcale ();
355 exec_vcagt ();
356 exec_vcalt ();
357 exec_vcvt ();
358 exec_vrecps ();
359 exec_vrsqrts ();
360
361 #if defined(__ARMCC_VERSION) || (!defined(__arm__) && !defined(__aarch64__))
362 exec_integer ();
363 exec_dsp ();
364 exec_dspfns ();
365 #endif
366
367 fprintf (log_file, "Finished\n");
368
369 return 0;
370 }
371