Allow platform NaN canonicalization in floating-point assertions - #134316
tannergooding merged 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
|
This is namely an issue in the V8 implementation here: https://github.com/v8/v8/blob/main/src/codegen/shared-ia32-x64/macro-assembler-shared-ia32-x64.cc#L290 They could do something more like what we do on xarch, which is notably also faster, but they don't today and explicitly canonicalize instead. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR adjusts shared test assertions to tolerate WebAssembly NaN canonicalization while preserving exact checks for finite values and signed zero.
Changes:
- Adds centralized NaN payload-preservation platform policy.
- Applies it to
double,float, andHalfassertions. - Restores four WebAssembly Min/Max test cases.
| File | Description |
|---|---|
| src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs | Updated as part of this pull request. |
| src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs | Updated as part of this pull request. |
| src/libraries/Common/tests/System/GenericMathTestMemberData.cs | Updated as part of this pull request. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Resolved merge conflicts |


WebAssembly floating-point operations can canonicalize NaNs rather than preserve the selected operand's payload and sign. Accept this platform behavior in the shared floating-point assertions instead of changing Min/Max lowering.
PlatformDetection.IsNaNPayloadPreservationExpected, retaining the RISC-V exception and adding WebAssembly (browser and WASI).double,float, andHalfassertions;NFloatdelegates to the corresponding overload. Finite values and signed zeros remain bit-exact, and mismatches between NaN and non-NaN still fail.Validation:
TestUtilities.csprojbuilt successfully for net10.0 and net481. Browser-Wasm test execution was blocked by the baseline build failing with invalid-character errors in the extracted LLVMIRBuilder.h; no managed tests ran.Resolves #134268
Note
This PR description was drafted with GitHub Copilot.