1 /* Template file for binary 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 binary
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(x1,x2), then store the result. */
19 #define TEST_BINARY_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 VECT_VAR(vector2, T1, W, N)); \
23 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
25 #define TEST_BINARY_OP(INSN, Q, T1, T2, W, N) \
26 TEST_BINARY_OP1(INSN, Q, T1, T2, W, N) \
28 DECL_VARIABLE_ALL_VARIANTS(vector);
29 DECL_VARIABLE_ALL_VARIANTS(vector2);
30 DECL_VARIABLE_ALL_VARIANTS(vector_res);
34 /* Initialize input "vector" from "buffer". */
35 TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer);
37 /* Fill input vector2 with arbitrary values. */
38 VDUP(vector2, , int, s, 8, 8, 2);
39 VDUP(vector2, , int, s, 16, 4, -4);
40 VDUP(vector2, , int, s, 32, 2, 3);
41 VDUP(vector2, , int, s, 64, 1, 100);
42 VDUP(vector2, , uint, u, 8, 8, 20);
43 VDUP(vector2, , uint, u, 16, 4, 30);
44 VDUP(vector2, , uint, u, 32, 2, 40);
45 VDUP(vector2, , uint, u, 64, 1, 2);
46 VDUP(vector2, q, int, s, 8, 16, -10);
47 VDUP(vector2, q, int, s, 16, 8, -20);
48 VDUP(vector2, q, int, s, 32, 4, -30);
49 VDUP(vector2, q, int, s, 64, 2, 24);
50 VDUP(vector2, q, uint, u, 8, 16, 12);
51 VDUP(vector2, q, uint, u, 16, 8, 3);
52 VDUP(vector2, q, uint, u, 32, 4, 55);
53 VDUP(vector2, q, uint, u, 64, 2, 3);
55 /* Apply a binary operator named INSN_NAME. */
56 TEST_MACRO_ALL_VARIANTS_1_5(TEST_BINARY_OP, INSN_NAME);
58 CHECK_RESULTS (TEST_MSG, "");
67 FNNAME (INSN_NAME) ();