1 /* Template file for unary operator validation.
3 This file is meant to be included by the relevant test files, which
4 have to define the intrinsic family to test. If a given intrinsic
5 supports variants which are not supported by all the other unary
6 operators, these can be tested by providing a definition for
10 #include "arm-neon-ref.h"
11 #include "compute-ref-data.h"
13 #define FNNAME1(NAME) exec_ ## NAME
14 #define FNNAME(NAME) FNNAME1(NAME)
16 void FNNAME (INSN_NAME) (void)
18 /* Basic test: y=OP(x), then store the result. */
19 #define TEST_UNARY_OP1(INSN, Q, T1, T2, W, N) \
20 VECT_VAR(vector_res, T1, W, N) = \
21 INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \
22 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
24 #define TEST_UNARY_OP(INSN, Q, T1, T2, W, N) \
25 TEST_UNARY_OP1(INSN, Q, T1, T2, W, N) \
27 /* No need for 64 bits variants in the general case. */
28 DECL_VARIABLE(vector, int, 8, 8);
29 DECL_VARIABLE(vector, int, 16, 4);
30 DECL_VARIABLE(vector, int, 32, 2);
31 DECL_VARIABLE(vector, int, 8, 16);
32 DECL_VARIABLE(vector, int, 16, 8);
33 DECL_VARIABLE(vector, int, 32, 4);
35 DECL_VARIABLE(vector_res, int, 8, 8);
36 DECL_VARIABLE(vector_res, int, 16, 4);
37 DECL_VARIABLE(vector_res, int, 32, 2);
38 DECL_VARIABLE(vector_res, int, 8, 16);
39 DECL_VARIABLE(vector_res, int, 16, 8);
40 DECL_VARIABLE(vector_res, int, 32, 4);
44 /* Initialize input "vector" from "buffer". */
45 VLOAD(vector, buffer, , int, s, 8, 8);
46 VLOAD(vector, buffer, , int, s, 16, 4);
47 VLOAD(vector, buffer, , int, s, 32, 2);
48 VLOAD(vector, buffer, q, int, s, 8, 16);
49 VLOAD(vector, buffer, q, int, s, 16, 8);
50 VLOAD(vector, buffer, q, int, s, 32, 4);
52 /* Apply a unary operator named INSN_NAME. */
53 TEST_UNARY_OP(INSN_NAME, , int, s, 8, 8);
54 TEST_UNARY_OP(INSN_NAME, , int, s, 16, 4);
55 TEST_UNARY_OP(INSN_NAME, , int, s, 32, 2);
56 TEST_UNARY_OP(INSN_NAME, q, int, s, 8, 16);
57 TEST_UNARY_OP(INSN_NAME, q, int, s, 16, 8);
58 TEST_UNARY_OP(INSN_NAME, q, int, s, 32, 4);
60 CHECK_RESULTS (TEST_MSG, "");