Re: [BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-19 Thread Heikki Linnakangas
On 19.12.2011 17:25, Tom Lane wrote: Heikki Linnakangas writes: On 19.12.2011 16:31, Robert Haas wrote: Actually, I believe our Itanium (and possibly ARM, too) implementation of S_UNLOCK() is wrong as it is. Hmm. Anybody got a large itanium box we could play with? If it is wrong, I'd expect

Re: [BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-19 Thread Heikki Linnakangas
On 19.12.2011 17:39, Martin Pitt wrote: Heikki Linnakangas [2011-12-19 17:09 +0200]: One thing that caught my eye: if you use __sync_lock_and_test() to implement S_LOCK(), you really should be using __sync_lock_release() for S_UNLOCK(). Right, the patch I send does that: #define S_UNLOCK(lo

Re: [BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-19 Thread Martin Pitt
Tom Lane [2011-12-19 10:25 -0500]: > Heikki Linnakangas writes: > > On 19.12.2011 16:31, Robert Haas wrote: > >> On Sun, Dec 18, 2011 at 5:42 PM, Martin Pitt wrote: > >>> I agree. How about a patch like this? It uses builtin atomics if > >>> available, and falls back to the custom implementations

Re: [BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-19 Thread Martin Pitt
Heikki Linnakangas [2011-12-19 17:09 +0200]: > One thing that caught my eye: if you use __sync_lock_and_test() to > implement S_LOCK(), you really should be using __sync_lock_release() > for S_UNLOCK(). Right, the patch I send does that: #define S_UNLOCK(lock) __sync_lock_release(lock) Martin -

Re: [BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-19 Thread Martin Pitt
Robert Haas [2011-12-19 9:31 -0500]: > On Sun, Dec 18, 2011 at 5:42 PM, Martin Pitt wrote: > >> It probably makes sense to use it on any platform where it's > >> defined. Presumably an implementation provided by the compiler is > >> always going to be at least as good as any magic assembler > >>

Re: [BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-19 Thread Tom Lane
Heikki Linnakangas writes: > On 19.12.2011 16:31, Robert Haas wrote: >> On Sun, Dec 18, 2011 at 5:42 PM, Martin Pitt wrote: >>> I agree. How about a patch like this? It uses builtin atomics if >>> available, and falls back to the custom implementations if not. >> -1. Absent some evidence that g

Re: [BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-19 Thread Heikki Linnakangas
On 19.12.2011 16:31, Robert Haas wrote: On Sun, Dec 18, 2011 at 5:42 PM, Martin Pitt wrote: It probably makes sense to use it on any platform where it's defined. Presumably an implementation provided by the compiler is always going to be at least as good as any magic assembler incantations we c

Re: [BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-19 Thread Robert Haas
On Sun, Dec 18, 2011 at 5:42 PM, Martin Pitt wrote: >> It probably makes sense to use it on any platform where it's >> defined. Presumably an implementation provided by the compiler is >> always going to be at least as good as any magic assembler >> incantations we can come up with. > > I agree. H

[BUGS] [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]

2011-12-18 Thread Martin Pitt
Hello all, Heikki Linnakangas wrote: > An even better approach would be to have a configure test for > __sync_lock_test_and_set. A quick google search suggests that Intel > C Compiler version >= 11.0 also supports __sync_lock_test_and_set, > for example. Right, http://gcc.gnu.org/onlinedocs/gcc-4