about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorErik Desjardins <erikdesjardins@users.noreply.github.com>2023-05-13 21:54:54 -0400
committerErik Desjardins <erikdesjardins@users.noreply.github.com>2023-07-10 19:19:35 -0400
commit102292655b896135be2970cc9b47b26ec3edea55 (patch)
tree14720e863a2b3947303467bb523c30cdcdb734a2 /tests/codegen
parent0becc89d4a75d14571b02fb34ec1e3a45c9fb9dc (diff)
downloadrust-102292655b896135be2970cc9b47b26ec3edea55.tar.gz
rust-102292655b896135be2970cc9b47b26ec3edea55.zip
align-byval test: use revisions to test different targets
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/align-byval.rs75
1 files changed, 35 insertions, 40 deletions
diff --git a/tests/codegen/align-byval.rs b/tests/codegen/align-byval.rs
index 35b3b1adc2c..4315c3371e1 100644
--- a/tests/codegen/align-byval.rs
+++ b/tests/codegen/align-byval.rs
@@ -1,56 +1,51 @@
-// ignore-x86
-// ignore-aarch64
-// ignore-aarch64_be
-// ignore-arm
-// ignore-armeb
-// ignore-avr
-// ignore-bpfel
-// ignore-bpfeb
-// ignore-hexagon
-// ignore-mips
-// 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
-//
+// revisions:m68k wasm x86_64-linux x86_64-windows
+
+//[m68k] compile-flags: --target m68k-unknown-linux-gnu
+//[m68k] needs-llvm-components: m68k
+//[wasm] compile-flags: --target wasm32-unknown-emscripten
+//[wasm] needs-llvm-components: webassembly
+//[x86_64-linux] compile-flags: --target x86_64-unknown-linux-gnu
+//[x86_64-linux] needs-llvm-components: x86
+//[x86_64-windows] compile-flags: --target x86_64-pc-windows-msvc
+//[x86_64-windows] needs-llvm-components: x86
+
 // Tests that `byval` alignment is properly specified (#80127).
 // 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.
+// 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(align(16))]
 struct Foo {
     a: [i32; 16],
+    b: i8
 }
 
 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);
 }
 
 pub fn main() {
-    unsafe { f(Foo { a: [1; 16] }) }
+    unsafe { f(Foo { a: [1; 16], b: 2 }) }
 }