blob: f63918246e04b353fe1ec6bb403a41f153bfc23c [file] [log] [blame]
Christophe Lyon073831a2011-01-24 17:37:40 +01001/*
2
Christophe Lyon80902f62013-03-29 16:26:42 +01003Copyright (c) 2009, 2010, 2011, 2013 STMicroelectronics
Christophe Lyon073831a2011-01-24 17:37:40 +01004Written by Christophe Lyon
5
6Permission is hereby granted, free of charge, to any person obtaining a copy
7of this software and associated documentation files (the "Software"), to deal
8in the Software without restriction, including without limitation the rights
9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22THE SOFTWARE.
23
24*/
25
26/* Template file for unary operator validation */
27
Christophe Lyon1775be02014-07-10 13:46:54 +020028#if defined(__arm__) || defined(__aarch64__)
Christophe Lyon073831a2011-01-24 17:37:40 +010029#include <arm_neon.h>
30#else
Christophe Lyon0dab5f72011-07-19 17:14:09 +020031#include "stm-arm-neon.h"
Christophe Lyon073831a2011-01-24 17:37:40 +010032#endif
33
34#include "stm-arm-neon-ref.h"
35
36void exec_vrev (void)
37{
38 /* Basic test: y=vrev(x), then store the result. */
39#define TEST_VREV(Q, T1, T2, W, N, W2) \
40 VECT_VAR(vector_res, T1, W, N) = \
41 vrev##W2##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \
42 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
43
44 /* With ARM RVCT, we need to declare variables before any executable
45 statement */
46
47 DECL_VARIABLE_ALL_VARIANTS(vector);
48 DECL_VARIABLE_ALL_VARIANTS(vector_res);
49
50 clean_results ();
51
52 /* Initialize input "vector" from "buffer" */
Christophe Lyonf2053672014-12-16 10:26:00 +010053 TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer);
54 VLOAD(vector, buffer, , float, f, 32, 2);
55 VLOAD(vector, buffer, q, float, f, 32, 4);
Christophe Lyon073831a2011-01-24 17:37:40 +010056
57 /* Check vrev in each of the existing combinations */
58#define TEST_MSG "VREV16"
59 TEST_VREV(, int, s, 8, 8, 16);
60 TEST_VREV(, uint, u, 8, 8, 16);
Christophe Lyon80902f62013-03-29 16:26:42 +010061 TEST_VREV(, poly, p, 8, 8, 16);
Christophe Lyon073831a2011-01-24 17:37:40 +010062 TEST_VREV(q, int, s, 8, 16, 16);
63 TEST_VREV(q, uint, u, 8, 16, 16);
Christophe Lyon80902f62013-03-29 16:26:42 +010064 TEST_VREV(q, poly, p, 8, 16, 16);
Christophe Lyon073831a2011-01-24 17:37:40 +010065 dump_results_hex (TEST_MSG);
66
67#undef TEST_MSG
68#define TEST_MSG "VREV32"
69 TEST_VREV(, int, s, 8, 8, 32);
70 TEST_VREV(, int, s, 16, 4, 32);
71 TEST_VREV(, uint, u, 8, 8, 32);
72 TEST_VREV(, uint, u, 16, 4, 32);
Christophe Lyon80902f62013-03-29 16:26:42 +010073 TEST_VREV(, poly, p, 8, 8, 32);
74 TEST_VREV(, poly, p, 16, 4, 32);
Christophe Lyon073831a2011-01-24 17:37:40 +010075 TEST_VREV(q, int, s, 8, 16, 32);
76 TEST_VREV(q, int, s, 16, 8, 32);
77 TEST_VREV(q, uint, u, 8, 16, 32);
78 TEST_VREV(q, uint, u, 16, 8, 32);
Christophe Lyon80902f62013-03-29 16:26:42 +010079 TEST_VREV(q, poly, p, 8, 16, 32);
80 TEST_VREV(q, poly, p, 16, 8, 32);
Christophe Lyon073831a2011-01-24 17:37:40 +010081 dump_results_hex (TEST_MSG);
82
83#undef TEST_MSG
84#define TEST_MSG "VREV64"
85 TEST_VREV(, int, s, 8, 8, 64);
86 TEST_VREV(, int, s, 16, 4, 64);
87 TEST_VREV(, int, s, 32, 2, 64);
88 TEST_VREV(, uint, u, 8, 8, 64);
89 TEST_VREV(, uint, u, 16, 4, 64);
90 TEST_VREV(, uint, u, 32, 2, 64);
Christophe Lyon80902f62013-03-29 16:26:42 +010091 TEST_VREV(, poly, p, 8, 8, 64);
92 TEST_VREV(, poly, p, 16, 4, 64);
Christophe Lyon073831a2011-01-24 17:37:40 +010093 TEST_VREV(q, int, s, 8, 16, 64);
94 TEST_VREV(q, int, s, 16, 8, 64);
95 TEST_VREV(q, int, s, 32, 4, 64);
96 TEST_VREV(q, uint, u, 8, 16, 64);
97 TEST_VREV(q, uint, u, 16, 8, 64);
98 TEST_VREV(q, uint, u, 32, 4, 64);
Christophe Lyon80902f62013-03-29 16:26:42 +010099 TEST_VREV(q, poly, p, 8, 16, 64);
100 TEST_VREV(q, poly, p, 16, 8, 64);
Christophe Lyon073831a2011-01-24 17:37:40 +0100101
102 TEST_VREV(, float, f, 32, 2, 64);
103 TEST_VREV(q, float, f, 32, 4, 64);
104
105 dump_results_hex (TEST_MSG);
106}