[Mesa-dev] [PATCH 6/9] intel/fs: Use the new nir_src_is_const and friends

Kenneth Graunke kenneth at whitecape.org
Wed Nov 7 22:06:01 UTC 2018


On Wednesday, November 7, 2018 1:45:59 PM PST Jason Ekstrand wrote:
> On Wed, Nov 7, 2018 at 12:20 PM Kenneth Graunke <kenneth at whitecape.org>
> wrote:
> 
> > On Saturday, October 20, 2018 10:55:44 AM PST Jason Ekstrand wrote:
> > > @@ -553,14 +552,18 @@
> > fs_visitor::optimize_frontfacing_ternary(nir_alu_instr *instr,
> > >     if (src0->intrinsic != nir_intrinsic_load_front_face)
> > >        return false;
> > >
> > > -   nir_const_value *value1 = nir_src_as_const_value(instr->src[1].src);
> > > -   if (!value1 || fabsf(value1->f32[0]) != 1.0f)
> > > +   if (!nir_src_is_const(instr->src[1].src) ||
> > > +       !nir_src_is_const(instr->src[2].src))
> > >        return false;
> > >
> > > -   nir_const_value *value2 = nir_src_as_const_value(instr->src[2].src);
> > > -   if (!value2 || fabsf(value2->f32[0]) != 1.0f)
> > > +   const float value1 = nir_src_as_float(instr->src[1].src);
> > > +   const float value2 = nir_src_as_float(instr->src[2].src);
> > > +   if (fabsf(value1) != 1.0f || fabsf(value2) != 1.0f)
> > >        return false;
> > >
> > > +   /* nir_opt_algebraic should have gotten rid of bcsel(b, a, a) */
> > > +   assert(value1 == -value2);
> > > +
> >
> > This is likely true, but it doesn't seem like this belongs in this
> > refactoring patch - we weren't doing it before, and no new code appears
> > to depend on the condition.
> 
> 
> Right.  No *new* code does; but old code definitely does.  Mind if I just
> make it a separate commit?

Sure, that's fine, feel free to put my R-b on that one as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181107/54e6a5ad/attachment.sig>


More information about the mesa-dev mailing list