1 /* { dg-do compile } */
2 /* { dg-options "-O -msve-vector-bits=2048 -g" } */
3 /* { dg-final { check-function-bodies "**" "" "" { target lp64 } } } */
4 
5 #define CALLEE(SUFFIX, TYPE)			\
6   TYPE __attribute__((noipa))			\
7   callee_##SUFFIX (TYPE *ptr)			\
8   {						\
9     return *ptr;				\
10   }
11 
12 /*
13 ** callee_s8:
14 **	ptrue	(p[0-7])\.b, vl256
15 **	ld1b	z0\.b, \1/z, \[x0\]
16 **	ret
17 */
18 CALLEE (s8, __SVInt8_t)
19 
20 /*
21 ** callee_u8:
22 **	ptrue	(p[0-7])\.b, vl256
23 **	ld1b	z0\.b, \1/z, \[x0\]
24 **	ret
25 */
26 CALLEE (u8, __SVUint8_t)
27 
28 /*
29 ** callee_s16:
30 **	ptrue	(p[0-7])\.b, vl256
31 **	ld1h	z0\.h, \1/z, \[x0\]
32 **	ret
33 */
34 CALLEE (s16, __SVInt16_t)
35 
36 /*
37 ** callee_u16:
38 **	ptrue	(p[0-7])\.b, vl256
39 **	ld1h	z0\.h, \1/z, \[x0\]
40 **	ret
41 */
42 CALLEE (u16, __SVUint16_t)
43 
44 /*
45 ** callee_f16:
46 **	ptrue	(p[0-7])\.b, vl256
47 **	ld1h	z0\.h, \1/z, \[x0\]
48 **	ret
49 */
50 CALLEE (f16, __SVFloat16_t)
51 
52 /*
53 ** callee_bf16:
54 **	ptrue	(p[0-7])\.b, vl256
55 **	ld1h	z0\.h, \1/z, \[x0\]
56 **	ret
57 */
58 CALLEE (bf16, __SVBfloat16_t)
59 
60 /*
61 ** callee_s32:
62 **	ptrue	(p[0-7])\.b, vl256
63 **	ld1w	z0\.s, \1/z, \[x0\]
64 **	ret
65 */
66 CALLEE (s32, __SVInt32_t)
67 
68 /*
69 ** callee_u32:
70 **	ptrue	(p[0-7])\.b, vl256
71 **	ld1w	z0\.s, \1/z, \[x0\]
72 **	ret
73 */
74 CALLEE (u32, __SVUint32_t)
75 
76 /*
77 ** callee_f32:
78 **	ptrue	(p[0-7])\.b, vl256
79 **	ld1w	z0\.s, \1/z, \[x0\]
80 **	ret
81 */
82 CALLEE (f32, __SVFloat32_t)
83 
84 /*
85 ** callee_s64:
86 **	ptrue	(p[0-7])\.b, vl256
87 **	ld1d	z0\.d, \1/z, \[x0\]
88 **	ret
89 */
90 CALLEE (s64, __SVInt64_t)
91 
92 /*
93 ** callee_u64:
94 **	ptrue	(p[0-7])\.b, vl256
95 **	ld1d	z0\.d, \1/z, \[x0\]
96 **	ret
97 */
98 CALLEE (u64, __SVUint64_t)
99 
100 /*
101 ** callee_f64:
102 **	ptrue	(p[0-7])\.b, vl256
103 **	ld1d	z0\.d, \1/z, \[x0\]
104 **	ret
105 */
106 CALLEE (f64, __SVFloat64_t)
107 
108 #include <arm_sve.h>
109 
110 #define CALLER(SUFFIX, TYPE)					\
111   typeof (svaddv (svptrue_b8 (), *(TYPE *) 0))			\
112   __attribute__((noipa))					\
113   caller_##SUFFIX (TYPE *ptr1)					\
114   {								\
115     return svaddv (svptrue_b8 (), callee_##SUFFIX (ptr1));	\
116   }
117 
118 #define CALLER_BF16(SUFFIX, TYPE)				\
119   typeof (svlasta (svptrue_b8 (), *(TYPE *) 0))			\
120   __attribute__((noipa))					\
121   caller_##SUFFIX (TYPE *ptr1)					\
122   {								\
123     return svlasta (svptrue_b8 (), callee_##SUFFIX (ptr1));	\
124   }
125 
126 /*
127 ** caller_s8:
128 **	...
129 **	bl	callee_s8
130 **	ptrue	(p[0-7])\.b, vl256
131 **	saddv	(d[0-9]+), \1, z0\.b
132 **	fmov	x0, \2
133 **	ldp	x29, x30, \[sp\], 16
134 **	ret
135 */
136 CALLER (s8, __SVInt8_t)
137 
138 /*
139 ** caller_u8:
140 **	...
141 **	bl	callee_u8
142 **	ptrue	(p[0-7])\.b, vl256
143 **	uaddv	(d[0-9]+), \1, z0\.b
144 **	fmov	x0, \2
145 **	ldp	x29, x30, \[sp\], 16
146 **	ret
147 */
148 CALLER (u8, __SVUint8_t)
149 
150 /*
151 ** caller_s16:
152 **	...
153 **	bl	callee_s16
154 **	ptrue	(p[0-7])\.b, vl256
155 **	saddv	(d[0-9]+), \1, z0\.h
156 **	fmov	x0, \2
157 **	ldp	x29, x30, \[sp\], 16
158 **	ret
159 */
160 CALLER (s16, __SVInt16_t)
161 
162 /*
163 ** caller_u16:
164 **	...
165 **	bl	callee_u16
166 **	ptrue	(p[0-7])\.b, vl256
167 **	uaddv	(d[0-9]+), \1, z0\.h
168 **	fmov	x0, \2
169 **	ldp	x29, x30, \[sp\], 16
170 **	ret
171 */
172 CALLER (u16, __SVUint16_t)
173 
174 /*
175 ** caller_f16:
176 **	...
177 **	bl	callee_f16
178 **	ptrue	(p[0-7])\.b, vl256
179 **	faddv	h0, \1, z0\.h
180 **	ldp	x29, x30, \[sp\], 16
181 **	ret
182 */
183 CALLER (f16, __SVFloat16_t)
184 
185 /*
186 ** caller_bf16:
187 **	...
188 **	bl	callee_bf16
189 **	ptrue	(p[0-7])\.b, vl256
190 **	lasta	h0, \1, z0\.h
191 **	ldp	x29, x30, \[sp\], 16
192 **	ret
193 */
194 CALLER_BF16 (bf16, __SVBfloat16_t)
195 
196 /*
197 ** caller_s32:
198 **	...
199 **	bl	callee_s32
200 **	ptrue	(p[0-7])\.b, vl256
201 **	saddv	(d[0-9]+), \1, z0\.s
202 **	fmov	x0, \2
203 **	ldp	x29, x30, \[sp\], 16
204 **	ret
205 */
206 CALLER (s32, __SVInt32_t)
207 
208 /*
209 ** caller_u32:
210 **	...
211 **	bl	callee_u32
212 **	ptrue	(p[0-7])\.b, vl256
213 **	uaddv	(d[0-9]+), \1, z0\.s
214 **	fmov	x0, \2
215 **	ldp	x29, x30, \[sp\], 16
216 **	ret
217 */
218 CALLER (u32, __SVUint32_t)
219 
220 /*
221 ** caller_f32:
222 **	...
223 **	bl	callee_f32
224 **	ptrue	(p[0-7])\.b, vl256
225 **	faddv	s0, \1, z0\.s
226 **	ldp	x29, x30, \[sp\], 16
227 **	ret
228 */
229 CALLER (f32, __SVFloat32_t)
230 
231 /*
232 ** caller_s64:
233 **	...
234 **	bl	callee_s64
235 **	ptrue	(p[0-7])\.b, vl256
236 **	uaddv	(d[0-9]+), \1, z0\.d
237 **	fmov	x0, \2
238 **	ldp	x29, x30, \[sp\], 16
239 **	ret
240 */
241 CALLER (s64, __SVInt64_t)
242 
243 /*
244 ** caller_u64:
245 **	...
246 **	bl	callee_u64
247 **	ptrue	(p[0-7])\.b, vl256
248 **	uaddv	(d[0-9]+), \1, z0\.d
249 **	fmov	x0, \2
250 **	ldp	x29, x30, \[sp\], 16
251 **	ret
252 */
253 CALLER (u64, __SVUint64_t)
254 
255 /*
256 ** caller_f64:
257 **	...
258 **	bl	callee_f64
259 **	ptrue	(p[0-7])\.b, vl256
260 **	faddv	d0, \1, z0\.d
261 **	ldp	x29, x30, \[sp\], 16
262 **	ret
263 */
264 CALLER (f64, __SVFloat64_t)
265