diff options
author | Ian Romanick <[email protected]> | 2020-03-03 19:49:13 -0800 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-18 20:36:29 +0000 |
commit | cae36fa217b427f67494bc67b3ca4bd0bbae517e (patch) | |
tree | fcd49f409e426980363b945f530a8e40998d03d2 /src | |
parent | 70be98f17a1b8c66a92daac2a3d4eeb084bbc954 (diff) |
soft-fp64/fadd: Pick zero or non-zero result based on subtraction result
The main purpose of this commit is to prepare for "soft-fp64/fadd: Move
common code out of both branches of an if-statement".
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: 817327 -> 815717 (-0.20%)
instructions in affected programs: 755504 -> 753894 (-0.21%)
helped: 73
HURT: 1
helped stats (abs) min: 1 max: 159 x̄: 22.12 x̃: 14
helped stats (rel) min: 0.05% max: 0.40% x̄: 0.22% x̃: 0.23%
HURT stats (abs) min: 5 max: 5 x̄: 5.00 x̃: 5
HURT stats (rel) min: 0.07% max: 0.07% x̄: 0.07% x̃: 0.07%
95% mean confidence interval for instructions value: -27.27 -16.24
95% mean confidence interval for instructions %-change: -0.24% -0.20%
Instructions are helped.
total cycles in shared programs: 6822826 -> 6820707 (-0.03%)
cycles in affected programs: 6390844 -> 6388725 (-0.03%)
helped: 71
HURT: 3
helped stats (abs) min: 2 max: 537 x̄: 30.72 x̃: 18
helped stats (rel) min: <.01% max: 0.08% x̄: 0.03% x̃: 0.03%
HURT stats (abs) min: 10 max: 32 x̄: 20.67 x̃: 20
HURT stats (rel) min: 0.01% max: 0.02% x̄: 0.02% x̃: 0.02%
95% mean confidence interval for cycles value: -43.41 -13.86
95% mean confidence interval for cycles %-change: -0.04% -0.03%
Cycles are helped.
Reviewed-by: Matt Turner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4142>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl/float64.glsl | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl index 6208a37757e..f26d5e29264 100644 --- a/src/compiler/glsl/float64.glsl +++ b/src/compiler/glsl/float64.glsl @@ -779,31 +779,26 @@ __fadd64(uint64_t a, uint64_t b) uint zFrac0 = 0; uint zFrac1 = 0; - bool zexp_normal = false; uint sign_of_difference = 0; if (bFracHi < aFracHi) { __sub64(aFracHi, aFracLo, bFracHi, bFracLo, zFrac0, zFrac1); - zexp_normal = true; } else if (aFracHi < bFracHi) { __sub64(bFracHi, bFracLo, aFracHi, aFracLo, zFrac0, zFrac1); sign_of_difference = 0x80000000; - zexp_normal = true; } else if (bFracLo < aFracLo) { __sub64(aFracHi, aFracLo, bFracHi, bFracLo, zFrac0, zFrac1); - zexp_normal = true; } else if (aFracLo < bFracLo) { __sub64(bFracHi, bFracLo, aFracHi, aFracLo, zFrac0, zFrac1); sign_of_difference = 0x80000000; - zexp_normal = true; } zExp = mix(bExp, aExp, sign_of_difference == 0u); aSign ^= sign_of_difference; uint64_t retval_0 = __packFloat64(uint(FLOAT_ROUNDING_MODE == FLOAT_ROUND_DOWN) << 31, 0, 0u, 0u); uint64_t retval_1 = __normalizeRoundAndPackFloat64(aSign, zExp - 11, zFrac0, zFrac1); - return mix(retval_0, retval_1, zexp_normal); + return mix(retval_0, retval_1, zFrac0 != 0u || zFrac1 != 0u); } } |