2019-07-19 02:29:59 +08:00
|
|
|
// RUN: %clang_cc1 -triple riscv32 -target-feature +d -target-abi ilp32d -emit-llvm %s -o - \
|
|
|
|
// RUN: | FileCheck %s
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
// Verify that the tracking of used GPRs and FPRs works correctly by checking
|
|
|
|
// that small integers are sign/zero extended when passed in registers.
|
|
|
|
|
|
|
|
// Doubles are passed in FPRs, so argument 'i' will be passed zero-extended
|
|
|
|
// because it will be passed in a GPR.
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} void @f_fpr_tracking(double %a, double %b, double %c, double %d, double %e, double %f, double %g, double %h, i8 zeroext %i)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_fpr_tracking(double a, double b, double c, double d, double e, double f,
|
|
|
|
double g, double h, uint8_t i) {}
|
|
|
|
|
|
|
|
// Check that fp, fp+fp, and int+fp structs are lowered correctly. These will
|
|
|
|
// be passed in FPR, FPR+FPR, or GPR+FPR regs if sufficient registers are
|
|
|
|
// available the widths are <= XLEN and FLEN, and should be expanded to
|
|
|
|
// separate arguments in IR. They are passed by the same rules for returns,
|
|
|
|
// but will be lowered to simple two-element structs if necessary (as LLVM IR
|
|
|
|
// functions cannot return multiple values).
|
|
|
|
|
|
|
|
// A struct containing just one floating-point real is passed as though it
|
|
|
|
// were a standalone floating-point real.
|
|
|
|
|
|
|
|
struct double_s { double f; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_s_arg(double %0)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_s_arg(struct double_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} double @f_ret_double_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_s f_ret_double_s() {
|
|
|
|
return (struct double_s){1.0};
|
|
|
|
}
|
|
|
|
|
|
|
|
// A struct containing a double and any number of zero-width bitfields is
|
|
|
|
// passed as though it were a standalone floating-point real.
|
|
|
|
|
|
|
|
struct zbf_double_s { int : 0; double f; };
|
|
|
|
struct zbf_double_zbf_s { int : 0; double f; int : 0; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_zbf_double_s_arg(double %0)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_zbf_double_s_arg(struct zbf_double_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} double @f_ret_zbf_double_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct zbf_double_s f_ret_zbf_double_s() {
|
|
|
|
return (struct zbf_double_s){1.0};
|
|
|
|
}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_zbf_double_zbf_s_arg(double %0)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_zbf_double_zbf_s_arg(struct zbf_double_zbf_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} double @f_ret_zbf_double_zbf_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct zbf_double_zbf_s f_ret_zbf_double_zbf_s() {
|
|
|
|
return (struct zbf_double_zbf_s){1.0};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that structs containing two floating point values (FLEN <= width) are
|
|
|
|
// expanded provided sufficient FPRs are available.
|
|
|
|
|
|
|
|
struct double_double_s { double f; double g; };
|
|
|
|
struct double_float_s { double f; float g; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_double_s_arg(double %0, double %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_double_s_arg(struct double_double_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_double_double_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_double_s f_ret_double_double_s() {
|
|
|
|
return (struct double_double_s){1.0, 2.0};
|
|
|
|
}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_float_s_arg(double %0, float %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_float_s_arg(struct double_float_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, float } @f_ret_double_float_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_float_s f_ret_double_float_s() {
|
|
|
|
return (struct double_float_s){1.0, 2.0};
|
|
|
|
}
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_double_s_arg_insufficient_fprs(float %a, double %b, double %c, double %d, double %e, double %f, double %g, %struct.double_double_s* %h)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_double_s_arg_insufficient_fprs(float a, double b, double c, double d,
|
|
|
|
double e, double f, double g, struct double_double_s h) {}
|
|
|
|
|
|
|
|
// Check that structs containing int+double values are expanded, provided
|
|
|
|
// sufficient FPRs and GPRs are available. The integer components are neither
|
|
|
|
// sign or zero-extended.
|
|
|
|
|
|
|
|
struct double_int8_s { double f; int8_t i; };
|
|
|
|
struct double_uint8_s { double f; uint8_t i; };
|
|
|
|
struct double_int32_s { double f; int32_t i; };
|
|
|
|
struct double_int64_s { double f; int64_t i; };
|
|
|
|
struct double_int64bf_s { double f; int64_t i : 32; };
|
|
|
|
struct double_int8_zbf_s { double f; int8_t i; int : 0; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_int8_s_arg(double %0, i8 %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_int8_s_arg(struct double_int8_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, i8 } @f_ret_double_int8_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_int8_s f_ret_double_int8_s() {
|
|
|
|
return (struct double_int8_s){1.0, 2};
|
|
|
|
}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_uint8_s_arg(double %0, i8 %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_uint8_s_arg(struct double_uint8_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, i8 } @f_ret_double_uint8_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_uint8_s f_ret_double_uint8_s() {
|
|
|
|
return (struct double_uint8_s){1.0, 2};
|
|
|
|
}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_int32_s_arg(double %0, i32 %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_int32_s_arg(struct double_int32_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, i32 } @f_ret_double_int32_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_int32_s f_ret_double_int32_s() {
|
|
|
|
return (struct double_int32_s){1.0, 2};
|
|
|
|
}
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_int64_s_arg(%struct.double_int64_s* %a)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_int64_s_arg(struct double_int64_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_ret_double_int64_s(%struct.double_int64_s* noalias sret(%struct.double_int64_s) align 8 %agg.result)
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_int64_s f_ret_double_int64_s() {
|
|
|
|
return (struct double_int64_s){1.0, 2};
|
|
|
|
}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_int64bf_s_arg(double %0, i32 %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_int64bf_s_arg(struct double_int64bf_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, i32 } @f_ret_double_int64bf_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_int64bf_s f_ret_double_int64bf_s() {
|
|
|
|
return (struct double_int64bf_s){1.0, 2};
|
|
|
|
}
|
|
|
|
|
|
|
|
// The zero-width bitfield means the struct can't be passed according to the
|
|
|
|
// floating point calling convention.
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_int8_zbf_s(double %0, i8 %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_int8_zbf_s(struct double_int8_zbf_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, i8 } @f_ret_double_int8_zbf_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct double_int8_zbf_s f_ret_double_int8_zbf_s() {
|
|
|
|
return (struct double_int8_zbf_s){1.0, 2};
|
|
|
|
}
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_int8_s_arg_insufficient_gprs(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, i32 %h, %struct.double_int8_s* %i)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_int8_s_arg_insufficient_gprs(int a, int b, int c, int d, int e,
|
|
|
|
int f, int g, int h, struct double_int8_s i) {}
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} void @f_struct_double_int8_insufficient_fprs(float %a, double %b, double %c, double %d, double %e, double %f, double %g, double %h, %struct.double_int8_s* %i)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_struct_double_int8_insufficient_fprs(float a, double b, double c, double d,
|
|
|
|
double e, double f, double g, double h, struct double_int8_s i) {}
|
|
|
|
|
|
|
|
// Complex floating-point values or structs containing a single complex
|
|
|
|
// floating-point value should be passed as if it were an fp+fp struct.
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} void @f_doublecomplex(double %a.coerce0, double %a.coerce1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_doublecomplex(double __complex__ a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_doublecomplex()
|
2019-07-19 02:29:59 +08:00
|
|
|
double __complex__ f_ret_doublecomplex() {
|
|
|
|
return 1.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct doublecomplex_s { double __complex__ c; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_doublecomplex_s_arg(double %0, double %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_doublecomplex_s_arg(struct doublecomplex_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_doublecomplex_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct doublecomplex_s f_ret_doublecomplex_s() {
|
|
|
|
return (struct doublecomplex_s){1.0};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test single or two-element structs that need flattening. e.g. those
|
|
|
|
// containing nested structs, doubles in small arrays, zero-length structs etc.
|
|
|
|
|
|
|
|
struct doublearr1_s { double a[1]; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_doublearr1_s_arg(double %0)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_doublearr1_s_arg(struct doublearr1_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} double @f_ret_doublearr1_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct doublearr1_s f_ret_doublearr1_s() {
|
|
|
|
return (struct doublearr1_s){{1.0}};
|
|
|
|
}
|
|
|
|
|
|
|
|
struct doublearr2_s { double a[2]; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_doublearr2_s_arg(double %0, double %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_doublearr2_s_arg(struct doublearr2_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_doublearr2_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct doublearr2_s f_ret_doublearr2_s() {
|
|
|
|
return (struct doublearr2_s){{1.0, 2.0}};
|
|
|
|
}
|
|
|
|
|
|
|
|
struct doublearr2_tricky1_s { struct { double f[1]; } g[2]; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_doublearr2_tricky1_s_arg(double %0, double %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_doublearr2_tricky1_s_arg(struct doublearr2_tricky1_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_doublearr2_tricky1_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct doublearr2_tricky1_s f_ret_doublearr2_tricky1_s() {
|
|
|
|
return (struct doublearr2_tricky1_s){{{{1.0}}, {{2.0}}}};
|
|
|
|
}
|
|
|
|
|
|
|
|
struct doublearr2_tricky2_s { struct {}; struct { double f[1]; } g[2]; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_doublearr2_tricky2_s_arg(double %0, double %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_doublearr2_tricky2_s_arg(struct doublearr2_tricky2_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_doublearr2_tricky2_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct doublearr2_tricky2_s f_ret_doublearr2_tricky2_s() {
|
|
|
|
return (struct doublearr2_tricky2_s){{}, {{{1.0}}, {{2.0}}}};
|
|
|
|
}
|
|
|
|
|
|
|
|
struct doublearr2_tricky3_s { union {}; struct { double f[1]; } g[2]; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_doublearr2_tricky3_s_arg(double %0, double %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_doublearr2_tricky3_s_arg(struct doublearr2_tricky3_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_doublearr2_tricky3_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct doublearr2_tricky3_s f_ret_doublearr2_tricky3_s() {
|
|
|
|
return (struct doublearr2_tricky3_s){{}, {{{1.0}}, {{2.0}}}};
|
|
|
|
}
|
|
|
|
|
|
|
|
struct doublearr2_tricky4_s { union {}; struct { struct {}; double f[1]; } g[2]; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_doublearr2_tricky4_s_arg(double %0, double %1)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_doublearr2_tricky4_s_arg(struct doublearr2_tricky4_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_doublearr2_tricky4_s()
|
2019-07-19 02:29:59 +08:00
|
|
|
struct doublearr2_tricky4_s f_ret_doublearr2_tricky4_s() {
|
|
|
|
return (struct doublearr2_tricky4_s){{}, {{{}, {1.0}}, {{}, {2.0}}}};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test structs that should be passed according to the normal integer calling
|
|
|
|
// convention.
|
|
|
|
|
|
|
|
struct int_double_int_s { int a; double b; int c; };
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} void @f_int_double_int_s_arg(%struct.int_double_int_s* %a)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_int_double_int_s_arg(struct int_double_int_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_ret_int_double_int_s(%struct.int_double_int_s* noalias sret(%struct.int_double_int_s) align 8 %agg.result)
|
2019-07-19 02:29:59 +08:00
|
|
|
struct int_double_int_s f_ret_int_double_int_s() {
|
|
|
|
return (struct int_double_int_s){1, 2.0, 3};
|
|
|
|
}
|
|
|
|
|
|
|
|
struct int64_double_s { int64_t a; double b; };
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} void @f_int64_double_s_arg(%struct.int64_double_s* %a)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_int64_double_s_arg(struct int64_double_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_ret_int64_double_s(%struct.int64_double_s* noalias sret(%struct.int64_double_s) align 8 %agg.result)
|
2019-07-19 02:29:59 +08:00
|
|
|
struct int64_double_s f_ret_int64_double_s() {
|
|
|
|
return (struct int64_double_s){1, 2.0};
|
|
|
|
}
|
|
|
|
|
|
|
|
struct char_char_double_s { char a; char b; double c; };
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK-LABEL: define{{.*}} void @f_char_char_double_s_arg(%struct.char_char_double_s* %a)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_char_char_double_s_arg(struct char_char_double_s a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_ret_char_char_double_s(%struct.char_char_double_s* noalias sret(%struct.char_char_double_s) align 8 %agg.result)
|
2019-07-19 02:29:59 +08:00
|
|
|
struct char_char_double_s f_ret_char_char_double_s() {
|
|
|
|
return (struct char_char_double_s){1, 2, 3.0};
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unions are always passed according to the integer calling convention, even
|
|
|
|
// if they can only contain a double.
|
|
|
|
|
|
|
|
union double_u { double a; };
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} void @f_double_u_arg(i64 %a.coerce)
|
2019-07-19 02:29:59 +08:00
|
|
|
void f_double_u_arg(union double_u a) {}
|
|
|
|
|
2020-12-31 16:27:11 +08:00
|
|
|
// CHECK: define{{.*}} i64 @f_ret_double_u()
|
2019-07-19 02:29:59 +08:00
|
|
|
union double_u f_ret_double_u() {
|
|
|
|
return (union double_u){1.0};
|
|
|
|
}
|
[RISCV] Fix ILP32D lowering for double+double/double+int return types
Summary:
Previously, since these aggregates are > 2*XLen, Clang would think they
were being returned indirectly and thus would decrease the number of
available GPRs available by 1. For long argument lists this could lead
to a struct argument incorrectly being passed indirectly.
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: luismarques, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69590
2020-01-14 19:17:19 +08:00
|
|
|
|
|
|
|
// Test that we don't incorrectly think double+int/double+double structs will
|
|
|
|
// be returned indirectly and thus have an off-by-one error for the number of
|
|
|
|
// GPRs available (this is an edge case when structs > 2*XLEN are still
|
|
|
|
// returned in registers). This includes complex doubles, which are treated as
|
|
|
|
// double+double structs by the ABI.
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} { double, i32 } @f_ret_double_int32_s_double_int32_s_just_sufficient_gprs(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, double %0, i32 %1)
|
[RISCV] Fix ILP32D lowering for double+double/double+int return types
Summary:
Previously, since these aggregates are > 2*XLen, Clang would think they
were being returned indirectly and thus would decrease the number of
available GPRs available by 1. For long argument lists this could lead
to a struct argument incorrectly being passed indirectly.
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: luismarques, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69590
2020-01-14 19:17:19 +08:00
|
|
|
struct double_int32_s f_ret_double_int32_s_double_int32_s_just_sufficient_gprs(
|
|
|
|
int a, int b, int c, int d, int e, int f, int g, struct double_int32_s h) {
|
|
|
|
return (struct double_int32_s){1.0, 2};
|
|
|
|
}
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_double_double_s_double_int32_s_just_sufficient_gprs(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, double %0, i32 %1)
|
[RISCV] Fix ILP32D lowering for double+double/double+int return types
Summary:
Previously, since these aggregates are > 2*XLen, Clang would think they
were being returned indirectly and thus would decrease the number of
available GPRs available by 1. For long argument lists this could lead
to a struct argument incorrectly being passed indirectly.
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: luismarques, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69590
2020-01-14 19:17:19 +08:00
|
|
|
struct double_double_s f_ret_double_double_s_double_int32_s_just_sufficient_gprs(
|
|
|
|
int a, int b, int c, int d, int e, int f, int g, struct double_int32_s h) {
|
|
|
|
return (struct double_double_s){1.0, 2.0};
|
|
|
|
}
|
|
|
|
|
2021-10-18 22:03:47 +08:00
|
|
|
// CHECK: define{{.*}} { double, double } @f_ret_doublecomplex_double_int32_s_just_sufficient_gprs(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e, i32 %f, i32 %g, double %0, i32 %1)
|
[RISCV] Fix ILP32D lowering for double+double/double+int return types
Summary:
Previously, since these aggregates are > 2*XLen, Clang would think they
were being returned indirectly and thus would decrease the number of
available GPRs available by 1. For long argument lists this could lead
to a struct argument incorrectly being passed indirectly.
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: luismarques, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, lenary, s.egerton, pzheng, sameer.abuasal, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69590
2020-01-14 19:17:19 +08:00
|
|
|
double __complex__ f_ret_doublecomplex_double_int32_s_just_sufficient_gprs(
|
|
|
|
int a, int b, int c, int d, int e, int f, int g, struct double_int32_s h) {
|
|
|
|
return 1.0;
|
|
|
|
}
|