Skip to content

Commit ab65b22

Browse files
committed
also test fastcall
1 parent 39a69a9 commit ab65b22

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

compiler/rustc_target/src/spec/mod.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -2813,11 +2813,15 @@ impl Target {
28132813
Abi::EfiApi if self.arch == "x86_64" => Abi::Win64 { unwind: false },
28142814
Abi::EfiApi => Abi::C { unwind: false },
28152815

2816-
// See commentary in `is_abi_supported`.
2816+
// See commentary in `is_abi_supported`: we map these to "C" on targets
2817+
// where they do not make sense.
28172818
Abi::Stdcall { .. } | Abi::Thiscall { .. } if self.arch == "x86" => abi,
28182819
Abi::Stdcall { unwind } | Abi::Thiscall { unwind } => Abi::C { unwind },
2819-
Abi::Fastcall { .. } if self.arch == "x86" => abi,
2820-
Abi::Vectorcall { .. } if ["x86", "x86_64"].contains(&&self.arch[..]) => abi,
2820+
Abi::Fastcall { .. } | Abi::Vectorcall { .. }
2821+
if ["x86", "x86_64"].contains(&&self.arch[..]) =>
2822+
{
2823+
abi
2824+
}
28212825
Abi::Fastcall { unwind } | Abi::Vectorcall { unwind } => Abi::C { unwind },
28222826

28232827
// The Windows x64 calling convention we use for `extern "Rust"`

tests/codegen/abi-win64-zst.rs

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ compile-flags: -Z merge-functions=disabled
2+
13
//@ revisions: linux
24
//@[linux] compile-flags: --target x86_64-unknown-linux-gnu
35
//@[linux] needs-llvm-components: x86
@@ -31,6 +33,12 @@ extern "sysv64" fn pass_zst_sysv64(_: ()) {}
3133
#[no_mangle]
3234
extern "vectorcall" fn pass_zst_vectorcall(_: ()) {}
3335

36+
// windows-gnu: define x86_fastcallcc void @pass_zst_fastcall()
37+
// windows-msvc: define x86_fastcallcc void @pass_zst_fastcall()
38+
#[no_mangle]
39+
#[cfg(windows)] // "fastcall" is not valid on 64bit Linux
40+
extern "fastcall" fn pass_zst_fastcall(_: ()) {}
41+
3442
// For `extern "C"` functions, ZST are *not* ignored on windows-gnu.
3543
// That's likely an accident on their side but the ABI is what it is.
3644

0 commit comments

Comments
 (0)