This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [autovect] [patch] vectorize in cases when number of iterations may be zero


Victor Kaplansky wrote:
> 
>       1 int
>       2 foo (short *in, short *out)
>       3 {
>       4   unsigned i;
>       5   unsigned N;
>       6   unsigned M;
>       7   int acc;
>       8
>       9   for (N = 0; N < 16; N++)
>      10     {
>      11       M = 500 - N;
>      12
>      13       acc = 0;
>      14
>      15       for (i = 0; i < M; i++)
>      16         {
>      17           acc += in[i + M];
>      18         }
>      19
>      20       out[N] = (short) acc;
>      21     }
>      22
>      23   return acc;
>      24 }
> 

At least for this example there is a way to get rid of the may_be_zero
condition (that is something like "N < 500"), as N is known to be
{0,+,1}_1 and the number of iterations in the outermost loop is 16.
So you can prove this way that the condition may_be_zero is satisfied.

I have started on such a patch but didn't finished it last weekend.
I'll try to get it done for Monday.

Sebastian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]