Mesa (master): nir: Recognize open coded lrp.

Matt Turner mattst88 at kemper.freedesktop.org
Wed Apr 1 20:53:47 UTC 2015


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Wed Mar 25 15:03:52 2015 -0700

nir: Recognize open coded lrp.

total instructions in shared programs: 6197614 -> 6195924 (-0.03%)
instructions in affected programs:     34773 -> 33083 (-4.86%)
helped:                                147
HURT:                                  6

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/glsl/nir/nir_opt_algebraic.py |    1 +
 1 file changed, 1 insertion(+)

diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 39f37bb..368ec7f 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -76,6 +76,7 @@ optimizations = [
    (('flrp', a, a, b), a),
    (('flrp', 0.0, a, b), ('fmul', a, b)),
    (('flrp', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp'),
+   (('fadd', ('fmul', a, ('fadd', 1.0, ('fneg', c))), ('fmul', b, c)), ('flrp', a, b, c), '!options->lower_flrp'),
    (('ffma', a, b, c), ('fadd', ('fmul', a, b), c), 'options->lower_ffma'),
    (('fadd', ('fmul', a, b), c), ('ffma', a, b, c), '!options->lower_ffma'),
    # Comparison simplifications




More information about the mesa-commit mailing list