aarch64: Remove testing of saturation cumulative QC bit
[gcc.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vqdmulh.c
1 #include <arm_neon.h>
2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
4
5 /* Expected results. */
6 VECT_VAR_DECL(expected,int,16,4) [] = { 0xffff, 0xffff, 0xffff, 0xffff };
7 VECT_VAR_DECL(expected,int,32,2) [] = { 0xffffffff, 0xffffffff };
8 VECT_VAR_DECL(expected,int,16,8) [] = { 0xffff, 0xffff, 0xffff, 0xffff,
9 0xffff, 0xffff, 0xffff, 0xffff };
10 VECT_VAR_DECL(expected,int,32,4) [] = { 0xffffffff, 0xffffffff,
11 0xffffffff, 0xffffffff };
12
13 /* Expected results when saturation occurs. */
14 VECT_VAR_DECL(expected2,int,16,4) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff };
15 VECT_VAR_DECL(expected2,int,32,2) [] = { 0x7fffffff, 0x7fffffff };
16 VECT_VAR_DECL(expected2,int,16,8) [] = { 0x7fff, 0x7fff, 0x7fff, 0x7fff,
17 0x7fff, 0x7fff, 0x7fff, 0x7fff };
18 VECT_VAR_DECL(expected2,int,32,4) [] = { 0x7fffffff, 0x7fffffff,
19 0x7fffffff, 0x7fffffff };
20
21 #define INSN_NAME vqdmulh
22 #define TEST_MSG "VQDMULH"
23
24 #define FNNAME1(NAME) exec_ ## NAME
25 #define FNNAME(NAME) FNNAME1(NAME)
26
27 void FNNAME (INSN_NAME) (void)
28 {
29 /* vector_res = vqdmulh(vector,vector2,lane), then store the result. */
30 #define TEST_VQDMULH2(INSN, Q, T1, T2, W, N, CMT) \
31 Set_Neon_Cumulative_Sat(0, VECT_VAR(vector_res, T1, W, N)); \
32 VECT_VAR(vector_res, T1, W, N) = \
33 INSN##Q##_##T2##W(VECT_VAR(vector, T1, W, N), \
34 VECT_VAR(vector2, T1, W, N)); \
35 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), \
36 VECT_VAR(vector_res, T1, W, N))
37
38 /* Two auxliary macros are necessary to expand INSN. */
39 #define TEST_VQDMULH1(INSN, Q, T1, T2, W, N, CMT) \
40 TEST_VQDMULH2(INSN, Q, T1, T2, W, N, CMT)
41
42 #define TEST_VQDMULH(Q, T1, T2, W, N, CMT) \
43 TEST_VQDMULH1(INSN_NAME, Q, T1, T2, W, N, CMT)
44
45 DECL_VARIABLE(vector, int, 16, 4);
46 DECL_VARIABLE(vector, int, 32, 2);
47 DECL_VARIABLE(vector, int, 16, 8);
48 DECL_VARIABLE(vector, int, 32, 4);
49
50 DECL_VARIABLE(vector_res, int, 16, 4);
51 DECL_VARIABLE(vector_res, int, 32, 2);
52 DECL_VARIABLE(vector_res, int, 16, 8);
53 DECL_VARIABLE(vector_res, int, 32, 4);
54
55 DECL_VARIABLE(vector2, int, 16, 4);
56 DECL_VARIABLE(vector2, int, 32, 2);
57 DECL_VARIABLE(vector2, int, 16, 8);
58 DECL_VARIABLE(vector2, int, 32, 4);
59
60 clean_results ();
61
62 VLOAD(vector, buffer, , int, s, 16, 4);
63 VLOAD(vector, buffer, , int, s, 32, 2);
64 VLOAD(vector, buffer, q, int, s, 16, 8);
65 VLOAD(vector, buffer, q, int, s, 32, 4);
66
67 /* Initialize vector2. */
68 VDUP(vector2, , int, s, 16, 4, 0x55);
69 VDUP(vector2, , int, s, 32, 2, 0xBB);
70 VDUP(vector2, q, int, s, 16, 8, 0x33);
71 VDUP(vector2, q, int, s, 32, 4, 0x22);
72
73 TEST_VQDMULH(, int, s, 16, 4, "");
74 TEST_VQDMULH(, int, s, 32, 2, "");
75 TEST_VQDMULH(q, int, s, 16, 8, "");
76 TEST_VQDMULH(q, int, s, 32, 4, "");
77
78 CHECK (TEST_MSG, int, 16, 4, PRIx16, expected, "");
79 CHECK (TEST_MSG, int, 32, 2, PRIx32, expected, "");
80 CHECK (TEST_MSG, int, 16, 8, PRIx16, expected, "");
81 CHECK (TEST_MSG, int, 32, 4, PRIx32, expected, "");
82
83 VDUP(vector, , int, s, 16, 4, 0x8000);
84 VDUP(vector2, , int, s, 16, 4, 0x8000);
85 VDUP(vector, , int, s, 32, 2, 0x80000000);
86 VDUP(vector2, , int, s, 32, 2, 0x80000000);
87 VDUP(vector, q, int, s, 16, 8, 0x8000);
88 VDUP(vector2, q, int, s, 16, 8, 0x8000);
89 VDUP(vector, q, int, s, 32, 4, 0x80000000);
90 VDUP(vector2, q, int, s, 32, 4, 0x80000000);
91
92 #define TEST_MSG2 "with saturation"
93 TEST_VQDMULH(, int, s, 16, 4, TEST_MSG2);
94 TEST_VQDMULH(, int, s, 32, 2, TEST_MSG2);
95 TEST_VQDMULH(q, int, s, 16, 8, TEST_MSG2);
96 TEST_VQDMULH(q, int, s, 32, 4, TEST_MSG2);
97
98 CHECK (TEST_MSG, int, 16, 4, PRIx16, expected2, TEST_MSG2);
99 CHECK (TEST_MSG, int, 32, 2, PRIx32, expected2, TEST_MSG2);
100 CHECK (TEST_MSG, int, 16, 8, PRIx16, expected2, TEST_MSG2);
101 CHECK (TEST_MSG, int, 32, 4, PRIx32, expected2, TEST_MSG2);
102 }
103
104 int main (void)
105 {
106 FNNAME (INSN_NAME) ();
107 return 0;
108 }