2024-10-12 11:17:34 -05:00
|
|
|
// 32-bit systems will return 128bit values using a return area pointer.
|
|
|
|
//@ revisions: bit32 bit64
|
|
|
|
//@[bit32] only-32bit
|
|
|
|
//@[bit64] only-64bit
|
2022-12-30 14:11:30 -06:00
|
|
|
//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
|
2020-08-16 18:24:59 -05:00
|
|
|
|
|
|
|
// Test that tuples get optimized layout, in particular with a ZST in the last field (#63244)
|
|
|
|
|
2024-05-28 23:11:20 -05:00
|
|
|
#![crate_type = "lib"]
|
2020-08-16 18:24:59 -05:00
|
|
|
|
|
|
|
type ScalarZstLast = (u128, ());
|
2024-10-12 11:17:34 -05:00
|
|
|
// bit32: define {{(dso_local )?}}void @test_ScalarZstLast({{.*}} sret([16 x i8]) {{.*}}, i128 %_1)
|
|
|
|
// bit64: define {{(dso_local )?}}i128 @test_ScalarZstLast(i128 %_1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
2024-05-28 23:11:20 -05:00
|
|
|
pub fn test_ScalarZstLast(_: ScalarZstLast) -> ScalarZstLast {
|
|
|
|
loop {}
|
|
|
|
}
|
2020-08-16 18:24:59 -05:00
|
|
|
|
|
|
|
type ScalarZstFirst = ((), u128);
|
2024-10-12 11:17:34 -05:00
|
|
|
// bit32: define {{(dso_local )?}}void @test_ScalarZstFirst({{.*}} sret([16 x i8]) {{.*}}, i128 %_1)
|
|
|
|
// bit64: define {{(dso_local )?}}i128 @test_ScalarZstFirst(i128 %_1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
2024-05-28 23:11:20 -05:00
|
|
|
pub fn test_ScalarZstFirst(_: ScalarZstFirst) -> ScalarZstFirst {
|
|
|
|
loop {}
|
|
|
|
}
|
2020-08-16 18:24:59 -05:00
|
|
|
|
|
|
|
type ScalarPairZstLast = (u8, u128, ());
|
2024-10-17 04:43:21 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}void @test_ScalarPairZstLast(ptr sret({{[^,]*}})
|
2024-10-12 11:17:34 -05:00
|
|
|
// CHECK-SAME: %_0, i128 %_1.0, i8 %_1.1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
2024-05-28 23:11:20 -05:00
|
|
|
pub fn test_ScalarPairZstLast(_: ScalarPairZstLast) -> ScalarPairZstLast {
|
|
|
|
loop {}
|
|
|
|
}
|
2020-08-16 18:24:59 -05:00
|
|
|
|
|
|
|
type ScalarPairZstFirst = ((), u8, u128);
|
2024-10-17 04:43:21 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}void @test_ScalarPairZstFirst(ptr sret({{[^,]*}})
|
2024-10-12 11:17:34 -05:00
|
|
|
// CHECK-SAME: %_0, i8 %_1.0, i128 %_1.1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
2024-05-28 23:11:20 -05:00
|
|
|
pub fn test_ScalarPairZstFirst(_: ScalarPairZstFirst) -> ScalarPairZstFirst {
|
|
|
|
loop {}
|
|
|
|
}
|
2020-08-16 18:24:59 -05:00
|
|
|
|
|
|
|
type ScalarPairLotsOfZsts = ((), u8, (), u128, ());
|
2024-10-17 04:43:21 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}void @test_ScalarPairLotsOfZsts(ptr sret({{[^,]*}})
|
2024-10-12 11:17:34 -05:00
|
|
|
// CHECK-SAME: %_0, i128 %_1.0, i8 %_1.1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
2024-05-28 23:11:20 -05:00
|
|
|
pub fn test_ScalarPairLotsOfZsts(_: ScalarPairLotsOfZsts) -> ScalarPairLotsOfZsts {
|
|
|
|
loop {}
|
|
|
|
}
|
2020-08-16 18:24:59 -05:00
|
|
|
|
|
|
|
type ScalarPairLottaNesting = (((), ((), u8, (), u128, ())), ());
|
2024-10-17 04:43:21 -05:00
|
|
|
// CHECK: define {{(dso_local )?}}void @test_ScalarPairLottaNesting(ptr sret({{[^,]*}})
|
2024-10-12 11:17:34 -05:00
|
|
|
// CHECK-SAME: %_0, i128 %_1.0, i8 %_1.1)
|
2020-08-16 18:24:59 -05:00
|
|
|
#[no_mangle]
|
2024-05-28 23:11:20 -05:00
|
|
|
pub fn test_ScalarPairLottaNesting(_: ScalarPairLottaNesting) -> ScalarPairLottaNesting {
|
|
|
|
loop {}
|
|
|
|
}
|