[Mesa-dev] [PATCH] nir: Add a couple of iand/ior optimizations
Jason Ekstrand
jason at jlekstrand.net
Wed Jul 25 03:44:21 UTC 2018
On Tue, Jul 24, 2018 at 5:41 PM Timothy Arceri <tarceri at itsqueeze.com>
wrote:
> On 24/07/18 00:10, Jason Ekstrand wrote:
> > On Mon, Jul 23, 2018 at 1:08 AM Timothy Arceri <tarceri at itsqueeze.com
> > <mailto:tarceri at itsqueeze.com>> wrote:
> >
> > Ian and I have been looking at these type of things recently. Ian has
> > started work on a pass to cover this stuff without having to add
> dozens
> > of these types of opts.
> >
> >
> https://lists.freedesktop.org/archives/mesa-dev/2018-July/200583.html
> >
> >
> > 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.
>
> Good point. I replied to this too quickly without thinking too hard. In
> that case we should probably also add these similar opt which I have
> also come across:
>
> (('ior', ('ior', a, b), a), ('ior', a, b)),
> (('iand', ('iand', a, b), a), ('iand', a, b)),
>
Done.
> With those added:
>
> Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
>
Thanks!
> >
> > --Jason
> >
> > On 23/07/18 17:36, Jason Ekstrand wrote:
> > > Spotted in a shader in Batman: Arkham City.
> > > ---
> > > src/compiler/nir/nir_opt_algebraic.py | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/src/compiler/nir/nir_opt_algebraic.py
> > b/src/compiler/nir/nir_opt_algebraic.py
> > > index ba277fdfd0e..f2007852b21 100644
> > > --- a/src/compiler/nir/nir_opt_algebraic.py
> > > +++ b/src/compiler/nir/nir_opt_algebraic.py
> > > @@ -377,6 +377,8 @@ optimizations = [
> > > (('ixor', a, a), 0),
> > > (('ixor', a, 0), a),
> > > (('inot', ('inot', a)), a),
> > > + (('ior', ('iand', a, b), b), b),
> > > + (('iand', ('ior', a, b), b), b),
> > > # DeMorgan's Laws
> > > (('iand', ('inot', a), ('inot', b)), ('inot', ('ior', a,
> b))),
> > > (('ior', ('inot', a), ('inot', b)), ('inot', ('iand', a,
> b))),
> > >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180724/11a4367d/attachment.html>
More information about the mesa-dev
mailing list