aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-02-20 00:00:27 -0800
committerEric Anholt <[email protected]>2015-02-21 14:57:14 -0800
commit4359954d842caa2a9f8d4b50d70ecc789884b68b (patch)
tree24e46fe696d1b1e629c35a5bf7c78a43dd96fbf1 /src/glsl
parent345c2b288a5f49b82d505eb098847b8e53dde91f (diff)
nir: Generalize the optimization of subs of subs from 0.
I initially wrote this based on the "(('fneg', ('fneg', a)), a)" above, but we can generalize it and make it more potentially useful. In the specific original case of a 0 for our new 'a' argument, it'll get further algebraic optimization once the 0 is an argument to the new add. No shader-db effects. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 3ea6320d36c..7bf6431345a 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -151,8 +151,8 @@ optimizations = [
(('fcsel', a, b, b), b),
# Subtracts
- (('fsub', 0.0, ('fsub', 0.0, a)), a),
- (('isub', 0, ('isub', 0, a)), a),
+ (('fsub', a, ('fsub', 0.0, b)), ('fadd', a, b)),
+ (('isub', a, ('isub', 0, b)), ('iadd', a, b)),
(('fneg', a), ('fsub', 0.0, a), 'options->lower_negate'),
(('ineg', a), ('isub', 0, a), 'options->lower_negate'),
(('fadd', a, ('fsub', 0.0, b)), ('fsub', a, b)),