summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2020-03-04 12:31:02 -0800
committerMarge Bot <[email protected]>2020-03-18 20:36:29 +0000
commit16dfd06472db407aee8a9c6ec761079633c6bdec (patch)
tree1e5f3a9ff1656f0533ad4704a3a828ae1103e0dc /src/compiler
parentda3fa01891ec41ced3cbe2b63e8e5c8252e6e7ba (diff)
soft-fp64/fadd: Use absolute value of expDiff
In one branch we know that expDiff is already positive. In the other branch we know the expDiff is negative. Previously in that branch the code was -(expDiff + 1). This is equvialent to (-expDiff) - 1, and since expDiff is negative, abs(expDiff) - 1. 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: 818246 -> 819560 (0.16%) instructions in affected programs: 756423 -> 757737 (0.17%) helped: 1 HURT: 73 helped stats (abs) min: 1205 max: 1205 x̄: 1205.00 x̃: 1205 helped stats (rel) min: 1.36% max: 1.36% x̄: 1.36% x̃: 1.36% HURT stats (abs) min: 2 max: 149 x̄: 34.51 x̃: 27 HURT stats (rel) min: 0.14% max: 1.09% x̄: 0.41% x̃: 0.30% 95% mean confidence interval for instructions value: -16.56 52.07 95% mean confidence interval for instructions %-change: 0.30% 0.47% Inconclusive result (value mean confidence interval includes 0). total cycles in shared programs: 6816686 -> 6817254 (<.01%) cycles in affected programs: 6384704 -> 6385272 (<.01%) helped: 37 HURT: 37 helped stats (abs) min: 30 max: 5790 x̄: 289.05 x̃: 102 helped stats (rel) min: 0.04% max: 0.86% x̄: 0.29% x̃: 0.31% HURT stats (abs) min: 2 max: 1020 x̄: 304.41 x̃: 232 HURT stats (rel) min: <.01% max: 1.58% x̄: 0.55% x̃: 0.43% 95% mean confidence interval for cycles value: -165.37 180.72 95% mean confidence interval for cycles %-change: <.01% 0.27% Inconclusive result (value mean confidence interval includes 0). total spills in shared programs: 705 -> 591 (-16.17%) spills in affected programs: 705 -> 591 (-16.17%) helped: 1 HURT: 0 total fills in shared programs: 1501 -> 1353 (-9.86%) fills in affected programs: 1501 -> 1353 (-9.86%) helped: 1 HURT: 0 Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4142>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/glsl/float64.glsl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl
index cdecfdb8dbb..06f47902745 100644
--- a/src/compiler/glsl/float64.glsl
+++ b/src/compiler/glsl/float64.glsl
@@ -714,7 +714,7 @@ __fadd64(uint64_t a, uint64_t b)
return mix(a, __propagateFloat64NaN(a, b), propagate);
}
- expDiff = mix(expDiff, expDiff - 1, bExp == 0);
+ expDiff = mix(abs(expDiff), abs(expDiff) - 1, bExp == 0);
bFracHi = mix(bFracHi | 0x00100000u, bFracHi, bExp == 0);
__shift64ExtraRightJamming(
bFracHi, bFracLo, 0u, expDiff, bFracHi, bFracLo, zFrac2);
@@ -728,10 +728,11 @@ __fadd64(uint64_t a, uint64_t b)
bool propagate = (aFracHi | aFracLo) != 0u;
return mix(__packFloat64(aSign, 0x7ff, 0u, 0u), __propagateFloat64NaN(a, b), propagate);
}
- expDiff = mix(expDiff, expDiff + 1, bExp == 0);
+
+ expDiff = mix(abs(expDiff), abs(expDiff) - 1, bExp == 0);
bFracHi = mix(bFracHi | 0x00100000u, bFracHi, bExp == 0);
__shift64ExtraRightJamming(
- bFracHi, bFracLo, 0u, - expDiff, bFracHi, bFracLo, zFrac2);
+ bFracHi, bFracLo, 0u, expDiff, bFracHi, bFracLo, zFrac2);
zExp = aExp;
}