1#define FNNAME1(NAME) exec_ ## NAME
2#define FNNAME(NAME) FNNAME1(NAME)
3
4void FNNAME (INSN_NAME) (void)
5{
6  /* Basic test: y=OP(x), then store the result.  */
7#define TEST_VPXXX1(INSN, T1, T2, W, N)					\
8  VECT_VAR(vector_res, T1, W, N) =					\
9    INSN##_##T2##W(VECT_VAR(vector, T1, W, N),				\
10		   VECT_VAR(vector, T1, W, N));				\
11  vst1##_##T2##W(VECT_VAR(result, T1, W, N),				\
12		 VECT_VAR(vector_res, T1, W, N))
13
14#define TEST_VPXXX(INSN, T1, T2, W, N)		\
15  TEST_VPXXX1(INSN, T1, T2, W, N)		\
16
17  /* No need for 64 bits variants.  */
18  DECL_VARIABLE(vector, int, 8, 8);
19  DECL_VARIABLE(vector, int, 16, 4);
20  DECL_VARIABLE(vector, int, 32, 2);
21  DECL_VARIABLE(vector, uint, 8, 8);
22  DECL_VARIABLE(vector, uint, 16, 4);
23  DECL_VARIABLE(vector, uint, 32, 2);
24#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
25  DECL_VARIABLE(vector, float, 16, 4);
26#endif
27  DECL_VARIABLE(vector, float, 32, 2);
28
29  DECL_VARIABLE(vector_res, int, 8, 8);
30  DECL_VARIABLE(vector_res, int, 16, 4);
31  DECL_VARIABLE(vector_res, int, 32, 2);
32  DECL_VARIABLE(vector_res, uint, 8, 8);
33  DECL_VARIABLE(vector_res, uint, 16, 4);
34  DECL_VARIABLE(vector_res, uint, 32, 2);
35#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
36  DECL_VARIABLE(vector_res, float, 16, 4);
37#endif
38  DECL_VARIABLE(vector_res, float, 32, 2);
39
40  clean_results ();
41
42  /* Initialize input "vector" from "buffer".  */
43  VLOAD(vector, buffer, , int, s, 8, 8);
44  VLOAD(vector, buffer, , int, s, 16, 4);
45  VLOAD(vector, buffer, , int, s, 32, 2);
46  VLOAD(vector, buffer, , uint, u, 8, 8);
47  VLOAD(vector, buffer, , uint, u, 16, 4);
48  VLOAD(vector, buffer, , uint, u, 32, 2);
49#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
50  VLOAD(vector, buffer, , float, f, 16, 4);
51#endif
52  VLOAD(vector, buffer, , float, f, 32, 2);
53
54  /* Apply a binary operator named INSN_NAME.  */
55  TEST_VPXXX(INSN_NAME, int, s, 8, 8);
56  TEST_VPXXX(INSN_NAME, int, s, 16, 4);
57  TEST_VPXXX(INSN_NAME, int, s, 32, 2);
58  TEST_VPXXX(INSN_NAME, uint, u, 8, 8);
59  TEST_VPXXX(INSN_NAME, uint, u, 16, 4);
60  TEST_VPXXX(INSN_NAME, uint, u, 32, 2);
61#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
62  TEST_VPXXX(INSN_NAME, float, f, 16, 4);
63#endif
64  TEST_VPXXX(INSN_NAME, float, f, 32, 2);
65
66  CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, "");
67  CHECK(TEST_MSG, int, 16, 4, PRIx16, expected, "");
68  CHECK(TEST_MSG, int, 32, 2, PRIx32, expected, "");
69  CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected, "");
70  CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, "");
71  CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, "");
72#if defined (__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
73  CHECK_FP(TEST_MSG, float, 16, 4, PRIx16, expected, "");
74#endif
75  CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected, "");
76}
77
78int main (void)
79{
80  FNNAME (INSN_NAME) ();
81  return 0;
82}
83