Hi,

> Doloop optimization fails to be applied on the following inner loop
> when compiling for PowerPC  (GCC -r162294) due to:
> 
> Doloop: number of iterations too costly to compute.

strength reduction is performed in ivopts, introducing new variable:

for (p = inptr; p < something; p += 3)
  ...

So the number of iterations is (something - p) / 3, which doloop considers
too costly to compute.

Zdenek

> I do not understand why as the number of iterations is max_cols and I
> appreciate an explanation.
> 
> Thanks,
> Revital
> 
>  11   while (--max_rows >= 0)
>  12     {
>  13       inptr = *inbuf++;
>  14       outp = outbuf[0][rows];
>  15       rows++;
>  16
>  17       for (y = 0; y < max_cols; y++)
>  18         {
>  19           k = ((int) (inptr[0]));
>  20           inptr += 3;
>  21
>  22           outp[y] = (unsigned char) ((inarr[k]) >> 16);
>  23         }
>  24     }
> 
> 
> >From Doloop dump:
> 
> Analyzing operand (reg/f:DI 246 [ D.2082 ]) of insn (insn 118 116 119 5
> test1.c:17 (set (reg:CC 272)
>         (compare:CC (reg/v/f:DI 199 [ inptr ])
>             (reg/f:DI 246 [ D.2082 ]))) 535 {*cmpdi_internal1}
> (expr_list:REG_DEAD (reg/f:DI 246 [ D.2082 ])
>         (nil)))
>   invariant (reg/f:DI 246 [ D.2082 ]) (in DI)
> Loop 2 is simple:
>   simple exit 5 -> 6
>   number of iterations: (mult:DI (plus:DI (minus:DI (reg/f:DI 246
> [ D.2082 ])
>             (reg/v/f:DI 199 [ inptr ]))
>         (const_int -3 [0xfffffffffffffffd]))
>     (const_int -6148914691236517205 [0xaaaaaaaaaaaaaaab]))
>   upper bound: -1
> Doloop: number of iterations too costly to compute.
> 
> 
>  (See attached file: test1.c)

Reply via email to