1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --filter "^define |^entry:" --version 2
2 // RUN: %clang_cc1 -triple riscv32 -emit-llvm %s -o - \
3 // RUN: | FileCheck -check-prefixes=ILP32-ILP32F-ILP32D,ILP32-ILP32F,ILP32 %s
4 // RUN: %clang_cc1 -triple riscv32 -target-feature +f -target-abi ilp32f -emit-llvm %s -o - \
5 // RUN: | FileCheck -check-prefixes=ILP32-ILP32F-ILP32D,ILP32F-ILP32D,ILP32-ILP32F,ILP32F %s
6 // RUN: %clang_cc1 -triple riscv32 -target-feature +f -target-feature +d -target-abi ilp32d -emit-llvm %s -o - \
7 // RUN: | FileCheck -check-prefixes=ILP32-ILP32F-ILP32D,ILP32F-ILP32D,ILP32D %s
8 // RUN: %clang_cc1 -triple riscv32 -emit-llvm -target-abi ilp32e %s -o - \
9 // RUN: | FileCheck -check-prefixes=ILP32-ILP32F-ILP32D,ILP32-ILP32F,ILP32,ILP32E %s
14 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_void
15 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0:[0-9]+]] {
16 // ILP32-ILP32F-ILP32D: entry:
20 // Scalar arguments and return values smaller than the word size are extended
21 // according to the sign of their type, up to 32 bits
23 // ILP32-ILP32F-ILP32D-LABEL: define dso_local zeroext i1 @f_scalar_0
24 // ILP32-ILP32F-ILP32D-SAME: (i1 noundef zeroext [[X:%.*]]) #[[ATTR0]] {
25 // ILP32-ILP32F-ILP32D: entry:
27 _Bool
f_scalar_0(_Bool x
) { return x
; }
29 // ILP32-ILP32F-ILP32D-LABEL: define dso_local signext i8 @f_scalar_1
30 // ILP32-ILP32F-ILP32D-SAME: (i8 noundef signext [[X:%.*]]) #[[ATTR0]] {
31 // ILP32-ILP32F-ILP32D: entry:
33 int8_t f_scalar_1(int8_t x
) { return x
; }
35 // ILP32-ILP32F-ILP32D-LABEL: define dso_local zeroext i8 @f_scalar_2
36 // ILP32-ILP32F-ILP32D-SAME: (i8 noundef zeroext [[X:%.*]]) #[[ATTR0]] {
37 // ILP32-ILP32F-ILP32D: entry:
39 uint8_t f_scalar_2(uint8_t x
) { return x
; }
41 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_scalar_3
42 // ILP32-ILP32F-ILP32D-SAME: (i32 noundef [[X:%.*]]) #[[ATTR0]] {
43 // ILP32-ILP32F-ILP32D: entry:
45 int32_t f_scalar_3(int32_t x
) { return x
; }
47 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i64 @f_scalar_4
48 // ILP32-ILP32F-ILP32D-SAME: (i64 noundef [[X:%.*]]) #[[ATTR0]] {
49 // ILP32-ILP32F-ILP32D: entry:
51 int64_t f_scalar_4(int64_t x
) { return x
; }
53 // ILP32-ILP32F-ILP32D-LABEL: define dso_local float @f_fp_scalar_1
54 // ILP32-ILP32F-ILP32D-SAME: (float noundef [[X:%.*]]) #[[ATTR0]] {
55 // ILP32-ILP32F-ILP32D: entry:
57 float f_fp_scalar_1(float x
) { return x
; }
59 // ILP32-ILP32F-ILP32D-LABEL: define dso_local double @f_fp_scalar_2
60 // ILP32-ILP32F-ILP32D-SAME: (double noundef [[X:%.*]]) #[[ATTR0]] {
61 // ILP32-ILP32F-ILP32D: entry:
63 double f_fp_scalar_2(double x
) { return x
; }
65 // Scalars larger than 2*xlen are passed/returned indirect. However, the
66 // RISC-V LLVM backend can handle this fine, so the function doesn't need to
69 // ILP32-ILP32F-ILP32D-LABEL: define dso_local fp128 @f_fp_scalar_3
70 // ILP32-ILP32F-ILP32D-SAME: (fp128 noundef [[X:%.*]]) #[[ATTR0]] {
71 // ILP32-ILP32F-ILP32D: entry:
73 long double f_fp_scalar_3(long double x
) { return x
; }
75 // ILP32-ILP32F-ILP32D-LABEL: define dso_local half @f_fp_scalar_4
76 // ILP32-ILP32F-ILP32D-SAME: (half noundef [[X:%.*]]) #[[ATTR0]] {
77 // ILP32-ILP32F-ILP32D: entry:
79 _Float16
f_fp_scalar_4(_Float16 x
) { return x
; }
81 // Empty structs or unions are ignored.
85 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_agg_empty_struct
86 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
87 // ILP32-ILP32F-ILP32D: entry:
89 struct empty_s
f_agg_empty_struct(struct empty_s x
) {
95 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_agg_empty_union
96 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
97 // ILP32-ILP32F-ILP32D: entry:
99 union empty_u
f_agg_empty_union(union empty_u x
) {
103 // Aggregates <= 2*xlen may be passed in registers, so will be coerced to
104 // integer arguments. The rules for return are the same.
110 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_agg_tiny
111 // ILP32-ILP32F-ILP32D-SAME: (i32 [[X_COERCE:%.*]]) #[[ATTR0]] {
112 // ILP32-ILP32F-ILP32D: entry:
114 void f_agg_tiny(struct tiny x
) {
119 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_agg_tiny_ret
120 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
121 // ILP32-ILP32F-ILP32D: entry:
123 struct tiny
f_agg_tiny_ret(void) {
124 return (struct tiny
){1, 2, 3, 4};
127 typedef uint8_t v4i8
__attribute__((vector_size(4)));
128 typedef int32_t v1i32
__attribute__((vector_size(4)));
130 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_vec_tiny_v4i8
131 // ILP32-ILP32F-ILP32D-SAME: (i32 noundef [[X_COERCE:%.*]]) #[[ATTR0]] {
132 // ILP32-ILP32F-ILP32D: entry:
134 void f_vec_tiny_v4i8(v4i8 x
) {
139 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_vec_tiny_v4i8_ret
140 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
141 // ILP32-ILP32F-ILP32D: entry:
143 v4i8
f_vec_tiny_v4i8_ret(void) {
144 return (v4i8
){1, 2, 3, 4};
147 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_vec_tiny_v1i32
148 // ILP32-ILP32F-ILP32D-SAME: (i32 noundef [[X_COERCE:%.*]]) #[[ATTR0]] {
149 // ILP32-ILP32F-ILP32D: entry:
151 void f_vec_tiny_v1i32(v1i32 x
) {
155 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_vec_tiny_v1i32_ret
156 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
157 // ILP32-ILP32F-ILP32D: entry:
159 v1i32
f_vec_tiny_v1i32_ret(void) {
167 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_agg_small
168 // ILP32-ILP32F-ILP32D-SAME: ([2 x i32] [[X_COERCE:%.*]]) #[[ATTR0]] {
169 // ILP32-ILP32F-ILP32D: entry:
171 void f_agg_small(struct small x
) {
176 // ILP32-ILP32F-ILP32D-LABEL: define dso_local [2 x i32] @f_agg_small_ret
177 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
178 // ILP32-ILP32F-ILP32D: entry:
180 struct small
f_agg_small_ret(void) {
181 return (struct small
){1, 0};
184 typedef uint8_t v8i8
__attribute__((vector_size(8)));
185 typedef int64_t v1i64
__attribute__((vector_size(8)));
187 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_vec_small_v8i8
188 // ILP32-ILP32F-ILP32D-SAME: (i64 noundef [[X_COERCE:%.*]]) #[[ATTR0]] {
189 // ILP32-ILP32F-ILP32D: entry:
191 void f_vec_small_v8i8(v8i8 x
) {
195 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i64 @f_vec_small_v8i8_ret
196 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
197 // ILP32-ILP32F-ILP32D: entry:
199 v8i8
f_vec_small_v8i8_ret(void) {
200 return (v8i8
){1, 2, 3, 4, 5, 6, 7, 8};
203 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_vec_small_v1i64
204 // ILP32-ILP32F-ILP32D-SAME: (i64 noundef [[X_COERCE:%.*]]) #[[ATTR0]] {
205 // ILP32-ILP32F-ILP32D: entry:
207 void f_vec_small_v1i64(v1i64 x
) {
211 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i64 @f_vec_small_v1i64_ret
212 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
213 // ILP32-ILP32F-ILP32D: entry:
215 v1i64
f_vec_small_v1i64_ret(void) {
219 // Aggregates of 2*xlen size and 2*xlen alignment should be coerced to a
220 // single 2*xlen-sized argument, to ensure that alignment can be maintained if
221 // passed on the stack.
223 struct small_aligned
{
227 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_agg_small_aligned
228 // ILP32-ILP32F-ILP32D-SAME: (i64 [[X_COERCE:%.*]]) #[[ATTR0]] {
229 // ILP32-ILP32F-ILP32D: entry:
231 void f_agg_small_aligned(struct small_aligned x
) {
235 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i64 @f_agg_small_aligned_ret
236 // ILP32-ILP32F-ILP32D-SAME: (i64 [[X_COERCE:%.*]]) #[[ATTR0]] {
237 // ILP32-ILP32F-ILP32D: entry:
239 struct small_aligned
f_agg_small_aligned_ret(struct small_aligned x
) {
240 return (struct small_aligned
){10};
243 // Aggregates greater > 2*xlen will be passed and returned indirectly
248 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_agg_large
249 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[X:%.*]]) #[[ATTR0]] {
250 // ILP32-ILP32F-ILP32D: entry:
252 void f_agg_large(struct large x
) {
253 x
.a
= x
.b
+ x
.c
+ x
.d
;
256 // The address where the struct should be written to will be the first
258 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_agg_large_ret
259 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_LARGE:%.*]]) align 4 [[AGG_RESULT:%.*]], i32 noundef [[I:%.*]], i8 noundef signext [[J:%.*]]) #[[ATTR0]] {
260 // ILP32-ILP32F-ILP32D: entry:
262 struct large
f_agg_large_ret(int32_t i
, int8_t j
) {
263 return (struct large
){1, 2, 3, 4};
266 typedef unsigned char v16i8
__attribute__((vector_size(16)));
268 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_vec_large_v16i8
269 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[TMP0:%.*]]) #[[ATTR0]] {
270 // ILP32-ILP32F-ILP32D: entry:
272 void f_vec_large_v16i8(v16i8 x
) {
276 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_vec_large_v16i8_ret
277 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret(<16 x i8>) align 16 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
278 // ILP32-ILP32F-ILP32D: entry:
280 v16i8
f_vec_large_v16i8_ret(void) {
281 return (v16i8
){1, 2, 3, 4, 5, 6, 7, 8};
284 // Scalars passed on the stack should have signext/zeroext attributes, just as
285 // if they were passed in registers.
287 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_scalar_stack_1
288 // ILP32-ILP32F-ILP32D-SAME: (i32 [[A_COERCE:%.*]], [2 x i32] [[B_COERCE:%.*]], i64 [[C_COERCE:%.*]], ptr noundef [[D:%.*]], i8 noundef zeroext [[E:%.*]], i8 noundef signext [[F:%.*]], i8 noundef zeroext [[G:%.*]], i8 noundef signext [[H:%.*]]) #[[ATTR0]] {
289 // ILP32-ILP32F-ILP32D: entry:
291 int f_scalar_stack_1(struct tiny a
, struct small b
, struct small_aligned c
,
292 struct large d
, uint8_t e
, int8_t f
, uint8_t g
, int8_t h
) {
296 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_scalar_stack_2
297 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_LARGE:%.*]]) align 4 [[AGG_RESULT:%.*]], i32 noundef [[A:%.*]], i64 noundef [[B:%.*]], i64 noundef [[C:%.*]], fp128 noundef [[D:%.*]], i8 noundef zeroext [[E:%.*]], i8 noundef signext [[F:%.*]], i8 noundef zeroext [[G:%.*]]) #[[ATTR0]] {
298 // ILP32-ILP32F-ILP32D: entry:
300 struct large
f_scalar_stack_2(int32_t a
, int64_t b
, int64_t c
, long double d
,
301 uint8_t e
, int8_t f
, uint8_t g
) {
302 return (struct large
){a
, e
, f
, g
};
305 // ILP32-ILP32F-ILP32D-LABEL: define dso_local fp128 @f_scalar_stack_3
306 // ILP32-ILP32F-ILP32D-SAME: (i32 noundef [[A:%.*]], i64 noundef [[B:%.*]], i64 noundef [[C:%.*]], fp128 noundef [[D:%.*]], i8 noundef zeroext [[E:%.*]], i8 noundef signext [[F:%.*]], i8 noundef zeroext [[G:%.*]]) #[[ATTR0]] {
307 // ILP32-ILP32F-ILP32D: entry:
309 long double f_scalar_stack_3(int32_t a
, int64_t b
, int64_t c
, long double d
,
310 uint8_t e
, int8_t f
, uint8_t g
) {
314 // Aggregates and >=XLen scalars passed on the stack should be lowered just as
315 // they would be if passed via registers.
317 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_scalar_stack_4
318 // ILP32-ILP32F-ILP32D-SAME: (double noundef [[A:%.*]], i64 noundef [[B:%.*]], double noundef [[C:%.*]], i64 noundef [[D:%.*]], i32 noundef [[E:%.*]], i64 noundef [[F:%.*]], float noundef [[G:%.*]], double noundef [[H:%.*]], fp128 noundef [[I:%.*]]) #[[ATTR0]] {
319 // ILP32-ILP32F-ILP32D: entry:
321 void f_scalar_stack_4(double a
, int64_t b
, double c
, int64_t d
, int e
,
322 int64_t f
, float g
, double h
, long double i
) {}
324 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_scalar_stack_5
325 // ILP32-ILP32F-ILP32D-SAME: (i32 noundef [[A:%.*]], i64 noundef [[B:%.*]], float noundef [[C:%.*]], double noundef [[D:%.*]], fp128 noundef [[E:%.*]], i8 noundef zeroext [[F:%.*]], i8 noundef signext [[G:%.*]], i8 noundef zeroext [[H:%.*]], half noundef [[I:%.*]]) #[[ATTR0]] {
326 // ILP32-ILP32F-ILP32D: entry:
328 int f_scalar_stack_5(int32_t a
, int64_t b
, float c
, double d
, long double e
,
329 uint8_t f
, int8_t g
, uint8_t h
, _Float16 i
) {
333 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_scalar_stack_6
334 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_LARGE:%.*]]) align 4 [[AGG_RESULT:%.*]], float noundef [[A:%.*]], i64 noundef [[B:%.*]], double noundef [[C:%.*]], fp128 noundef [[D:%.*]], i8 noundef zeroext [[E:%.*]], i8 noundef signext [[F:%.*]], i8 noundef zeroext [[G:%.*]]) #[[ATTR0]] {
335 // ILP32-ILP32F-ILP32D: entry:
337 struct large
f_scalar_stack_6(float a
, int64_t b
, double c
, long double d
,
338 uint8_t e
, int8_t f
, uint8_t g
) {
339 return (struct large
){a
, e
, f
, g
};
342 // Aggregates and >=XLen scalars passed on the stack should be lowered just as
343 // they would be if passed via registers.
345 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_agg_stack
346 // ILP32-ILP32F-ILP32D-SAME: (double noundef [[A:%.*]], i64 noundef [[B:%.*]], double noundef [[C:%.*]], i64 noundef [[D:%.*]], i32 [[E_COERCE:%.*]], [2 x i32] [[F_COERCE:%.*]], i64 [[G_COERCE:%.*]], ptr noundef [[H:%.*]]) #[[ATTR0]] {
347 // ILP32-ILP32F-ILP32D: entry:
349 void f_agg_stack(double a
, int64_t b
, double c
, int64_t d
, struct tiny e
,
350 struct small f
, struct small_aligned g
, struct large h
) {}
352 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_fpr_tracking
353 // ILP32-ILP32F-ILP32D-SAME: (double noundef [[A:%.*]], double noundef [[B:%.*]], double noundef [[C:%.*]], double noundef [[D:%.*]], i8 noundef signext [[E:%.*]]) #[[ATTR0]] {
354 // ILP32-ILP32F-ILP32D: entry:
356 void f_fpr_tracking(double a
, double b
, double c
, double d
, int8_t e
) {}
358 // Lowering for doubles is unnmodified, as 64 > FLEN.
360 struct double_s
{ double d
; };
362 struct double_double_s
{ double d
; double e
; };
364 struct double_int8_s
{ double d
; int64_t i
; };
366 struct int_double_s
{ int a
; double b
; };
368 // ILP32-ILP32F-LABEL: define dso_local void @f_int_double_s_arg
369 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
370 // ILP32-ILP32F: entry:
372 // ILP32D-LABEL: define dso_local void @f_int_double_s_arg
373 // ILP32D-SAME: (i32 [[TMP0:%.*]], double [[TMP1:%.*]]) #[[ATTR0]] {
376 void f_int_double_s_arg(struct int_double_s a
) {}
378 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_int_double_s
379 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_INT_DOUBLE_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
380 // ILP32-ILP32F: entry:
382 // ILP32D-LABEL: define dso_local { i32, double } @f_ret_int_double_s
383 // ILP32D-SAME: () #[[ATTR0]] {
386 struct int_double_s
f_ret_int_double_s(void) {
387 return (struct int_double_s
){1, 2.0};
390 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_fpr_tracking2
391 // ILP32-ILP32F-ILP32D-SAME: (double noundef [[A:%.*]], double noundef [[B:%.*]], double noundef [[C:%.*]], double noundef [[D:%.*]], double noundef [[E:%.*]], double noundef [[F:%.*]], double noundef [[G:%.*]], double noundef [[H:%.*]], i8 noundef zeroext [[I:%.*]]) #[[ATTR0]] {
392 // ILP32-ILP32F-ILP32D: entry:
394 void f_fpr_tracking2(double a
, double b
, double c
, double d
, double e
, double f
,
395 double g
, double h
, uint8_t i
) {}
397 // Check that fp, fp+fp, and int+fp structs are lowered correctly. These will
398 // be passed in FPR, FPR+FPR, or GPR+FPR regs if sufficient registers are
399 // available the widths are <= XLEN and FLEN, and should be expanded to
400 // separate arguments in IR. They are passed by the same rules for returns,
401 // but will be lowered to simple two-element structs if necessary (as LLVM IR
402 // functions cannot return multiple values).
404 // A struct containing just one floating-point real is passed as though it
405 // were a standalone floating-point real.
407 // ILP32-ILP32F-LABEL: define dso_local void @f_double_s_arg
408 // ILP32-ILP32F-SAME: (i64 [[A_COERCE:%.*]]) #[[ATTR0]] {
409 // ILP32-ILP32F: entry:
411 // ILP32D-LABEL: define dso_local void @f_double_s_arg
412 // ILP32D-SAME: (double [[TMP0:%.*]]) #[[ATTR0]] {
415 void f_double_s_arg(struct double_s a
) {}
417 // ILP32-ILP32F-LABEL: define dso_local i64 @f_ret_double_s
418 // ILP32-ILP32F-SAME: () #[[ATTR0]] {
419 // ILP32-ILP32F: entry:
421 // ILP32D-LABEL: define dso_local double @f_ret_double_s
422 // ILP32D-SAME: () #[[ATTR0]] {
425 struct double_s
f_ret_double_s(void) {
426 return (struct double_s
){1.0};
429 // A struct containing a double and any number of zero-width bitfields is
430 // passed as though it were a standalone floating-point real.
432 struct zbf_double_s
{ int : 0; double f
; };
433 struct zbf_double_zbf_s
{ int : 0; double f
; int : 0; };
435 // ILP32-ILP32F-LABEL: define dso_local void @f_zbf_double_s_arg
436 // ILP32-ILP32F-SAME: (i64 [[A_COERCE:%.*]]) #[[ATTR0]] {
437 // ILP32-ILP32F: entry:
439 // ILP32D-LABEL: define dso_local void @f_zbf_double_s_arg
440 // ILP32D-SAME: (double [[TMP0:%.*]]) #[[ATTR0]] {
443 void f_zbf_double_s_arg(struct zbf_double_s a
) {}
445 // ILP32-ILP32F-LABEL: define dso_local i64 @f_ret_zbf_double_s
446 // ILP32-ILP32F-SAME: () #[[ATTR0]] {
447 // ILP32-ILP32F: entry:
449 // ILP32D-LABEL: define dso_local double @f_ret_zbf_double_s
450 // ILP32D-SAME: () #[[ATTR0]] {
453 struct zbf_double_s
f_ret_zbf_double_s(void) {
454 return (struct zbf_double_s
){1.0};
457 // ILP32-ILP32F-LABEL: define dso_local void @f_zbf_double_zbf_s_arg
458 // ILP32-ILP32F-SAME: (i64 [[A_COERCE:%.*]]) #[[ATTR0]] {
459 // ILP32-ILP32F: entry:
461 // ILP32D-LABEL: define dso_local void @f_zbf_double_zbf_s_arg
462 // ILP32D-SAME: (double [[TMP0:%.*]]) #[[ATTR0]] {
465 void f_zbf_double_zbf_s_arg(struct zbf_double_zbf_s a
) {}
467 // ILP32-ILP32F-LABEL: define dso_local i64 @f_ret_zbf_double_zbf_s
468 // ILP32-ILP32F-SAME: () #[[ATTR0]] {
469 // ILP32-ILP32F: entry:
471 // ILP32D-LABEL: define dso_local double @f_ret_zbf_double_zbf_s
472 // ILP32D-SAME: () #[[ATTR0]] {
475 struct zbf_double_zbf_s
f_ret_zbf_double_zbf_s(void) {
476 return (struct zbf_double_zbf_s
){1.0};
479 // Check that structs containing two floating point values (FLEN <= width) are
480 // expanded provided sufficient FPRs are available.
482 struct double_float_s
{ double f
; float g
; };
484 // ILP32-ILP32F-LABEL: define dso_local void @f_double_double_s_arg
485 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
486 // ILP32-ILP32F: entry:
488 // ILP32D-LABEL: define dso_local void @f_double_double_s_arg
489 // ILP32D-SAME: (double [[TMP0:%.*]], double [[TMP1:%.*]]) #[[ATTR0]] {
492 void f_double_double_s_arg(struct double_double_s a
) {}
494 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_double_s
495 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_DOUBLE_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
496 // ILP32-ILP32F: entry:
498 // ILP32D-LABEL: define dso_local { double, double } @f_ret_double_double_s
499 // ILP32D-SAME: () #[[ATTR0]] {
502 struct double_double_s
f_ret_double_double_s(void) {
503 return (struct double_double_s
){1.0, 2.0};
506 // ILP32-ILP32F-LABEL: define dso_local void @f_double_float_s_arg
507 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
508 // ILP32-ILP32F: entry:
510 // ILP32D-LABEL: define dso_local void @f_double_float_s_arg
511 // ILP32D-SAME: (double [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0]] {
514 void f_double_float_s_arg(struct double_float_s a
) {}
516 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_float_s
517 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_FLOAT_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
518 // ILP32-ILP32F: entry:
520 // ILP32D-LABEL: define dso_local { double, float } @f_ret_double_float_s
521 // ILP32D-SAME: () #[[ATTR0]] {
524 struct double_float_s
f_ret_double_float_s(void) {
525 return (struct double_float_s
){1.0, 2.0};
528 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_double_double_s_arg_insufficient_fprs
529 // ILP32-ILP32F-ILP32D-SAME: (float noundef [[A:%.*]], double noundef [[B:%.*]], double noundef [[C:%.*]], double noundef [[D:%.*]], double noundef [[E:%.*]], double noundef [[F:%.*]], double noundef [[G:%.*]], ptr noundef [[H:%.*]]) #[[ATTR0]] {
530 // ILP32-ILP32F-ILP32D: entry:
532 void f_double_double_s_arg_insufficient_fprs(float a
, double b
, double c
, double d
,
533 double e
, double f
, double g
, struct double_double_s h
) {}
535 // Check that structs containing int+double values are expanded, provided
536 // sufficient FPRs and GPRs are available. The integer components are neither
537 // sign or zero-extended.
539 struct double_uint8_s
{ double d
; uint8_t i
; };
540 struct double_int32_s
{ double d
; int32_t i
; };
541 struct double_int64_s
{ double d
; int64_t i
; };
542 struct double_int64bf_s
{ double d
; int64_t i
: 32; };
543 struct double_int8_zbf_s
{ double d
; int8_t i
; int : 0; };
545 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_double_int8_s_arg
546 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
547 // ILP32-ILP32F-ILP32D: entry:
549 void f_double_int8_s_arg(struct double_int8_s a
) {}
551 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_double_int8_s
552 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_INT8_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
553 // ILP32-ILP32F-ILP32D: entry:
555 struct double_int8_s
f_ret_double_int8_s(void) {
556 return (struct double_int8_s
){1.0, 2};
559 // ILP32-ILP32F-LABEL: define dso_local void @f_double_uint8_s_arg
560 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
561 // ILP32-ILP32F: entry:
563 // ILP32D-LABEL: define dso_local void @f_double_uint8_s_arg
564 // ILP32D-SAME: (double [[TMP0:%.*]], i8 [[TMP1:%.*]]) #[[ATTR0]] {
567 void f_double_uint8_s_arg(struct double_uint8_s a
) {}
569 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_uint8_s
570 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_UINT8_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
571 // ILP32-ILP32F: entry:
573 // ILP32D-LABEL: define dso_local { double, i8 } @f_ret_double_uint8_s
574 // ILP32D-SAME: () #[[ATTR0]] {
577 struct double_uint8_s
f_ret_double_uint8_s(void) {
578 return (struct double_uint8_s
){1.0, 2};
581 // ILP32-ILP32F-LABEL: define dso_local void @f_double_int32_s_arg
582 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
583 // ILP32-ILP32F: entry:
585 // ILP32D-LABEL: define dso_local void @f_double_int32_s_arg
586 // ILP32D-SAME: (double [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
589 void f_double_int32_s_arg(struct double_int32_s a
) {}
591 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_int32_s
592 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_INT32_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
593 // ILP32-ILP32F: entry:
595 // ILP32D-LABEL: define dso_local { double, i32 } @f_ret_double_int32_s
596 // ILP32D-SAME: () #[[ATTR0]] {
599 struct double_int32_s
f_ret_double_int32_s(void) {
600 return (struct double_int32_s
){1.0, 2};
603 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_double_int64_s_arg
604 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
605 // ILP32-ILP32F-ILP32D: entry:
607 void f_double_int64_s_arg(struct double_int64_s a
) {}
609 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_double_int64_s
610 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_INT64_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
611 // ILP32-ILP32F-ILP32D: entry:
613 struct double_int64_s
f_ret_double_int64_s(void) {
614 return (struct double_int64_s
){1.0, 2};
617 // ILP32-ILP32F-LABEL: define dso_local void @f_double_int64bf_s_arg
618 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
619 // ILP32-ILP32F: entry:
621 // ILP32D-LABEL: define dso_local void @f_double_int64bf_s_arg
622 // ILP32D-SAME: (double [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
625 void f_double_int64bf_s_arg(struct double_int64bf_s a
) {}
627 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_int64bf_s
628 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_INT64BF_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
629 // ILP32-ILP32F: entry:
631 // ILP32D-LABEL: define dso_local { double, i32 } @f_ret_double_int64bf_s
632 // ILP32D-SAME: () #[[ATTR0]] {
635 struct double_int64bf_s
f_ret_double_int64bf_s(void) {
636 return (struct double_int64bf_s
){1.0, 2};
639 // The zero-width bitfield means the struct can't be passed according to the
640 // floating point calling convention.
642 // ILP32-ILP32F-LABEL: define dso_local void @f_double_int8_zbf_s
643 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
644 // ILP32-ILP32F: entry:
646 // ILP32D-LABEL: define dso_local void @f_double_int8_zbf_s
647 // ILP32D-SAME: (double [[TMP0:%.*]], i8 [[TMP1:%.*]]) #[[ATTR0]] {
650 void f_double_int8_zbf_s(struct double_int8_zbf_s a
) {}
652 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_int8_zbf_s
653 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_INT8_ZBF_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
654 // ILP32-ILP32F: entry:
656 // ILP32D-LABEL: define dso_local { double, i8 } @f_ret_double_int8_zbf_s
657 // ILP32D-SAME: () #[[ATTR0]] {
660 struct double_int8_zbf_s
f_ret_double_int8_zbf_s(void) {
661 return (struct double_int8_zbf_s
){1.0, 2};
664 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_double_int8_s_arg_insufficient_gprs
665 // ILP32-ILP32F-ILP32D-SAME: (i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], i32 noundef [[H:%.*]], ptr noundef [[I:%.*]]) #[[ATTR0]] {
666 // ILP32-ILP32F-ILP32D: entry:
668 void f_double_int8_s_arg_insufficient_gprs(int a
, int b
, int c
, int d
, int e
,
669 int f
, int g
, int h
, struct double_int8_s i
) {}
671 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_struct_double_int8_insufficient_fprs
672 // ILP32-ILP32F-ILP32D-SAME: (float noundef [[A:%.*]], double noundef [[B:%.*]], double noundef [[C:%.*]], double noundef [[D:%.*]], double noundef [[E:%.*]], double noundef [[F:%.*]], double noundef [[G:%.*]], double noundef [[H:%.*]], ptr noundef [[I:%.*]]) #[[ATTR0]] {
673 // ILP32-ILP32F-ILP32D: entry:
675 void f_struct_double_int8_insufficient_fprs(float a
, double b
, double c
, double d
,
676 double e
, double f
, double g
, double h
, struct double_int8_s i
) {}
678 // Complex floating-point values or structs containing a single complex
679 // floating-point value should be passed as if it were an fp+fp struct.
681 // ILP32-ILP32F-LABEL: define dso_local void @f_doublecomplex
682 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
683 // ILP32-ILP32F: entry:
685 // ILP32D-LABEL: define dso_local void @f_doublecomplex
686 // ILP32D-SAME: (double noundef [[A_COERCE0:%.*]], double noundef [[A_COERCE1:%.*]]) #[[ATTR0]] {
689 void f_doublecomplex(double __complex__ a
) {}
691 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_doublecomplex
692 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret({ double, double }) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
693 // ILP32-ILP32F: entry:
695 // ILP32D-LABEL: define dso_local { double, double } @f_ret_doublecomplex
696 // ILP32D-SAME: () #[[ATTR0]] {
699 double __complex__
f_ret_doublecomplex(void) {
703 struct doublecomplex_s
{ double __complex__ c
; };
705 // ILP32-ILP32F-LABEL: define dso_local void @f_doublecomplex_s_arg
706 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
707 // ILP32-ILP32F: entry:
709 // ILP32D-LABEL: define dso_local void @f_doublecomplex_s_arg
710 // ILP32D-SAME: (double [[TMP0:%.*]], double [[TMP1:%.*]]) #[[ATTR0]] {
713 void f_doublecomplex_s_arg(struct doublecomplex_s a
) {}
715 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_doublecomplex_s
716 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLECOMPLEX_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
717 // ILP32-ILP32F: entry:
719 // ILP32D-LABEL: define dso_local { double, double } @f_ret_doublecomplex_s
720 // ILP32D-SAME: () #[[ATTR0]] {
723 struct doublecomplex_s
f_ret_doublecomplex_s(void) {
724 return (struct doublecomplex_s
){1.0};
727 // Test single or two-element structs that need flattening. e.g. those
728 // containing nested structs, doubles in small arrays, zero-length structs etc.
730 struct doublearr1_s
{ double a
[1]; };
732 // ILP32-ILP32F-LABEL: define dso_local void @f_doublearr1_s_arg
733 // ILP32-ILP32F-SAME: (i64 [[A_COERCE:%.*]]) #[[ATTR0]] {
734 // ILP32-ILP32F: entry:
736 // ILP32D-LABEL: define dso_local void @f_doublearr1_s_arg
737 // ILP32D-SAME: (double [[TMP0:%.*]]) #[[ATTR0]] {
740 void f_doublearr1_s_arg(struct doublearr1_s a
) {}
742 // ILP32-ILP32F-LABEL: define dso_local i64 @f_ret_doublearr1_s
743 // ILP32-ILP32F-SAME: () #[[ATTR0]] {
744 // ILP32-ILP32F: entry:
746 // ILP32D-LABEL: define dso_local double @f_ret_doublearr1_s
747 // ILP32D-SAME: () #[[ATTR0]] {
750 struct doublearr1_s
f_ret_doublearr1_s(void) {
751 return (struct doublearr1_s
){{1.0}};
754 struct doublearr2_s
{ double a
[2]; };
756 // ILP32-ILP32F-LABEL: define dso_local void @f_doublearr2_s_arg
757 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
758 // ILP32-ILP32F: entry:
760 // ILP32D-LABEL: define dso_local void @f_doublearr2_s_arg
761 // ILP32D-SAME: (double [[TMP0:%.*]], double [[TMP1:%.*]]) #[[ATTR0]] {
764 void f_doublearr2_s_arg(struct doublearr2_s a
) {}
766 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_doublearr2_s
767 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLEARR2_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
768 // ILP32-ILP32F: entry:
770 // ILP32D-LABEL: define dso_local { double, double } @f_ret_doublearr2_s
771 // ILP32D-SAME: () #[[ATTR0]] {
774 struct doublearr2_s
f_ret_doublearr2_s(void) {
775 return (struct doublearr2_s
){{1.0, 2.0}};
778 struct doublearr2_tricky1_s
{ struct { double f
[1]; } g
[2]; };
780 // ILP32-ILP32F-LABEL: define dso_local void @f_doublearr2_tricky1_s_arg
781 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
782 // ILP32-ILP32F: entry:
784 // ILP32D-LABEL: define dso_local void @f_doublearr2_tricky1_s_arg
785 // ILP32D-SAME: (double [[TMP0:%.*]], double [[TMP1:%.*]]) #[[ATTR0]] {
788 void f_doublearr2_tricky1_s_arg(struct doublearr2_tricky1_s a
) {}
790 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_doublearr2_tricky1_s
791 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLEARR2_TRICKY1_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
792 // ILP32-ILP32F: entry:
794 // ILP32D-LABEL: define dso_local { double, double } @f_ret_doublearr2_tricky1_s
795 // ILP32D-SAME: () #[[ATTR0]] {
798 struct doublearr2_tricky1_s
f_ret_doublearr2_tricky1_s(void) {
799 return (struct doublearr2_tricky1_s
){{{{1.0}}, {{2.0}}}};
802 struct doublearr2_tricky2_s
{ struct {}; struct { double f
[1]; } g
[2]; };
804 // ILP32-ILP32F-LABEL: define dso_local void @f_doublearr2_tricky2_s_arg
805 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
806 // ILP32-ILP32F: entry:
808 // ILP32D-LABEL: define dso_local void @f_doublearr2_tricky2_s_arg
809 // ILP32D-SAME: (double [[TMP0:%.*]], double [[TMP1:%.*]]) #[[ATTR0]] {
812 void f_doublearr2_tricky2_s_arg(struct doublearr2_tricky2_s a
) {}
814 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_doublearr2_tricky2_s
815 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLEARR2_TRICKY2_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
816 // ILP32-ILP32F: entry:
818 // ILP32D-LABEL: define dso_local { double, double } @f_ret_doublearr2_tricky2_s
819 // ILP32D-SAME: () #[[ATTR0]] {
822 struct doublearr2_tricky2_s
f_ret_doublearr2_tricky2_s(void) {
823 return (struct doublearr2_tricky2_s
){{}, {{{1.0}}, {{2.0}}}};
826 struct doublearr2_tricky3_s
{ union {}; struct { double f
[1]; } g
[2]; };
828 // ILP32-ILP32F-LABEL: define dso_local void @f_doublearr2_tricky3_s_arg
829 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
830 // ILP32-ILP32F: entry:
832 // ILP32D-LABEL: define dso_local void @f_doublearr2_tricky3_s_arg
833 // ILP32D-SAME: (double [[TMP0:%.*]], double [[TMP1:%.*]]) #[[ATTR0]] {
836 void f_doublearr2_tricky3_s_arg(struct doublearr2_tricky3_s a
) {}
838 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_doublearr2_tricky3_s
839 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLEARR2_TRICKY3_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
840 // ILP32-ILP32F: entry:
842 // ILP32D-LABEL: define dso_local { double, double } @f_ret_doublearr2_tricky3_s
843 // ILP32D-SAME: () #[[ATTR0]] {
846 struct doublearr2_tricky3_s
f_ret_doublearr2_tricky3_s(void) {
847 return (struct doublearr2_tricky3_s
){{}, {{{1.0}}, {{2.0}}}};
850 struct doublearr2_tricky4_s
{ union {}; struct { struct {}; double f
[1]; } g
[2]; };
852 // ILP32-ILP32F-LABEL: define dso_local void @f_doublearr2_tricky4_s_arg
853 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
854 // ILP32-ILP32F: entry:
856 // ILP32D-LABEL: define dso_local void @f_doublearr2_tricky4_s_arg
857 // ILP32D-SAME: (double [[TMP0:%.*]], double [[TMP1:%.*]]) #[[ATTR0]] {
860 void f_doublearr2_tricky4_s_arg(struct doublearr2_tricky4_s a
) {}
862 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_doublearr2_tricky4_s
863 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLEARR2_TRICKY4_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
864 // ILP32-ILP32F: entry:
866 // ILP32D-LABEL: define dso_local { double, double } @f_ret_doublearr2_tricky4_s
867 // ILP32D-SAME: () #[[ATTR0]] {
870 struct doublearr2_tricky4_s
f_ret_doublearr2_tricky4_s(void) {
871 return (struct doublearr2_tricky4_s
){{}, {{{}, {1.0}}, {{}, {2.0}}}};
874 // Test structs that should be passed according to the normal integer calling
877 struct int_double_int_s
{ int a
; double b
; int c
; };
879 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_int_double_int_s_arg
880 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
881 // ILP32-ILP32F-ILP32D: entry:
883 void f_int_double_int_s_arg(struct int_double_int_s a
) {}
885 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_int_double_int_s
886 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_INT_DOUBLE_INT_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
887 // ILP32-ILP32F-ILP32D: entry:
889 struct int_double_int_s
f_ret_int_double_int_s(void) {
890 return (struct int_double_int_s
){1, 2.0, 3};
893 struct int64_double_s
{ int64_t a
; double b
; };
895 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_int64_double_s_arg
896 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
897 // ILP32-ILP32F-ILP32D: entry:
899 void f_int64_double_s_arg(struct int64_double_s a
) {}
901 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_int64_double_s
902 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_INT64_DOUBLE_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
903 // ILP32-ILP32F-ILP32D: entry:
905 struct int64_double_s
f_ret_int64_double_s(void) {
906 return (struct int64_double_s
){1, 2.0};
909 struct char_char_double_s
{ char a
; char b
; double c
; };
911 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_char_char_double_s_arg
912 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
913 // ILP32-ILP32F-ILP32D: entry:
915 void f_char_char_double_s_arg(struct char_char_double_s a
) {}
917 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_char_char_double_s
918 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_CHAR_CHAR_DOUBLE_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
919 // ILP32-ILP32F-ILP32D: entry:
921 struct char_char_double_s
f_ret_char_char_double_s(void) {
922 return (struct char_char_double_s
){1, 2, 3.0};
925 // Unions are always passed according to the integer calling convention, even
926 // if they can only contain a double.
928 union double_u
{ double a
; };
930 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_double_u_arg
931 // ILP32-ILP32F-ILP32D-SAME: (i64 [[A_COERCE:%.*]]) #[[ATTR0]] {
932 // ILP32-ILP32F-ILP32D: entry:
934 void f_double_u_arg(union double_u a
) {}
936 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i64 @f_ret_double_u
937 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
938 // ILP32-ILP32F-ILP32D: entry:
940 union double_u
f_ret_double_u(void) {
941 return (union double_u
){1.0};
944 // Test that we don't incorrectly think double+int/double+double structs will
945 // be returned indirectly and thus have an off-by-one error for the number of
946 // GPRs available (this is an edge case when structs > 2*XLEN are still
947 // returned in registers). This includes complex doubles, which are treated as
948 // double+double structs by the ABI.
950 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_int32_s_double_int32_s_just_sufficient_gprs
951 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_INT32_S:%.*]]) align 8 [[AGG_RESULT:%.*]], i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], ptr noundef [[H:%.*]]) #[[ATTR0]] {
952 // ILP32-ILP32F: entry:
954 // ILP32D-LABEL: define dso_local { double, i32 } @f_ret_double_int32_s_double_int32_s_just_sufficient_gprs
955 // ILP32D-SAME: (i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], double [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
958 struct double_int32_s
f_ret_double_int32_s_double_int32_s_just_sufficient_gprs(
959 int a
, int b
, int c
, int d
, int e
, int f
, int g
, struct double_int32_s h
) {
960 return (struct double_int32_s
){1.0, 2};
963 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_double_s_double_int32_s_just_sufficient_gprs
964 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_DOUBLE_S:%.*]]) align 8 [[AGG_RESULT:%.*]], i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], ptr noundef [[H:%.*]]) #[[ATTR0]] {
965 // ILP32-ILP32F: entry:
967 // ILP32D-LABEL: define dso_local { double, double } @f_ret_double_double_s_double_int32_s_just_sufficient_gprs
968 // ILP32D-SAME: (i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], double [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
971 struct double_double_s
f_ret_double_double_s_double_int32_s_just_sufficient_gprs(
972 int a
, int b
, int c
, int d
, int e
, int f
, int g
, struct double_int32_s h
) {
973 return (struct double_double_s
){1.0, 2.0};
976 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_doublecomplex_double_int32_s_just_sufficient_gprs
977 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret({ double, double }) align 8 [[AGG_RESULT:%.*]], i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], ptr noundef [[H:%.*]]) #[[ATTR0]] {
978 // ILP32-ILP32F: entry:
980 // ILP32D-LABEL: define dso_local { double, double } @f_ret_doublecomplex_double_int32_s_just_sufficient_gprs
981 // ILP32D-SAME: (i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], double [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
984 double __complex__
f_ret_doublecomplex_double_int32_s_just_sufficient_gprs(
985 int a
, int b
, int c
, int d
, int e
, int f
, int g
, struct double_int32_s h
) {
989 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_fpr_tracking_3
990 // ILP32-ILP32F-ILP32D-SAME: (float noundef [[A:%.*]], float noundef [[B:%.*]], float noundef [[C:%.*]], float noundef [[D:%.*]], float noundef [[E:%.*]], float noundef [[F:%.*]], float noundef [[G:%.*]], float noundef [[H:%.*]], i8 noundef zeroext [[I:%.*]]) #[[ATTR0]] {
991 // ILP32-ILP32F-ILP32D: entry:
993 void f_fpr_tracking_3(float a
, float b
, float c
, float d
, float e
, float f
,
994 float g
, float h
, uint8_t i
) {}
996 // Check that fp, fp+fp, and int+fp structs are lowered correctly. These will
997 // be passed in FPR, FPR+FPR, or GPR+FPR regs if sufficient registers are
998 // available the widths are <= XLEN and FLEN, and should be expanded to
999 // separate arguments in IR. They are passed by the same rules for returns,
1000 // but will be lowered to simple two-element structs if necessary (as LLVM IR
1001 // functions cannot return multiple values).
1003 // A struct containing just one floating-point real is passed as though it
1004 // were a standalone floating-point real.
1006 struct float_s
{ float f
; };
1008 // ILP32-LABEL: define dso_local void @f_float_s_arg
1009 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1012 // ILP32F-ILP32D-LABEL: define dso_local void @f_float_s_arg
1013 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]]) #[[ATTR0]] {
1014 // ILP32F-ILP32D: entry:
1016 void f_float_s_arg(struct float_s a
) {}
1018 // ILP32-LABEL: define dso_local i32 @f_ret_float_s
1019 // ILP32-SAME: () #[[ATTR0]] {
1022 // ILP32F-ILP32D-LABEL: define dso_local float @f_ret_float_s
1023 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1024 // ILP32F-ILP32D: entry:
1026 struct float_s
f_ret_float_s(void) {
1027 return (struct float_s
){1.0};
1030 // A struct containing a float and any number of zero-width bitfields is
1031 // passed as though it were a standalone floating-point real.
1033 struct zbf_float_s
{ int : 0; float f
; };
1034 struct zbf_float_zbf_s
{ int : 0; float f
; int : 0; };
1036 // ILP32-LABEL: define dso_local void @f_zbf_float_s_arg
1037 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1040 // ILP32F-ILP32D-LABEL: define dso_local void @f_zbf_float_s_arg
1041 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]]) #[[ATTR0]] {
1042 // ILP32F-ILP32D: entry:
1044 void f_zbf_float_s_arg(struct zbf_float_s a
) {}
1046 // ILP32-LABEL: define dso_local i32 @f_ret_zbf_float_s
1047 // ILP32-SAME: () #[[ATTR0]] {
1050 // ILP32F-ILP32D-LABEL: define dso_local float @f_ret_zbf_float_s
1051 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1052 // ILP32F-ILP32D: entry:
1054 struct zbf_float_s
f_ret_zbf_float_s(void) {
1055 return (struct zbf_float_s
){1.0};
1058 // ILP32-LABEL: define dso_local void @f_zbf_float_zbf_s_arg
1059 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1062 // ILP32F-ILP32D-LABEL: define dso_local void @f_zbf_float_zbf_s_arg
1063 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]]) #[[ATTR0]] {
1064 // ILP32F-ILP32D: entry:
1066 void f_zbf_float_zbf_s_arg(struct zbf_float_zbf_s a
) {}
1068 // ILP32-LABEL: define dso_local i32 @f_ret_zbf_float_zbf_s
1069 // ILP32-SAME: () #[[ATTR0]] {
1072 // ILP32F-ILP32D-LABEL: define dso_local float @f_ret_zbf_float_zbf_s
1073 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1074 // ILP32F-ILP32D: entry:
1076 struct zbf_float_zbf_s
f_ret_zbf_float_zbf_s(void) {
1077 return (struct zbf_float_zbf_s
){1.0};
1080 // Check that structs containing two float values (FLEN <= width) are expanded
1081 // provided sufficient FPRs are available.
1083 struct float_float_s
{ float f
; float g
; };
1085 // ILP32-LABEL: define dso_local void @f_float_float_s_arg
1086 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1089 // ILP32F-ILP32D-LABEL: define dso_local void @f_float_float_s_arg
1090 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0]] {
1091 // ILP32F-ILP32D: entry:
1093 void f_float_float_s_arg(struct float_float_s a
) {}
1095 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_float_float_s
1096 // ILP32-SAME: () #[[ATTR0]] {
1099 // ILP32F-ILP32D-LABEL: define dso_local { float, float } @f_ret_float_float_s
1100 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1101 // ILP32F-ILP32D: entry:
1103 struct float_float_s
f_ret_float_float_s(void) {
1104 return (struct float_float_s
){1.0, 2.0};
1107 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_float_float_s_arg_insufficient_fprs
1108 // ILP32-ILP32F-ILP32D-SAME: (float noundef [[A:%.*]], float noundef [[B:%.*]], float noundef [[C:%.*]], float noundef [[D:%.*]], float noundef [[E:%.*]], float noundef [[F:%.*]], float noundef [[G:%.*]], [2 x i32] [[H_COERCE:%.*]]) #[[ATTR0]] {
1109 // ILP32-ILP32F-ILP32D: entry:
1111 void f_float_float_s_arg_insufficient_fprs(float a
, float b
, float c
, float d
,
1112 float e
, float f
, float g
, struct float_float_s h
) {}
1114 // Check that structs containing int+float values are expanded, provided
1115 // sufficient FPRs and GPRs are available. The integer components are neither
1116 // sign or zero-extended.
1118 struct float_int8_s
{ float f
; int8_t i
; };
1119 struct float_uint8_s
{ float f
; uint8_t i
; };
1120 struct float_int32_s
{ float f
; int32_t i
; };
1121 struct float_int64_s
{ float f
; int64_t i
; };
1122 struct float_int64bf_s
{ float f
; int64_t i
: 32; };
1123 struct float_int8_zbf_s
{ float f
; int8_t i
; int : 0; };
1125 // ILP32-LABEL: define dso_local void @f_float_int8_s_arg
1126 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1129 // ILP32F-ILP32D-LABEL: define dso_local void @f_float_int8_s_arg
1130 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], i8 [[TMP1:%.*]]) #[[ATTR0]] {
1131 // ILP32F-ILP32D: entry:
1133 void f_float_int8_s_arg(struct float_int8_s a
) {}
1135 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_float_int8_s
1136 // ILP32-SAME: () #[[ATTR0]] {
1139 // ILP32F-ILP32D-LABEL: define dso_local { float, i8 } @f_ret_float_int8_s
1140 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1141 // ILP32F-ILP32D: entry:
1143 struct float_int8_s
f_ret_float_int8_s(void) {
1144 return (struct float_int8_s
){1.0, 2};
1147 // ILP32-LABEL: define dso_local void @f_float_uint8_s_arg
1148 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1151 // ILP32F-ILP32D-LABEL: define dso_local void @f_float_uint8_s_arg
1152 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], i8 [[TMP1:%.*]]) #[[ATTR0]] {
1153 // ILP32F-ILP32D: entry:
1155 void f_float_uint8_s_arg(struct float_uint8_s a
) {}
1157 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_float_uint8_s
1158 // ILP32-SAME: () #[[ATTR0]] {
1161 // ILP32F-ILP32D-LABEL: define dso_local { float, i8 } @f_ret_float_uint8_s
1162 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1163 // ILP32F-ILP32D: entry:
1165 struct float_uint8_s
f_ret_float_uint8_s(void) {
1166 return (struct float_uint8_s
){1.0, 2};
1169 // ILP32-LABEL: define dso_local void @f_float_int32_s_arg
1170 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1173 // ILP32F-ILP32D-LABEL: define dso_local void @f_float_int32_s_arg
1174 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
1175 // ILP32F-ILP32D: entry:
1177 void f_float_int32_s_arg(struct float_int32_s a
) {}
1179 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_float_int32_s
1180 // ILP32-SAME: () #[[ATTR0]] {
1183 // ILP32F-ILP32D-LABEL: define dso_local { float, i32 } @f_ret_float_int32_s
1184 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1185 // ILP32F-ILP32D: entry:
1187 struct float_int32_s
f_ret_float_int32_s(void) {
1188 return (struct float_int32_s
){1.0, 2};
1191 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_float_int64_s_arg
1192 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
1193 // ILP32-ILP32F-ILP32D: entry:
1195 void f_float_int64_s_arg(struct float_int64_s a
) {}
1197 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_float_int64_s
1198 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_FLOAT_INT64_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
1199 // ILP32-ILP32F-ILP32D: entry:
1201 struct float_int64_s
f_ret_float_int64_s(void) {
1202 return (struct float_int64_s
){1.0, 2};
1205 // ILP32-LABEL: define dso_local void @f_float_int64bf_s_arg
1206 // ILP32-SAME: (i64 [[A_COERCE:%.*]]) #[[ATTR0]] {
1209 // ILP32F-ILP32D-LABEL: define dso_local void @f_float_int64bf_s_arg
1210 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
1211 // ILP32F-ILP32D: entry:
1213 void f_float_int64bf_s_arg(struct float_int64bf_s a
) {}
1215 // ILP32-LABEL: define dso_local i64 @f_ret_float_int64bf_s
1216 // ILP32-SAME: () #[[ATTR0]] {
1219 // ILP32F-ILP32D-LABEL: define dso_local { float, i32 } @f_ret_float_int64bf_s
1220 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1221 // ILP32F-ILP32D: entry:
1223 struct float_int64bf_s
f_ret_float_int64bf_s(void) {
1224 return (struct float_int64bf_s
){1.0, 2};
1227 // The zero-width bitfield means the struct can't be passed according to the
1228 // floating point calling convention.
1230 // ILP32-LABEL: define dso_local void @f_float_int8_zbf_s
1231 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1234 // ILP32F-ILP32D-LABEL: define dso_local void @f_float_int8_zbf_s
1235 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], i8 [[TMP1:%.*]]) #[[ATTR0]] {
1236 // ILP32F-ILP32D: entry:
1238 void f_float_int8_zbf_s(struct float_int8_zbf_s a
) {}
1240 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_float_int8_zbf_s
1241 // ILP32-SAME: () #[[ATTR0]] {
1244 // ILP32F-ILP32D-LABEL: define dso_local { float, i8 } @f_ret_float_int8_zbf_s
1245 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1246 // ILP32F-ILP32D: entry:
1248 struct float_int8_zbf_s
f_ret_float_int8_zbf_s(void) {
1249 return (struct float_int8_zbf_s
){1.0, 2};
1252 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_float_int8_s_arg_insufficient_gprs
1253 // ILP32-ILP32F-ILP32D-SAME: (i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], i32 noundef [[H:%.*]], [2 x i32] [[I_COERCE:%.*]]) #[[ATTR0]] {
1254 // ILP32-ILP32F-ILP32D: entry:
1256 void f_float_int8_s_arg_insufficient_gprs(int a
, int b
, int c
, int d
, int e
,
1257 int f
, int g
, int h
, struct float_int8_s i
) {}
1259 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_struct_float_int8_insufficient_fprs
1260 // ILP32-ILP32F-ILP32D-SAME: (float noundef [[A:%.*]], float noundef [[B:%.*]], float noundef [[C:%.*]], float noundef [[D:%.*]], float noundef [[E:%.*]], float noundef [[F:%.*]], float noundef [[G:%.*]], float noundef [[H:%.*]], [2 x i32] [[I_COERCE:%.*]]) #[[ATTR0]] {
1261 // ILP32-ILP32F-ILP32D: entry:
1263 void f_struct_float_int8_insufficient_fprs(float a
, float b
, float c
, float d
,
1264 float e
, float f
, float g
, float h
, struct float_int8_s i
) {}
1266 // Complex floating-point values or structs containing a single complex
1267 // floating-point value should be passed as if it were an fp+fp struct.
1269 // ILP32-LABEL: define dso_local void @f_floatcomplex
1270 // ILP32-SAME: ([2 x i32] noundef [[A_COERCE:%.*]]) #[[ATTR0]] {
1273 // ILP32F-ILP32D-LABEL: define dso_local void @f_floatcomplex
1274 // ILP32F-ILP32D-SAME: (float noundef [[A_COERCE0:%.*]], float noundef [[A_COERCE1:%.*]]) #[[ATTR0]] {
1275 // ILP32F-ILP32D: entry:
1277 void f_floatcomplex(float __complex__ a
) {}
1279 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_floatcomplex
1280 // ILP32-SAME: () #[[ATTR0]] {
1283 // ILP32F-ILP32D-LABEL: define dso_local { float, float } @f_ret_floatcomplex
1284 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1285 // ILP32F-ILP32D: entry:
1287 float __complex__
f_ret_floatcomplex(void) {
1291 struct floatcomplex_s
{ float __complex__ c
; };
1293 // ILP32-LABEL: define dso_local void @f_floatcomplex_s_arg
1294 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1297 // ILP32F-ILP32D-LABEL: define dso_local void @f_floatcomplex_s_arg
1298 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0]] {
1299 // ILP32F-ILP32D: entry:
1301 void f_floatcomplex_s_arg(struct floatcomplex_s a
) {}
1303 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_floatcomplex_s
1304 // ILP32-SAME: () #[[ATTR0]] {
1307 // ILP32F-ILP32D-LABEL: define dso_local { float, float } @f_ret_floatcomplex_s
1308 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1309 // ILP32F-ILP32D: entry:
1311 struct floatcomplex_s
f_ret_floatcomplex_s(void) {
1312 return (struct floatcomplex_s
){1.0};
1315 // Test single or two-element structs that need flattening. e.g. those
1316 // containing nested structs, floats in small arrays, zero-length structs etc.
1318 struct floatarr1_s
{ float a
[1]; };
1320 // ILP32-LABEL: define dso_local void @f_floatarr1_s_arg
1321 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1324 // ILP32F-ILP32D-LABEL: define dso_local void @f_floatarr1_s_arg
1325 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]]) #[[ATTR0]] {
1326 // ILP32F-ILP32D: entry:
1328 void f_floatarr1_s_arg(struct floatarr1_s a
) {}
1330 // ILP32-LABEL: define dso_local i32 @f_ret_floatarr1_s
1331 // ILP32-SAME: () #[[ATTR0]] {
1334 // ILP32F-ILP32D-LABEL: define dso_local float @f_ret_floatarr1_s
1335 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1336 // ILP32F-ILP32D: entry:
1338 struct floatarr1_s
f_ret_floatarr1_s(void) {
1339 return (struct floatarr1_s
){{1.0}};
1342 struct floatarr2_s
{ float a
[2]; };
1344 // ILP32-LABEL: define dso_local void @f_floatarr2_s_arg
1345 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1348 // ILP32F-ILP32D-LABEL: define dso_local void @f_floatarr2_s_arg
1349 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0]] {
1350 // ILP32F-ILP32D: entry:
1352 void f_floatarr2_s_arg(struct floatarr2_s a
) {}
1354 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_floatarr2_s
1355 // ILP32-SAME: () #[[ATTR0]] {
1358 // ILP32F-ILP32D-LABEL: define dso_local { float, float } @f_ret_floatarr2_s
1359 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1360 // ILP32F-ILP32D: entry:
1362 struct floatarr2_s
f_ret_floatarr2_s(void) {
1363 return (struct floatarr2_s
){{1.0, 2.0}};
1366 struct floatarr2_tricky1_s
{ struct { float f
[1]; } g
[2]; };
1368 // ILP32-LABEL: define dso_local void @f_floatarr2_tricky1_s_arg
1369 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1372 // ILP32F-ILP32D-LABEL: define dso_local void @f_floatarr2_tricky1_s_arg
1373 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0]] {
1374 // ILP32F-ILP32D: entry:
1376 void f_floatarr2_tricky1_s_arg(struct floatarr2_tricky1_s a
) {}
1378 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_floatarr2_tricky1_s
1379 // ILP32-SAME: () #[[ATTR0]] {
1382 // ILP32F-ILP32D-LABEL: define dso_local { float, float } @f_ret_floatarr2_tricky1_s
1383 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1384 // ILP32F-ILP32D: entry:
1386 struct floatarr2_tricky1_s
f_ret_floatarr2_tricky1_s(void) {
1387 return (struct floatarr2_tricky1_s
){{{{1.0}}, {{2.0}}}};
1390 struct floatarr2_tricky2_s
{ struct {}; struct { float f
[1]; } g
[2]; };
1392 // ILP32-LABEL: define dso_local void @f_floatarr2_tricky2_s_arg
1393 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1396 // ILP32F-ILP32D-LABEL: define dso_local void @f_floatarr2_tricky2_s_arg
1397 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0]] {
1398 // ILP32F-ILP32D: entry:
1400 void f_floatarr2_tricky2_s_arg(struct floatarr2_tricky2_s a
) {}
1402 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_floatarr2_tricky2_s
1403 // ILP32-SAME: () #[[ATTR0]] {
1406 // ILP32F-ILP32D-LABEL: define dso_local { float, float } @f_ret_floatarr2_tricky2_s
1407 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1408 // ILP32F-ILP32D: entry:
1410 struct floatarr2_tricky2_s
f_ret_floatarr2_tricky2_s(void) {
1411 return (struct floatarr2_tricky2_s
){{}, {{{1.0}}, {{2.0}}}};
1414 struct floatarr2_tricky3_s
{ union {}; struct { float f
[1]; } g
[2]; };
1416 // ILP32-LABEL: define dso_local void @f_floatarr2_tricky3_s_arg
1417 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1420 // ILP32F-ILP32D-LABEL: define dso_local void @f_floatarr2_tricky3_s_arg
1421 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0]] {
1422 // ILP32F-ILP32D: entry:
1424 void f_floatarr2_tricky3_s_arg(struct floatarr2_tricky3_s a
) {}
1426 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_floatarr2_tricky3_s
1427 // ILP32-SAME: () #[[ATTR0]] {
1430 // ILP32F-ILP32D-LABEL: define dso_local { float, float } @f_ret_floatarr2_tricky3_s
1431 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1432 // ILP32F-ILP32D: entry:
1434 struct floatarr2_tricky3_s
f_ret_floatarr2_tricky3_s(void) {
1435 return (struct floatarr2_tricky3_s
){{}, {{{1.0}}, {{2.0}}}};
1438 struct floatarr2_tricky4_s
{ union {}; struct { struct {}; float f
[1]; } g
[2]; };
1440 // ILP32-LABEL: define dso_local void @f_floatarr2_tricky4_s_arg
1441 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1444 // ILP32F-ILP32D-LABEL: define dso_local void @f_floatarr2_tricky4_s_arg
1445 // ILP32F-ILP32D-SAME: (float [[TMP0:%.*]], float [[TMP1:%.*]]) #[[ATTR0]] {
1446 // ILP32F-ILP32D: entry:
1448 void f_floatarr2_tricky4_s_arg(struct floatarr2_tricky4_s a
) {}
1450 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_floatarr2_tricky4_s
1451 // ILP32-SAME: () #[[ATTR0]] {
1454 // ILP32F-ILP32D-LABEL: define dso_local { float, float } @f_ret_floatarr2_tricky4_s
1455 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1456 // ILP32F-ILP32D: entry:
1458 struct floatarr2_tricky4_s
f_ret_floatarr2_tricky4_s(void) {
1459 return (struct floatarr2_tricky4_s
){{}, {{{}, {1.0}}, {{}, {2.0}}}};
1462 // Test structs that should be passed according to the normal integer calling
1465 struct int_float_int_s
{ int a
; float b
; int c
; };
1467 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_int_float_int_s_arg
1468 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
1469 // ILP32-ILP32F-ILP32D: entry:
1471 void f_int_float_int_s_arg(struct int_float_int_s a
) {}
1473 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_int_float_int_s
1474 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_INT_FLOAT_INT_S:%.*]]) align 4 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
1475 // ILP32-ILP32F-ILP32D: entry:
1477 struct int_float_int_s
f_ret_int_float_int_s(void) {
1478 return (struct int_float_int_s
){1, 2.0, 3};
1481 struct int64_float_s
{ int64_t a
; float b
; };
1483 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_int64_float_s_arg
1484 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
1485 // ILP32-ILP32F-ILP32D: entry:
1487 void f_int64_float_s_arg(struct int64_float_s a
) {}
1489 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_int64_float_s
1490 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_INT64_FLOAT_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
1491 // ILP32-ILP32F-ILP32D: entry:
1493 struct int64_float_s
f_ret_int64_float_s(void) {
1494 return (struct int64_float_s
){1, 2.0};
1497 struct char_char_float_s
{ char a
; char b
; float c
; };
1499 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_char_char_float_s_arg
1500 // ILP32-ILP32F-ILP32D-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1501 // ILP32-ILP32F-ILP32D: entry:
1503 void f_char_char_float_s_arg(struct char_char_float_s a
) {}
1505 // ILP32-ILP32F-ILP32D-LABEL: define dso_local [2 x i32] @f_ret_char_char_float_s
1506 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1507 // ILP32-ILP32F-ILP32D: entry:
1509 struct char_char_float_s
f_ret_char_char_float_s(void) {
1510 return (struct char_char_float_s
){1, 2, 3.0};
1513 // Unions are always passed according to the integer calling convention, even
1514 // if they can only contain a float.
1516 union float_u
{ float a
; };
1518 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_float_u_arg
1519 // ILP32-ILP32F-ILP32D-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1520 // ILP32-ILP32F-ILP32D: entry:
1522 void f_float_u_arg(union float_u a
) {}
1524 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_ret_float_u
1525 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1526 // ILP32-ILP32F-ILP32D: entry:
1528 union float_u
f_ret_float_u(void) {
1529 return (union float_u
){1.0};
1532 // Check that fp, fp+fp, and int+fp structs are lowered correctly. These will
1533 // be passed in FPR, FPR+FPR, or GPR+FPR regs if sufficient registers are
1534 // available the widths are <= XLEN and FLEN, and should be expanded to
1535 // separate arguments in IR. They are passed by the same rules for returns,
1536 // but will be lowered to simple two-element structs if necessary (as LLVM IR
1537 // functions cannot return multiple values).
1539 struct float16_s
{ _Float16 f
; };
1541 // A struct containing just one floating-point real is passed as though it
1542 // were a standalone floating-point real.
1544 // ILP32-LABEL: define dso_local void @f_float16_s_arg
1545 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1548 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16_s_arg
1549 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]]) #[[ATTR0]] {
1550 // ILP32F-ILP32D: entry:
1552 void f_float16_s_arg(struct float16_s a
) {}
1554 // ILP32-LABEL: define dso_local i32 @f_ret_float16_s
1555 // ILP32-SAME: () #[[ATTR0]] {
1558 // ILP32F-ILP32D-LABEL: define dso_local half @f_ret_float16_s
1559 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1560 // ILP32F-ILP32D: entry:
1562 struct float16_s
f_ret_float16_s(void) {
1563 return (struct float16_s
){1.0};
1566 // A struct containing a double and any number of zero-width bitfields is
1567 // passed as though it were a standalone floating-point real.
1569 struct zbf_float16_s
{ int : 0; _Float16 f
; };
1570 struct zbf_float16_zbf_s
{ int : 0; _Float16 f
; int : 0; };
1572 // ILP32-LABEL: define dso_local void @f_zbf_float16_s_arg
1573 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1576 // ILP32F-ILP32D-LABEL: define dso_local void @f_zbf_float16_s_arg
1577 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]]) #[[ATTR0]] {
1578 // ILP32F-ILP32D: entry:
1580 void f_zbf_float16_s_arg(struct zbf_float16_s a
) {}
1582 // ILP32-LABEL: define dso_local i32 @f_ret_zbf_float16_s
1583 // ILP32-SAME: () #[[ATTR0]] {
1586 // ILP32F-ILP32D-LABEL: define dso_local half @f_ret_zbf_float16_s
1587 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1588 // ILP32F-ILP32D: entry:
1590 struct zbf_float16_s
f_ret_zbf_float16_s(void) {
1591 return (struct zbf_float16_s
){1.0};
1594 // ILP32-LABEL: define dso_local void @f_zbf_float16_zbf_s_arg
1595 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1598 // ILP32F-ILP32D-LABEL: define dso_local void @f_zbf_float16_zbf_s_arg
1599 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]]) #[[ATTR0]] {
1600 // ILP32F-ILP32D: entry:
1602 void f_zbf_float16_zbf_s_arg(struct zbf_float16_zbf_s a
) {}
1604 // ILP32-LABEL: define dso_local i32 @f_ret_zbf_float16_zbf_s
1605 // ILP32-SAME: () #[[ATTR0]] {
1608 // ILP32F-ILP32D-LABEL: define dso_local half @f_ret_zbf_float16_zbf_s
1609 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1610 // ILP32F-ILP32D: entry:
1612 struct zbf_float16_zbf_s
f_ret_zbf_float16_zbf_s(void) {
1613 return (struct zbf_float16_zbf_s
){1.0};
1616 // Check that structs containing two floating point values (FLEN <= width) are
1617 // expanded provided sufficient FPRs are available.
1619 struct double_float16_s
{ double f
; _Float16 g
; };
1621 // ILP32-ILP32F-LABEL: define dso_local void @f_double_float16_s_arg
1622 // ILP32-ILP32F-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
1623 // ILP32-ILP32F: entry:
1625 // ILP32D-LABEL: define dso_local void @f_double_float16_s_arg
1626 // ILP32D-SAME: (double [[TMP0:%.*]], half [[TMP1:%.*]]) #[[ATTR0]] {
1629 void f_double_float16_s_arg(struct double_float16_s a
) {}
1631 // ILP32-ILP32F-LABEL: define dso_local void @f_ret_double_float16_s
1632 // ILP32-ILP32F-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_DOUBLE_FLOAT16_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
1633 // ILP32-ILP32F: entry:
1635 // ILP32D-LABEL: define dso_local { double, half } @f_ret_double_float16_s
1636 // ILP32D-SAME: () #[[ATTR0]] {
1639 struct double_float16_s
f_ret_double_float16_s(void) {
1640 return (struct double_float16_s
){1.0, 2.0};
1643 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_double_float16_s_arg_insufficient_fprs
1644 // ILP32-ILP32F-ILP32D-SAME: (float noundef [[A:%.*]], double noundef [[B:%.*]], double noundef [[C:%.*]], double noundef [[D:%.*]], double noundef [[E:%.*]], double noundef [[F:%.*]], double noundef [[G:%.*]], ptr noundef [[H:%.*]]) #[[ATTR0]] {
1645 // ILP32-ILP32F-ILP32D: entry:
1647 void f_double_float16_s_arg_insufficient_fprs(float a
, double b
, double c
, double d
,
1648 double e
, double f
, double g
, struct double_float16_s h
) {}
1650 // Check that structs containing int+_Float16 values are expanded, provided
1651 // sufficient FPRs and GPRs are available. The integer components are neither
1652 // sign or zero-extended.
1654 struct float16_int8_s
{ _Float16 f
; int8_t i
; };
1655 struct float16_uint8_s
{ _Float16 f
; uint8_t i
; };
1656 struct float16_int32_s
{ _Float16 f
; int32_t i
; };
1657 struct float16_int64_s
{ _Float16 f
; int64_t i
; };
1658 struct float16_int64bf_s
{ _Float16 f
; int64_t i
: 32; };
1659 struct float16_int8_zbf_s
{ _Float16 f
; int8_t i
; int : 0; };
1661 // ILP32-LABEL: define dso_local void @f_float16_int8_s_arg
1662 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1665 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16_int8_s_arg
1666 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], i8 [[TMP1:%.*]]) #[[ATTR0]] {
1667 // ILP32F-ILP32D: entry:
1669 void f_float16_int8_s_arg(struct float16_int8_s a
) {}
1671 // ILP32-LABEL: define dso_local i32 @f_ret_float16_int8_s
1672 // ILP32-SAME: () #[[ATTR0]] {
1675 // ILP32F-ILP32D-LABEL: define dso_local { half, i8 } @f_ret_float16_int8_s
1676 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1677 // ILP32F-ILP32D: entry:
1679 struct float16_int8_s
f_ret_float16_int8_s(void) {
1680 return (struct float16_int8_s
){1.0, 2};
1683 // ILP32-LABEL: define dso_local void @f_float16_uint8_s_arg
1684 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1687 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16_uint8_s_arg
1688 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], i8 [[TMP1:%.*]]) #[[ATTR0]] {
1689 // ILP32F-ILP32D: entry:
1691 void f_float16_uint8_s_arg(struct float16_uint8_s a
) {}
1693 // ILP32-LABEL: define dso_local i32 @f_ret_float16_uint8_s
1694 // ILP32-SAME: () #[[ATTR0]] {
1697 // ILP32F-ILP32D-LABEL: define dso_local { half, i8 } @f_ret_float16_uint8_s
1698 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1699 // ILP32F-ILP32D: entry:
1701 struct float16_uint8_s
f_ret_float16_uint8_s(void) {
1702 return (struct float16_uint8_s
){1.0, 2};
1705 // ILP32-LABEL: define dso_local void @f_float16_int32_s_arg
1706 // ILP32-SAME: ([2 x i32] [[A_COERCE:%.*]]) #[[ATTR0]] {
1709 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16_int32_s_arg
1710 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
1711 // ILP32F-ILP32D: entry:
1713 void f_float16_int32_s_arg(struct float16_int32_s a
) {}
1715 // ILP32-LABEL: define dso_local [2 x i32] @f_ret_float16_int32_s
1716 // ILP32-SAME: () #[[ATTR0]] {
1719 // ILP32F-ILP32D-LABEL: define dso_local { half, i32 } @f_ret_float16_int32_s
1720 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1721 // ILP32F-ILP32D: entry:
1723 struct float16_int32_s
f_ret_float16_int32_s(void) {
1724 return (struct float16_int32_s
){1.0, 2};
1727 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_float16_int64_s_arg
1728 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
1729 // ILP32-ILP32F-ILP32D: entry:
1731 void f_float16_int64_s_arg(struct float16_int64_s a
) {}
1733 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_float16_int64_s
1734 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_FLOAT16_INT64_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
1735 // ILP32-ILP32F-ILP32D: entry:
1737 struct float16_int64_s
f_ret_float16_int64_s(void) {
1738 return (struct float16_int64_s
){1.0, 2};
1741 // ILP32-LABEL: define dso_local void @f_float16_int64bf_s_arg
1742 // ILP32-SAME: (i64 [[A_COERCE:%.*]]) #[[ATTR0]] {
1745 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16_int64bf_s_arg
1746 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR0]] {
1747 // ILP32F-ILP32D: entry:
1749 void f_float16_int64bf_s_arg(struct float16_int64bf_s a
) {}
1751 // ILP32-LABEL: define dso_local i64 @f_ret_float16_int64bf_s
1752 // ILP32-SAME: () #[[ATTR0]] {
1755 // ILP32F-ILP32D-LABEL: define dso_local <{ half, i32 }> @f_ret_float16_int64bf_s
1756 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1757 // ILP32F-ILP32D: entry:
1759 struct float16_int64bf_s
f_ret_float16_int64bf_s(void) {
1760 return (struct float16_int64bf_s
){1.0, 2};
1763 // The zero-width bitfield means the struct can't be passed according to the
1764 // floating point calling convention.
1766 // ILP32-LABEL: define dso_local void @f_float16_int8_zbf_s
1767 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1770 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16_int8_zbf_s
1771 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], i8 [[TMP1:%.*]]) #[[ATTR0]] {
1772 // ILP32F-ILP32D: entry:
1774 void f_float16_int8_zbf_s(struct float16_int8_zbf_s a
) {}
1776 // ILP32-LABEL: define dso_local i32 @f_ret_float16_int8_zbf_s
1777 // ILP32-SAME: () #[[ATTR0]] {
1780 // ILP32F-ILP32D-LABEL: define dso_local { half, i8 } @f_ret_float16_int8_zbf_s
1781 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1782 // ILP32F-ILP32D: entry:
1784 struct float16_int8_zbf_s
f_ret_float16_int8_zbf_s(void) {
1785 return (struct float16_int8_zbf_s
){1.0, 2};
1788 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_float16_int8_s_arg_insufficient_gprs
1789 // ILP32-ILP32F-ILP32D-SAME: (i32 noundef [[A:%.*]], i32 noundef [[B:%.*]], i32 noundef [[C:%.*]], i32 noundef [[D:%.*]], i32 noundef [[E:%.*]], i32 noundef [[F:%.*]], i32 noundef [[G:%.*]], i32 noundef [[H:%.*]], i32 [[I_COERCE:%.*]]) #[[ATTR0]] {
1790 // ILP32-ILP32F-ILP32D: entry:
1792 void f_float16_int8_s_arg_insufficient_gprs(int a
, int b
, int c
, int d
, int e
,
1793 int f
, int g
, int h
, struct float16_int8_s i
) {}
1795 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_struct_float16_int8_insufficient_fprs
1796 // ILP32-ILP32F-ILP32D-SAME: (float noundef [[A:%.*]], double noundef [[B:%.*]], double noundef [[C:%.*]], double noundef [[D:%.*]], double noundef [[E:%.*]], double noundef [[F:%.*]], double noundef [[G:%.*]], double noundef [[H:%.*]], i32 [[I_COERCE:%.*]]) #[[ATTR0]] {
1797 // ILP32-ILP32F-ILP32D: entry:
1799 void f_struct_float16_int8_insufficient_fprs(float a
, double b
, double c
, double d
,
1800 double e
, double f
, double g
, double h
, struct float16_int8_s i
) {}
1802 // Complex floating-point values or structs containing a single complex
1803 // floating-point value should be passed as if it were an fp+fp struct.
1805 // ILP32-LABEL: define dso_local void @f_float16complex
1806 // ILP32-SAME: (i32 noundef [[A_COERCE:%.*]]) #[[ATTR0]] {
1809 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16complex
1810 // ILP32F-ILP32D-SAME: (half noundef [[A_COERCE0:%.*]], half noundef [[A_COERCE1:%.*]]) #[[ATTR0]] {
1811 // ILP32F-ILP32D: entry:
1813 void f_float16complex(_Float16 __complex__ a
) {}
1815 // ILP32-LABEL: define dso_local i32 @f_ret_float16complex
1816 // ILP32-SAME: () #[[ATTR0]] {
1819 // ILP32F-ILP32D-LABEL: define dso_local { half, half } @f_ret_float16complex
1820 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1821 // ILP32F-ILP32D: entry:
1823 _Float16 __complex__
f_ret_float16complex(void) {
1827 struct float16complex_s
{ _Float16 __complex__ c
; };
1829 // ILP32-LABEL: define dso_local void @f_float16complex_s_arg
1830 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1833 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16complex_s_arg
1834 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], half [[TMP1:%.*]]) #[[ATTR0]] {
1835 // ILP32F-ILP32D: entry:
1837 void f_float16complex_s_arg(struct float16complex_s a
) {}
1839 // ILP32-LABEL: define dso_local i32 @f_ret_float16complex_s
1840 // ILP32-SAME: () #[[ATTR0]] {
1843 // ILP32F-ILP32D-LABEL: define dso_local { half, half } @f_ret_float16complex_s
1844 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1845 // ILP32F-ILP32D: entry:
1847 struct float16complex_s
f_ret_float16complex_s(void) {
1848 return (struct float16complex_s
){1.0};
1851 // Test single or two-element structs that need flattening. e.g. those
1852 // containing nested structs, _Float16 in small arrays, zero-length structs etc.
1854 struct float16arr1_s
{ _Float16 a
[1]; };
1856 // ILP32-LABEL: define dso_local void @f_float16arr1_s_arg
1857 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1860 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16arr1_s_arg
1861 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]]) #[[ATTR0]] {
1862 // ILP32F-ILP32D: entry:
1864 void f_float16arr1_s_arg(struct float16arr1_s a
) {}
1866 // ILP32-LABEL: define dso_local i32 @f_ret_float16arr1_s
1867 // ILP32-SAME: () #[[ATTR0]] {
1870 // ILP32F-ILP32D-LABEL: define dso_local half @f_ret_float16arr1_s
1871 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1872 // ILP32F-ILP32D: entry:
1874 struct float16arr1_s
f_ret_float16arr1_s(void) {
1875 return (struct float16arr1_s
){{1.0}};
1878 struct float16arr2_s
{ _Float16 a
[2]; };
1880 // ILP32-LABEL: define dso_local void @f_float16arr2_s_arg
1881 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1884 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16arr2_s_arg
1885 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], half [[TMP1:%.*]]) #[[ATTR0]] {
1886 // ILP32F-ILP32D: entry:
1888 void f_float16arr2_s_arg(struct float16arr2_s a
) {}
1890 // ILP32-LABEL: define dso_local i32 @f_ret_float16arr2_s
1891 // ILP32-SAME: () #[[ATTR0]] {
1894 // ILP32F-ILP32D-LABEL: define dso_local { half, half } @f_ret_float16arr2_s
1895 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1896 // ILP32F-ILP32D: entry:
1898 struct float16arr2_s
f_ret_float16arr2_s(void) {
1899 return (struct float16arr2_s
){{1.0, 2.0}};
1902 struct float16arr2_tricky1_s
{ struct { _Float16 f
[1]; } g
[2]; };
1904 // ILP32-LABEL: define dso_local void @f_float16arr2_tricky1_s_arg
1905 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1908 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16arr2_tricky1_s_arg
1909 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], half [[TMP1:%.*]]) #[[ATTR0]] {
1910 // ILP32F-ILP32D: entry:
1912 void f_float16arr2_tricky1_s_arg(struct float16arr2_tricky1_s a
) {}
1914 // ILP32-LABEL: define dso_local i32 @f_ret_float16arr2_tricky1_s
1915 // ILP32-SAME: () #[[ATTR0]] {
1918 // ILP32F-ILP32D-LABEL: define dso_local { half, half } @f_ret_float16arr2_tricky1_s
1919 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1920 // ILP32F-ILP32D: entry:
1922 struct float16arr2_tricky1_s
f_ret_float16arr2_tricky1_s(void) {
1923 return (struct float16arr2_tricky1_s
){{{{1.0}}, {{2.0}}}};
1926 struct float16arr2_tricky2_s
{ struct {}; struct { _Float16 f
[1]; } g
[2]; };
1928 // ILP32-LABEL: define dso_local void @f_float16arr2_tricky2_s_arg
1929 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1932 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16arr2_tricky2_s_arg
1933 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], half [[TMP1:%.*]]) #[[ATTR0]] {
1934 // ILP32F-ILP32D: entry:
1936 void f_float16arr2_tricky2_s_arg(struct float16arr2_tricky2_s a
) {}
1938 // ILP32-LABEL: define dso_local i32 @f_ret_float16arr2_tricky2_s
1939 // ILP32-SAME: () #[[ATTR0]] {
1942 // ILP32F-ILP32D-LABEL: define dso_local { half, half } @f_ret_float16arr2_tricky2_s
1943 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1944 // ILP32F-ILP32D: entry:
1946 struct float16arr2_tricky2_s
f_ret_float16arr2_tricky2_s(void) {
1947 return (struct float16arr2_tricky2_s
){{}, {{{1.0}}, {{2.0}}}};
1950 struct float16arr2_tricky3_s
{ union {}; struct { _Float16 f
[1]; } g
[2]; };
1952 // ILP32-LABEL: define dso_local void @f_float16arr2_tricky3_s_arg
1953 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1956 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16arr2_tricky3_s_arg
1957 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], half [[TMP1:%.*]]) #[[ATTR0]] {
1958 // ILP32F-ILP32D: entry:
1960 void f_float16arr2_tricky3_s_arg(struct float16arr2_tricky3_s a
) {}
1962 // ILP32-LABEL: define dso_local i32 @f_ret_float16arr2_tricky3_s
1963 // ILP32-SAME: () #[[ATTR0]] {
1966 // ILP32F-ILP32D-LABEL: define dso_local { half, half } @f_ret_float16arr2_tricky3_s
1967 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1968 // ILP32F-ILP32D: entry:
1970 struct float16arr2_tricky3_s
f_ret_float16arr2_tricky3_s(void) {
1971 return (struct float16arr2_tricky3_s
){{}, {{{1.0}}, {{2.0}}}};
1974 struct float16arr2_tricky4_s
{ union {}; struct { struct {}; _Float16 f
[1]; } g
[2]; };
1976 // ILP32-LABEL: define dso_local void @f_float16arr2_tricky4_s_arg
1977 // ILP32-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
1980 // ILP32F-ILP32D-LABEL: define dso_local void @f_float16arr2_tricky4_s_arg
1981 // ILP32F-ILP32D-SAME: (half [[TMP0:%.*]], half [[TMP1:%.*]]) #[[ATTR0]] {
1982 // ILP32F-ILP32D: entry:
1984 void f_float16arr2_tricky4_s_arg(struct float16arr2_tricky4_s a
) {}
1986 // ILP32-LABEL: define dso_local i32 @f_ret_float16arr2_tricky4_s
1987 // ILP32-SAME: () #[[ATTR0]] {
1990 // ILP32F-ILP32D-LABEL: define dso_local { half, half } @f_ret_float16arr2_tricky4_s
1991 // ILP32F-ILP32D-SAME: () #[[ATTR0]] {
1992 // ILP32F-ILP32D: entry:
1994 struct float16arr2_tricky4_s
f_ret_float16arr2_tricky4_s(void) {
1995 return (struct float16arr2_tricky4_s
){{}, {{{}, {1.0}}, {{}, {2.0}}}};
1998 // Test structs that should be passed according to the normal integer calling
2001 struct int_float16_int_s
{ int a
; _Float16 b
; int c
; };
2003 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_int_float16_int_s_arg
2004 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
2005 // ILP32-ILP32F-ILP32D: entry:
2007 void f_int_float16_int_s_arg(struct int_float16_int_s a
) {}
2009 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_int_float16_int_s
2010 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_INT_FLOAT16_INT_S:%.*]]) align 4 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
2011 // ILP32-ILP32F-ILP32D: entry:
2013 struct int_float16_int_s
f_ret_int_float16_int_s(void) {
2014 return (struct int_float16_int_s
){1, 2.0, 3};
2017 struct int64_float16_s
{ int64_t a
; _Float16 b
; };
2019 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_int64_float16_s_arg
2020 // ILP32-ILP32F-ILP32D-SAME: (ptr noundef [[A:%.*]]) #[[ATTR0]] {
2021 // ILP32-ILP32F-ILP32D: entry:
2023 void f_int64_float16_s_arg(struct int64_float16_s a
) {}
2025 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_ret_int64_float16_s
2026 // ILP32-ILP32F-ILP32D-SAME: (ptr dead_on_unwind noalias writable sret([[STRUCT_INT64_FLOAT16_S:%.*]]) align 8 [[AGG_RESULT:%.*]]) #[[ATTR0]] {
2027 // ILP32-ILP32F-ILP32D: entry:
2029 struct int64_float16_s
f_ret_int64_float16_s(void) {
2030 return (struct int64_float16_s
){1, 2.0};
2033 struct char_char_float16_s
{ char a
; char b
; _Float16 c
; };
2035 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_char_char_float16_s_arg
2036 // ILP32-ILP32F-ILP32D-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
2037 // ILP32-ILP32F-ILP32D: entry:
2039 void f_char_char_float16_s_arg(struct char_char_float16_s a
) {}
2041 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_ret_char_char_float16_s
2042 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
2043 // ILP32-ILP32F-ILP32D: entry:
2045 struct char_char_float16_s
f_ret_char_char_float16_s(void) {
2046 return (struct char_char_float16_s
){1, 2, 3.0};
2049 // Unions are always passed according to the integer calling convention, even
2050 // if they can only contain a double.
2052 union float16_u
{ _Float16 a
; };
2054 // ILP32-ILP32F-ILP32D-LABEL: define dso_local void @f_float16_u_arg
2055 // ILP32-ILP32F-ILP32D-SAME: (i32 [[A_COERCE:%.*]]) #[[ATTR0]] {
2056 // ILP32-ILP32F-ILP32D: entry:
2058 void f_float16_u_arg(union float16_u a
) {}
2060 // ILP32-ILP32F-ILP32D-LABEL: define dso_local i32 @f_ret_float16_u
2061 // ILP32-ILP32F-ILP32D-SAME: () #[[ATTR0]] {
2062 // ILP32-ILP32F-ILP32D: entry:
2064 union float16_u
f_ret_float16_u(void) {
2065 return (union float16_u
){1.0};
2068 //// NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: