Skip to content

x86_64-win: Return f128 on the stack, matching LLVM#158918

Draft
tgross35 wants to merge 4 commits into
rust-lang:mainfrom
tgross35:win64-f128-updates
Draft

x86_64-win: Return f128 on the stack, matching LLVM#158918
tgross35 wants to merge 4 commits into
rust-lang:mainfrom
tgross35:win64-f128-updates

Conversation

@tgross35

@tgross35 tgross35 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

We can start matching the codegen introduced by LLVM at 1. This alone
isn't enough to make f128 functional on the platform because libcalls
use the LLVM ABI.

Current behavior originally introduced in RUST-128388.

The second commit updates cfg(target_has_reliable_f16)

Based on #158889 which is in the queue

durin42 and others added 4 commits July 6, 2026 21:01
In LLVM 22 the x64 MSVC ABI wasn't matched and f128 was being directly
returned in %xmm0, but now it correctly returns the value via a pointer.
We can start matching the codegen introduced by LLVM at [1]. This alone
isn't enough to make f128 functional on the platform because libcalls
use the LLVM ABI.

Current behavior originally introduced in RUST-128388.

[1]: llvm/llvm-project@aa47e59
LLVM23 includes the ABI fix to make f128 work [1]. That version isn't
yet stable, but at least the type will start getting picked up in
top-of-tree CI.

While addressing this, also update the comment regarding f16.

[1]: llvm/llvm-project@aa47e59
@tgross35

tgross35 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@bors try jobs=x86_64-msvc*,x86_64-mingw*

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 7, 2026
x86_64-win: Return f128 on the stack, matching LLVM


try-job: x86_64-msvc*
try-job: x86_64-mingw*
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 7, 2026
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-msvc-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
---- num::floats::is_sign_negative::test_f128 stdout ----
---- num::floats::is_sign_negative::test_f128 stderr ----

thread 'main' (4696) panicked at coretests\tests\num\floats.rs:1232:9:
assertion failed: (Float::ONE / Float::NEG_INFINITY).is_sign_negative()
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---- num::floats::is_sign_positive::test_f128 stdout ----
---- num::floats::is_sign_positive::test_f128 stderr ----

thread 'main' (5164) panicked at coretests\tests\num\floats.rs:1213:9:
assertion failed: !(Float::ONE / Float::NEG_INFINITY).is_sign_positive()
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---
    num::floats::to_radians::test_f128

test result: FAILED. 2662 passed; 14 failed; 6 ignored; 0 measured; 0 filtered out; finished in 15.43s

error: test failed, to rerun pass `-p coretests --test coretests`
"D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage0\\bin\\cargo.exe" "test" "--manifest-path" "D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage2-codegen\\cg_clif\\build\\sysroot_tests\\Cargo.toml" "--target-dir" "D:\\a\\rust\\rust\\build\\x86_64-pc-windows-msvc\\stage2-codegen\\cg_clif\\build\\sysroot_tests_target" "--locked" "--target" "x86_64-pc-windows-msvc" "-p" "coretests" "-p" "alloctests" "--tests" "--" "-q" exited with status ExitStatus(ExitStatus(101))
error: process didn't exit successfully: `D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage3-codegen\x86_64-pc-windows-msvc\release\y.exe test --download-dir 'D:\a\rust\rust\build\cg_clif_download' --out-dir 'D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-codegen\cg_clif' --no-unstable-features --use-backend cranelift --sysroot llvm --skip-test testsuite.extended_sysroot` (exit code: 1)
Command `D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage0\bin\cargo.exe run --target x86_64-pc-windows-msvc -Zbinary-dep-depinfo -j 4 -Zroot-dir=D:\a\rust\rust --locked --color=always --profile=release --manifest-path D:\a\rust\rust\compiler/rustc_codegen_cranelift/build_system/Cargo.toml -- test --download-dir D:\a\rust\rust\build\cg_clif_download --out-dir D:\a\rust\rust\build\x86_64-pc-windows-msvc\stage2-codegen\cg_clif --no-unstable-features --use-backend cranelift --sysroot llvm --skip-test testsuite.extended_sysroot [workdir=D:\a\rust\rust\compiler/rustc_codegen_cranelift]` failed with exit code 1
Created at: src\bootstrap\src\core\build_steps\test.rs:4246:25
Executed at: src\bootstrap\src\core\build_steps\test.rs:4291:26

