Mesa (master): nir: Optimize find_lsb/imsb/umsb error checks
Matt Turner
mattst88 at kemper.freedesktop.org
Fri Jul 21 00:03:33 UTC 2017
Module: Mesa
Branch: master
Commit: aff108f2fd303ea4671541c8eca8550ddf69dc13
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=aff108f2fd303ea4671541c8eca8550ddf69dc13
Author: Matt Turner <mattst88 at gmail.com>
Date: Fri Jun 30 15:48:19 2017 -0700
nir: Optimize find_lsb/imsb/umsb error checks
Two of the ARB_shader_ballot piglit tests hit the find_lsb case,
removing some of the noise allowed me to better debug the test when it
was failing.
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
---
src/compiler/nir/nir_opt_algebraic.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index fe6e33d313..df5854270c 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -357,6 +357,17 @@ optimizations = [
(('~fadd', '#a', ('fadd', b, '#c')), ('fadd', ('fadd', a, c), b)),
(('iadd', '#a', ('iadd', b, '#c')), ('iadd', ('iadd', a, c), b)),
+ # By definition...
+ (('bcsel', ('ige', ('find_lsb', a), 0), ('find_lsb', a), -1), ('find_lsb', a)),
+ (('bcsel', ('ige', ('ifind_msb', a), 0), ('ifind_msb', a), -1), ('ifind_msb', a)),
+ (('bcsel', ('ige', ('ufind_msb', a), 0), ('ufind_msb', a), -1), ('ufind_msb', a)),
+
+ (('bcsel', ('ine', a, 0), ('find_lsb', a), -1), ('find_lsb', a)),
+ (('bcsel', ('ine', a, 0), ('ifind_msb', a), -1), ('ifind_msb', a)),
+ (('bcsel', ('ine', a, 0), ('ufind_msb', a), -1), ('ufind_msb', a)),
+
+ (('bcsel', ('ine', a, -1), ('ifind_msb', a), -1), ('ifind_msb', a)),
+
# Misc. lowering
(('fmod at 32', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod32'),
(('fmod at 64', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod64'),
More information about the mesa-commit
mailing list