Open Quuxplusone opened 8 years ago
#define SIZE (1 << 15) #define MINDEX(n, m) (SIZE*(n)+(m)) #define XMM_ALIGNMENT_BYTES 16 float *restrict mat_a __attribute__((aligned (XMM_ALIGNMENT_BYTES))); float *restrict vec_b __attribute__((aligned (XMM_ALIGNMENT_BYTES))); float *restrict vec_c __attribute__((aligned (XMM_ALIGNMENT_BYTES))); // __attribute__ ((noinline)) void matvec_autovec() { int i, j; float tmp; for (i = 0; i < SIZE; i++) { tmp = 0; for (j = 0; j < SIZE; j++) { tmp += mat_a[MINDEX(i, j)] * vec_b[j]; } vec_c[i] = tmp; } } void multiple() { matvec_autovec(); } int main(int argc, char **argv) { return 0; }
The command I used is clang-3.8 -Ofast test.c -Rpass=loop-vectorize
clang-3.8 -Ofast test.c -Rpass=loop-vectorize
test.c:22:9: remark: vectorized loop (vectorization width: 4, interleaved count: 1) [-Rpass=loop-vectorize] for (j = 0; j < SIZE; j++) { ^ test.c:22:9: remark: vectorized loop (vectorization width: 4, interleaved count: 1) [-Rpass=loop-vectorize]
The output reduces to 1 after I uncomment the noinline attribute.
noinline
Indeed, I think we need to provide more information when the remark occurs in the context of inlined code.
The command I used is
clang-3.8 -Ofast test.c -Rpass=loop-vectorize
The output reduces to 1 after I uncomment the
noinline
attribute.