Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 1022926

Browse files
align-byval test: use revisions to test different targets
1 parent 0becc89 commit 1022926

File tree

1 file changed

+35
-40
lines changed

1 file changed

+35
-40
lines changed

tests/codegen/align-byval.rs

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,51 @@
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+
3912
// Tests that `byval` alignment is properly specified (#80127).
4013
// The only targets that use `byval` are m68k, wasm, x86-64, and x86. Note that
4114
// 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 {}
4228

4329
#[repr(C)]
4430
#[repr(align(16))]
4531
struct Foo {
4632
a: [i32; 16],
33+
b: i8
4734
}
4835

4936
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{{.*}})
5146
fn f(foo: Foo);
5247
}
5348

5449
pub fn main() {
55-
unsafe { f(Foo { a: [1; 16] }) }
50+
unsafe { f(Foo { a: [1; 16], b: 2 }) }
5651
}

0 commit comments

Comments
 (0)