Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add foreign-vectorcall test
  • Loading branch information
RalfJung committed Sep 11, 2024
commit a78c911ecf11ae34715989bce30461e396e035b9
10 changes: 10 additions & 0 deletions tests/ui/extern/auxiliary/foreign-vectorcall.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Make the aux build not use `dylib` to avoid https://github.com/rust-lang/rust/issues/130196
//@ no-prefer-dynamic
#![feature(abi_vectorcall)]
#![crate_type = "lib"]

#[no_mangle]
#[inline(never)]
pub extern "vectorcall" fn call_with_42(i: i32) {
assert_eq!(i, 42);
}
10 changes: 10 additions & 0 deletions tests/ui/extern/extern-vectorcall.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
//@ run-pass
//@ aux-build:foreign-vectorcall.rs
//@ revisions: x64 x32
//@ [x64]only-x86_64
//@ [x32]only-x86

#![feature(abi_vectorcall)]

extern crate foreign_vectorcall;

// Import this as a foreign function, that's the code path we are interested in
// (LLVM has to do some name mangling here).
extern "vectorcall" {
fn call_with_42(i: i32);
}

trait A {
extern "vectorcall" fn test1(i: i32);
}
Expand All @@ -24,4 +33,5 @@ extern "vectorcall" fn test2(i: i32) {
fn main() {
<S as A>::test1(1);
test2(2);
unsafe { call_with_42(42) };
}
Loading