summaryrefslogtreecommitdiff
path: root/lib/asyncsafe-spin.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-07-03 12:35:45 +0200
committerBruno Haible <bruno@clisp.org>2020-07-03 12:37:03 +0200
commitcb38aa3df6a57b1206b33736939e9f9cfff297ad (patch)
treee00cb7f12ea8dee96e74e62deb8c023f789a5326 /lib/asyncsafe-spin.c
parent6b91be0bcbe64077d1c6a380c4597943e710734c (diff)
downloadgnulib-cb38aa3df6a57b1206b33736939e9f9cfff297ad.tar.gz
asyncsafe-spin: Use GCC extended asm syntax for SunStudio 12 compiler.
* lib/asyncsafe-spin.c (memory_barrier, atomic_compare_and_swap): Use the GCC extended asm syntax also for the Sun Studio 12 compilers.
Diffstat (limited to 'lib/asyncsafe-spin.c')
-rw-r--r--lib/asyncsafe-spin.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/asyncsafe-spin.c b/lib/asyncsafe-spin.c
index 81e48ad43e..6ea5781b36 100644
--- a/lib/asyncsafe-spin.c
+++ b/lib/asyncsafe-spin.c
@@ -186,14 +186,14 @@ do_unlock (asyncsafe_spinlock_t *lock)
# elif (defined __GNUC__ || defined __SUNPRO_C) && (defined __sparc || defined __i386 || defined __x86_64__)
/* For older versions of GCC, use inline assembly.
- GCC and the Oracle Studio C compiler understand GCC's extended asm syntax,
- but the plain Solaris cc understands only simple asm. */
+ GCC and the Oracle Studio C 12 compiler understand GCC's extended asm syntax,
+ but the plain Oracle Studio C 11 compiler understands only simple asm. */
/* An implementation that verifies the unlocks. */
static void
memory_barrier (void)
{
-# if defined __GNUC__
+# if defined __GNUC__ || __SUNPRO_C >= 0x590
# if defined __i386 || defined __x86_64__
asm volatile ("mfence");
# endif
@@ -216,7 +216,7 @@ static unsigned int
atomic_compare_and_swap (volatile unsigned int *vp, unsigned int cmp,
unsigned int newval)
{
-# if defined __GNUC__
+# if defined __GNUC__ || __SUNPRO_C >= 0x590
unsigned int oldval;
# if defined __i386 || defined __x86_64__
asm volatile (" lock\n cmpxchgl %3,(%1)"