Skip to content

Remove /fp:fast ceil/floor workarounds from floatdouble.cpp and floatsingle.cpp#127325

Open
Copilot wants to merge 2 commits intomainfrom
copilot/remove-workaround-floatdouble-floatsingle
Open

Remove /fp:fast ceil/floor workarounds from floatdouble.cpp and floatsingle.cpp#127325
Copilot wants to merge 2 commits intomainfrom
copilot/remove-workaround-floatdouble-floatsingle

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

Description

Remove MSVC /fp:fast workarounds for ceil/ceilf and floor in floatdouble.cpp and floatsingle.cpp. These #pragma float_control(precise, on) guards were added in dotnet/coreclr#19725 to handle incorrect -0.0 results from the CRT.

They are no longer needed:

  • The MSVC /fp:fast bugs (DevDiv 673060/673062) have been resolved
  • SSE4.1 is now the hardware baseline, so roundss/roundsd are used instead of the MSVCRT implementations on xarch

The unrelated SinCos workaround (for https://developercommunity.visualstudio.com/t/10582378) is not touched.

Changes

  • floatdouble.cpp: Remove #if defined(_MSC_VER) && defined(TARGET_AMD64) guard around Ceil; remove #if defined(_MSC_VER) && defined(TARGET_X86) guard around Floor
  • floatsingle.cpp: Remove #if defined(_MSC_VER) && defined(TARGET_AMD64) guard around Ceil

Existing Ceiling_Double_IEEE, Floor_Double_IEEE, and corresponding MathF tests already validate -0.0 handling.

Copilot AI self-assigned this Apr 23, 2026
Copilot AI review requested due to automatic review settings April 23, 2026 16:15
Copilot AI review requested due to automatic review settings April 23, 2026 16:15
…single.cpp

These workarounds were added in dotnet/coreclr#19725
to ensure ceil and floor returned the appropriate values (particularly for
-0.0) when compiled with MSVC under /fp:fast.

These can now be removed because:
1. The MSVC /fp:fast bugs have been resolved
2. The hardware baseline has been updated to SSE4.1 where roundss/roundsd
   are available, so the MSVCRT implementations will never be hit on xarch

Fixes #11003

Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/b14e52eb-82fa-4f73-8722-0df9a7bc86a3

Co-authored-by: tannergooding <10487869+tannergooding@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot April 23, 2026 16:40
Copilot AI changed the title [WIP] Remove workaround from floatdouble and floatsingle Remove /fp:fast ceil/floor workarounds from floatdouble.cpp and floatsingle.cpp Apr 23, 2026
Copilot AI requested a review from tannergooding April 23, 2026 16:42
@tannergooding tannergooding marked this pull request as ready for review April 23, 2026 16:51
Copilot AI review requested due to automatic review settings April 23, 2026 16:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Removes legacy MSVC /fp:fast ceil/floor #pragma float_control(precise, on) workarounds in CoreCLR float helpers, based on the claim that the compiler/CRT issues are resolved and xarch now uses SSE4.1 instructions.

Changes:

  • Delete MSVC float_control push/pop blocks around COMSingle::Ceil and COMDouble::Ceil.
  • Delete MSVC float_control push/pop blocks around COMDouble::Floor.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/coreclr/vm/floatsingle.cpp Removes MSVC AMD64 float_control(precise) workaround guard around ceilf.
src/coreclr/vm/floatdouble.cpp Removes MSVC AMD64 float_control(precise) workaround guard around ceil, and MSVC x86 guard around floor.

Comment thread src/coreclr/vm/floatsingle.cpp
Comment thread src/coreclr/vm/floatdouble.cpp
Comment thread src/coreclr/vm/floatdouble.cpp
@tannergooding tannergooding enabled auto-merge (squash) April 23, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove workaround from floatdouble and floatsingle after the /fp:fast bugs are resolved

4 participants