|
| 1 | +//@ revisions: aarch64-linux aarch64-darwin |
| 2 | +//@ compile-flags: -O -C no-prepopulate-passes |
| 3 | + |
| 4 | +//@[aarch64-linux] compile-flags: --target aarch64-unknown-linux-gnu |
| 5 | +//@[aarch64-linux] needs-llvm-components: aarch64 |
| 6 | +//@[aarch64-darwin] compile-flags: --target aarch64-apple-darwin |
| 7 | +//@[aarch64-darwin] needs-llvm-components: aarch64 |
| 8 | + |
| 9 | +// See ./transparent.rs |
| 10 | +// Some platforms pass large aggregates using immediate arrays in LLVMIR |
| 11 | +// Other platforms pass large aggregates using by-value struct pointer in LLVMIR |
| 12 | +// Yet more platforms pass large aggregates using opaque pointer in LLVMIR |
| 13 | +// This covers the "opaque pointer" case. |
| 14 | + |
| 15 | +#![feature(no_core, lang_items, transparent_unions)] |
| 16 | +#![crate_type = "lib"] |
| 17 | +#![no_std] |
| 18 | +#![no_core] |
| 19 | + |
| 20 | +#[lang = "sized"] |
| 21 | +trait Sized {} |
| 22 | +#[lang = "freeze"] |
| 23 | +trait Freeze {} |
| 24 | +#[lang = "copy"] |
| 25 | +trait Copy {} |
| 26 | + |
| 27 | +impl Copy for [u32; 16] {} |
| 28 | +impl Copy for BigS {} |
| 29 | +impl Copy for BigU {} |
| 30 | + |
| 31 | +#[repr(C)] |
| 32 | +pub struct BigS([u32; 16]); |
| 33 | + |
| 34 | +#[repr(transparent)] |
| 35 | +pub struct TsBigS(BigS); |
| 36 | + |
| 37 | +#[repr(transparent)] |
| 38 | +pub union TuBigS { |
| 39 | + field: BigS, |
| 40 | +} |
| 41 | + |
| 42 | +#[repr(transparent)] |
| 43 | +pub enum TeBigS { |
| 44 | + Variant(BigS), |
| 45 | +} |
| 46 | + |
| 47 | +// CHECK: define{{.*}}void @test_BigS(ptr [[BIGS_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGS_RET_ATTRS2:.*]], ptr [[BIGS_ARG_ATTRS1:.*]]) |
| 48 | +#[no_mangle] |
| 49 | +pub extern "C" fn test_BigS(_: BigS) -> BigS { |
| 50 | + loop {} |
| 51 | +} |
| 52 | + |
| 53 | +// CHECK: define{{.*}}void @test_TsBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]]) |
| 54 | +#[no_mangle] |
| 55 | +pub extern "C" fn test_TsBigS(_: TsBigS) -> TsBigS { |
| 56 | + loop {} |
| 57 | +} |
| 58 | + |
| 59 | +// CHECK: define{{.*}}void @test_TuBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]]) |
| 60 | +#[no_mangle] |
| 61 | +pub extern "C" fn test_TuBigS(_: TuBigS) -> TuBigS { |
| 62 | + loop {} |
| 63 | +} |
| 64 | + |
| 65 | +// CHECK: define{{.*}}void @test_TeBigS(ptr [[BIGS_RET_ATTRS1]] sret([64 x i8]) [[BIGS_RET_ATTRS2]], ptr [[BIGS_ARG_ATTRS1]]) |
| 66 | +#[no_mangle] |
| 67 | +pub extern "C" fn test_TeBigS(_: TeBigS) -> TeBigS { |
| 68 | + loop {} |
| 69 | +} |
| 70 | + |
| 71 | +#[repr(C)] |
| 72 | +pub union BigU { |
| 73 | + foo: [u32; 16], |
| 74 | +} |
| 75 | + |
| 76 | +#[repr(transparent)] |
| 77 | +pub struct TsBigU(BigU); |
| 78 | + |
| 79 | +#[repr(transparent)] |
| 80 | +pub union TuBigU { |
| 81 | + field: BigU, |
| 82 | +} |
| 83 | + |
| 84 | +#[repr(transparent)] |
| 85 | +pub enum TeBigU { |
| 86 | + Variant(BigU), |
| 87 | +} |
| 88 | + |
| 89 | +// CHECK: define{{.*}}void @test_BigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1:.*]]) |
| 90 | +#[no_mangle] |
| 91 | +pub extern "C" fn test_BigU(_: BigU) -> BigU { |
| 92 | + loop {} |
| 93 | +} |
| 94 | + |
| 95 | +// CHECK: define{{.*}}void @test_TsBigU(ptr [[BIGU_RET_ATTRS1:.*]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]]) |
| 96 | +#[no_mangle] |
| 97 | +pub extern "C" fn test_TsBigU(_: TsBigU) -> TsBigU { |
| 98 | + loop {} |
| 99 | +} |
| 100 | + |
| 101 | +// CHECK: define{{.*}}void @test_TuBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]]) |
| 102 | +#[no_mangle] |
| 103 | +pub extern "C" fn test_TuBigU(_: TuBigU) -> TuBigU { |
| 104 | + loop {} |
| 105 | +} |
| 106 | + |
| 107 | +// CHECK: define{{.*}}void @test_TeBigU(ptr [[BIGU_RET_ATTRS1]] sret([64 x i8]) [[BIGU_RET_ATTRS2:.*]], ptr [[BIGU_ARG_ATTRS1]]) |
| 108 | +#[no_mangle] |
| 109 | +pub extern "C" fn test_TeBigU(_: TeBigU) -> TeBigU { |
| 110 | + loop {} |
| 111 | +} |
0 commit comments