<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Jul 24, 2018 at 5:41 PM 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">On 24/07/18 00:10, Jason Ekstrand wrote:<br>
> On Mon, Jul 23, 2018 at 1:08 AM Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a> <br>
> <mailto:<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>>> wrote:<br>
> <br>
> 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>
> <br>
> <br>
> Does said pass work only on logical operations with booleans or also <br>
> regular bitwise operations? This patch is for bitwise operations though <br>
> it naturally works with booleans.<br>
<br>
Good point. I replied to this too quickly without thinking too hard. In <br>
that case we should probably also add these similar opt which I have <br>
also come across:<br>
<br>
(('ior', ('ior', a, b), a), ('ior', a, b)),<br>
(('iand', ('iand', a, b), a), ('iand', a, b)),<br></blockquote><div><br></div><div>Done.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
With those added:<br>
<br>
Reviewed-by: Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>><br></blockquote><div><br></div><div>Thanks!<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> <br>
> --Jason<br>
> <br>
> 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<br>
> 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>
> <br>
</blockquote></div></div>