<p dir="ltr"><br>
On Mar 18, 2015 8:32 PM, "Matt Turner" <<a href="mailto:mattst88@gmail.com">mattst88@gmail.com</a>> wrote:<br>
><br>
> On Wed, Mar 18, 2015 at 7:39 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> > On Wed, Mar 18, 2015 at 11:37 AM, Matt Turner <<a href="mailto:mattst88@gmail.com">mattst88@gmail.com</a>> wrote:<br>
> >> Transform this into b2f(and(a, b)).<br>
> >><br>
> >> total instructions in shared programs: 6205448 -> 6204391 (-0.02%)<br>
> >> instructions in affected programs:  Â  Â 284030 -> 282973 (-0.37%)<br>
> >> helped:  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  903<br>
> >> HURT:  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  6<br>
> >> ---<br>
> >>  src/glsl/nir/nir_opt_algebraic.py | 2 ++<br>
> >>  1 file changed, 2 insertions(+)<br>
> >><br>
> >> diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py<br>
> >> index ef855aa..f956edf 100644<br>
> >> --- a/src/glsl/nir/nir_opt_algebraic.py<br>
> >> +++ b/src/glsl/nir/nir_opt_algebraic.py<br>
> >> @@ -95,6 +95,8 @@ optimizations = [<br>
> >>  Â  Â (('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'),<br>
> >>  Â  Â (('fsat', ('fsat', a)), ('fsat', a)),<br>
> >>  Â  Â (('fmin', ('fmax', ('fmin', ('fmax', a, 0.0), 1.0), 0.0), 1.0), ('fmin', ('fmax', a, 0.0), 1.0)),<br>
> >> +  Â # Emulating booleans<br>
> >> +  Â (('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))),<br>
> ><br>
> > Those are only equivalent if the sources are known booleans.<br>
> > Otherwise, no dice.<br>
><br>
> Well... they're the source of a b2f. Are you saying that's not sufficient?</p>
<p dir="ltr">No, that's not.  Fortunately, @bool should solve it for you in all of the cases you care about.</p>