Mesa (master): nir: add is_used_once for fmul(fexp2(a), fexp2(b)) to fexp2(fadd(a, b))

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Thu Feb 22 19:41:12 UTC 2018


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Mon Feb  5 16:07:45 2018 +0100

nir: add is_used_once for fmul(fexp2(a), fexp2(b)) to fexp2(fadd(a, b))

Otherwise the code size increases because the original fexp2()
instructions can't be deleted.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/compiler/nir/nir_opt_algebraic.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 6dc19d9b12..622ce824b9 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -334,7 +334,7 @@ optimizations = [
    (('~flog2', ('frcp', a)), ('fneg', ('flog2', a))),
    (('~flog2', ('frsq', a)), ('fmul', -0.5, ('flog2', a))),
    (('~flog2', ('fpow', a, b)), ('fmul', b, ('flog2', a))),
-   (('~fmul', ('fexp2', a), ('fexp2', b)), ('fexp2', ('fadd', a, b))),
+   (('~fmul', ('fexp2(is_used_once)', a), ('fexp2(is_used_once)', b)), ('fexp2', ('fadd', a, b))),
    # Division and reciprocal
    (('~fdiv', 1.0, a), ('frcp', a)),
    (('fdiv', a, b), ('fmul', a, ('frcp', b)), 'options->lower_fdiv'),




More information about the mesa-commit mailing list