Verified Solution[rust-lang/rust] What are the intended semantics for simd_fmin/fmax and simd_reduce_min/max vs signaling NaN?
Sponsored Content
### ROOT CAUSE
The issue arises because the SIMD intrinsics `simd_fmin`, `simd_fmax`, `simd_reduce_min`, and `simd_reduce_max` are documented to use IEEE-754 `maxNum`, but their implementation does not fully align with the IEEE-754-2019 standard for `min/maximumNum` operations. Specifically, they may not consistently handle signaling NaNs (sNaNs) as quiet NaNs (qNaNs), leading to potential differences in behavior compared to the scalar `min`/`max` functions. The root cause is the lack of uniform implementation across different architectures and the absence of explicit handling for sNaNs in the current code.
### CODE FIX
To resolve this, update the implementation of the SIMD intrinsics to explicitly use the `nsz` (no signaling) behavior when available in LLVM intrinsics. This ensures sNaNs are treated as qNaNs, matching the IEEE-754-2019 standard. Modify the code generation for these intrinsics to use `llvm.min/maximumnum nsz` intrinsics where supported, and fall back to other methods if necessary. Additionally, update documentation to clearly state the IEEE-754-2019 `min/maximumNum` semantics for consistency with the scalar operations.
Deploy on DigitalOcean ($200 Credit)
Related Fixes
[gitlab-org/gitlab] [FF] Rollout read_project_push_rules, and write_project_push_rules feature flags on self-managed
[rust-lang/rust] rustdoc-json: Move `#[doc` attribute out of `Attribute::Other` to own well-typed variant
[microsoft/vscode] Worker initialization failure: EMFILE opus 4.6