]> Savannah Git Hosting - gnulib.git/commitdiff
asyncsafe-spin: Use GCC extended asm syntax for SunStudio 12 compiler.
authorBruno Haible <bruno@clisp.org>
Fri, 3 Jul 2020 10:35:45 +0000 (12:35 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 3 Jul 2020 10:37:03 +0000 (12:37 +0200)
* lib/asyncsafe-spin.c (memory_barrier, atomic_compare_and_swap): Use
the GCC extended asm syntax also for the Sun Studio 12 compilers.

ChangeLog
lib/asyncsafe-spin.c

index c7374d1dff24250b038bc2d2f2e53ef1e6659dcc..4e1e067e083f0953a677f54d03c6d9c28f20391f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,13 @@
+2020-07-03  Bruno Haible  <bruno@clisp.org>
+
+       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.
+
 2020-07-03  Bruno Haible  <bruno@clisp.org>
 
        asyncsafe-spin: Reduce code duplication.
-       * lib/asyncsafe-spin.c: (do_lock, do_unlock): New functions.
+       * lib/asyncsafe-spin.c (do_lock, do_unlock): New functions.
        (asyncsafe_spin_lock, asyncsafe_spin_unlock): Use them.
        * modules/asyncsafe-spin (configure.ac): Require AC_C_INLINE.
 
index 81e48ad43e1a78d6803521cdf4eee8563ec57b67..6ea5781b369faaebb03ef219c3c3699d65ab97cf 100644 (file)
@@ -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)"