|
1 | | -// ignore-x86 |
2 | | -// ignore-aarch64 |
3 | | -// ignore-aarch64_be |
4 | | -// ignore-arm |
5 | | -// ignore-armeb |
6 | | -// ignore-avr |
7 | | -// ignore-bpfel |
8 | | -// ignore-bpfeb |
9 | | -// ignore-hexagon |
10 | | -// ignore-mips |
11 | | -// ignore-mips64 |
12 | | -// ignore-msp430 |
13 | | -// ignore-powerpc64 |
14 | | -// ignore-powerpc64le |
15 | | -// ignore-powerpc |
16 | | -// ignore-r600 |
17 | | -// ignore-amdgcn |
18 | | -// ignore-sparc |
19 | | -// ignore-sparcv9 |
20 | | -// ignore-sparcel |
21 | | -// ignore-s390x |
22 | | -// ignore-tce |
23 | | -// ignore-thumb |
24 | | -// ignore-thumbeb |
25 | | -// ignore-xcore |
26 | | -// ignore-nvptx |
27 | | -// ignore-nvptx64 |
28 | | -// ignore-le32 |
29 | | -// ignore-le64 |
30 | | -// ignore-amdil |
31 | | -// ignore-amdil64 |
32 | | -// ignore-hsail |
33 | | -// ignore-hsail64 |
34 | | -// ignore-spir |
35 | | -// ignore-spir64 |
36 | | -// ignore-kalimba |
37 | | -// ignore-shave |
38 | | -// |
| 1 | +// revisions:m68k wasm x86_64-linux x86_64-windows |
| 2 | + |
| 3 | +//[m68k] compile-flags: --target m68k-unknown-linux-gnu |
| 4 | +//[m68k] needs-llvm-components: m68k |
| 5 | +//[wasm] compile-flags: --target wasm32-unknown-emscripten |
| 6 | +//[wasm] needs-llvm-components: webassembly |
| 7 | +//[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu |
| 8 | +//[x86_64-linux] needs-llvm-components: x86 |
| 9 | +//[x86_64-windows] compile-flags: --target x86_64-pc-windows-msvc |
| 10 | +//[x86_64-windows] needs-llvm-components: x86 |
| 11 | + |
39 | 12 | // Tests that `byval` alignment is properly specified (#80127). |
40 | 13 | // The only targets that use `byval` are m68k, wasm, x86-64, and x86. Note that |
41 | 14 | // x86 has special rules (see #103830), and it's therefore ignored here. |
| 15 | +// Note also that Windows mandates a by-ref ABI here, so it does not use byval. |
| 16 | + |
| 17 | +#![feature(no_core, lang_items)] |
| 18 | +#![crate_type = "lib"] |
| 19 | +#![no_std] |
| 20 | +#![no_core] |
| 21 | + |
| 22 | +#[lang="sized"] trait Sized { } |
| 23 | +#[lang="freeze"] trait Freeze { } |
| 24 | +#[lang="copy"] trait Copy { } |
| 25 | + |
| 26 | +impl Copy for i32 {} |
| 27 | +impl Copy for i64 {} |
42 | 28 |
|
43 | 29 | #[repr(C)] |
44 | 30 | #[repr(align(16))] |
45 | 31 | struct Foo { |
46 | 32 | a: [i32; 16], |
| 33 | + b: i8 |
47 | 34 | } |
48 | 35 |
|
49 | 36 | extern "C" { |
50 | | - // CHECK: declare void @f({{.*}}byval(%Foo) align 16{{.*}}) |
| 37 | + // m68k: declare void @f({{.*}}byval(%Foo) align 16{{.*}}) |
| 38 | + |
| 39 | + // wasm: declare void @f({{.*}}byval(%Foo) align 16{{.*}}) |
| 40 | + |
| 41 | + // x86_64-linux: declare void @f({{.*}}byval(%Foo) align 16{{.*}}) |
| 42 | + |
| 43 | + // x86_64-windows: declare void @f( |
| 44 | + // x86_64-windows-NOT: byval |
| 45 | + // x86_64-windows-SAME: align 16{{.*}}) |
51 | 46 | fn f(foo: Foo); |
52 | 47 | } |
53 | 48 |
|
54 | 49 | pub fn main() { |
55 | | - unsafe { f(Foo { a: [1; 16] }) } |
| 50 | + unsafe { f(Foo { a: [1; 16], b: 2 }) } |
56 | 51 | } |
0 commit comments