// #target: linux-riscv32
// #opt: --riscvfloat=float
module test;
struct Tiny {
  char a, b, c, d;
}

struct Small {
  int a;
  int* b;
}

struct Small_aligned {
  long a;
}

struct Large {
  int a, b, c, d;
}

// Scalars passed on the stack should not have signext/zeroext attributes
// (they are anyext).

fn int f_scalar_stack_1(int a, long b, int c, double d, float128 e,
                     char f, ichar g, char h) {
  return g + h;
}

// Ensure that scalars passed on the stack are still determined correctly in
// the presence of large return values that consume a register due to the need
// to pass a pointer.

fn Large f_scalar_stack_2(int a, long b, double c, float128 d,
                              char e, ichar f, char g) {
  return {a, e, f, g};
}

// Aggregates and >=XLen scalars passed on the stack should be lowered just as
// they would be if passed via registers.

fn void f_scalar_stack_3(double a, long b, double c, long d, int e,
                      long f, int g, double h, float128 i) {}

fn void f_agg_stack(double a, long b, double c, long d, Tiny e,
                 Small f, Small_aligned g, Large h) {}

/* #expect: test.ll

define i32 @test.f_scalar_stack_1(i32 %0, i64 %1, i32 %2, double %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7)

define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, double %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7)

define void @test.f_scalar_stack_3(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, i32 %6, double %7, fp128 %8)

define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7)


