<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Nov 7, 2018 at 12:20 PM Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Saturday, October 20, 2018 10:55:44 AM PST Jason Ekstrand wrote:<br>
> @@ -553,14 +552,18 @@ fs_visitor::optimize_frontfacing_ternary(nir_alu_instr *instr,<br>
>     if (src0->intrinsic != nir_intrinsic_load_front_face)<br>
>        return false;<br>
>  <br>
> -   nir_const_value *value1 = nir_src_as_const_value(instr->src[1].src);<br>
> -   if (!value1 || fabsf(value1->f32[0]) != 1.0f)<br>
> +   if (!nir_src_is_const(instr->src[1].src) ||<br>
> +       !nir_src_is_const(instr->src[2].src))<br>
>        return false;<br>
>  <br>
> -   nir_const_value *value2 = nir_src_as_const_value(instr->src[2].src);<br>
> -   if (!value2 || fabsf(value2->f32[0]) != 1.0f)<br>
> +   const float value1 = nir_src_as_float(instr->src[1].src);<br>
> +   const float value2 = nir_src_as_float(instr->src[2].src);<br>
> +   if (fabsf(value1) != 1.0f || fabsf(value2) != 1.0f)<br>
>        return false;<br>
>  <br>
> +   /* nir_opt_algebraic should have gotten rid of bcsel(b, a, a) */<br>
> +   assert(value1 == -value2);<br>
> +<br>
<br>
This is likely true, but it doesn't seem like this belongs in this<br>
refactoring patch - we weren't doing it before, and no new code appears<br>
to depend on the condition.</blockquote><div><br></div><div>Right.  No *new* code does; but old code definitely does.  Mind if I just make it a separate commit?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  Normally I wouldn't mind, but I'm a bit<br>
paranoid about float equality in assertions.  It's probably fine,<br>
though, since we ensured fabsf is 1.0f earlier...<br>
Patches 5-9 are:<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>><br>
</blockquote></div></div>