folkertdev opened PR #14361 from folkertdev:rust-windows-float-scalar-pair to bytecodealliance:main:
This fixes this issue in
rustc_codegen_craneliftand is in line with a similar solution in
get_intreg_for_retvalright aboveCallConv::WindowsFastcall => match intreg_idx { 0 => Some(regs::rax()), 1 => Some(regs::rdx()), // The Rust ABI for i128s needs this. _ => None, },The rust calling convention uses
xmm0andxmm1for returning float scalar pairs. Previously cranelift would return one of the floats viaxmm0and the other via an outpointer, which is obviously not abi-compatible.
folkertdev requested fitzgen for a review on PR #14361.
folkertdev requested wasmtime-compiler-reviewers for a review on PR #14361.
folkertdev commented on PR #14361:
Presumably this needs a test but I'm not sure how that works or where it would go.
cfallin commented on PR #14361:
Presumably this needs a test but I'm not sure how that works or where it would go.
Thanks! We have compiler-output golden tests as "filetests" in
cranelift/filetests/filetests-- a test inisa/x64that has a small fastcall function with two float returns would be great.If you write just the test preamble (
test compile precise-output/target x86_64) and CLIF function itself, you canCRANELIFT_TEST_BLESS=1 cargo run -p cranelift-tools -- test .../test.clifto "bless" new output (in this case, initially put the expectation in the file).
folkertdev updated PR #14361.
:memo: folkertdev submitted PR review.
:speech_balloon: folkertdev created PR review comment:
I think I got it. I'm swapping
v1, v0so the body cannot be optimized out (even though it maybe wouldn't today).
github-actions[bot] added the label cranelift on PR #14361.
github-actions[bot] added the label cranelift:area:x64 on PR #14361.
Last updated: Sep 20 2026 at 18:08 UTC