Re: GCC memory barriers are missing "cc" clobbers - Mailing list pgsql-hackers

From Andres Freund
Subject Re: GCC memory barriers are missing "cc" clobbers
Date
Msg-id 20140919101903.GA8435@alap3.anarazel.de
Whole thread Raw
In response to GCC memory barriers are missing "cc" clobbers  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: GCC memory barriers are missing "cc" clobbers
List pgsql-hackers
Hi,

On 2014-09-19 12:00:16 +0200, Andres Freund wrote:
> 
> barrier.h defines memory barriers for x86 as:
> 32bit:
> #define pg_memory_barrier()           \
>         __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
> 64bit:
> #define pg_memory_barrier()        \
>     __asm__ __volatile__ ("lock; addl $0,0(%%rsp)" : : : "memory")
> 
> But addl sets condition flags. So this really also needs a "cc" clobber?
> Or am I missing something?

What I missed is that x86 has an implied "cc" clobber for every inline
assembly statement. So forget that.

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Abhijit Menon-Sen
Date:
Subject: Re: pg_xlogdump --stats
Next
From: Amit Kapila
Date:
Subject: Re: Scaling shared buffer eviction