Vector permutation only deals with # of vector elements same as mask?

Tim Prince n8tm@aol.com
Fri Feb 11 17:52:00 GMT 2011


On 2/11/2011 7:30 AM, Bingfeng Mei wrote:
> Thanks. Another question. Is there any plan to vectorize
> the loops like the following ones?
>
>      for (i=127; i>=0; i--) {
> 	x[i] = y[i] + z[i];
>      }
>

When I last tried, the Sun compilers could vectorize such loops 
efficiently (for fairly short loops), with appropriate data definitions. 
  The Sun compilers didn't peel for alignment, to improve performance on 
longer loops, as gcc and others do.  For a case with no data overlaps 
(float * __restrict__ x, ....,y,z,  or Fortran), loop reversal can do 
the job. gcc has some loop reversal machinery, but I haven't seen it 
used for vectorization.  In a simple case like this, some might argue 
there's no reason to write a backward loop when it could easily be 
reversed in source code, and compilers have been seen to make mistakes 
in reversal.

-- 
Tim Prince



More information about the Gcc mailing list