1 /* { dg-do compile { target { arm*-*-* } } } */
2 /* { dg-require-effective-target arm_hard_ok } */
3 /* { dg-require-effective-target arm_v8_neon_ok } */
4 /* { dg-add-options arm_v8_neon } */
5 /* { dg-additional-options "-Ofast -mfloat-abi=hard" } */
6 /* { dg-final { check-function-bodies "**" "" "" } } */
7
8 #include <stdint.h>
9
10 #define TEST2(OUT, NAME, IN) \
11 OUT __attribute__((vector_size(sizeof(OUT) * 2))) \
12 test2_##OUT##_##NAME##_##IN (float dummy, \
13 IN __attribute__((vector_size(sizeof(IN) * 2))) y) \
14 { \
15 OUT __attribute__((vector_size(sizeof(OUT) * 2))) x; \
16 x[0] = __builtin_##NAME (y[0]); \
17 x[1] = __builtin_##NAME (y[1]); \
18 return x; \
19 }
20
21 #define TEST4(OUT, NAME, IN) \
22 OUT __attribute__((vector_size(sizeof(OUT) * 4))) \
23 test4_##OUT##_##NAME##_##IN (float dummy, \
24 IN __attribute__((vector_size(sizeof(OUT) * 4))) y) \
25 { \
26 OUT __attribute__((vector_size(sizeof(OUT) * 4))) x; \
27 x[0] = __builtin_##NAME (y[0]); \
28 x[1] = __builtin_##NAME (y[1]); \
29 x[2] = __builtin_##NAME (y[2]); \
30 x[3] = __builtin_##NAME (y[3]); \
31 return x; \
32 }
33
34 #define TEST8(OUT, NAME, IN) \
35 OUT __attribute__((vector_size(sizeof(OUT) * 8))) \
36 test8_##OUT##_##NAME##_##IN (float dummy, \
37 IN __attribute__((vector_size(sizeof(OUT) * 8))) y) \
38 { \
39 OUT __attribute__((vector_size(sizeof(OUT) * 8))) x; \
40 x[0] = __builtin_##NAME (y[0]); \
41 x[1] = __builtin_##NAME (y[1]); \
42 x[2] = __builtin_##NAME (y[2]); \
43 x[3] = __builtin_##NAME (y[3]); \
44 x[4] = __builtin_##NAME (y[4]); \
45 x[5] = __builtin_##NAME (y[5]); \
46 x[6] = __builtin_##NAME (y[6]); \
47 x[7] = __builtin_##NAME (y[7]); \
48 return x; \
49 }
50
51 /*
52 ** test2_float_truncf_float:
53 ** vrintz.f32 d0, d1
54 ** bx lr
55 */
56 TEST2 (float, truncf, float)
57
58 /*
59 ** test4_float_truncf_float:
60 ** vrintz.f32 q0, q1
61 ** bx lr
62 */
63 TEST4 (float, truncf, float)
64
65 /*
66 ** test2_float_roundf_float:
67 ** vrinta.f32 d0, d1
68 ** bx lr
69 */
70 TEST2 (float, roundf, float)
71
72 /*
73 ** test4_float_roundf_float:
74 ** vrinta.f32 q0, q1
75 ** bx lr
76 */
77 TEST4 (float, roundf, float)
78
79 /*
80 ** test2_float_floorf_float:
81 ** vrintm.f32 d0, d1
82 ** bx lr
83 */
84 TEST2 (float, floorf, float)
85
86 /*
87 ** test4_float_floorf_float:
88 ** vrintm.f32 q0, q1
89 ** bx lr
90 */
91 TEST4 (float, floorf, float)
92
93 /*
94 ** test2_float_ceilf_float:
95 ** vrintp.f32 d0, d1
96 ** bx lr
97 */
98 TEST2 (float, ceilf, float)
99
100 /*
101 ** test4_float_ceilf_float:
102 ** vrintp.f32 q0, q1
103 ** bx lr
104 */
105 TEST4 (float, ceilf, float)
106
107 /*
108 ** test2_float_rintf_float:
109 ** vrintx.f32 d0, d1
110 ** bx lr
111 */
112 TEST2 (float, rintf, float)
113
114 /*
115 ** test4_float_rintf_float:
116 ** vrintx.f32 q0, q1
117 ** bx lr
118 */
119 TEST4 (float, rintf, float)
120
121 /*
122 ** test2_float_roundevenf_float:
123 ** vrintn.f32 d0, d1
124 ** bx lr
125 */
126 TEST2 (float, roundevenf, float)
127
128 /*
129 ** test4_float_roundevenf_float:
130 ** vrintn.f32 q0, q1
131 ** bx lr
132 */
133 TEST4 (float, roundevenf, float)
134
135 /*
136 ** test2_int_roundf_float:
137 ** vcvta.s32.f32 d0, d1
138 ** bx lr
139 */
140 TEST2 (int, roundf, float)
141
142 /*
143 ** test4_int_roundf_float:
144 ** vcvta.s32.f32 q0, q1
145 ** bx lr
146 */
147 TEST4 (int, roundf, float)
148
149 /*
150 ** test2_int_floorf_float:
151 ** vcvtm.s32.f32 d0, d1
152 ** bx lr
153 */
154 TEST2 (int, floorf, float)
155
156 /*
157 ** test4_int_floorf_float:
158 ** vcvtm.s32.f32 q0, q1
159 ** bx lr
160 */
161 TEST4 (int, floorf, float)
162
163 /*
164 ** test2_int_ceilf_float:
165 ** vcvtp.s32.f32 d0, d1
166 ** bx lr
167 */
168 TEST2 (int, ceilf, float)
169
170 /*
171 ** test4_int_ceilf_float:
172 ** vcvtp.s32.f32 q0, q1
173 ** bx lr
174 */
175 TEST4 (int, ceilf, float)
176
177 /*
178 ** test2_int_clz_int:
179 ** vclz.i32 d0, d1
180 ** bx lr
181 */
182 TEST2 (int, clz, int)
183
184 /*
185 ** test4_int_clz_int:
186 ** vclz.i32 q0, q1
187 ** bx lr
188 */
189 TEST4 (int, clz, int)
190
191 /*
192 ** test4_int16_t_bswap16_int16_t: { target arm_little_endian }
193 ** vrev16.8 d0, d1
194 ** bx lr
195 */
196 TEST4 (int16_t, bswap16, int16_t)
197
198 /*
199 ** test8_int16_t_bswap16_int16_t: { target arm_little_endian }
200 ** vrev16.8 q0, q1
201 ** bx lr
202 */
203 TEST8 (int16_t, bswap16, int16_t)
204
205 /*
206 ** test2_int_bswap32_int: { target arm_little_endian }
207 ** vrev32.8 d0, d1
208 ** bx lr
209 */
210 TEST2 (int, bswap32, int)
211
212 /*
213 ** test4_int_bswap32_int: { target arm_little_endian }
214 ** vrev32.8 q0, q1
215 ** bx lr
216 */
217 TEST4 (int, bswap32, int)
218
219 /*
220 ** test2_int64_t_bswap64_int64_t: { target arm_little_endian }
221 ** vrev64.8 q0, q1
222 ** bx lr
223 */
224 TEST2 (int64_t, bswap64, int64_t)