[Mesa-dev] [PATCH 5/7] nir/int64: Call nir_lower_int64() in a loop

Jason Ekstrand jason at jlekstrand.net
Mon Oct 15 19:47:57 UTC 2018


On Mon, Oct 15, 2018 at 1:48 PM Ian Romanick <idr at freedesktop.org> wrote:

> On 10/14/2018 03:11 PM, Matt Turner wrote:
> > Unfortunately some int64 lowerings generate more int64 operations, so we
> > need to call this function a few times. Also call
> > nir_lower_alu_to_scalar() beforehand to make more int64 operations
> > available for lowering.
> > ---
> >  src/intel/compiler/brw_nir.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
> > index f61baee230a..066724c58a6 100644
> > --- a/src/intel/compiler/brw_nir.c
> > +++ b/src/intel/compiler/brw_nir.c
> > @@ -670,12 +670,16 @@ brw_preprocess_nir(const struct brw_compiler
> *compiler, nir_shader *nir)
> >      */
> >     OPT(nir_opt_algebraic);
> >
> > +   if (is_scalar) {
> > +      OPT(nir_lower_alu_to_scalar);
> > +   }
> > +
> >     /* Lower int64 instructions before nir_optimize so that loop
> unrolling
> >      * sees their actual cost.
> >      */
> > -   nir_lower_int64(nir, nir_lower_imul64 |
> > -                        nir_lower_isign64 |
> > -                        nir_lower_divmod64);
> > +   while (nir_lower_int64(nir, nir_lower_imul64 |
> > +                               nir_lower_isign64 |
> > +                               nir_lower_divmod64));
>
> I don't know that we have a specific coding standard about this, but I
> always like
>
>         while (foo)
>                 /* empty */ ;
>
> just to make it obvious.
>

I think I'd opt for "continue" but yeah, I think one or the other is better
than silently putting the semicolon at the end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181015/0a681c13/attachment.html>


More information about the mesa-dev mailing list