[PATCH] Use lwsync in PowerPC sync_* builtins

Joel Sherrill joel.sherrill@oarcorp.com
Thu Sep 4 12:33:00 GMT 2008

David Daney wrote:
> On Wed, Sep 3, 2008 at 6:09 PM, David Edelsohn <dje.gcc@gmail.com> wrote:
>> On Wed, Sep 3, 2008 at 6:53 PM, Anton Blanchard <anton@samba.org> wrote:
>>> The only thing lwsync wont order is a store followed by a load. Since
>>> the lwsync will always be paired with a store (the stwcx), we will order
>>> all accesses before it and provide a release barrier.
>> Anton,
>> My one other concern is developers using the builtins for applications on
>> embedded PowerPC processors.  lwsync will not order accesses to device
>> memory space, AFAICT.  I do not know if developers would rely on GCC builtins
>> in that context and assume it implements the correct semantics.  Otherwise,
>> I agree that the memory barrier operations probably can use lwsync.
> Would it be possible to have a conservative default and use a more
> optimal form based on a specific CPU specified by -mcpu=?
> I was thinking of doing something similar on MIPS where there are
> similar issues.
Another related issue is that psim in gdb does not currently
support the lwsync instruction so any code generated using it
would fail there.  Since this is used as the test platform for
the embedded gcc targets (at least powerpc-elf and powerpc-rtems)
if gcc is going to generate this instruction, the simulator
needs to support it or there will be lots of failures.
> David Daney

Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985

More information about the Gcc mailing list