]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/repr-transparent-aggregates-2.rs
Merge commit '40dd3e2b7089b5e96714e064b731f6dbf17c61a9' into sync_cg_clif-2021-05-27
[rust.git] / src / test / codegen / repr-transparent-aggregates-2.rs
1 // compile-flags: -C no-prepopulate-passes
2 //
3
4 // min-system-llvm-version: 12.0
5 // ignore-aarch64
6 // ignore-emscripten
7 // ignore-mips64
8 // ignore-powerpc
9 // ignore-powerpc64
10 // ignore-powerpc64le
11 // ignore-riscv64 see codegen/riscv-abi
12 // ignore-s390x
13 // ignore-sparc
14 // ignore-sparc64
15 // ignore-x86
16 // ignore-x86_64
17 // See repr-transparent.rs
18
19 #![feature(transparent_unions)]
20
21 #![crate_type="lib"]
22
23
24 #[derive(Clone, Copy)]
25 #[repr(C)]
26 pub struct BigS([u32; 16]);
27
28 #[repr(transparent)]
29 pub struct TsBigS(BigS);
30
31 #[repr(transparent)]
32 pub union TuBigS {
33     field: BigS,
34 }
35
36 #[repr(transparent)]
37 pub enum TeBigS {
38     Variant(BigS),
39 }
40
41 // CHECK: define void @test_BigS(%BigS* [[BIGS_RET_ATTRS1:.*]] sret(%BigS) [[BIGS_RET_ATTRS2:.*]], [16 x i32]
42 #[no_mangle]
43 pub extern fn test_BigS(_: BigS) -> BigS { loop {} }
44
45 // CHECK: define void @test_TsBigS(%TsBigS* [[BIGS_RET_ATTRS1]] sret(%TsBigS) [[BIGS_RET_ATTRS2]], [16 x i32]
46 #[no_mangle]
47 pub extern fn test_TsBigS(_: TsBigS) -> TsBigS { loop {} }
48
49 // CHECK: define void @test_TuBigS(%TuBigS* [[BIGS_RET_ATTRS1]] sret(%TuBigS) [[BIGS_RET_ATTRS2]], [16 x i32]
50 #[no_mangle]
51 pub extern fn test_TuBigS(_: TuBigS) -> TuBigS { loop {} }
52
53 // CHECK: define void @test_TeBigS(%"TeBigS::Variant"* [[BIGS_RET_ATTRS1]] sret(%"TeBigS::Variant") [[BIGS_RET_ATTRS2]], [16 x i32]
54 #[no_mangle]
55 pub extern fn test_TeBigS(_: TeBigS) -> TeBigS { loop {} }
56
57
58 #[derive(Clone, Copy)]
59 #[repr(C)]
60 pub union BigU {
61     foo: [u32; 16],
62 }
63
64 #[repr(transparent)]
65 pub struct TsBigU(BigU);
66
67 #[repr(transparent)]
68 pub union TuBigU {
69     field: BigU,
70 }
71
72 #[repr(transparent)]
73 pub enum TeBigU {
74     Variant(BigU),
75 }
76
77 // CHECK: define void @test_BigU(%BigU* [[BIGU_RET_ATTRS1:.*]] sret(%BigU) [[BIGU_RET_ATTRS2:.*]], [16 x i32]
78 #[no_mangle]
79 pub extern fn test_BigU(_: BigU) -> BigU { loop {} }
80
81 // CHECK: define void @test_TsBigU(%TsBigU* [[BIGU_RET_ATTRS1]] sret(%TsBigU) [[BIGU_RET_ATTRS2]], [16 x i32]
82 #[no_mangle]
83 pub extern fn test_TsBigU(_: TsBigU) -> TsBigU { loop {} }
84
85 // CHECK: define void @test_TuBigU(%TuBigU* [[BIGU_RET_ATTRS1]] sret(%TuBigU) [[BIGU_RET_ATTRS2]], [16 x i32]
86 #[no_mangle]
87 pub extern fn test_TuBigU(_: TuBigU) -> TuBigU { loop {} }
88
89 // CHECK: define void @test_TeBigU(%"TeBigU::Variant"* [[BIGU_RET_ATTRS1]] sret(%"TeBigU::Variant") [[BIGU_RET_ATTRS2]], [16 x i32]
90 #[no_mangle]
91 pub extern fn test_TeBigU(_: TeBigU) -> TeBigU { loop {} }