From 722d67d5e7d55f7135984fe359892476564429d4 Mon Sep 17 00:00:00 2001 From: Daniel Paoliello Date: Tue, 19 Jul 2022 10:40:26 -0700 Subject: Fix vectorcall --- compiler/rustc_metadata/src/native_libs.rs | 4 +++- compiler/rustc_target/src/abi/call/mod.rs | 6 ++++-- compiler/rustc_target/src/abi/call/x86.rs | 6 +++--- 3 files changed, 10 insertions(+), 6 deletions(-) (limited to 'compiler') diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index c33219e4700..9f6079ecba4 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -472,7 +472,9 @@ impl<'tcx> Collector<'tcx> { Abi::Fastcall { .. } => { DllCallingConvention::Fastcall(self.i686_arg_list_size(item)) } - // Vectorcall is intentionally not supported at this time. + Abi::Vectorcall { .. } => { + DllCallingConvention::Vectorcall(self.i686_arg_list_size(item)) + } _ => { self.tcx.sess.span_fatal( item.span, diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index ca1d1302ec6..577126a95cc 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -669,8 +669,10 @@ impl<'a, Ty> FnAbi<'a, Ty> { match &cx.target_spec().arch[..] { "x86" => { - let flavor = if let spec::abi::Abi::Fastcall { .. } = abi { - x86::Flavor::Fastcall + let flavor = if let spec::abi::Abi::Fastcall { .. } + | spec::abi::Abi::Vectorcall { .. } = abi + { + x86::Flavor::FastcallOrVectorcall } else { x86::Flavor::General }; diff --git a/compiler/rustc_target/src/abi/call/x86.rs b/compiler/rustc_target/src/abi/call/x86.rs index d169087dfbd..c7d59baf919 100644 --- a/compiler/rustc_target/src/abi/call/x86.rs +++ b/compiler/rustc_target/src/abi/call/x86.rs @@ -5,7 +5,7 @@ use crate::spec::HasTargetSpec; #[derive(PartialEq)] pub enum Flavor { General, - Fastcall, + FastcallOrVectorcall, } pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, flavor: Flavor) @@ -60,9 +60,9 @@ where } } - if flavor == Flavor::Fastcall { + if flavor == Flavor::FastcallOrVectorcall { // Mark arguments as InReg like clang does it, - // so our fastcall is compatible with C/C++ fastcall. + // so our fastcall/vectorcall is compatible with C/C++ fastcall/vectorcall. // Clang reference: lib/CodeGen/TargetInfo.cpp // See X86_32ABIInfo::shouldPrimitiveUseInReg(), X86_32ABIInfo::updateFreeRegs() -- cgit 1.4.1-3-g733a5