2022-12-30 14:11:30 -06:00
|
|
|
//@ compile-flags: -C no-prepopulate-passes -Copt-level=0
|
2020-08-16 21:02:18 -05:00
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
2020-08-20 17:59:52 -05:00
|
|
|
#![feature(repr_simd)]
|
2020-08-16 21:02:18 -05:00
|
|
|
|
|
|
|
// Hack to get the correct size for the length part in slices
|
2022-12-30 14:11:30 -06:00
|
|
|
// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
|
2020-08-16 21:02:18 -05:00
|
|
|
#[no_mangle]
|
2024-05-28 23:11:20 -05:00
|
|
|
pub fn helper(_: usize) {}
|
2020-08-16 21:02:18 -05:00
|
|
|
|
|
|
|
// Check that we correctly generate a GEP for a ZST that is not included in Scalar layout
|
|
|
|
// CHECK-LABEL: @scalar_layout
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn scalar_layout(s: &(u64, ())) {
|
2024-05-28 23:11:20 -05:00
|
|
|
// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 8
|
2020-08-16 21:02:18 -05:00
|
|
|
let x = &s.1;
|
2022-12-06 12:58:05 -06:00
|
|
|
witness(&x); // keep variable in an alloca
|
2020-08-16 21:02:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check that we correctly generate a GEP for a ZST that is not included in ScalarPair layout
|
|
|
|
// CHECK-LABEL: @scalarpair_layout
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn scalarpair_layout(s: &(u64, u32, ())) {
|
2024-05-28 23:11:20 -05:00
|
|
|
// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 12
|
2020-08-16 21:02:18 -05:00
|
|
|
let x = &s.2;
|
2022-12-06 12:58:05 -06:00
|
|
|
witness(&x); // keep variable in an alloca
|
2020-08-16 21:02:18 -05:00
|
|
|
}
|
2020-08-20 17:59:52 -05:00
|
|
|
|
|
|
|
#[repr(simd)]
|
2024-08-22 03:28:20 -05:00
|
|
|
pub struct U64x4([u64; 4]);
|
2020-08-20 17:59:52 -05:00
|
|
|
|
|
|
|
// Check that we correctly generate a GEP for a ZST that is not included in Vector layout
|
|
|
|
// CHECK-LABEL: @vector_layout
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn vector_layout(s: &(U64x4, ())) {
|
2024-05-28 23:11:20 -05:00
|
|
|
// CHECK: getelementptr inbounds i8, {{.+}}, [[USIZE]] 32
|
2020-08-20 17:59:52 -05:00
|
|
|
let x = &s.1;
|
2022-12-06 12:58:05 -06:00
|
|
|
witness(&x); // keep variable in an alloca
|
2020-08-20 17:59:52 -05:00
|
|
|
}
|
2022-12-06 12:58:05 -06:00
|
|
|
|
|
|
|
#[inline(never)]
|
|
|
|
fn witness(_: &impl Sized) {}
|