From d1e0227ef14291242886be48424f723bf60bc439 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 4 Mar 2020 16:53:36 -0800 Subject: soft-fp64/b2f: Reimplement using bitwise logic ops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This doesn't help a lot of shaders, but it helps those few a LOT. This could also be implemented using bcsel. That version is very slightly worse because the generated SEL instruction wants to have two immediate sources, so one of them usually needs an extra MOV instruction to load. 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: 929619 -> 928859 (-0.08%) instructions in affected programs: 1651 -> 891 (-46.03%) helped: 8 HURT: 0 helped stats (abs) min: 38 max: 152 x̄: 95.00 x̃: 95 helped stats (rel) min: 42.70% max: 86.36% x̄: 49.88% x̃: 44.66% 95% mean confidence interval for instructions value: -132.97 -57.03 95% mean confidence interval for instructions %-change: -62.28% -37.49% Instructions are helped. total cycles in shared programs: 7280180 -> 7272912 (-0.10%) cycles in affected programs: 12960 -> 5692 (-56.08%) helped: 8 HURT: 0 helped stats (abs) min: 352 max: 1456 x̄: 908.50 x̃: 910 helped stats (rel) min: 52.45% max: 91.19% x̄: 59.24% x̃: 55.15% 95% mean confidence interval for cycles value: -1274.03 -542.97 95% mean confidence interval for cycles %-change: -70.06% -48.41% Cycles are helped. Reviewed-by: Matt Turner Part-of: --- src/compiler/glsl/float64.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/compiler') diff --git a/src/compiler/glsl/float64.glsl b/src/compiler/glsl/float64.glsl index 5f201c8f725..7d58da3d18c 100644 --- a/src/compiler/glsl/float64.glsl +++ b/src/compiler/glsl/float64.glsl @@ -1192,7 +1192,7 @@ __fp64_to_bool(uint64_t a) uint64_t __bool_to_fp64(bool a) { - return __int_to_fp64(int(a)); + return packUint2x32(uvec2(0x00000000u, uint(-int(a) & 0x3ff00000))); } /* Packs the sign `zSign', exponent `zExp', and significand `zFrac' into a -- cgit v1.2.3