[Mesa-dev] [PATCH 1/2] nir: add lowering for ffloor
Christian Gmeiner
christian.gmeiner at gmail.com
Mon Nov 12 19:29:13 UTC 2018
Hi Jason
Am Sa., 1. Sep. 2018 um 21:23 Uhr schrieb Jason Ekstrand <jason at jlekstrand.net>:
>
> I don't think either of these work for negative numbers
>
I would like to land this patch - can you provide some details why
this does not work for
negative numbers?
> On September 1, 2018 14:16:11 Christian Gmeiner
> <christian.gmeiner at gmail.com> wrote:
>
> > 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 169fa1fa20..d81eefc032 100644
> > --- a/src/compiler/nir/nir.h
> > +++ b/src/compiler/nir/nir.h
> > @@ -2054,6 +2054,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 ae1261f874..3d2b861a42 100644
> > --- a/src/compiler/nir/nir_opt_algebraic.py
> > +++ b/src/compiler/nir/nir_opt_algebraic.py
> > @@ -118,6 +118,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'),
> > --
> > 2.17.1
> >
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
>
--
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
More information about the mesa-dev
mailing list