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 <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4142>
This commit is contained in:
Ian Romanick
2020-03-04 14:21:02 -08:00
committed by Marge Bot
parent abf28d6a70
commit 617a69107e

View File

@@ -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)) {