Re: GCC memory barriers are missing "cc" clobbers

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: GCC memory barriers are missing "cc" clobbers
Date: 2014-09-19 10:19:03
Message-ID: 20140919101903.GA8435@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-09-19 11:21:43 Re: Scaling shared buffer eviction
Previous Message Abhijit Menon-Sen 2014-09-19 10:14:24 Re: pg_xlogdump --stats