[PATCH] D127964: [DCE] Eliminate no-op atan and atan2 calls
Rainer Orth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 18 13:34:38 PDT 2022
ro added a comment.
In D127964#3732256 <https://reviews.llvm.org/D127964#3732256>, @spatel wrote:
>
> That would be the quick fix to get things passing. But does that mean the mathlib on Solaris is setting errno on "atan2(-0.0, 0.0)" ?
>
> IEEE says "atan2(±0, +0) is ±0".
> POSIX has that case as optional - https://pubs.opengroup.org/onlinepubs/9699919799/functions/atan2.html :
> "If y is ±0 and x is +0, ±0 shall be returned."
> And also says:
> "If both arguments are 0, a domain error shall not occur."
> ...but that's in the same optional block.
I've just checked: the difference is between clang 11.3.0 and clang 15.0.0 (and older):
- With gcc, I get both the expected return values and `errno` is `0`.
- With clang, the values remain correct, but somehow `errno` is set to `EDOM`.
However, this only happens because gcc, unlike clang, evaluates the `atan2` calls at compile time. When compiling with `-fno-builtin-atan2`, both clang and gcc binaries behave the same.
I've found a copy of the Solaris 9 `libm` sources and am looking at the `atan2` implementation and error handling right now.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127964/new/
https://reviews.llvm.org/D127964
More information about the llvm-commits
mailing list