Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
shallow = true
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/20.1-2025-02-13
url = https://github.com/tgross35/llvm-project.git
branch = windows-f128-abi-combined
shallow = true
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book
Expand Down
20 changes: 12 additions & 8 deletions compiler/rustc_target/src/callconv/x86_win64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,24 @@ pub(crate) fn compute_abi_info<Ty>(cx: &impl HasTargetSpec, fn_abi: &mut FnAbi<'
// (probably what clang calls "illegal vectors").
}
BackendRepr::Scalar(scalar) => {
if is_ret && matches!(scalar.primitive(), Primitive::Int(Integer::I128, _)) {
if is_ret
&& matches!(
scalar.primitive(),
Primitive::Int(Integer::I128, _) | Primitive::Float(Float::F128)
)
{
// i128 and f128 have the same ABI on Windows.
if cx.target_spec().rustc_abi == Some(RustcAbi::X86Softfloat) {
// Use the native `i128` LLVM type for the softfloat ABI -- in other words, adjust nothing.
// Use the native `i128`/`f128` LLVM type for the softfloat ABI -- in other
// words, adjust nothing.
} else {
// `i128` is returned in xmm0 by Clang and GCC
// `i128` and `f128` are returned in xmm0 by Clang. `i128` is returned in
// xmm0 by GCC but `f128` is indirect (Clang and GCC have a mismatch).
// FIXME(#134288): This may change for the `-msvc` targets in the future.
let reg = Reg { kind: RegKind::Vector, size: Size::from_bits(128) };
a.cast_to(reg);
}
} 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);
Expand Down
2 changes: 1 addition & 1 deletion tests/assembly/x86_64-windows-float-abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub extern "C" fn second_f64(_: f64, x: f64) -> f64 {
}

// CHECK-LABEL: second_f128
// CHECK: movaps %xmm1, %xmm0
// CHECK: movaps (%rdx), %xmm0
// CHECK-NEXT: retq
#[no_mangle]
pub extern "C" fn second_f128(_: f128, x: f128) -> f128 {
Expand Down
Loading