Module: Mesa
Branch: master
Commit: 3a7f95b3aa7397aa8a118d2634fdc5cf8f84f989
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a7f95b3aa7397aa8a118d2634fdc5cf8f84f989

Author: Matt Turner <matts...@gmail.com>
Date:   Tue Dec  1 16:13:11 2015 -0800

nir: Optimize useless comparisons against true/false.

Reviewed-by: Jason Ekstrand <jason.ekstr...@intel.com> [v1]
Reviewed-by: Eric Anholt <e...@anholt.net> [v1]

v2: Move new rule to Boolean simplification section
    Add a a@bool != true simplification

Suggested-by: Neil Roberts <n...@linux.intel.com>

---

 src/glsl/nir/nir_opt_algebraic.py |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir_opt_algebraic.py 
b/src/glsl/nir/nir_opt_algebraic.py
index 6aa8b1f..cb715c0 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -184,8 +184,10 @@ optimizations = [
    (('fsqrt', a), ('frcp', ('frsq', a)), 'options->lower_fsqrt'),
    (('frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'),
    # Boolean simplifications
-   (('ine', 'a@bool', 0), 'a'),
-   (('ieq', 'a@bool', 0), ('inot', 'a')),
+   (('ieq', 'a@bool', True), a),
+   (('ine', 'a@bool', True), ('inot', a)),
+   (('ine', 'a@bool', False), a),
+   (('ieq', 'a@bool', False), ('inot', 'a')),
    (('bcsel', a, True, False), ('ine', a, 0)),
    (('bcsel', a, False, True), ('ieq', a, 0)),
    (('bcsel', True, b, c), b),

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to