Skip to content

Add x64 disasm regression for BitConverter.SingleToInt32Bits in hot Span<float> loops#9

Draft
Copilot wants to merge 3 commits into
cca-eval-treatmentfrom
copilot/fix-suboptimal-codegen
Draft

Add x64 disasm regression for BitConverter.SingleToInt32Bits in hot Span<float> loops#9
Copilot wants to merge 3 commits into
cca-eval-treatmentfrom
copilot/fix-suboptimal-codegen

Conversation

Copilot AI commented May 28, 2026

Copy link
Copy Markdown

BitConverter.SingleToInt32Bits in tight Span<float> loops can regress to a stack roundtrip (movss store + mov reload) instead of a direct register transfer (movd). This PR adds a focused JIT regression test to lock in the expected x64 codegen shape.

  • Regression coverage

    • Adds src/tests/JIT/Regression/JitBlue/Runtime_130999/Runtime_130999.cs.
    • Exercises SingleToInt32Bits in a hot loop with an additional float use to keep the value in FP registers before bit reinterpretation.
    • Includes disasm assertions for x64 to require register-file transfer and reject stack-spill pattern.
  • Disasm check wiring

    • Adds Runtime_130999.csproj with HasDisasmCheck=true and standard JIT test env settings for deterministic disasm validation.
  • Functional guardrails

    • Verifies runtime behavior across empty, single-element, mixed, and edge-case float inputs (NaN, infinities, epsilon) so the codegen check remains attached to a correct computation path.
// X64-FULL-LINE: vmovd [[REG:[a-z0-9]+]], xmm{{[0-9]+}}
// X64-FULL-LINE-NEXT: add {{[a-z0-9]+}}, [[REG]]
// X64-NOT: movss dword ptr [rsp
acc += BitConverter.SingleToInt32Bits(f);

Copilot AI and others added 2 commits May 28, 2026 00:42
Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix suboptimal codegen for BitConverter.SingleToInt32Bits Add x64 disasm regression for BitConverter.SingleToInt32Bits in hot Span<float> loops May 28, 2026
Copilot AI requested a review from steveisok May 28, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[treatment] Suboptimal codegen for BitConverter.SingleToInt32Bits in a hot Span<float> loop on x64

2 participants