align-byval test: use revisions to test different targets

This commit is contained in:
Erik Desjardins 2023-05-13 21:54:54 -04:00
parent 0becc89d4a
commit 102292655b

View File

@ -1,56 +1,51 @@
// ignore-x86 // revisions:m68k wasm x86_64-linux x86_64-windows
// ignore-aarch64
// ignore-aarch64_be //[m68k] compile-flags: --target m68k-unknown-linux-gnu
// ignore-arm //[m68k] needs-llvm-components: m68k
// ignore-armeb //[wasm] compile-flags: --target wasm32-unknown-emscripten
// ignore-avr //[wasm] needs-llvm-components: webassembly
// ignore-bpfel //[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu
// ignore-bpfeb //[x86_64-linux] needs-llvm-components: x86
// ignore-hexagon //[x86_64-windows] compile-flags: --target x86_64-pc-windows-msvc
// ignore-mips //[x86_64-windows] needs-llvm-components: x86
// ignore-mips64
// ignore-msp430
// ignore-powerpc64
// ignore-powerpc64le
// ignore-powerpc
// ignore-r600
// ignore-amdgcn
// ignore-sparc
// ignore-sparcv9
// ignore-sparcel
// ignore-s390x
// ignore-tce
// ignore-thumb
// ignore-thumbeb
// ignore-xcore
// ignore-nvptx
// ignore-nvptx64
// ignore-le32
// ignore-le64
// ignore-amdil
// ignore-amdil64
// ignore-hsail
// ignore-hsail64
// ignore-spir
// ignore-spir64
// ignore-kalimba
// ignore-shave
//
// Tests that `byval` alignment is properly specified (#80127). // Tests that `byval` alignment is properly specified (#80127).
// The only targets that use `byval` are m68k, wasm, x86-64, and x86. Note that // The only targets that use `byval` are m68k, wasm, x86-64, and x86. Note that
// x86 has special rules (see #103830), and it's therefore ignored here. // x86 has special rules (see #103830), and it's therefore ignored here.
// Note also that Windows mandates a by-ref ABI here, so it does not use byval.
#![feature(no_core, lang_items)]
#![crate_type = "lib"]
#![no_std]
#![no_core]
#[lang="sized"] trait Sized { }
#[lang="freeze"] trait Freeze { }
#[lang="copy"] trait Copy { }
impl Copy for i32 {}
impl Copy for i64 {}
#[repr(C)] #[repr(C)]
#[repr(align(16))] #[repr(align(16))]
struct Foo { struct Foo {
a: [i32; 16], a: [i32; 16],
b: i8
} }
extern "C" { extern "C" {
// CHECK: declare void @f({{.*}}byval(%Foo) align 16{{.*}}) // m68k: declare void @f({{.*}}byval(%Foo) align 16{{.*}})
// wasm: declare void @f({{.*}}byval(%Foo) align 16{{.*}})
// x86_64-linux: declare void @f({{.*}}byval(%Foo) align 16{{.*}})
// x86_64-windows: declare void @f(
// x86_64-windows-NOT: byval
// x86_64-windows-SAME: align 16{{.*}})
fn f(foo: Foo); fn f(foo: Foo);
} }
pub fn main() { pub fn main() {
unsafe { f(Foo { a: [1; 16] }) } unsafe { f(Foo { a: [1; 16], b: 2 }) }
} }