Revert "Merge pull request #1871 from folkertdev/aarch64-float-min-max"#2052
Revert "Merge pull request #1871 from folkertdev/aarch64-float-min-max"#2052folkertdev merged 1 commit intorust-lang:mainfrom
Conversation
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Seems fine. The PR also touches some integer min/max functions which aren't problematic but we can handle that separately. Also this means that these float intrinsics need to be handled by miri? At least based on the discussion elsewhere we won't be adding rust intrinsics that have the behavior of the aarch64 intrinsics. |
Ah, sorry for that. Thanks for taking care of it! |
Yeah as usual -- if there's a good motivation, we can add support for them. |
This reverts #1871. For context, see the discussion in rust-lang/rust#153395.
Using
simd_fmin/maxfor the aarch64 intrinsics is semantically incorrect:simd_fmin/maxare documented as ground truth, then they behave non-deterministically for comparing signed zeros. The Arm intrinsic (if I understood the docs correctly) guarantees that-0.0 < +0.0for the purpose of min/max.simd_fmin/maxmap to, that avoids the signed zero problem ([LangRef] Clarify specification for float min/max operations llvm/llvm-project#172012 says thatfmin/maxnow respect signed zeros, though this is probably not yet correctly implemented everywhere), but behavior is still incorrect for NaNs: the Arm operation (if I understood the docs correctly) returns NaN when an input is SNaN (only QNaN gets "ignored"), but LLVM is allowed to foldfmin(SNaN, x)tox.Given that float min/max behavior has an entire zoo of options and differs widely across targets, I think it just doesn't make sense to try to use target-independent intrinsics like
simd_fmin/maxto implement target-specific semantics for the stdarch intrinsics.Cc @folkertdev