<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Oct 22, 2018 at 6:26 PM Ian Romanick <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 10/22/2018 03:13 PM, Jason Ekstrand wrote:<br>
> These all assume the 0/~0 representation of booleans.  We'll turn them<br>
> back on before too long.<br>
> ---<br>
>  src/compiler/nir/nir_opt_algebraic.py | 5 -----<br>
>  1 file changed, 5 deletions(-)<br>
> <br>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py<br>
> index 8b24daddfdc..5a4e78e8e0e 100644<br>
> --- a/src/compiler/nir/nir_opt_algebraic.py<br>
> +++ b/src/compiler/nir/nir_opt_algebraic.py<br>
> @@ -436,9 +436,7 @@ optimizations = [<br>
>     (('imul', ('b2i', a), ('b2i', b)), ('b2i', ('iand', a, b))),<br>
>     (('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))),<br>
>     (('fsat', ('fadd', ('b2f', a), ('b2f', b))), ('b2f', ('ior', a, b))),<br>
> -   (('iand', 'a@bool', 1.0), ('b2f', a), '!options->lower_b2f'),<br>
>     # True/False are ~0 and 0 in NIR.  b2i of True is 1, and -1 is ~0 (True).<br>
<br>
Is this comment still true at the end of the series?  Should it also change?<br></blockquote><div><br></div><div>It is still true but it doesn't apply to any of the optimizations that follow.  I'll kill it off.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> -   (('ineg', ('b2i@32', a)), a),<br>
>     (('flt', ('fneg', ('b2f', a)), 0), a), # Generated by TGSI KILL_IF.<br>
>     (('flt', ('fsub', 0.0, ('b2f', a)), 0), a), # Generated by TGSI KILL_IF.<br>
>     # Comparison with the same args.  Note that these are not done for<br>
> @@ -917,9 +915,6 @@ late_optimizations = [<br>
>     # we do these late so that we don't get in the way of creating ffmas<br>
>     (('fmin', ('fadd(is_used_once)', '#c', a), ('fadd(is_used_once)', '#c', b)), ('fadd', c, ('fmin', a, b))),<br>
>     (('fmax', ('fadd(is_used_once)', '#c', a), ('fadd(is_used_once)', '#c', b)), ('fadd', c, ('fmax', a, b))),<br>
> -<br>
> -   # Lowered for backends without a dedicated b2f instruction<br>
> -   (('b2f@32', a), ('iand', a, 1.0), 'options->lower_b2f'),<br>
<br>
I've never understood the point of this.  The backend should just<br>
generate the iand instruction as it's implementation of b2f.  This is<br>
what i965 does.  Converting the b2f at the late hour doesn't give any<br>
opportunities to enable other optimizations, so it seems pretty useless.<br></blockquote><div><br></div><div>I don't really get it either but Alyssa wanted it.  Maybe we can can it eventually once their back-end gets more mature?  In any case, it's not hurting anything sitting here.<br></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">
>  ]<br>
>  <br>
>  print(nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render())<br>
> <br>
<br>
</blockquote></div></div>