]> git.proxmox.com Git - rustc.git/blame - src/test/codegen/zst-offset.rs
Update unsuspicious file list
[rustc.git] / src / test / codegen / zst-offset.rs
CommitLineData
1b1a35ee
XL
1// compile-flags: -C no-prepopulate-passes
2
3#![crate_type = "lib"]
4#![feature(repr_simd)]
5
6// Hack to get the correct size for the length part in slices
7// CHECK: @helper([[USIZE:i[0-9]+]] %_1)
8#[no_mangle]
9pub fn helper(_: usize) {
10}
11
12// Check that we correctly generate a GEP for a ZST that is not included in Scalar layout
13// CHECK-LABEL: @scalar_layout
14#[no_mangle]
15pub fn scalar_layout(s: &(u64, ())) {
923072b8 16// CHECK: getelementptr i8, {{.+}}, [[USIZE]] 8
1b1a35ee
XL
17 let x = &s.1;
18 &x; // keep variable in an alloca
19}
20
21// Check that we correctly generate a GEP for a ZST that is not included in ScalarPair layout
22// CHECK-LABEL: @scalarpair_layout
23#[no_mangle]
24pub fn scalarpair_layout(s: &(u64, u32, ())) {
923072b8 25// CHECK: getelementptr i8, {{.+}}, [[USIZE]] 12
1b1a35ee
XL
26 let x = &s.2;
27 &x; // keep variable in an alloca
28}
29
30#[repr(simd)]
31pub struct U64x4(u64, u64, u64, u64);
32
33// Check that we correctly generate a GEP for a ZST that is not included in Vector layout
34// CHECK-LABEL: @vector_layout
35#[no_mangle]
36pub fn vector_layout(s: &(U64x4, ())) {
923072b8 37// CHECK: getelementptr i8, {{.+}}, [[USIZE]] 32
1b1a35ee
XL
38 let x = &s.1;
39 &x; // keep variable in an alloca
40}