1 /* Template file for saturating 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
6 saturating unary operators, these can be tested by providing a
7 definition for EXTRA_TESTS. */
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 /* y=OP(x), then store the result. */
19 #define TEST_UNARY_SAT_OP1(INSN, Q, T1, T2, W, N, CMT) \
20 Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \
21 VECT_VAR(vector_res, T1, W, N) = \
22 INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N)); \
23 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \
24 VECT_VAR(vector_res, T1, W, N))
26 #define TEST_UNARY_SAT_OP(INSN, Q, T1, T2, W, N, CMT) \
27 TEST_UNARY_SAT_OP1(INSN, Q, T1, T2, W, N, CMT)
29 /* No need for 64 bits variants. */
30 DECL_VARIABLE(vector, int, 8, 8);
31 DECL_VARIABLE(vector, int, 16, 4);
32 DECL_VARIABLE(vector, int, 32, 2);
33 DECL_VARIABLE(vector, int, 8, 16);
34 DECL_VARIABLE(vector, int, 16, 8);
35 DECL_VARIABLE(vector, int, 32, 4);
37 DECL_VARIABLE(vector_res, int, 8, 8);
38 DECL_VARIABLE(vector_res, int, 16, 4);
39 DECL_VARIABLE(vector_res, int, 32, 2);
40 DECL_VARIABLE(vector_res, int, 8, 16);
41 DECL_VARIABLE(vector_res, int, 16, 8);
42 DECL_VARIABLE(vector_res, int, 32, 4);
46 /* Initialize input "vector" from "buffer". */
47 VLOAD(vector, buffer, , int, s, 8, 8);
48 VLOAD(vector, buffer, , int, s, 16, 4);
49 VLOAD(vector, buffer, , int, s, 32, 2);
50 VLOAD(vector, buffer, q, int, s, 8, 16);
51 VLOAD(vector, buffer, q, int, s, 16, 8);
52 VLOAD(vector, buffer, q, int, s, 32, 4);
54 /* Apply a saturating unary operator named INSN_NAME. */
55 TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 8, 8, "");
56 TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 16, 4, "");
57 TEST_UNARY_SAT_OP(INSN_NAME, , int, s, 32, 2, "");
58 TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 8, 16, "");
59 TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 16, 8, "");
60 TEST_UNARY_SAT_OP(INSN_NAME, q, int, s, 32, 4, "");
62 CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, "");
63 CHECK(TEST_MSG, int, 16, 4, PRIx16, expected, "");
64 CHECK(TEST_MSG, int, 32, 2, PRIx32, expected, "");
65 CHECK(TEST_MSG, int, 8, 16, PRIx8, expected, "");
66 CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, "");
67 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, "");
76 FNNAME (INSN_NAME) ();