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 10, 2024
1 parent 454b281 commit 7642197
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/ui/extern/auxiliary/foreign-vectorcall.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![feature(abi_vectorcall)]

#[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(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 7642197

Please sign in to comment.