1 /* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */
2 
3 #include "test_sve_acle.h"
4 
5 /*
6 ** cntb_1:
7 **	cntb	x0
8 **	ret
9 */
10 PROTO (cntb_1, uint64_t, ()) { return svcntb (); }
11 
12 /*
13 ** cntb_2:
14 **	cntb	x0, all, mul #2
15 **	ret
16 */
17 PROTO (cntb_2, uint64_t, ()) { return svcntb () * 2; }
18 
19 /*
20 ** cntb_3:
21 **	cntb	x0, all, mul #3
22 **	ret
23 */
24 PROTO (cntb_3, uint64_t, ()) { return svcntb () * 3; }
25 
26 /*
27 ** cntb_4:
28 **	cntb	x0, all, mul #4
29 **	ret
30 */
31 PROTO (cntb_4, uint64_t, ()) { return svcntb () * 4; }
32 
33 /*
34 ** cntb_8:
35 **	cntb	x0, all, mul #8
36 **	ret
37 */
38 PROTO (cntb_8, uint64_t, ()) { return svcntb () * 8; }
39 
40 /*
41 ** cntb_15:
42 **	cntb	x0, all, mul #15
43 **	ret
44 */
45 PROTO (cntb_15, uint64_t, ()) { return svcntb () * 15; }
46 
47 /*
48 ** cntb_16:
49 **	cntb	x0, all, mul #16
50 **	ret
51 */
52 PROTO (cntb_16, uint64_t, ()) { return svcntb () * 16; }
53 
54 /* Other sequences would be OK.  */
55 /*
56 ** cntb_17:
57 **	cntb	x0, all, mul #16
58 **	incb	x0
59 **	ret
60 */
61 PROTO (cntb_17, uint64_t, ()) { return svcntb () * 17; }
62 
63 /*
64 ** cntb_32:
65 **	cntd	(x[0-9]+)
66 **	lsl	x0, \1, 8
67 **	ret
68 */
69 PROTO (cntb_32, uint64_t, ()) { return svcntb () * 32; }
70 
71 /* Other sequences would be OK.  */
72 /*
73 ** cntb_33:
74 **	cntb	(x[0-9]+)
75 **	lsl	x0, \1, 5
76 **	incb	x0
77 **	ret
78 */
79 PROTO (cntb_33, uint64_t, ()) { return svcntb () * 33; }
80 
81 /*
82 ** cntb_64:
83 **	cntd	(x[0-9]+)
84 **	lsl	x0, \1, 9
85 **	ret
86 */
87 PROTO (cntb_64, uint64_t, ()) { return svcntb () * 64; }
88 
89 /*
90 ** cntb_128:
91 **	cntd	(x[0-9]+)
92 **	lsl	x0, \1, 10
93 **	ret
94 */
95 PROTO (cntb_128, uint64_t, ()) { return svcntb () * 128; }
96 
97 /* Other sequences would be OK.  */
98 /*
99 ** cntb_129:
100 **	cntb	(x[0-9]+)
101 **	lsl	x0, \1, 7
102 **	incb	x0
103 **	ret
104 */
105 PROTO (cntb_129, uint64_t, ()) { return svcntb () * 129; }
106 
107 /*
108 ** cntb_m1:
109 **	cntb	(x[0-9]+)
110 **	neg	x0, \1
111 **	ret
112 */
113 PROTO (cntb_m1, uint64_t, ()) { return -svcntb (); }
114 
115 /*
116 ** cntb_m13:
117 **	cntb	(x[0-9]+), all, mul #13
118 **	neg	x0, \1
119 **	ret
120 */
121 PROTO (cntb_m13, uint64_t, ()) { return -svcntb () * 13; }
122 
123 /*
124 ** cntb_m15:
125 **	cntb	(x[0-9]+), all, mul #15
126 **	neg	x0, \1
127 **	ret
128 */
129 PROTO (cntb_m15, uint64_t, ()) { return -svcntb () * 15; }
130 
131 /*
132 ** cntb_m16:
133 **	cntb	(x[0-9]+), all, mul #16
134 **	neg	x0, \1
135 **	ret
136 */
137 PROTO (cntb_m16, uint64_t, ()) { return -svcntb () * 16; }
138 
139 /* Other sequences would be OK.  */
140 /*
141 ** cntb_m17:
142 **	cntb	x0, all, mul #16
143 **	incb	x0
144 **	neg	x0, x0
145 **	ret
146 */
147 PROTO (cntb_m17, uint64_t, ()) { return -svcntb () * 17; }
148 
149 /*
150 ** incb_1:
151 **	incb	x0
152 **	ret
153 */
154 PROTO (incb_1, uint64_t, (uint64_t x0)) { return x0 + svcntb (); }
155 
156 /*
157 ** incb_2:
158 **	incb	x0, all, mul #2
159 **	ret
160 */
161 PROTO (incb_2, uint64_t, (uint64_t x0)) { return x0 + svcntb () * 2; }
162 
163 /*
164 ** incb_3:
165 **	incb	x0, all, mul #3
166 **	ret
167 */
168 PROTO (incb_3, uint64_t, (uint64_t x0)) { return x0 + svcntb () * 3; }
169 
170 /*
171 ** incb_4:
172 **	incb	x0, all, mul #4
173 **	ret
174 */
175 PROTO (incb_4, uint64_t, (uint64_t x0)) { return x0 + svcntb () * 4; }
176 
177 /*
178 ** incb_8:
179 **	incb	x0, all, mul #8
180 **	ret
181 */
182 PROTO (incb_8, uint64_t, (uint64_t x0)) { return x0 + svcntb () * 8; }
183 
184 /*
185 ** incb_15:
186 **	incb	x0, all, mul #15
187 **	ret
188 */
189 PROTO (incb_15, uint64_t, (uint64_t x0)) { return x0 + svcntb () * 15; }
190 
191 /*
192 ** incb_16:
193 **	incb	x0, all, mul #16
194 **	ret
195 */
196 PROTO (incb_16, uint64_t, (uint64_t x0)) { return x0 + svcntb () * 16; }
197 
198 /*
199 ** incb_17:
200 **	addvl	x0, x0, #17
201 **	ret
202 */
203 PROTO (incb_17, uint64_t, (uint64_t x0)) { return x0 + svcntb () * 17; }
204 
205 /*
206 ** incb_31:
207 **	addvl	x0, x0, #31
208 **	ret
209 */
210 PROTO (incb_31, uint64_t, (uint64_t x0)) { return x0 + svcntb () * 31; }
211 
212 /*
213 ** decb_1:
214 **	decb	x0
215 **	ret
216 */
217 PROTO (decb_1, uint64_t, (uint64_t x0)) { return x0 - svcntb (); }
218 
219 /*
220 ** decb_2:
221 **	decb	x0, all, mul #2
222 **	ret
223 */
224 PROTO (decb_2, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 2; }
225 
226 /*
227 ** decb_3:
228 **	decb	x0, all, mul #3
229 **	ret
230 */
231 PROTO (decb_3, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 3; }
232 
233 /*
234 ** decb_4:
235 **	decb	x0, all, mul #4
236 **	ret
237 */
238 PROTO (decb_4, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 4; }
239 
240 /*
241 ** decb_8:
242 **	decb	x0, all, mul #8
243 **	ret
244 */
245 PROTO (decb_8, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 8; }
246 
247 /*
248 ** decb_15:
249 **	decb	x0, all, mul #15
250 **	ret
251 */
252 PROTO (decb_15, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 15; }
253 
254 /*
255 ** decb_16:
256 **	decb	x0, all, mul #16
257 **	ret
258 */
259 PROTO (decb_16, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 16; }
260 
261 /*
262 ** decb_17:
263 **	addvl	x0, x0, #-17
264 **	ret
265 */
266 PROTO (decb_17, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 17; }
267 
268 /*
269 ** decb_31:
270 **	addvl	x0, x0, #-31
271 **	ret
272 */
273 PROTO (decb_31, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 31; }
274 
275 /*
276 ** decb_32:
277 **	addvl	x0, x0, #-32
278 **	ret
279 */
280 PROTO (decb_32, uint64_t, (uint64_t x0)) { return x0 - svcntb () * 32; }
281