lkml.org 
[lkml]   [2011]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC 0/7] x86: convert ticketlocks to C and remove duplicate code
On 06/22/2011 12:21 PM, Jeremy Fitzhardinge wrote:
>
> A friend just pointed out that gcc has a "__sync_fetch_and_add()"
> intrinsic, which compiles to xadd when used in this context. What's the
> general feeling about using these kinds of gcc features?
>

In general they are good, IF:

a) they cover all versions of gcc we care about (or we have a fallback),
and
b) they have the right semantics.

Using gcc intrinsics can generate better code than we can in inline
assembly.

However, (b) is a killer since gcc doesn't have a way to generate our
lock prefix annotations, and so it isn't really useful here.

-hpa


\
 
 \ /
  Last update: 2011-06-22 22:23    [from the cache]
©2003-2011 Jasper Spaans