[Mesa-dev] [PATCH 6/7] nir/opt_algebraic: Add some boolean simplifications

Jason Ekstrand jason at jlekstrand.net
Thu Jan 29 13:42:07 PST 2015

```On Thu, Jan 29, 2015 at 12:50 PM, Jason Ekstrand <jason at jlekstrand.net>
wrote:

> total instructions in shared programs: 8026509 -> 8026469 (-0.00%)
> instructions in affected programs:     6338 -> 6298 (-0.63%)
> helped:                                11
>

Ignore those numbers. they're bogus.  Here are the real ones:

total instructions in shared programs: 5998321 -> 5998287 (-0.00%)
instructions in affected programs:     4520 -> 4486 (-0.75%)
helped:                                8

> ---
>  src/glsl/nir/nir_opt_algebraic.py | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/glsl/nir/nir_opt_algebraic.py
> b/src/glsl/nir/nir_opt_algebraic.py
> index 1dea42a..e3b309c 100644
> --- a/src/glsl/nir/nir_opt_algebraic.py
> +++ b/src/glsl/nir/nir_opt_algebraic.py
> @@ -117,6 +117,11 @@ optimizations = [
>     (('frcp', ('frcp', a)), a),
>     (('frcp', ('fsqrt', a)), ('frsq', a)),
>     (('frcp', ('frsq', a)), ('fsqrt', a)),
> +   # Boolean simplifications
> +   (('ine', 'a at bool', 0), 'a'),
> +   (('ieq', 'a at bool', 0), ('inot', 'a')),
> +   (('bcsel', 'a at bool', True, False), 'a'),
> +   (('bcsel', 'a at bool', False, True), ('inot', 'a')),
>
>  # This one may not be exact
>     (('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),
> --
> 2.2.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150129/6d2e0a90/attachment.html>
```