<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Jul 23, 2018 at 1:08 AM Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ian and I have been looking at these type of things recently. Ian has <br>
started work on a pass to cover this stuff without having to add dozens <br>
of these types of opts.<br>
<br>
<a href="https://lists.freedesktop.org/archives/mesa-dev/2018-July/200583.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/archives/mesa-dev/2018-July/200583.html</a><br></blockquote><div><br></div><div>Does said pass work only on logical operations with booleans or also regular bitwise operations?  This patch is for bitwise operations though it naturally works with booleans.</div><div><br></div><div>--Jason<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 23/07/18 17:36, Jason Ekstrand wrote:<br>
> Spotted in a shader in Batman: Arkham City.<br>
> ---<br>
>   src/compiler/nir/nir_opt_algebraic.py | 2 ++<br>
>   1 file changed, 2 insertions(+)<br>
> <br>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py<br>
> index ba277fdfd0e..f2007852b21 100644<br>
> --- a/src/compiler/nir/nir_opt_algebraic.py<br>
> +++ b/src/compiler/nir/nir_opt_algebraic.py<br>
> @@ -377,6 +377,8 @@ optimizations = [<br>
>      (('ixor', a, a), 0),<br>
>      (('ixor', a, 0), a),<br>
>      (('inot', ('inot', a)), a),<br>
> +   (('ior', ('iand', a, b), b), b),<br>
> +   (('iand', ('ior', a, b), b), b),<br>
>      # DeMorgan's Laws<br>
>      (('iand', ('inot', a), ('inot', b)), ('inot', ('ior',  a, b))),<br>
>      (('ior',  ('inot', a), ('inot', b)), ('inot', ('iand', a, b))),<br>
> <br>
</blockquote></div></div>