--- BACKTRACE vvv
   0: std::backtrace_rs::backtrace::win64::trace
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2: std::backtrace::Backtrace::create
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\backtrace.rs:331
   3: std::backtrace::Backtrace::capture
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\backtrace.rs:296
   4: bootstrap::utils::exec::DeferredCommand::finish_process
             at .\src\bootstrap\src\utils\exec.rs:939
   5: bootstrap::utils::exec::DeferredCommand::wait_for_output<ref$<bootstrap::utils::exec::ExecutionContext> >
             at .\src\bootstrap\src\utils\exec.rs:831
   6: bootstrap::utils::exec::ExecutionContext::run
             at .\src\bootstrap\src\utils\exec.rs:741
   7: bootstrap::utils::exec::BootstrapCommand::run<ref$<bootstrap::core::builder::Builder> >
             at .\src\bootstrap\src\utils\exec.rs:339
   8: bootstrap::core::build_steps::test::impl$41::run
             at .\src\bootstrap\src\core\build_steps\test.rs:4291
   9: bootstrap::core::builder::Builder::ensure<bootstrap::core::build_steps::test::CodegenCranelift>
             at .\src\bootstrap\src\core\builder\mod.rs:1607
  10: bootstrap::core::build_steps::test::impl$41::make_run
             at .\src\bootstrap\src\core\build_steps\test.rs:4232
  11: bootstrap::core::builder::StepDescription::maybe_run
             at .\src\bootstrap\src\core\builder\mod.rs:476
  12: bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run
             at .\src\bootstrap\src\core\builder\cli_paths.rs:141
  13: bootstrap::core::builder::Builder::run_step_descriptions
             at .\src\bootstrap\src\core\builder\mod.rs:1140
  14: bootstrap::core::builder::Builder::execute_cli
             at .\src\bootstrap\src\core\builder\mod.rs:1119
  15: bootstrap::Build::build
             at .\src\bootstrap\src\lib.rs:803
  16: bootstrap::main
             at .\src\bootstrap\src\bin\main.rs:130
  17: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\core\src\ops\function.rs:250
  18: std::sys::backtrace::__rust_begin_short_backtrace<void (*)(),tuple$<> >
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\sys\backtrace.rs:166
  19: std::rt::lang_start::closure$0<tuple$<> >
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\rt.rs:206
  20: std::rt::lang_start_internal::closure$0
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\rt.rs:175
  21: std::panicking::catch_unwind::do_call
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\panicking.rs:581
  22: std::panicking::catch_unwind
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\panicking.rs:544
  23: std::panic::catch_unwind
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\panic.rs:359
  24: std::rt::lang_start_internal
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\rt.rs:171
  25: std::rt::lang_start<tuple$<> >
             at /rustc/0417c25868d6dfbd1c291dfeae950504faa6f790/library\std\src\rt.rs:205
  26: main
  27: invoke_main
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  28: __scrt_common_main_seh
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  29: BaseThreadInitThunk
  30: RtlUserThreadStart


Command has failed. Rerun with -v to see more details.
Bootstrap failed while executing `test --stage 2 --skip=tests --skip=coverage-map --skip=coverage-run --skip=library --skip=tidyselftest --skip=src/tools/linkchecker`
Build completed unsuccessfully in 1:24:45
make: *** [Makefile:117: ci-msvc-ps1] Error 1
  local time: Tue Jul  7 18:42:06 CUT 2026
  network time: Tue, 07 Jul 2026 18:42:06 GMT
##[error]Process completed with exit code 2.
##[group]Run echo "disk usage:"
echo "disk usage:"

@rust-bors

rust-bors Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

💔 Test for a7adc0d failed: CI. Failed jobs:

@rust-bors

rust-bors Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #158924) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants