https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48052

zaafrani <az.zaafrani at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |az.zaafrani at gmail dot com

--- Comment #10 from zaafrani <az.zaafrani at gmail dot com> ---
Created attachment 35459
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35459&action=edit
patch

This is an old thread and we are still running into similar issues: Code is not
being vectorized on 64-bit target due to scev not being able to optimally
analyze overflow condition.
While the original test case shown here seems to work now, it does not work if
the start value is not a constant and the loop index variable is of unsigned
type: Ex

void loop2( double const * __restrict__ x_in,  double * __restrict__ x_out,
double const * __restrict__ c, unsigned int N, unsigned int start) {
       for(unsigned int i=start; i!=N; ++i)
                x_out[i] = c[i]*x_in[i];
  }

Here is our unit test: 

int foo(int* A, int* B,  unsigned start, unsigned B)
{
  int s;  
 for (unsigned k = start;  k <start+B; k++)
     s += A[k] * B[k];

    return s;
 }

Our unit test case is extracted from a matrix multiply of a two-dimensional
array and all loops are blocked by hand by a factor of B.  Even though a bit
modified, above loop corresponds to the innermost loop of the blocked matrix
multiply. 

We worked on patch to solve the problem (see attachment)

Reply via email to