<div dir="ltr">Matt wanted shader-db numbers and here they are:<br><br>total instructions in shared programs: 5998287 -> 5974070 (-0.40%)<br>instructions in affected programs:     732041 -> 707824 (-3.31%)<br>helped:                                3135<br>HURT:                                  193<br>GAINED:                                18<br>LOST:                                  0<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 29, 2015 at 3:41 AM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Wednesday, January 28, 2015 04:27:23 PM Jason Ekstrand wrote:<br>
> On Wed, Jan 28, 2015 at 4:02 PM, Matt Turner <<a href="mailto:mattst88@gmail.com">mattst88@gmail.com</a>> wrote:<br>
><br>
> > On Tue, Jan 27, 2015 at 5:31 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> > wrote:<br>
> > > diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> > b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> > > index de0d780..217fe09 100644<br>
> > > @@ -689,9 +689,9 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)<br>
> > ><br>
> > >        struct brw_reg acc = retype(brw_acc_reg(dispatch_width),<br>
> > result.type);<br>
> > ><br>
> > > -      emit_percomp(MUL(acc, op[0], op[1]), instr->dest.write_mask);<br>
> > > -      emit_percomp(MACH(reg_null_d, op[0], op[1]),<br>
> > instr->dest.write_mask);<br>
> > > -      emit_percomp(MOV(result, fs_reg(acc)), instr->dest.write_mask);<br>
> ><br>
> > Bah. How the hell did the old code pass piglit?<br>
> ><br>
><br>
> I think channel expressions saved it.<br>
><br>
><br>
> ><br>
> > > +      emit(MUL(acc, op[0], op[1]));<br>
> > > +      emit(MACH(reg_null_d, op[0], op[1]));<br>
> > > +      emit(MOV(result, fs_reg(acc)));<br>
> > >        break;<br>
> > >     }<br>
> > ><br>
> > > @@ -773,72 +767,38 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)<br>
> > >     case nir_op_ball_fequal3:<br>
> > >     case nir_op_ball_iequal3:<br>
> > >     case nir_op_ball_fequal4:<br>
> > > -   case nir_op_ball_iequal4: {<br>
> > > -      unsigned num_components = nir_op_infos[instr->op].input_sizes[0];<br>
> > > -      fs_reg temp = vgrf(num_components);<br>
> > > -      emit_percomp(CMP(temp, op[0], op[1], BRW_CONDITIONAL_Z),<br>
> > > -                   (1 << num_components) - 1);<br>
> > > -      emit_reduction(BRW_OPCODE_AND, result, temp, num_components);<br>
> > > -      break;<br>
> > > -   }<br>
> > > -<br>
> > > +   case nir_op_ball_iequal4:<br>
> ><br>
> > We can save it for later, but it might be interesting to let the fs<br>
> > backend get the vector comparisons directly, if that's possible.<br>
> ><br>
> > See <a href="https://bugs.freedesktop.org/show_bug.cgi?id=77456" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=77456</a><br>
> ><br>
><br>
> We can.  We just have to add a flag to turn that off in the<br>
> nir_lower_alu_to_scalar pass.<br>
><br>
><br>
> ><br>
> > > @@ -867,83 +827,67 @@ fs_visitor::nir_emit_alu(nir_alu_instr *instr)<br>
> > >        unreachable("not reached: should be handled by ldexp_to_arith()");<br>
> > ><br>
> > >     case nir_op_fsqrt:<br>
> > > -      emit_math_percomp(SHADER_OPCODE_SQRT, result, op[0],<br>
> > > -                        instr->dest.write_mask, instr->dest.saturate);<br>
> > > +      emit_math(SHADER_OPCODE_SQRT, result, op[0])<br>
> > > +               ->saturate = instr->dest.saturate;<br>
> ><br>
> > I don't really like the ->saturate = ... as a single statement. I know<br>
> > I'm guilty of using it in a unit test recently.<br>
> ><br>
><br>
> Yeah, I'm not sure what to do there.  I really don't like having to assign<br>
> it to a fs_inst variable and then do the saturate.  I guess we could.  Or<br>
> we could add something to emit_math.  Thoughts?<br>
<br>
</div></div>In the brw_eu_emit.c code I worked around this by creating a brw_last_inst<br>
macro that always refers to the most recently emitted instruction.<br>
<br>
Still not 100% crazy about it, but it's been pretty handy.  *shrug*.<br>
It's an idea, anyway.<br>
<br>
I'm not too opposed to just creating fs_inst * temporaries.<br>
<br>
--Ken</blockquote></div><br></div>