1 /* { dg-options "-O3 -fno-math-errno --save-temps" } */
2 /* { dg-final { check-function-bodies "**" "" "" } } */
3
4 #include <stdint.h>
5
6 #define TEST2(OUT, NAME, IN) \
7 OUT __attribute__((vector_size(sizeof(OUT) * 2))) \
8 test2_##OUT##_##NAME##_##IN (float dummy, \
9 IN __attribute__((vector_size(sizeof(IN) * 2))) y) \
10 { \
11 OUT __attribute__((vector_size(sizeof(OUT) * 2))) x; \
12 x[0] = __builtin_##NAME (y[0]); \
13 x[1] = __builtin_##NAME (y[1]); \
14 return x; \
15 } \
16
17 #define TEST4(OUT, NAME, IN) \
18 OUT __attribute__((vector_size(16))) \
19 test4_##OUT##_##NAME##_##IN (float dummy, \
20 IN __attribute__((vector_size(16))) y) \
21 { \
22 OUT __attribute__((vector_size(16))) x; \
23 x[0] = __builtin_##NAME (y[0]); \
24 x[1] = __builtin_##NAME (y[1]); \
25 x[2] = __builtin_##NAME (y[2]); \
26 x[3] = __builtin_##NAME (y[3]); \
27 return x; \
28 } \
29
30 /*
31 ** test2_float_truncf_float:
32 ** frintz v0.2s, v1.2s
33 ** ret
34 */
35 TEST2 (float, truncf, float)
36
37 /*
38 ** test2_double_trunc_double:
39 ** frintz v0.2d, v1.2d
40 ** ret
41 */
42 TEST2 (double, trunc, double)
43
44 /*
45 ** test4_float_truncf_float:
46 ** frintz v0.4s, v1.4s
47 ** ret
48 */
49 TEST4 (float, truncf, float)
50
51 /*
52 ** test2_float_roundf_float:
53 ** frinta v0.2s, v1.2s
54 ** ret
55 */
56 TEST2 (float, roundf, float)
57
58 /*
59 ** test2_double_round_double:
60 ** frinta v0.2d, v1.2d
61 ** ret
62 */
63 TEST2 (double, round, double)
64
65 /*
66 ** test4_float_roundf_float:
67 ** frinta v0.4s, v1.4s
68 ** ret
69 */
70 TEST4 (float, roundf, float)
71
72 /*
73 ** test2_float_nearbyintf_float:
74 ** frinti v0.2s, v1.2s
75 ** ret
76 */
77 TEST2 (float, nearbyintf, float)
78
79 /*
80 ** test2_double_nearbyint_double:
81 ** frinti v0.2d, v1.2d
82 ** ret
83 */
84 TEST2 (double, nearbyint, double)
85
86 /*
87 ** test4_float_nearbyintf_float:
88 ** frinti v0.4s, v1.4s
89 ** ret
90 */
91 TEST4 (float, nearbyintf, float)
92
93 /*
94 ** test2_float_floorf_float:
95 ** frintm v0.2s, v1.2s
96 ** ret
97 */
98 TEST2 (float, floorf, float)
99
100 /*
101 ** test2_double_floor_double:
102 ** frintm v0.2d, v1.2d
103 ** ret
104 */
105 TEST2 (double, floor, double)
106
107 /*
108 ** test4_float_floorf_float:
109 ** frintm v0.4s, v1.4s
110 ** ret
111 */
112 TEST4 (float, floorf, float)
113
114 /*
115 ** test2_float_ceilf_float:
116 ** frintp v0.2s, v1.2s
117 ** ret
118 */
119 TEST2 (float, ceilf, float)
120
121 /*
122 ** test2_double_ceil_double:
123 ** frintp v0.2d, v1.2d
124 ** ret
125 */
126 TEST2 (double, ceil, double)
127
128 /*
129 ** test4_float_ceilf_float:
130 ** frintp v0.4s, v1.4s
131 ** ret
132 */
133 TEST4 (float, ceilf, float)
134
135 /*
136 ** test2_float_rintf_float:
137 ** frintx v0.2s, v1.2s
138 ** ret
139 */
140 TEST2 (float, rintf, float)
141
142 /*
143 ** test2_double_rint_double:
144 ** frintx v0.2d, v1.2d
145 ** ret
146 */
147 TEST2 (double, rint, double)
148
149 /*
150 ** test4_float_rintf_float:
151 ** frintx v0.4s, v1.4s
152 ** ret
153 */
154 TEST4 (float, rintf, float)
155
156 /*
157 ** test2_int_clz_int:
158 ** clz v0.2s, v1.2s
159 ** ret
160 */
161 TEST2 (int, clz, int)
162
163 /*
164 ** test4_int_clz_int:
165 ** clz v0.4s, v1.4s
166 ** ret
167 */
168 TEST4 (int, clz, int)
169
170 /*
171 ** test2_int_ctz_int:
172 ** rev32 (v[0-9]+).8b, v1.8b
173 ** rbit (v[0-9]+).8b, \1.8b
174 ** clz v0.2s, \2.2s
175 ** ret
176 */
177 TEST2 (int, ctz, int)
178
179 /*
180 ** test4_int_ctz_int:
181 ** rev32 (v[0-9]+).16b, v1.16b
182 ** rbit (v[0-9]+).16b, \1.16b
183 ** clz v0.4s, \2.4s
184 ** ret
185 */
186 TEST4 (int, ctz, int)
187
188 /*
189 ** test2_int_iroundf_float:
190 ** fcvtas v0.2s, v1.2s
191 ** ret
192 */
193 TEST2 (int, iroundf, float)
194
195 /*
196 ** test2_int64_t_llround_double:
197 ** fcvtas v0.2d, v1.2d
198 ** ret
199 */
200 TEST2 (int64_t, llround, double)
201
202 /*
203 ** test4_int_iroundf_float:
204 ** fcvtas v0.4s, v1.4s
205 ** ret
206 */
207 TEST4 (int, iroundf, float)
208
209 /*
210 ** test2_int_ifloorf_float:
211 ** fcvtms v0.2s, v1.2s
212 ** ret
213 */
214 TEST2 (int, ifloorf, float)
215
216 /*
217 ** test2_int64_t_llfloor_double:
218 ** fcvtms v0.2d, v1.2d
219 ** ret
220 */
221 TEST2 (int64_t, llfloor, double)
222
223 /*
224 ** test4_int_ifloorf_float:
225 ** fcvtms v0.4s, v1.4s
226 ** ret
227 */
228 TEST4 (int, ifloorf, float)
229
230 /*
231 ** test2_int_iceilf_float:
232 ** fcvtps v0.2s, v1.2s
233 ** ret
234 */
235 TEST2 (int, iceilf, float)
236
237 /*
238 ** test2_int64_t_llceil_double:
239 ** fcvtps v0.2d, v1.2d
240 ** ret
241 */
242 TEST2 (int64_t, llceil, double)
243
244 /*
245 ** test4_int_iceilf_float:
246 ** fcvtps v0.4s, v1.4s
247 ** ret
248 */
249 TEST4 (int, iceilf, float)