[Mesa-dev] [PATCH] nir: add some comparison simplifications

Jason Ekstrand jason at jlekstrand.net
Fri Mar 16 05:22:32 UTC 2018


I think you can just do

(('ine', ('b2i', 'a at bool'), 0), 'a'),

Or something like that.  I may have gotten the syntax wrong.



On March 15, 2018 20:53:44 Timothy Arceri <tarceri at itsqueeze.com> wrote:

> These can be found in the Tomb Raider shaders, eliminating them
> helps unroll more loops.
> ---
>  src/compiler/nir/nir_opt_algebraic.py | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py 
> b/src/compiler/nir/nir_opt_algebraic.py
> index c9575e6be4..56dfc53043 100644
> --- a/src/compiler/nir/nir_opt_algebraic.py
> +++ b/src/compiler/nir/nir_opt_algebraic.py
> @@ -152,6 +152,10 @@ optimizations = [
>     (('inot', ('ige', a, b)), ('ilt', a, b)),
>     (('inot', ('ieq', a, b)), ('ine', a, b)),
>     (('inot', ('ine', a, b)), ('ieq', a, b)),
> +   (('ine', ('b2i', ('ige', a, b)), 0), ('ige', a, b)),
> +   (('ine', ('b2i', ('ilt', a, b)), 0), ('ilt', a, b)),
> +   (('ine', ('b2i', ('ult', a, b)), 0), ('ult', a, b)),
> +   (('ine', ('b2i', ('ine', a, b)), 0), ('ine', a, b)),
>
>     # 0.0 >= b2f(a)
>     # b2f(a) <= 0.0
> --
> 2.14.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev




More information about the mesa-dev mailing list