Skip to content

[interp] Treat 'unsigned' fp->int conversions like signed ones#119549

Merged
kg merged 1 commit intodotnet:mainfrom
kg:interp-fp-unsigned-conv
Sep 11, 2025
Merged

[interp] Treat 'unsigned' fp->int conversions like signed ones#119549
kg merged 1 commit intodotnet:mainfrom
kg:interp-fp-unsigned-conv

Conversation

@kg
Copy link
Member

@kg kg commented Sep 10, 2025

We have some test cases that use .un conversion opcodes to convert floats to ints. The spec doesn't say what this does, and it doesn't make much sense. What the JIT does is ignore the .un modifier in this scenario, so this PR updates the interpreter to do the same thing.

Depends on (contains) #119548 because that PR exposes this problem.

Fixes JIT\Regression\JitBlue\DevDiv_362706

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

@kg kg force-pushed the interp-fp-unsigned-conv branch from 77c3a5e to b20677a Compare September 10, 2025 21:22
@kg kg marked this pull request as ready for review September 10, 2025 21:23
@kg kg requested review from BrzVlad and janvorli as code owners September 10, 2025 21:23
Copilot AI review requested due to automatic review settings September 10, 2025 21:23
Copy link
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

This PR updates the CoreCLR interpreter to align with JIT behavior for unsigned floating-point to integer conversions. The change addresses the ambiguity in the spec regarding .un conversion opcodes when used with floating-point operands by making the interpreter ignore the unsigned modifier, just as the JIT does.

  • Replaces assert statements with actual conversion implementations for floating-point operands
  • Adds platform-specific handling for native integer conversions using TARGET_64BIT preprocessor directives
  • Includes detailed comments explaining the rationale for treating unsigned FP-to-int conversions like signed ones

@kg kg merged commit 774e77b into dotnet:main Sep 11, 2025
96 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants