Skip to content

Commit f91c8f4

Browse files
committed
x86_win64 ABI: do not use xmm0 with softfloat ABI
1 parent 608e228 commit f91c8f4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler/rustc_target/src/callconv/x86_win64.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use rustc_abi::{BackendRepr, Float, Integer, Primitive, RegKind, Size};
22

33
use crate::callconv::{ArgAbi, FnAbi, Reg};
4-
use crate::spec::HasTargetSpec;
4+
use crate::spec::{HasTargetSpec, RustcAbi};
55

66
// Win64 ABI: https://docs.microsoft.com/en-us/cpp/build/parameter-passing
77

8-
pub(crate) fn compute_abi_info<Ty>(_cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
8+
pub(crate) fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'_, Ty>) {
99
let fixup = |a: &mut ArgAbi<'_, Ty>, is_ret: bool| {
1010
match a.layout.backend_repr {
1111
BackendRepr::Uninhabited | BackendRepr::Memory { sized: false } => {}
@@ -23,7 +23,10 @@ pub(crate) fn compute_abi_info<Ty>(_cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<
2323
// (probably what clang calls "illegal vectors").
2424
}
2525
BackendRepr::Scalar(scalar) => {
26-
if is_ret && matches!(scalar.primitive(), Primitive::Int(Integer::I128, _)) {
26+
if is_ret
27+
&& cx.target_spec().rustc_abi != Some(RustcAbi::X86Softfloat)
28+
&& matches!(scalar.primitive(), Primitive::Int(Integer::I128, _))
29+
{
2730
// `i128` is returned in xmm0 by Clang and GCC
2831
// FIXME(#134288): This may change for the `-msvc` targets in the future.
2932
let reg = Reg { kind: RegKind::Vector, size: Size::from_bits(128) };

0 commit comments

Comments
 (0)