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

Поиск
Список
Период
Сортировка
От Martin Pitt
Тема [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]
Дата
Msg-id 20111218224203.GA2950@piware.de
обсуждение исходный текст
Ответ на Re: TAS patch for building on armel/armhf thumb  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Ответы Re: [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb]  (Robert Haas <robertmhaas@gmail.com>)
Список 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)

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: BUG #6343: PGTYPES library missing qualifiers
Следующее
От: Alex Hunsaker
Дата:
Сообщение: Re: BUG #6344: Trouble with plperl