[PATCH, i386]: Fix PR 38254 [Was: PR 36793: x86-64 does not get __sync_synchronize right]

Uros Bizjak ubizjak@gmail.com
Tue Nov 25 01:34:00 GMT 2008


H.J. Lu wrote:

>> Attached patch implements the suggestion with locked no-operation insn. On
>> !TARGET_SSE2, we generate:
>>
>>   lock orb    $0, -1(%esp)
>>
>> where memory location gets assigned by assign_386_stack_local (). This way,
>> we avoid various store forwarding stalls, since this is an exclusive QImode
>> address. Also, it can point into redzone area, when redzone is available.
>>
>>
>>     
>
> This patch caused
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38254
>   

Apparently, UNSPEC_VOLATILEs are not enough for a full memory barrier. 
Attached patch implements the same solution as linux is using (well, 
using "or $0, mem" instead of "add $0, mem") for a memory barrier on 
32bit x86.

2008-11-25  Uros Bizjak  <ubizjak@gmail.com>

    PR target/38256
    * config/i386/sync.md (memory_barrier_nosse): New insn
    (memory_barrier): Generate memory_barrier_nosse insn for !TARGET_SSE2.

Patch was tested on x86_64-pc-linux-gnu {,-m32}, committed to mainline.

Uros.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: p.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20081125/a29c7ab8/attachment.txt>


More information about the Gcc-patches mailing list