1 // RUN: %clang_cc1 -triple riscv32 -target-feature +f -target-abi ilp32f -emit-llvm %s -o - \
2 // RUN: | FileCheck %s
3
4 #include <stdint.h>
5
6 // Doubles are still passed in GPRs, so the 'e' argument will be anyext as
7 // GPRs are exhausted.
8
9 // CHECK: define void @f_fpr_tracking(double %a, double %b, double %c, double %d, i8 %e)
f_fpr_tracking(double a,double b,double c,double d,int8_t e)10 void f_fpr_tracking(double a, double b, double c, double d, int8_t e) {}
11
12 // Lowering for doubles is unnmodified, as 64 > FLEN.
13
14 struct double_s { double d; };
15
16 // CHECK: define void @f_double_s_arg(i64 %a.coerce)
f_double_s_arg(struct double_s a)17 void f_double_s_arg(struct double_s a) {}
18
19 // CHECK: define i64 @f_ret_double_s()
f_ret_double_s()20 struct double_s f_ret_double_s() {
21 return (struct double_s){1.0};
22 }
23
24 struct double_double_s { double d; double e; };
25
26 // CHECK: define void @f_double_double_s_arg(%struct.double_double_s* %a)
f_double_double_s_arg(struct double_double_s a)27 void f_double_double_s_arg(struct double_double_s a) {}
28
29 // CHECK: define void @f_ret_double_double_s(%struct.double_double_s* noalias sret(%struct.double_double_s) align 8 %agg.result)
f_ret_double_double_s()30 struct double_double_s f_ret_double_double_s() {
31 return (struct double_double_s){1.0, 2.0};
32 }
33
34 struct double_int8_s { double d; int64_t i; };
35
36 struct int_double_s { int a; double b; };
37
38 // CHECK: define void @f_int_double_s_arg(%struct.int_double_s* %a)
f_int_double_s_arg(struct int_double_s a)39 void f_int_double_s_arg(struct int_double_s a) {}
40
41 // CHECK: define void @f_ret_int_double_s(%struct.int_double_s* noalias sret(%struct.int_double_s) align 8 %agg.result)
f_ret_int_double_s()42 struct int_double_s f_ret_int_double_s() {
43 return (struct int_double_s){1, 2.0};
44 }
45
46