diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 73b7f699b606d..61e503101fe89 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -369,7 +369,8 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { cfg.has_reliable_f16 = match (target_arch, target_os) { // Unsupported (fixed in llvm22) (Arch::Arm64EC, _) if major < 22 => false, - // MinGW ABI bugs + // MinGW ABI bugs resolved in GCC 16 + // but our toolchain hasn't been updated. (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => { false } @@ -397,8 +398,10 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) { (Arch::PowerPC | Arch::PowerPC64, _) => false, // ABI unsupported (fixed in llvm22) (Arch::Sparc, _) if major < 22 => false, - // MinGW ABI bugs - (Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => { + // MinGW ABI bugs (fixed in llvm23) + (Arch::X86_64, Os::Windows) + if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm && major < 23 => + { false } // There are no known problems on other platforms, so the only requirement is that symbols diff --git a/compiler/rustc_target/src/callconv/x86_win64.rs b/compiler/rustc_target/src/callconv/x86_win64.rs index cece9d032b53a..c0916727126e1 100644 --- a/compiler/rustc_target/src/callconv/x86_win64.rs +++ b/compiler/rustc_target/src/callconv/x86_win64.rs @@ -1,4 +1,4 @@ -use rustc_abi::{BackendRepr, Float, Integer, Primitive, Size, TyAbiInterface}; +use rustc_abi::{BackendRepr, Integer, Primitive, Size, TyAbiInterface}; use crate::callconv::{ArgAbi, FnAbi, Reg}; use crate::spec::{HasTargetSpec, RustcAbi}; @@ -35,11 +35,7 @@ where // FIXME(#134288): This may change for the `-msvc` targets in the future. a.cast_to(Reg::opaque_vector(Size::from_bits(128))); } - } else if a.layout.size.bytes() > 8 - && !matches!(scalar.primitive(), Primitive::Float(Float::F128)) - { - // Match what LLVM does for `f128` so that `compiler-builtins` builtins match up - // with what LLVM expects. + } else if a.layout.size.bytes() > 8 { a.make_indirect(); } else { a.extend_integer_width_to(32); diff --git a/tests/assembly-llvm/x86_64-windows-float-abi.rs b/tests/assembly-llvm/x86_64-windows-float-abi.rs index 51daff56789e6..3b9d85b279ca7 100644 --- a/tests/assembly-llvm/x86_64-windows-float-abi.rs +++ b/tests/assembly-llvm/x86_64-windows-float-abi.rs @@ -37,7 +37,9 @@ pub extern "C" fn second_f64(_: f64, x: f64) -> f64 { } // CHECK-LABEL: second_f128 -// CHECK: movaps (%rdx), %xmm0 +// CHECK: movq %rcx, %rax +// CHECK-NEXT: movaps (%r8), %xmm0 +// CHECK-NEXT: movaps %xmm0, (%rcx) // CHECK-NEXT: retq #[no_mangle] pub extern "C" fn second_f128(_: f128, x: f128) -> f128 {