[Bug target/40243] New: no aligned instruction generated for i386
Even a simple program like: for(i=0;i1000;i++) a[i]= b[i]+c[i]; is vectorized using -ftree-vectorize -msse2 -O2 flag. Unaligned instruction are generated. For any program, Not even a single aligned instruction is generated. As, the variable STACK_BOUNDARY in function vect_can_force_dr_alignment_p in file tree-vectorizer.c:1798 is defined to be BITS_PER_WORD(32) for i386 in i386.h . while this should be 128, so this variable should be replaced by some other variable or might be again restored to PREFERRED_STACK_BOUNDARY, like previous versions. In version 4.4.0 , it is replaced by MAX_STACK_ALIGNMENT, which is defined as MAX_OFILE_ALIGNEMENT in i386.h. So, both conditions return ,the same answer ( alignment = MAX_OFILE_ALIGNMENT). -- Summary: no aligned instruction generated for i386 Product: gcc Version: 4.3.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: abhishek dot shrivastav24 at gmail dot com GCC build triplet: i686-unknown-linux GCC host triplet: i686-unknown-linux GCC target triplet: i686-unknown-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40243
[Bug target/40243] no aligned instruction generated for i386
--- Comment #2 from abhishek dot shrivastav24 at gmail dot com 2009-05-25 14:36 --- (In reply to comment #1) Works for me (your simple program is not a valid program). The whole program is like this: /* sample.c */ #include stdio.h #define N 1000 int main() { int a[N], b[N], c[N], i; for(i=0;iN;i++) b[i]=c[i]=i; for(i=0;iN;i++) a[i]=b[i]+c[i]; for(i=0;iN;i++) printf(%d, a[i]); } compile using gcc version 4.3.*, using gcc -S -ftree-vectorize -ftree-vectorizer-verbose=10 -msse2 -O2 sample.c Now, view the assembly file generated and also the verbose, it always prints when analyzing in function vect_analyze_data_refs_alignment ***can't force alignment of ref: b[i_43]***, while it does not need alignment, as it is already aligned. Simply changed the instruction movdqu to movdqa and no segmentation fault would occur, as the array references are aligned. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40243