summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_algebraic.py
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2016-03-02 15:18:34 -0800
committerIan Romanick <ian.d.romanick@intel.com>2016-03-22 14:44:57 -0700
commit564a8b8a2645939cd416b62ae2e59c2fbd4b9fc2 (patch)
treec914706e38104d68fb8837eac6d6bf70f544a989 /src/compiler/nir/nir_opt_algebraic.py
parentbf0d60aa115cb8ba83f9b853f1b57c290eaf325b (diff)
downloadexternal_mesa3d-564a8b8a2645939cd416b62ae2e59c2fbd4b9fc2.zip
external_mesa3d-564a8b8a2645939cd416b62ae2e59c2fbd4b9fc2.tar.gz
external_mesa3d-564a8b8a2645939cd416b62ae2e59c2fbd4b9fc2.tar.bz2
nir: Simplify 0 >= b2f(a)
This also prevented some regressions with other patches in my local tree. Broadwell / Skylake total instructions in shared programs: 8980835 -> 8980833 (-0.00%) instructions in affected programs: 45 -> 43 (-4.44%) helped: 1 HURT: 0 total cycles in shared programs: 70077904 -> 70077900 (-0.00%) cycles in affected programs: 122 -> 118 (-3.28%) helped: 1 HURT: 0 No changes on earlier platforms. v2: Modify the comments to look more like a proof. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/compiler/nir/nir_opt_algebraic.py')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 5b3694e..facc33b 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -101,6 +101,13 @@ optimizations = [
(('inot', ('ige', a, b)), ('ilt', a, b)),
(('inot', ('ieq', a, b)), ('ine', a, b)),
(('inot', ('ine', a, b)), ('ieq', a, b)),
+
+ # 0.0 >= b2f(a)
+ # b2f(a) <= 0.0
+ # b2f(a) == 0.0 because b2f(a) can only be 0 or 1
+ # inot(a)
+ (('fge', 0.0, ('b2f', a)), ('inot', a)),
+
(('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
(('bcsel', ('flt', a, b), a, b), ('fmin', a, b)),
(('bcsel', ('flt', a, b), b, a), ('fmax', a, b)),