soft-fp64/fadd: Combine an if-statement into the preceeding else-clause
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 4 Mar 2020 20:13:32 +0000 (12:13 -0800)
committerMarge Bot <eric+marge@anholt.net>
Wed, 18 Mar 2020 20:36:29 +0000 (20:36 +0000)
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: 812590 -> 812094 (-0.06%)
instructions in affected programs: 672135 -> 671639 (-0.07%)
helped: 57
HURT: 0
helped stats (abs) min: 1 max: 32 x̄: 8.70 x̃: 7
helped stats (rel) min: <.01% max: 0.49% x̄: 0.12% x̃: 0.09%
95% mean confidence interval for instructions value: -10.46 -6.94
95% mean confidence interval for instructions %-change: -0.15% -0.09%
Instructions are helped.

total cycles in shared programs: 6798039 -> 6797157 (-0.01%)
cycles in affected programs: 5810059 -> 5809177 (-0.02%)
helped: 54
HURT: 2
helped stats (abs) min: 2 max: 68 x̄: 16.44 x̃: 12
helped stats (rel) min: <.01% max: 0.12% x̄: 0.03% x̃: 0.02%
HURT stats (abs)   min: 2 max: 4 x̄: 3.00 x̃: 3
HURT stats (rel)   min: <.01% max: <.01% x̄: <.01% x̃: <.01%
95% mean confidence interval for cycles value: -19.50 -12.00
95% mean confidence interval for cycles %-change: -0.03% -0.02%
Cycles are helped.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4142>

src/compiler/glsl/float64.glsl

index b24a7812b92a00dbd26d1a98836d23a5bcd89152..40cc84439fb1a6ff992b6e39459d2c70468b97bd 100644 (file)
@@ -682,9 +682,8 @@ __fadd64(uint64_t a, uint64_t b)
       uint zFrac1;
       uint zFrac2;
       int zExp;
-      bool orig_exp_diff_is_zero = (expDiff == 0);
 
-      if (orig_exp_diff_is_zero) {
+      if (expDiff == 0) {
          if (aExp == 0x7FF) {
             bool propagate = ((aFracHi | bFracHi) | (aFracLo| bFracLo)) != 0u;
             return mix(a, __propagateFloat64NaN(a, b), propagate);
@@ -720,8 +719,7 @@ __fadd64(uint64_t a, uint64_t b)
                aFracHi, aFracLo, 0u, - expDiff, aFracHi, aFracLo, zFrac2);
             zExp = bExp;
          }
-      }
-      if (!orig_exp_diff_is_zero) {
+
          aFracHi |= 0x00100000u;
          __add64(aFracHi, aFracLo, bFracHi, bFracLo, zFrac0, zFrac1);
          --zExp;