Mesa (master): nir: add lowering for ffloor

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Nov 12 20:58:45 UTC 2018


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

Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date:   Sat Sep  1 21:15:27 2018 +0200

nir: add lowering for ffloor

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

---

 src/compiler/nir/nir.h                | 3 +++
 src/compiler/nir/nir_opt_algebraic.py | 1 +
 2 files changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index f984c76fe6..c469e111b2 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2083,6 +2083,9 @@ typedef struct nir_shader_compiler_options {
     */
    bool fdot_replicates;
 
+   /** lowers ffloor to fsub+ffract: */
+   bool lower_ffloor;
+
    /** lowers ffract to fsub+ffloor: */
    bool lower_ffract;
 
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 8b24daddfd..0d8802582a 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -123,6 +123,7 @@ optimizations = [
    (('~flrp', a, 0.0, c), ('fadd', ('fmul', ('fneg', a), c), a)),
    (('flrp at 32', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp32'),
    (('flrp at 64', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp64'),
+   (('ffloor', a), ('fsub', a, ('ffract', a)), 'options->lower_ffloor'),
    (('ffract', a), ('fsub', a, ('ffloor', a)), 'options->lower_ffract'),
    (('~fadd', ('fmul', a, ('fadd', 1.0, ('fneg', ('b2f', c)))), ('fmul', b, ('b2f', c))), ('bcsel', c, b, a), 'options->lower_flrp32'),
    (('~fadd at 32', ('fmul', a, ('fadd', 1.0, ('fneg',         c ))), ('fmul', b,         c )), ('flrp', a, b, c), '!options->lower_flrp32'),




More information about the mesa-commit mailing list