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