summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Gmeiner <[email protected]>2018-09-01 21:15:27 +0200
committerChristian Gmeiner <[email protected]>2018-11-12 21:57:25 +0100
commitc6aaafa3a1745c0c5a3b4cc0e023b74e2eccbaf4 (patch)
treeb1721240dc579966c86201aa95898d5ac4edbebe
parent41c8f991379d1a714cb6c161edfacca1dd296d87 (diff)
nir: add lowering for ffloor
Signed-off-by: Christian Gmeiner <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r--src/compiler/nir/nir.h3
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index f984c76fe66..c469e111b2c 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 8b24daddfdc..0d8802582aa 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@32', a, b, c), ('fadd', ('fmul', c, ('fsub', b, a)), a), 'options->lower_flrp32'),
(('flrp@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@32', ('fmul', a, ('fadd', 1.0, ('fneg', c ))), ('fmul', b, c )), ('flrp', a, b, c), '!options->lower_flrp32'),