http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38011
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-27
12:35:44 UTC ---
Not true - you aligned the pointer, not the data it points to. There isn't
a good way to do that with an aligned attribute, the closest you can get at
is with
typedef double aligned_double __attribute__((aligned (16)));
void assignMultiplyVec(aligned_double* restrict a, aligned_double* restrict b,
double coef, unsigned count)
{
for(unsigned i=0; i<count; i++) {
a[i] = b[i]*coef;
}
}
but that has the issue that a[1] is not aligned but technically you
still say so (the issue is that the array has no gaps according to
the C standard but the alignment of the element type is bigger than
its size ...).
So instead we now have an assume_aligned builtin which you can use like
void assignMultiplyVec(double* restrict a_, const double * restrict b_,
double coef, unsigned count)
{
double* restrict a = __builtin_assume_aligned (a_, 16);
double* restrict b = __builtin_assume_aligned (b_, 16);
for(unsigned i=0; i<count; i++) {
a[i] = b[i]*coef;
}
}
which does not have this issue.