Enable gcc.dg/vect/vect-early-break_21.c on x86_64
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / advsimd-intrinsics / vbsl.c
blobe9b3dfd1c0233a900ce9889793100a651a7e51cc
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) [] = { 0xf2, 0xf2, 0xf2, 0xf2,
7 0xf6, 0xf6, 0xf6, 0xf6 };
8 VECT_VAR_DECL(expected,int,16,4) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2 };
9 VECT_VAR_DECL(expected,int,32,2) [] = { 0xfffffff0, 0xfffffff0 };
10 VECT_VAR_DECL(expected,int,64,1) [] = { 0xfffffffffffffffd };
11 VECT_VAR_DECL(expected,uint,8,8) [] = { 0xf3, 0xf3, 0xf3, 0xf3,
12 0xf7, 0xf7, 0xf7, 0xf7 };
13 VECT_VAR_DECL(expected,uint,16,4) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2 };
14 VECT_VAR_DECL(expected,uint,32,2) [] = { 0xfffffff0, 0xfffffff0 };
15 VECT_VAR_DECL(expected,uint,64,1) [] = { 0xfffffff1 };
16 VECT_VAR_DECL(expected,poly,8,8) [] = { 0xf3, 0xf3, 0xf3, 0xf3,
17 0xf7, 0xf7, 0xf7, 0xf7 };
18 VECT_VAR_DECL(expected,poly,16,4) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2 };
19 #if defined (FP16_SUPPORTED)
20 VECT_VAR_DECL (expected, hfloat, 16, 4) [] = { 0xcc09, 0xcb89,
21 0xcb09, 0xca89 };
22 #endif
23 VECT_VAR_DECL(expected,hfloat,32,2) [] = { 0xc1800004, 0xc1700004 };
24 VECT_VAR_DECL(expected,int,8,16) [] = { 0xf2, 0xf2, 0xf2, 0xf2,
25 0xf6, 0xf6, 0xf6, 0xf6,
26 0xf2, 0xf2, 0xf2, 0xf2,
27 0xf6, 0xf6, 0xf6, 0xf6 };
28 VECT_VAR_DECL(expected,int,16,8) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2,
29 0xfff4, 0xfff4, 0xfff6, 0xfff6 };
30 VECT_VAR_DECL(expected,int,32,4) [] = { 0xfffffff0, 0xfffffff0,
31 0xfffffff2, 0xfffffff2 };
32 VECT_VAR_DECL(expected,int,64,2) [] = { 0xfffffffffffffffd,
33 0xfffffffffffffffd };
34 VECT_VAR_DECL(expected,uint,8,16) [] = { 0xf3, 0xf3, 0xf3, 0xf3,
35 0xf7, 0xf7, 0xf7, 0xf7,
36 0xf3, 0xf3, 0xf3, 0xf3,
37 0xf7, 0xf7, 0xf7, 0xf7 };
38 VECT_VAR_DECL(expected,uint,16,8) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2,
39 0xfff4, 0xfff4, 0xfff6, 0xfff6 };
40 VECT_VAR_DECL(expected,uint,32,4) [] = { 0xfffffff0, 0xfffffff0,
41 0xfffffff2, 0xfffffff2 };
42 VECT_VAR_DECL(expected,uint,64,2) [] = { 0xfffffff1,
43 0xfffffff1 };
44 VECT_VAR_DECL(expected,poly,8,16) [] = { 0xf3, 0xf3, 0xf3, 0xf3,
45 0xf7, 0xf7, 0xf7, 0xf7,
46 0xf3, 0xf3, 0xf3, 0xf3,
47 0xf7, 0xf7, 0xf7, 0xf7 };
48 VECT_VAR_DECL(expected,poly,16,8) [] = { 0xfff0, 0xfff0, 0xfff2, 0xfff2,
49 0xfff4, 0xfff4, 0xfff6, 0xfff6 };
50 #if defined (FP16_SUPPORTED)
51 VECT_VAR_DECL (expected, hfloat, 16, 8) [] = { 0xcc09, 0xcb89,
52 0xcb09, 0xca89,
53 0xca09, 0xc989,
54 0xc909, 0xc889 };
55 #endif
56 VECT_VAR_DECL(expected,hfloat,32,4) [] = { 0xc1800001, 0xc1700001,
57 0xc1600001, 0xc1500001 };
59 #define TEST_MSG "VBSL/VBSLQ"
60 void exec_vbsl (void)
62 /* Basic test: y=vbsl(unsigned_vec,x1,x2), then store the result. */
63 #define TEST_VBSL(T3, Q, T1, T2, W, N) \
64 VECT_VAR(vector_res, T1, W, N) = \
65 vbsl##Q##_##T2##W(VECT_VAR(vector_first, T3, W, N), \
66 VECT_VAR(vector, T1, W, N), \
67 VECT_VAR(vector2, T1, W, N)); \
68 vst1##Q##_##T2##W(VECT_VAR(result, T1, W, N), VECT_VAR(vector_res, T1, W, N))
70 DECL_VARIABLE_ALL_VARIANTS(vector);
71 DECL_VARIABLE_ALL_VARIANTS(vector2);
72 DECL_VARIABLE_ALL_VARIANTS(vector_res);
74 DECL_VARIABLE_UNSIGNED_VARIANTS(vector_first);
76 clean_results ();
78 TEST_MACRO_ALL_VARIANTS_2_5(VLOAD, vector, buffer);
79 #if defined (FP16_SUPPORTED)
80 VLOAD(vector, buffer, , float, f, 16, 4);
81 VLOAD(vector, buffer, q, float, f, 16, 8);
82 #endif
83 VLOAD(vector, buffer, , float, f, 32, 2);
84 VLOAD(vector, buffer, q, float, f, 32, 4);
86 /* Choose init value arbitrarily, will be used for vector
87 comparison. As we want different values for each type variant, we
88 can't use generic initialization macros. */
89 VDUP(vector2, , int, s, 8, 8, -10);
90 VDUP(vector2, , int, s, 16, 4, -14);
91 VDUP(vector2, , int, s, 32, 2, -30);
92 VDUP(vector2, , int, s, 64, 1, -33);
93 VDUP(vector2, , uint, u, 8, 8, 0xF3);
94 VDUP(vector2, , uint, u, 16, 4, 0xFFF2);
95 VDUP(vector2, , uint, u, 32, 2, 0xFFFFFFF0);
96 VDUP(vector2, , uint, u, 64, 1, 0xFFFFFFF3);
97 #if defined (FP16_SUPPORTED)
98 VDUP(vector2, , float, f, 16, 4, -2.4f); /* -2.4f is 0xC0CD. */
99 #endif
100 VDUP(vector2, , float, f, 32, 2, -30.3f);
101 VDUP(vector2, , poly, p, 8, 8, 0xF3);
102 VDUP(vector2, , poly, p, 16, 4, 0xFFF2);
104 VDUP(vector2, q, int, s, 8, 16, -10);
105 VDUP(vector2, q, int, s, 16, 8, -14);
106 VDUP(vector2, q, int, s, 32, 4, -30);
107 VDUP(vector2, q, int, s, 64, 2, -33);
108 VDUP(vector2, q, uint, u, 8, 16, 0xF3);
109 VDUP(vector2, q, uint, u, 16, 8, 0xFFF2);
110 VDUP(vector2, q, uint, u, 32, 4, 0xFFFFFFF0);
111 VDUP(vector2, q, uint, u, 64, 2, 0xFFFFFFF3);
112 VDUP(vector2, q, poly, p, 8, 16, 0xF3);
113 VDUP(vector2, q, poly, p, 16, 8, 0xFFF2);
114 #if defined (FP16_SUPPORTED)
115 VDUP(vector2, q, float, f, 16, 8, -2.4f);
116 #endif
117 VDUP(vector2, q, float, f, 32, 4, -30.4f);
119 VDUP(vector_first, , uint, u, 8, 8, 0xF4);
120 VDUP(vector_first, , uint, u, 16, 4, 0xFFF6);
121 VDUP(vector_first, , uint, u, 32, 2, 0xFFFFFFF2);
122 VDUP(vector_first, , uint, u, 64, 1, 0xFFFFFFF2);
123 VDUP(vector_first, q, uint, u, 8, 16, 0xF4);
124 VDUP(vector_first, q, uint, u, 16, 8, 0xFFF6);
125 VDUP(vector_first, q, uint, u, 32, 4, 0xFFFFFFF2);
126 VDUP(vector_first, q, uint, u, 64, 2, 0xFFFFFFF2);
128 /* Execute the tests. */
129 TEST_MACRO_ALL_VARIANTS_1_5(TEST_VBSL, uint);
130 TEST_VBSL(uint, , poly, p, 8, 8);
131 TEST_VBSL(uint, , poly, p, 16, 4);
132 TEST_VBSL(uint, q, poly, p, 8, 16);
133 TEST_VBSL(uint, q, poly, p, 16, 8);
134 #if defined (FP16_SUPPORTED)
135 TEST_VBSL(uint, , float, f, 16, 4);
136 TEST_VBSL(uint, q, float, f, 16, 8);
137 #endif
138 TEST_VBSL(uint, , float, f, 32, 2);
139 TEST_VBSL(uint, q, float, f, 32, 4);
141 #if defined (FP16_SUPPORTED)
142 CHECK_RESULTS (TEST_MSG, "");
143 #else
144 CHECK_RESULTS_NO_FP16 (TEST_MSG, "");
145 #endif
148 int main (void)
150 exec_vbsl ();
151 return 0;