__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined on aarch64 (correction)
Toebs Douglass
toby@winterflaw.net
Mon Jun 26 07:47:00 GMT 2017
On 26/06/17 09:37, Toebs Douglass wrote:
> Hej all.
>
> __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 is defined on x86_64 if and only if
> -mcx16 is given.
>
> gcc version 4.9.2 (Debian 4.9.2-10)
> winterflaw@localhost:~$ gcc -march=native -dM -E - < /dev/null | sort |
> grep SYNC
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 1
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
Stunning, eh? what happened was; without -march=native, there's no
SYNC_16. This isn't too surprising, I think, because looking over the
list of predefines (and configure options) the compiler actually seems
to have no default arch - I mean, it must, but there are no defines
indicating it. Lord knows what it's assuming, since the i586 introduced
DWCAS on Intel.
Even with that seeming lack of arch, with -mcx16, we do of course then
get SYNC_16, since we've told the compiler it exists.
If I then move to arch native, I get SYNC_16 even without mcx16; this on
4.9.2. That surprised me (and is the cause of the mistake in the
original post).
Anyways, this wasn't the main point - it was only there to point out
SYNC_16 is set on x86_64 (usually).
> __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 is not defined at all on aarch64, as
> far as I can tell.
>
> gcc version 4.9.2 (Debian/Linaro 4.9.2-10)
> debian@pine64:~$ gcc -march=armv8-a+crypto+crc -dM -E - < /dev/null |
> sort | grep SYNC
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
> #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
This being the main point.
More information about the Gcc-help
mailing list