Debian Codegraph @

gcc/testsuite/g++.target/aarch64/pr109661-2.C

raw
1 /* { dg-options "-O2 -Wpsabi" } */
2 /* { dg-final { check-function-bodies "**" "" "" } } */
3
4 #include <stdarg.h>
5
6 #define ALIGN __attribute__((aligned(8)))
7
8 typedef __uint128_t u128_4 __attribute__((aligned(4)));
9 typedef __uint128_t u128_8 __attribute__((aligned(8)));
10 typedef __uint128_t u128_16 __attribute__((aligned(16)));
11 typedef __uint128_t u128_32 __attribute__((aligned(32)));
12 typedef __uint128_t u128;
13
14 typedef __UINT64_TYPE__ u64_4 __attribute__((aligned(4)));
15 typedef __UINT64_TYPE__ u64_8 __attribute__((aligned(8)));
16 typedef __UINT64_TYPE__ u64_16 __attribute__((aligned(16)));
17 typedef __UINT64_TYPE__ u64_32 __attribute__((aligned(32)));
18 typedef __UINT64_TYPE__ u64;
19
20 enum class ALIGN e128_4 : u128_4 { A };
21 enum class ALIGN e128_8 : u128_8 { A };
22 enum class ALIGN e128_16 : u128_16 { A };
23 enum class ALIGN e128_32 : u128_32 { A };
24 enum class ALIGN e128 : u128 { A };
25
26 enum class ALIGN e64_4 : u64_4 { A };
27 enum class ALIGN e64_8 : u64_8 { A };
28 enum class ALIGN e64_16 : u64_16 { A };
29 enum class ALIGN e64_32 : u64_32 { A };
30 enum class ALIGN e64 : u64 { A };
31
32 extern "C" {
33
34 /*
35 ** reg_e128_4:
36 ** (
37 ** mov x1, x3
38 ** mov x0, x2
39 ** |
40 ** mov x0, x2
41 ** mov x1, x3
42 ** )
43 ** ret
44 */
45 e128_4 reg_e128_4 (int x, e128_4 y) { return y; } /* { dg-note {parameter passing for argument of type 'e128_4' changed in GCC 14.1} } */
46
47 /*
48 ** reg_e128_8:
49 ** (
50 ** mov x1, x3
51 ** mov x0, x2
52 ** |
53 ** mov x0, x2
54 ** mov x1, x3
55 ** )
56 ** ret
57 */
58 e128_8 reg_e128_8 (int x, e128_8 y) { return y; } /* { dg-note {parameter passing for argument of type 'e128_8' changed in GCC 14.1} } */
59
60 /*
61 ** reg_e128_16:
62 ** (
63 ** mov x1, x3
64 ** mov x0, x2
65 ** |
66 ** mov x0, x2
67 ** mov x1, x3
68 ** )
69 ** ret
70 */
71 e128_16 reg_e128_16 (int x, e128_16 y) { return y; } /* { dg-bogus {parameter passing} } */
72
73 /*
74 ** reg_e128_32:
75 ** (
76 ** mov x1, x3
77 ** mov x0, x2
78 ** |
79 ** mov x0, x2
80 ** mov x1, x3
81 ** )
82 ** ret
83 */
84 e128_32 reg_e128_32 (int x, e128_32 y) { return y; } /* { dg-note {parameter passing for argument of type 'e128_32' changed in GCC 14.1} } */
85
86 /*
87 ** reg_e128:
88 ** (
89 ** mov x1, x3
90 ** mov x0, x2
91 ** |
92 ** mov x0, x2
93 ** mov x1, x3
94 ** )
95 ** ret
96 */
97 e128 reg_e128 (int x, e128 y) { return y; } /* { dg-bogus {parameter passing} } */
98
99 /*
100 ** reg_e64_4:
101 ** mov x0, x1
102 ** ret
103 */
104 e64_4 reg_e64_4 (int x, e64_4 y) { return y; } /* { dg-bogus {parameter passing} } */
105
106 /*
107 ** reg_e64_8:
108 ** mov x0, x1
109 ** ret
110 */
111 e64_8 reg_e64_8 (int x, e64_8 y) { return y; } /* { dg-bogus {parameter passing} } */
112
113 /*
114 ** reg_e64_16:
115 ** mov x0, x1
116 ** ret
117 */
118 e64_16 reg_e64_16 (int x, e64_16 y) { return y; } /* { dg-bogus {parameter passing} } */
119
120 /*
121 ** reg_e64_32:
122 ** mov x0, x1
123 ** ret
124 */
125 e64_32 reg_e64_32 (int x, e64_32 y) { return y; } /* { dg-bogus {parameter passing} } */
126
127 /*
128 ** reg_e64:
129 ** mov x0, x1
130 ** ret
131 */
132 e64 reg_e64 (int x, e64 y) { return y; } /* { dg-bogus {parameter passing} } */
133
134 /*
135 ** stack_e128_4:
136 ** ldp x0, x1, \[sp, #?16\]
137 ** ret
138 */
139 e128_4 stack_e128_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_4 y) { return y; } /* { dg-note {parameter passing for argument of type 'e128_4' changed in GCC 14.1} } */
140
141 /*
142 ** stack_e128_8:
143 ** ldp x0, x1, \[sp, #?16\]
144 ** ret
145 */
146 e128_8 stack_e128_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_8 y) { return y; } /* { dg-note {parameter passing for argument of type 'e128_8' changed in GCC 14.1} } */
147
148 /*
149 ** stack_e128_16:
150 ** ldp x0, x1, \[sp, #?16\]
151 ** ret
152 */
153 e128_16 stack_e128_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_16 y) { return y; } /* { dg-bogus {parameter passing} } */
154
155 /*
156 ** stack_e128_32:
157 ** ldp x0, x1, \[sp, #?16\]
158 ** ret
159 */
160 e128_32 stack_e128_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128_32 y) { return y; } /* { dg-bogus {parameter passing} } */
161
162 /*
163 ** stack_e128:
164 ** ldp x0, x1, \[sp, #?16\]
165 ** ret
166 */
167 e128 stack_e128 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e128 y) { return y; } /* { dg-bogus {parameter passing} } */
168
169 /*
170 ** stack_e64_4:
171 ** ldr x0, \[sp, #?8\]
172 ** ret
173 */
174 e64_4 stack_e64_4 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_4 y) { return y; } /* { dg-bogus {parameter passing} } */
175
176 /*
177 ** stack_e64_8:
178 ** ldr x0, \[sp, #?8\]
179 ** ret
180 */
181 e64_8 stack_e64_8 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_8 y) { return y; } /* { dg-bogus {parameter passing} } */
182
183 /*
184 ** stack_e64_16:
185 ** ldr x0, \[sp, #?8\]
186 ** ret
187 */
188 e64_16 stack_e64_16 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_16 y) { return y; } /* { dg-note {parameter passing for argument of type 'e64_16' changed in GCC 14.1} } */
189
190 /*
191 ** stack_e64_32:
192 ** ldr x0, \[sp, #?8\]
193 ** ret
194 */
195 e64_32 stack_e64_32 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64_32 y) { return y; } /* { dg-note {parameter passing for argument of type 'e64_32' changed in GCC 14.1} } */
196
197 /*
198 ** stack_e64:
199 ** ldr x0, \[sp, #?8\]
200 ** ret
201 */
202 e64 stack_e64 (u128 x0, u128 x2, u128 x4, u128 x6, int x, e64 y) { return y; } /* { dg-bogus {parameter passing} } */
203
204 void callee (int n, ...);
205
206 void
207 caller ()
208 {
209 callee (1, e128_4::A); /* { dg-note {parameter passing for argument of type 'e128_4' changed in GCC 14.1} } */
210 callee (1, e128_8::A); /* { dg-note {parameter passing for argument of type 'e128_8' changed in GCC 14.1} } */
211 callee (1, e128_16::A); /* { dg-bogus {parameter passing} } */
212 callee (1, e128_32::A); /* { dg-note {parameter passing for argument of type 'e128_32' changed in GCC 14.1} } */
213 callee (1, e128::A); /* { dg-bogus {parameter passing} } */
214
215 callee (1, e64_4::A); /* { dg-bogus {parameter passing} } */
216 callee (1, e64_8::A); /* { dg-bogus {parameter passing} } */
217 callee (1, e64_16::A); /* { dg-bogus {parameter passing} } */
218 callee (1, e64_32::A); /* { dg-bogus {parameter passing} } */
219 callee (1, e64::A); /* { dg-bogus {parameter passing} } */
220
221 #define LOTS 1, 2, 3, 4, 5, 6, 7, 8, 9
222
223 callee (LOTS, e128_4::A); /* { dg-note {parameter passing for argument of type 'e128_4' changed in GCC 14.1} } */
224 callee (LOTS, e128_8::A); /* { dg-note {parameter passing for argument of type 'e128_8' changed in GCC 14.1} } */
225 callee (LOTS, e128_16::A); /* { dg-bogus {parameter passing} } */
226 callee (LOTS, e128_32::A); /* { dg-bogus {parameter passing} } */
227 callee (LOTS, e128::A); /* { dg-bogus {parameter passing} } */
228
229 callee (LOTS, e64_4::A); /* { dg-bogus {parameter passing} } */
230 callee (LOTS, e64_8::A); /* { dg-bogus {parameter passing} } */
231 callee (LOTS, e64_16::A); /* { dg-note {parameter passing for argument of type 'e64_16' changed in GCC 14.1} } */
232 callee (LOTS, e64_32::A); /* { dg-note {parameter passing for argument of type 'e64_32' changed in GCC 14.1} } */
233 callee (LOTS, e64::A); /* { dg-bogus {parameter passing} } */
234 }
235
236 void
237 va (volatile void *ptr, ...)
238 {
239 va_list ap;
240 va_start (ap, ptr);
241 *(volatile e128_4 *) ptr = va_arg (ap, e128_4); /* { dg-note {parameter passing for argument of type 'e128_4' changed in GCC 14.1} } */
242 *(volatile e128_8 *) ptr = va_arg (ap, e128_8); /* { dg-note {parameter passing for argument of type 'e128_8' changed in GCC 14.1} } */
243 *(volatile e128_16 *) ptr = va_arg (ap, e128_16); /* { dg-bogus {parameter passing} } */
244 *(volatile e128_32 *) ptr = va_arg (ap, e128_32); /* { dg-bogus {parameter passing} } */
245 *(volatile e128 *) ptr = va_arg (ap, e128); /* { dg-bogus {parameter passing} } */
246 *(volatile e64_4 *) ptr = va_arg (ap, e64_4); /* { dg-bogus {parameter passing} } */
247 *(volatile e64_8 *) ptr = va_arg (ap, e64_8); /* { dg-bogus {parameter passing} } */
248 *(volatile e64_16 *) ptr = va_arg (ap, e64_16); /* { dg-note {parameter passing for argument of type 'e64_16' changed in GCC 14.1} } */
249 *(volatile e64_32 *) ptr = va_arg (ap, e64_32); /* { dg-note {parameter passing for argument of type 'e64_32' changed in GCC 14.1} } */
250 *(volatile e64 *) ptr = va_arg (ap, e64); /* { dg-bogus {parameter passing} } */
251 }
252
253 }