Files
c3c/test/test_suite/abi/riscv64-lp64-lp64f-abi-1.c3t
2023-03-01 22:43:50 +01:00

51 lines
1.7 KiB
C

// #target: linux-riscv64
module test;
struct Large {
long 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, int128 b, double c, float128 d, char[<32>] 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(double a, int128 b, float128 c, char[<32>] d,
char e, ichar f, char g) {
return {(long)a, e, f, g};
}
/* #expect: test.ll
define signext i32 @test.f_scalar_stack_1(i32 signext %0, i128 %1, double %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) #0 {
entry:
%sext = sext i8 %6 to i32
%zext = zext i8 %7 to i32
%add = add i32 %sext, %zext
ret i32 %add
}
define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 8 %0, double %1, i128 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) #0 {
entry:
%literal = alloca %Large, align 8
%8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0
%fpsi = fptosi double %1 to i64
store i64 %fpsi, ptr %8, align 8
%9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1
%zext = zext i8 %5 to i64
store i64 %zext, ptr %9, align 8
%10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2
%sext = sext i8 %6 to i64
store i64 %sext, ptr %10, align 8
%11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3
%zext1 = zext i8 %7 to i64
store i64 %zext1, ptr %11, align 8
call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 32, i1 false)
ret void
}