[Mesa-dev] [PATCH 02/10] nir: Add a loop analysis pass

Timothy Arceri timothy.arceri at collabora.com
Fri Sep 16 22:49:53 UTC 2016


On Fri, 2016-09-16 at 17:01 +0200, Erik Faye-Lund wrote:
> On Thu, Sep 15, 2016 at 9:03 AM, Timothy Arceri
> <timothy.arceri at collabora.com> wrote:
> > 
> > +   const int bias[] = { -1, 1, 1 };
> > +
> > +   for (unsigned i = 0; i < ARRAY_SIZE(bias); i++) {
> > +      iter_int = iter_int + bias[i];
> > +
> > +      switch (cond_op) {
> > +      case nir_op_ige:
> > +      case nir_op_ilt:
> > +      case nir_op_ieq:
> > +      case nir_op_ine:
> > +         if (itest_interations(iter_int, step, limit, cond_op,
> > initial_val,
> > +                               limit_rhs)) {
> > +            return iter_int;
> > +         }
> > +         break;
> > +      case nir_op_uge:
> > +      case nir_op_ult:
> > +         if (utest_interations(iter_int, step, limit, cond_op,
> > +                               (uint32_t) initial_val, limit_rhs))
> > {
> > +            return iter_int;
> > +         }
> > +         break;
> > +      default:
> > +         return -1;
> > +      }
> > +   }
> 
> Can't this be easier written as:

Probably. I believe Thomas just copied this code from the GLSL IR pass.

> 
> for (int i = iter_int - 1; i <= iter_int + 1; ++i)
> {
>     switch (cond_op) {
>     [...]
>     if (itest_interations(i, step, limit, cond_op, initial_val,
> limit_rhs))
>          return i;
> [...]
> ?
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list