705f90ac5e584ffffd84333695330762d0cc0b7a
[gcc.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vqdmlXl_lane.inc
1 #define FNNAME1(NAME) exec_ ## NAME
2 #define FNNAME(NAME) FNNAME1(NAME)
3
4 void FNNAME (INSN_NAME) (void)
5 {
6 /* vector_res = vqdmlXl_lane(vector, vector3, vector4, lane),
7 then store the result. */
8 #define TEST_VQDMLXL_LANE1(INSN, T1, T2, W, W2, N, V, EXPECTED_CUMULATIVE_SAT, CMT) \
9 Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \
10 VECT_VAR(vector_res, T1, W, N) = \
11 INSN##_##T2##W2(VECT_VAR(vector, T1, W, N), \
12 VECT_VAR(vector3, T1, W2, N), \
13 VECT_VAR(vector4, T1, W2, N), \
14 V); \
15 vst1q_##T2##W(VECT_VAR(result, T1, W, N), \
16 VECT_VAR(vector_res, T1, W, N)); \
17 CHECK_CUMULATIVE_SAT(TEST_MSG, T1, W, N, EXPECTED_CUMULATIVE_SAT, CMT)
18
19 #define TEST_VQDMLXL_LANE(INSN, T1, T2, W, W2, N, V, EXPECTED_CUMULATIVE_SAT, CMT) \
20 TEST_VQDMLXL_LANE1(INSN, T1, T2, W, W2, N, V, EXPECTED_CUMULATIVE_SAT, CMT)
21
22 DECL_VARIABLE(vector, int, 32, 4);
23 DECL_VARIABLE(vector3, int, 16, 4);
24 DECL_VARIABLE(vector4, int, 16, 4);
25 DECL_VARIABLE(vector_res, int, 32, 4);
26
27 DECL_VARIABLE(vector, int, 64, 2);
28 DECL_VARIABLE(vector3, int, 32, 2);
29 DECL_VARIABLE(vector4, int, 32, 2);
30 DECL_VARIABLE(vector_res, int, 64, 2);
31
32 clean_results ();
33
34 VLOAD(vector, buffer, q, int, s, 32, 4);
35 VLOAD(vector, buffer, q, int, s, 64, 2);
36
37 VDUP(vector3, , int, s, 16, 4, 0x55);
38 VDUP(vector4, , int, s, 16, 4, 0xBB);
39 VDUP(vector3, , int, s, 32, 2, 0x55);
40 VDUP(vector4, , int, s, 32, 2, 0xBB);
41
42 TEST_VQDMLXL_LANE(INSN_NAME, int, s, 32, 16, 4, 0, expected_cumulative_sat, "");
43 TEST_VQDMLXL_LANE(INSN_NAME, int, s, 64, 32, 2, 0, expected_cumulative_sat, "");
44
45 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, "");
46 CHECK(TEST_MSG, int, 64, 2, PRIx64, expected, "");
47
48 #define TEST_MSG2 "(mul with input=0)"
49 VDUP(vector3, , int, s, 16, 4, 0);
50 VDUP(vector3, , int, s, 32, 2, 0);
51 TEST_VQDMLXL_LANE(INSN_NAME, int, s, 32, 16, 4, 0, expected_cumulative_sat2, TEST_MSG2);
52 TEST_VQDMLXL_LANE(INSN_NAME, int, s, 64, 32, 2, 0, expected_cumulative_sat2, TEST_MSG2);
53
54 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected2, TEST_MSG2);
55 CHECK(TEST_MSG, int, 64, 2, PRIx64, expected2, TEST_MSG2);
56
57 #define TEST_MSG3 "(mul with saturation)"
58 VDUP(vector3, , int, s, 16, 4, 0x8000);
59 VDUP(vector3, , int, s, 32, 2, 0x80000000);
60 VDUP(vector4, , int, s, 16, 4, 0x8000);
61 VDUP(vector4, , int, s, 32, 2, 0x80000000);
62 TEST_VQDMLXL_LANE(INSN_NAME, int, s, 32, 16, 4, 0, expected_cumulative_sat3, TEST_MSG3);
63 TEST_VQDMLXL_LANE(INSN_NAME, int, s, 64, 32, 2, 0, expected_cumulative_sat3, TEST_MSG3);
64
65 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected3, TEST_MSG3);
66 CHECK(TEST_MSG, int, 64, 2, PRIx64, expected3, TEST_MSG3);
67 }
68
69 int main (void)
70 {
71 FNNAME (INSN_NAME) ();
72 return 0;
73 }