Mesa (master): nir: lower fexp2(fmul(flog2(a), 2)) to fmul(a, a)
Samuel Pitoiset
hakzsam at kemper.freedesktop.org
Thu Feb 22 19:41:12 UTC 2018
Module: Mesa
Branch: master
Commit: 63fb30c6743a2d8dfb13f5fee18e0f950822e562
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=63fb30c6743a2d8dfb13f5fee18e0f950822e562
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Mon Feb 5 15:08:03 2018 +0100
nir: lower fexp2(fmul(flog2(a), 2)) to fmul(a, a)
Similar for the 4 case.
Suggested by Bas.
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, 2 insertions(+)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 622ce824b9..d40d59b5cd 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -321,6 +321,8 @@ optimizations = [
(('~fexp2', ('fmul', ('flog2', a), b)), ('fpow', a, b), '!options->lower_fpow'), # 2^(lg2(a)*b) = a^b
(('~fexp2', ('fadd', ('fmul', ('flog2', a), b), ('fmul', ('flog2', c), d))),
('~fmul', ('fpow', a, b), ('fpow', c, d)), '!options->lower_fpow'), # 2^(lg2(a) * b + lg2(c) + d) = a^b * c^d
+ (('~fexp2', ('fmul', ('flog2', a), 2.0)), ('fmul', a, a)),
+ (('~fexp2', ('fmul', ('flog2', a), 4.0)), ('fmul', ('fmul', a, a), ('fmul', a, a))),
(('~fpow', a, 1.0), a),
(('~fpow', a, 2.0), ('fmul', a, a)),
(('~fpow', a, 4.0), ('fmul', ('fmul', a, a), ('fmul', a, a))),
More information about the mesa-commit
mailing list