Re: gcc 4.3.2 vectorizes access to volatile array

2009-06-23 Thread Andrew Haley
Till Straumann wrote: > Andrew Haley wrote: >> H.J. Lu wrote: >>> >>> That may be too old. Gcc 4.3.4 revision 148680 >>> generates: >>> >>> .L5: >>> leaq(%rsi,%rdx), %rax >>> movzbl(%rax), %eax >>> movb%al, (%rdi,%rdx) >>> addq$1, %rdx >>> cmpq$32, %rdx >>>

Re: gcc 4.3.2 vectorizes access to volatile array

2009-06-22 Thread Till Straumann
That's roughly the same that 4.3.3 produces. I had not quoted the full assembly code but just the essential part that is executed when source and destination are 4-byte aligned and are more than 4-bytes apart. Otherwise (not longword-aligned) the (correct) code labeled '.L5' is executed. -- Till

Re: gcc 4.3.2 vectorizes access to volatile array

2009-06-22 Thread Andrew Haley
H.J. Lu wrote: > On Mon, Jun 22, 2009 at 11:14 AM, Till > Straumann wrote: >> Andrew Haley wrote: >>> Till Straumann wrote: >>> gcc-4.3.2 seems to produce bad code when accessing an array of small 'volatile' objects -- it may try to access multiple such objects in a 'parallel' f

Re: gcc 4.3.2 vectorizes access to volatile array

2009-06-22 Thread H.J. Lu
On Mon, Jun 22, 2009 at 11:14 AM, Till Straumann wrote: > Andrew Haley wrote: >> >> Till Straumann wrote: >> >>> >>> gcc-4.3.2 seems to produce bad code when >>> accessing an array of small 'volatile' >>> objects -- it may try to access multiple >>> such objects in a 'parallel' fashion. >>> E.g., i

Re: gcc 4.3.2 vectorizes access to volatile array

2009-06-22 Thread Till Straumann
Andrew Haley wrote: Till Straumann wrote: gcc-4.3.2 seems to produce bad code when accessing an array of small 'volatile' objects -- it may try to access multiple such objects in a 'parallel' fashion. E.g., instead of reading two consecutive 'volatile short's sequentially it reads a single 32

Re: gcc 4.3.2 vectorizes access to volatile array

2009-06-22 Thread Andrew Haley
Till Straumann wrote: > gcc-4.3.2 seems to produce bad code when > accessing an array of small 'volatile' > objects -- it may try to access multiple > such objects in a 'parallel' fashion. > E.g., instead of reading two consecutive > 'volatile short's sequentially it reads > a single 32-bit longwor

gcc 4.3.2 vectorizes access to volatile array

2009-06-22 Thread Till Straumann
gcc-4.3.2 seems to produce bad code when accessing an array of small 'volatile' objects -- it may try to access multiple such objects in a 'parallel' fashion. E.g., instead of reading two consecutive 'volatile short's sequentially it reads a single 32-bit longword. This may crash e.g., when access