This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: 16 byte alignment hint for sse vectorization
- From: Mike Stump <mrs at apple dot com>
- To: Michael James <james dot me at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Sun, 5 Nov 2006 10:11:36 -0800
- Subject: Re: 16 byte alignment hint for sse vectorization
- References: <83b27df30611041100m33641e1cl42cc7d6da0922393@mail.gmail.com>
On Nov 4, 2006, at 11:00 AM, Michael James wrote:
Does anyone have a suggestion?
#define SSE __attribute__((aligned (16)))
typedef float matrix_sub_t[1024] SSE;
typedef matrix_sub_t matrix_t[100];
matrix_t a, b, c;
void calc(matrix_sub_t * restrict ap,
matrix_sub_t * restrict bp,
matrix_sub_t * restrict cp) {
int i, n = 1024;
for (i=0; i<n; ++i) {
ap[0][i] = bp[0][i] / (bp[0][i] + cp[0][i]);
}
}
int main(void) {
int i, n = 100;
for (i=0; i<n; ++i) {
calc(&a[i], &b[i], &c[i]);
}
}
would seem the be one way to do this that should work. Doesn't seem
to vectorize for me, though, if I read that right, the alignment
issue isn't the problem but rather the data dependancy analysis:
t.c:13: note: === vect_analyze_dependences ===
t.c:13: note: not vectorized: can't determine dependence between
(*bp_12)[i_4] and (*ap_16)[i_4]
t.c:13: note: bad data dependence.