> 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:~$ > > Is this intentional? If yes, what is the exact difference between V8+ and > 32-bit V9?
V8+ requires the full 64-bit registers to be preserved by the kernel, whereas 32-bit V9 does not. -- Eric Botcazou