Skip to content

Commit 7642197

Browse files
committed
add foreign-vectorcall test
1 parent 454b281 commit 7642197

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![feature(abi_vectorcall)]
2+
3+
#[no_mangle]
4+
#[inline(never)]
5+
pub extern "vectorcall" fn call_with_42(i: i32) {
6+
assert_eq!(i, 42);
7+
}

tests/ui/extern/extern-vectorcall.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
//@ run-pass
2+
//@ aux-build:foreign-vectorcall.rs
23
//@ revisions: x64 x32
34
//@ [x64]only-x86_64
45
//@ [x32]only-x86
56

67
#![feature(abi_vectorcall)]
78

9+
extern crate foreign_vectorcall;
10+
11+
// Import this as a foreign function, that's the code path we are interested in
12+
// (LLVM has to do some name mangling here).
13+
extern "vectorcall" {
14+
fn call_with_42(i32);
15+
}
16+
817
trait A {
918
extern "vectorcall" fn test1(i: i32);
1019
}
@@ -24,4 +33,5 @@ extern "vectorcall" fn test2(i: i32) {
2433
fn main() {
2534
<S as A>::test1(1);
2635
test2(2);
36+
unsafe { call_with_42(42) };
2737
}

0 commit comments

Comments
 (0)