[ARM,AArch64][testsuite] AdvSIMD intrinsics tests cleanup: remove useless expected...
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vaba.c
blobe3692f96ea27d310b3c4459155749357ea74d4c7
1 #include <arm_neon.h>
2 #include "arm-neon-ref.h"
3 #include "compute-ref-data.h"
5 /* Expected results. */
6 VECT_VAR_DECL(expected,int,8,8) [] = { 0xf6, 0xf7, 0xf8, 0xf9,
7 0xfa, 0xfb, 0xfc, 0xfd };
8 VECT_VAR_DECL(expected,int,16,4) [] = { 0x16, 0x17, 0x18, 0x19 };
9 VECT_VAR_DECL(expected,int,32,2) [] = { 0x20, 0x21 };
10 VECT_VAR_DECL(expected,uint,8,8) [] = { 0x53, 0x54, 0x55, 0x56,
11 0x57, 0x58, 0x59, 0x5a };
12 VECT_VAR_DECL(expected,uint,16,4) [] = { 0x907, 0x908, 0x909, 0x90a };
13 VECT_VAR_DECL(expected,uint,32,2) [] = { 0xffffffe7, 0xffffffe8 };
14 VECT_VAR_DECL(expected,int,8,16) [] = { 0x5e, 0x5f, 0x60, 0x61,
15 0x62, 0x63, 0x64, 0x65,
16 0x66, 0x67, 0x68, 0x69,
17 0x6a, 0x6b, 0x6c, 0x6d };
18 VECT_VAR_DECL(expected,int,16,8) [] = { 0xb9c, 0xb9d, 0xb9e, 0xb9f,
19 0xba0, 0xba1, 0xba2, 0xba3 };
20 VECT_VAR_DECL(expected,int,32,4) [] = { 0x26e0, 0x26e1, 0x26e2, 0x26e3 };
21 VECT_VAR_DECL(expected,uint,8,16) [] = { 0xf8, 0xf9, 0xfa, 0xfb,
22 0xfc, 0xfd, 0xfe, 0xff,
23 0x0, 0x1, 0x2, 0x3,
24 0x4, 0x5, 0x6, 0x7 };
25 VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff9, 0xfffa, 0xfffb, 0xfffc,
26 0xfffd, 0xfffe, 0xffff, 0x0 };
27 VECT_VAR_DECL(expected,uint,32,4) [] = { 0xc, 0xd, 0xe, 0xf };
29 #define TEST_MSG "VABA/VABAQ"
30 void exec_vaba (void)
32 /* Basic test: v4=vaba(v1,v2,v3), then store the result. */
33 #define TEST_VABA(Q, T1, T2, W, N) \
34 VECT_VAR(vector_res, T1, W, N) = \
35 vaba##Q##_##T2##W(VECT_VAR(vector1, T1, W, N), \
36 VECT_VAR(vector2, T1, W, N), \
37 VECT_VAR(vector3, T1, W, N)); \
38 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
40 #define DECL_VABA_VAR(VAR) \
41 DECL_VARIABLE(VAR, int, 8, 8); \
42 DECL_VARIABLE(VAR, int, 16, 4); \
43 DECL_VARIABLE(VAR, int, 32, 2); \
44 DECL_VARIABLE(VAR, uint, 8, 8); \
45 DECL_VARIABLE(VAR, uint, 16, 4); \
46 DECL_VARIABLE(VAR, uint, 32, 2); \
47 DECL_VARIABLE(VAR, int, 8, 16); \
48 DECL_VARIABLE(VAR, int, 16, 8); \
49 DECL_VARIABLE(VAR, int, 32, 4); \
50 DECL_VARIABLE(VAR, uint, 8, 16); \
51 DECL_VARIABLE(VAR, uint, 16, 8); \
52 DECL_VARIABLE(VAR, uint, 32, 4)
54 DECL_VABA_VAR(vector1);
55 DECL_VABA_VAR(vector2);
56 DECL_VABA_VAR(vector3);
57 DECL_VABA_VAR(vector_res);
59 clean_results ();
61 /* Initialize input "vector1" from "buffer". */
62 VLOAD(vector1, buffer, , int, s, 8, 8);
63 VLOAD(vector1, buffer, , int, s, 16, 4);
64 VLOAD(vector1, buffer, , int, s, 32, 2);
65 VLOAD(vector1, buffer, , uint, u, 8, 8);
66 VLOAD(vector1, buffer, , uint, u, 16, 4);
67 VLOAD(vector1, buffer, , uint, u, 32, 2);
68 VLOAD(vector1, buffer, q, int, s, 8, 16);
69 VLOAD(vector1, buffer, q, int, s, 16, 8);
70 VLOAD(vector1, buffer, q, int, s, 32, 4);
71 VLOAD(vector1, buffer, q, uint, u, 8, 16);
72 VLOAD(vector1, buffer, q, uint, u, 16, 8);
73 VLOAD(vector1, buffer, q, uint, u, 32, 4);
75 /* Choose init value arbitrarily. */
76 VDUP(vector2, , int, s, 8, 8, 1);
77 VDUP(vector2, , int, s, 16, 4, -13);
78 VDUP(vector2, , int, s, 32, 2, 8);
79 VDUP(vector2, , uint, u, 8, 8, 1);
80 VDUP(vector2, , uint, u, 16, 4, 13);
81 VDUP(vector2, , uint, u, 32, 2, 8);
82 VDUP(vector2, q, int, s, 8, 16, 10);
83 VDUP(vector2, q, int, s, 16, 8, -12);
84 VDUP(vector2, q, int, s, 32, 4, 32);
85 VDUP(vector2, q, uint, u, 8, 16, 10);
86 VDUP(vector2, q, uint, u, 16, 8, 12);
87 VDUP(vector2, q, uint, u, 32, 4, 32);
89 /* Choose init value arbitrarily. */
90 VDUP(vector3, , int, s, 8, 8, -5);
91 VDUP(vector3, , int, s, 16, 4, 25);
92 VDUP(vector3, , int, s, 32, 2, -40);
93 VDUP(vector3, , uint, u, 8, 8, 100);
94 VDUP(vector3, , uint, u, 16, 4, 2340);
95 VDUP(vector3, , uint, u, 32, 2, 0xffffffff);
96 VDUP(vector3, q, int, s, 8, 16, -100);
97 VDUP(vector3, q, int, s, 16, 8, -3000);
98 VDUP(vector3, q, int, s, 32, 4, 10000);
99 VDUP(vector3, q, uint, u, 8, 16, 2);
100 VDUP(vector3, q, uint, u, 16, 8, 3);
101 VDUP(vector3, q, uint, u, 32, 4, 4);
103 /* Execute the tests. */
104 TEST_VABA(, int, s, 8, 8);
105 TEST_VABA(, int, s, 16, 4);
106 TEST_VABA(, int, s, 32, 2);
107 TEST_VABA(, uint, u, 8, 8);
108 TEST_VABA(, uint, u, 16, 4);
109 TEST_VABA(, uint, u, 32, 2);
110 TEST_VABA(q, int, s, 8, 16);
111 TEST_VABA(q, int, s, 16, 8);
112 TEST_VABA(q, int, s, 32, 4);
113 TEST_VABA(q, uint, u, 8, 16);
114 TEST_VABA(q, uint, u, 16, 8);
115 TEST_VABA(q, uint, u, 32, 4);
117 CHECK(TEST_MSG, int, 8, 8, PRIx8, expected, "");
118 CHECK(TEST_MSG, int, 16, 4, PRIx16, expected, "");
119 CHECK(TEST_MSG, int, 32, 2, PRIx32, expected, "");
120 CHECK(TEST_MSG, uint, 8, 8, PRIx8, expected, "");
121 CHECK(TEST_MSG, uint, 16, 4, PRIx16, expected, "");
122 CHECK(TEST_MSG, uint, 32, 2, PRIx32, expected, "");
123 CHECK(TEST_MSG, int, 8, 16, PRIx8, expected, "");
124 CHECK(TEST_MSG, int, 16, 8, PRIx16, expected, "");
125 CHECK(TEST_MSG, int, 32, 4, PRIx32, expected, "");
126 CHECK(TEST_MSG, uint, 8, 16, PRIx8, expected, "");
127 CHECK(TEST_MSG, uint, 16, 8, PRIx16, expected, "");
128 CHECK(TEST_MSG, uint, 32, 4, PRIx32, expected, "");
131 int main (void)
133 exec_vaba ();
134 return 0;