[Bug target/33413] Please provide __sync_lock_test_and_set builtin for ARM using swap insn

spam_from_gcc_bugzilla at chezphil dot org gcc-bugzilla@gcc.gnu.org
Mon Apr 5 14:10:00 GMT 2010



------- Comment #2 from spam_from_gcc_bugzilla at chezphil dot org  2010-04-05 14:10 -------
Hi Richard,

This is obviously less of an issue than it was in 2007.

I think there are enough pre-ARMv6 systems still deployed that they cannot be
ignored, though.  For example, I believe that the Android native development
kit assumes that the hardware is >= ARMv5.

Currently, portable code need to do something like:

#if v6 or newer
...use gcc builtins, which generate ldx/stx...
#else
...use asm statements that generate swp...
#endif

It would be a bit less clunky if gcc builtins could be used in both cases. 
Personally, I use asm sufficiently rarely that it takes me a while to work out
the syntax each time (both the actual assembler syntax and the gcc asm
statement syntax).  The builtins are much easier to use.


Regards,  Phil.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33413



More information about the Gcc-bugs mailing list