Skip to content

Commit

Permalink
add foreign-vectorcall test
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Sep 11, 2024
1 parent dfcd0db commit a78c911
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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) };
}

0 comments on commit a78c911

Please sign in to comment.