From: | Martin Pitt <mpitt(at)debian(dot)org> |
---|---|
To: | PostgreSQL Bugs <pgsql-bugs(at)postgresql(dot)org> |
Subject: | [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb] |
Date: | 2011-12-18 22:42:03 |
Message-ID: | 20111218224203.GA2950@piware.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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.1.2/gcc/Atomic-Builtins.html
explicitly refers to intel CC as well.
> 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. How about a patch like this? It uses builtin atomics if
available, and falls back to the custom implementations if not.
Note that a simple AC_CHECK_FUNC(__sync_lock_test_and_set) does not
work, so I used a slightly more complicated AC_TRY_LINK() which also
verifies that __sync_lock_release() is available.
The patch is against 9.1.2, but I suppose it also applies to trunk
(except perhaps the autogenerated configure part, this needs an
autoheader/autoconf run).
Thanks for considering,
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
Attachment | Content-Type | Size |
---|---|---|
01-atomic-builtins.patch | text/x-diff | 5.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Hunsaker | 2011-12-19 00:35:54 | Re: BUG #6344: Trouble with plperl |
Previous Message | Michael Meskes | 2011-12-18 18:05:57 | Re: BUG #6343: PGTYPES library missing qualifiers |