Mesa (master): nir: Add algebraic opt for int comparisons with identical operands.
Eric Anholt
anholt at kemper.freedesktop.org
Wed Feb 11 19:54:17 UTC 2015
Module: Mesa
Branch: master
Commit: 56e21647e20db8e3708001a8600c3d8e7d12d841
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=56e21647e20db8e3708001a8600c3d8e7d12d841
Author: Eric Anholt <eric at anholt.net>
Date: Fri Feb 6 17:12:59 2015 -0800
nir: Add algebraic opt for int comparisons with identical operands.
No change on shader-db on i965.
v2: Reword the comment due to feedback from Erik Faye-Lund
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com> (v1)
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com> (v1)
---
src/glsl/nir/nir_opt_algebraic.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index a5fe19a..2b4259e 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -83,6 +83,15 @@ optimizations = [
(('fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))),
(('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
(('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a)),
+ # Comparison with the same args. Note that these are not done for
+ # the float versions because NaN always returns false on float
+ # inequalities.
+ (('ilt', a, a), False),
+ (('ige', a, a), True),
+ (('ieq', a, a), True),
+ (('ine', a, a), False),
+ (('ult', a, a), False),
+ (('uge', a, a), True),
# Logical and bit operations
(('fand', a, 0.0), 0.0),
(('iand', a, a), a),
More information about the mesa-commit
mailing list