summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2020-03-04 14:21:02 -0800
committerMarge Bot <[email protected]>2020-03-18 20:36:29 +0000
commit617a69107ee58e23ace06093bc49fa2c86b7dd4b (patch)
treee598904931d40b1d3f761561d1af04b5b4cd4b83
parentabf28d6a70c3219e41c904806f77ea92d31bdb0f (diff)
soft-fp64/ffloor: Simplify the >= 0 comparison
Results on the 308 shaders extracted from the fp64 portion of the OpenGL CTS: Tiger Lake and Ice Lake had similar results. (Tiger Lake shown) total instructions in shared programs: 797951 -> 797779 (-0.02%) instructions in affected programs: 126482 -> 126310 (-0.14%) helped: 15 HURT: 0 helped stats (abs) min: 1 max: 20 x̄: 11.47 x̃: 10 helped stats (rel) min: <.01% max: 0.60% x̄: 0.28% x̃: 0.29% 95% mean confidence interval for instructions value: -14.79 -8.14 95% mean confidence interval for instructions %-change: -0.40% -0.16% Instructions are helped. total cycles in shared programs: 6601437 -> 6601355 (<.01%) cycles in affected programs: 1089336 -> 1089254 (<.01%) helped: 15 HURT: 0 helped stats (abs) min: 2 max: 12 x̄: 5.47 x̃: 6 helped stats (rel) min: <.01% max: 0.04% x̄: 0.01% x̃: 0.01% 95% mean confidence interval for cycles value: -7.06 -3.87 95% mean confidence interval for cycles %-change: -0.02% <.01% Cycles are helped. Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4142>
-rw-r--r--src/compiler/glsl/float64.glsl14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl
index 5b0a9dc0c28..67e0e657c55 100644
--- a/src/compiler/glsl/float64.glsl
+++ b/src/compiler/glsl/float64.glsl
@@ -1714,7 +1714,19 @@ __ftrunc64(uint64_t __a)
uint64_t
__ffloor64(uint64_t a)
{
- bool is_positive = __fge64(a, 0ul);
+ /* The big assumtion is that when 'a' is NaN, __ftrunc(a) returns a. Based
+ * on that assumption, NaN values that don't have the sign bit will safely
+ * return NaN (identity). This is guarded by RELAXED_NAN_PROPAGATION
+ * because otherwise the NaN should have the "signal" bit set. The
+ * __fadd64 will ensure that occurs.
+ */
+ bool is_positive =
+#if defined RELAXED_NAN_PROPAGATION
+ int(unpackUint2x32(a).y) >= 0
+#else
+ __fge64(a, 0ul)
+#endif
+ ;
uint64_t tr = __ftrunc64(a);
if (is_positive || __feq64(tr, a)) {