1#define FNNAME1(NAME) exec_ ## NAME
2#define FNNAME(NAME) FNNAME1(NAME)
3
4void FNNAME (INSN_NAME) (void)
5{
6#define DECL_VMLX_LANE(VAR)			\
7  DECL_VARIABLE(VAR, int, 16, 4);		\
8  DECL_VARIABLE(VAR, int, 32, 2);		\
9  DECL_VARIABLE(VAR, uint, 16, 4);		\
10  DECL_VARIABLE(VAR, uint, 32, 2);		\
11  DECL_VARIABLE(VAR, float, 32, 2);		\
12  DECL_VARIABLE(VAR, int, 16, 8);		\
13  DECL_VARIABLE(VAR, int, 32, 4);		\
14  DECL_VARIABLE(VAR, uint, 16, 8);		\
15  DECL_VARIABLE(VAR, uint, 32, 4);		\
16  DECL_VARIABLE(VAR, float, 32, 4)
17
18  /* vector_res = vmlx_lane(vector, vector2, vector3, lane),
19     then store the result.  */
20#define TEST_VMLX_LANE1(INSN, Q, T1, T2, W, N, N2, L)			\
21  VECT_VAR(vector_res, T1, W, N) =					\
22    INSN##Q##_lane_##T2##W(VECT_VAR(vector, T1, W, N),			\
23			   VECT_VAR(vector2, T1, W, N),			\
24			   VECT_VAR(vector3, T1, W, N2),		\
25			   L);						\
26  vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \
27		    VECT_VAR(vector_res, T1, W, N))
28
29#define TEST_VMLX_LANE(INSN, Q, T1, T2, W, N, N2, V)	\
30  TEST_VMLX_LANE1(INSN, Q, T1, T2, W, N, N2, V)
31
32  DECL_VMLX_LANE(vector);
33  DECL_VMLX_LANE(vector2);
34  DECL_VMLX_LANE(vector_res);
35
36  DECL_VARIABLE(vector3, int, 16, 4);
37  DECL_VARIABLE(vector3, int, 32, 2);
38  DECL_VARIABLE(vector3, uint, 16, 4);
39  DECL_VARIABLE(vector3, uint, 32, 2);
40  DECL_VARIABLE(vector3, float, 32, 2);
41
42  clean_results ();
43
44  VLOAD(vector, buffer, , int, s, 16, 4);
45  VLOAD(vector, buffer, , int, s, 32, 2);
46  VLOAD(vector, buffer, , uint, u, 16, 4);
47  VLOAD(vector, buffer, , uint, u, 32, 2);
48  VLOAD(vector, buffer, q, int, s, 16, 8);
49  VLOAD(vector, buffer, q, int, s, 32, 4);
50  VLOAD(vector, buffer, q, uint, u, 16, 8);
51  VLOAD(vector, buffer, q, uint, u, 32, 4);
52  VLOAD(vector, buffer, , float, f, 32, 2);
53  VLOAD(vector, buffer, q, float, f, 32, 4);
54
55  VDUP(vector2, , int, s, 16, 4, 0x55);
56  VDUP(vector2, , int, s, 32, 2, 0x55);
57  VDUP(vector2, , uint, u, 16, 4, 0x55);
58  VDUP(vector2, , uint, u, 32, 2, 0x55);
59  VDUP(vector2, , float, f, 32, 2, 55.3f);
60  VDUP(vector2, q, int, s, 16, 8, 0x55);
61  VDUP(vector2, q, int, s, 32, 4, 0x55);
62  VDUP(vector2, q, uint, u, 16, 8, 0x55);
63  VDUP(vector2, q, uint, u, 32, 4, 0x55);
64  VDUP(vector2, q, float, f, 32, 4, 55.8f);
65
66  VDUP(vector3, , int, s, 16, 4, 0xBB);
67  VDUP(vector3, , int, s, 32, 2, 0xBB);
68  VDUP(vector3, , uint, u, 16, 4, 0xBB);
69  VDUP(vector3, , uint, u, 32, 2, 0xBB);
70  VDUP(vector3, , float, f, 32, 2, 11.34f);
71
72  /* Choose lane arbitrarily.  */
73  TEST_VMLX_LANE(INSN_NAME, , int, s, 16, 4, 4, 2);
74  TEST_VMLX_LANE(INSN_NAME, , int, s, 32, 2, 2, 1);
75  TEST_VMLX_LANE(INSN_NAME, , uint, u, 16, 4, 4, 2);
76  TEST_VMLX_LANE(INSN_NAME, , uint, u, 32, 2, 2, 1);
77  TEST_VMLX_LANE(INSN_NAME, , float, f, 32, 2, 2, 1);
78  TEST_VMLX_LANE(INSN_NAME, q, int, s, 16, 8, 4, 3);
79  TEST_VMLX_LANE(INSN_NAME, q, int, s, 32, 4, 2, 1);
80  TEST_VMLX_LANE(INSN_NAME, q, uint, u, 16, 8, 4, 2);
81  TEST_VMLX_LANE(INSN_NAME, q, uint, u, 32, 4, 2, 1);
82  TEST_VMLX_LANE(INSN_NAME, q, float, f, 32, 4, 2, 1);
83
84  CHECK(TEST_MSG, int, 16, 4, PRIx16, expected, "");
85  CHECK(TEST_MSG, int, 32, 2, PRIx32, expected, "");
86  CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, "");
87  CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, "");
88  CHECK_FP(TEST_MSG, float, 32, 2, PRIx32, expected, "");
89  CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, "");
90  CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, "");
91  CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, "");
92  CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, "");
93  CHECK_FP(TEST_MSG, float, 32, 4, PRIx32, expected, "");
94}
95
96int main (void)
97{
98  FNNAME (INSN_NAME) ();
99  return 0;
100}
101