nir: use copysign for atan

this does two things:

* ignores sign of negative numbers which let us play fast and loose later in th
  series
* avoids an expensive fsign instruction in favour of a cheap bitwise op

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30934>
This commit is contained in:
Alyssa Rosenzweig
2024-09-03 09:25:45 -04:00
committed by Marge Bot
parent 95215a094a
commit 87b99d5797

View File

@@ -208,7 +208,7 @@ nir_atan(nir_builder *b, nir_def *y_over_x)
tmp);
/* sign fixup */
nir_def *result = nir_fmul(b, tmp, nir_fsign(b, y_over_x));
nir_def *result = nir_copysign(b, tmp, y_over_x);
/* The fmin and fmax above will filter out NaN values. This leads to
* non-NaN results for NaN inputs. Work around this by doing