diff --git a/tests/ui/extern/auxiliary/foreign-vectorcall.rs b/tests/ui/extern/auxiliary/foreign-vectorcall.rs new file mode 100644 index 0000000000000..5ef724dd60ccd --- /dev/null +++ b/tests/ui/extern/auxiliary/foreign-vectorcall.rs @@ -0,0 +1,7 @@ +#![feature(abi_vectorcall)] + +#[no_mangle] +#[inline(never)] +pub extern "vectorcall" fn call_with_42(i: i32) { + assert_eq!(i, 42); +} diff --git a/tests/ui/extern/extern-vectorcall.rs b/tests/ui/extern/extern-vectorcall.rs index c0d872bc14beb..186ad4aa492db 100644 --- a/tests/ui/extern/extern-vectorcall.rs +++ b/tests/ui/extern/extern-vectorcall.rs @@ -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); } @@ -24,4 +33,5 @@ extern "vectorcall" fn test2(i: i32) { fn main() { ::test1(1); test2(2); + unsafe { call_with_42(42) }; }