[Mesa-dev] [PATCH 6/8] nir: Recognize (a < b || a < c) as a < min(b, c).

Eric Anholt eric at anholt.net
Fri Mar 27 12:00:12 PDT 2015


Matt Turner <mattst88 at gmail.com> writes:

> Doesn't work for analogous && cases, because of NaNs.
>
> total instructions in shared programs: 6195712 -> 6194829 (-0.01%)
> instructions in affected programs:     42000 -> 41117 (-2.10%)
> helped:                                403
> ---
>  src/glsl/nir/nir_opt_algebraic.py | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
> index 34a401a..56dd8be 100644
> --- a/src/glsl/nir/nir_opt_algebraic.py
> +++ b/src/glsl/nir/nir_opt_algebraic.py
> @@ -93,6 +93,8 @@ optimizations = [
>     (('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'),
>     (('fsat', ('fsat', a)), ('fsat', a)),
>     (('fmin', ('fmax', ('fmin', ('fmax', a, 0.0), 1.0), 0.0), 1.0), ('fmin', ('fmax', a, 0.0), 1.0)),
> +   (('ior', ('flt', a, b), ('flt', a, c)), ('flt', a, ('fmax', b, c))),
> +   (('ior', ('fge', a, b), ('fge', a, c)), ('fge', a, ('fmin', b, c))),

In the subject, I think you meant "max" instead of "min".

Other than this, my note in #5, and conditioning the new flrps on
!lower_flrp if I land my patch first, 1-7 are:

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150327/b56e25e5/attachment.sig>


More information about the mesa-dev mailing list