This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libgo patch committed: Add __sync_bool_compare_and_swap_4


On Tue, 1 Feb 2011, Ian Lance Taylor wrote:

> The libgo library uses __sync_bool_compare_and_swap_4 (i.e., uses
> __sync_bool_compare_and_swap on uint32 types).  That function is not
> available for all gcc targets.  This patch adds the function to the
> library for those cases.  Ideally this would be handled by libgcc, but
> that does not currently happen.  This function should be harmless if
> libgcc does get an implementation.

On some targets libgcc does have an implementation (ARM, PA, SH Linux - 
note that for more recent ARM architectures the sync operations are 
inlined).  The __HAVE_* macros only know about whether the operation can 
be inlined, not about whether it's available in libgcc.  libstdc++-v3 uses 
link tests to see if these operations are available (either inlined or in 
libgcc - or for that matter in libc, which could make sense for kernel 
helpers accessed through a vDSO).

For more general questions about implementing atomics in libgcc, see past 
discussions around implementing C++0x/C1x atomics.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]