[Mesa-dev] [PATCH 2/2] nir: add lowering for fceil

Christian Gmeiner christian.gmeiner at gmail.com
Sat Sep 1 19:15:28 UTC 2018


Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 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 d81eefc032..1dcc221777 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -2057,6 +2057,9 @@ typedef struct nir_shader_compiler_options {
    /** lowers ffloor to fsub+ffract: */
    bool lower_ffloor;
 
+   /** lowers fceil to fadd+ffract: */
+   bool lower_fceil;
+
    /** 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 3d2b861a42..43a1642aa5 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -119,6 +119,7 @@ optimizations = [
    (('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'),
+   (('fceil', a), ('fadd', a, ('ffract', a)), 'options->lower_fceil'),
    (('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'),
-- 
2.17.1



More information about the mesa-dev mailing list