Difference between 32-bit SPARCv9 and SPARCv8+?

John Paul Adrian Glaubitz glaubitz@physik.fu-berlin.de
Sun Jan 23 00:44:35 GMT 2022


Hi!

On 1/21/22 15:00, John Paul Adrian Glaubitz wrote:
> While playing around with the compiler options trying to find a solution, I made an interesting
> discovery which is that GCC support 64-bit compare and swap on SPARCv8plus but not on 32-bit
> SPARCv9:
> 
> glaubitz@gcc202:~$ echo | gcc -mv8plus -E -dM -|grep -i SWAP
> #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
> glaubitz@gcc202:~$ echo | gcc -mcpu=v9 -m32 -E -dM -|grep -i SWAP
> #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
> glaubitz@gcc202:~$

It gets even more confusing since on Solaris, gcc will actually support 64-bit atomic
operations when setting -mcpu=v9:

sysadmin@deimos:~$ echo | gcc -m32 -mcpu=v9 -E -dM -|grep -i SWAP
#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
sysadmin@deimos:~$

Does anyone know the reasoning behind this?

Adrian

PS: Please CC me, I'm not subscribed.

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



More information about the Gcc-patches mailing list