aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2020-03-02 16:43:11 -0800
committerMarge Bot <[email protected]>2020-03-18 20:36:29 +0000
commit325a21f5ebca90ccac9a7c3c571ed0513c4ec3d2 (patch)
treedf779843c312c67496067f373e4e737b4c9baf87 /src/compiler
parent812230fd94e2661b1e69234f35f3ec0e3bcc9571 (diff)
soft-fp64: Simplify __countLeadingZeros32 function
findMSB returns -1 for an input of zero, so 31 - findMSB(a) is sufficient on its own. There's only one user of findMSB in shader-db, and it does not match this pattern. TODO: Add a pattern in the backend code generator that emits 31 - nir_op_ufind_msb(a) as if it were nir_op_uclz. That should save a couple instructions. 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: 859509 -> 848109 (-1.33%) instructions in affected programs: 841058 -> 829658 (-1.36%) helped: 97 HURT: 0 helped stats (abs) min: 3 max: 1161 x̄: 117.53 x̃: 72 helped stats (rel) min: 0.98% max: 6.74% x̄: 1.70% x̃: 1.35% 95% mean confidence interval for instructions value: -147.21 -87.84 95% mean confidence interval for instructions %-change: -1.94% -1.46% Instructions are helped. total cycles in shared programs: 7072275 -> 6969145 (-1.46%) cycles in affected programs: 6955767 -> 6852637 (-1.48%) helped: 97 HURT: 0 helped stats (abs) min: 32 max: 10900 x̄: 1063.20 x̃: 560 helped stats (rel) min: 1.18% max: 7.58% x̄: 1.84% x̃: 1.45% 95% mean confidence interval for cycles value: -1339.43 -786.96 95% mean confidence interval for cycles %-change: -2.11% -1.57% Cycles are helped. Reviewed-by: Jason Ekstrand <[email protected]> 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.glsl4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl
index 9834241872c..f5dee00ae2b 100644
--- a/src/compiler/glsl/float64.glsl
+++ b/src/compiler/glsl/float64.glsl
@@ -537,9 +537,7 @@ __roundAndPackInt64(uint zSign, uint zFrac0, uint zFrac1, uint zFrac2)
int
__countLeadingZeros32(uint a)
{
- int shiftCount;
- shiftCount = mix(31 - findMSB(a), 32, a == 0u);
- return shiftCount;
+ return 31 - findMSB(a);
}
/* Takes an abstract floating-point value having sign `zSign', exponent `zExp',