summaryrefslogtreecommitdiff
path: root/lib/asyncsafe-spin.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-03-03 13:32:41 +0100
committerBruno Haible <bruno@clisp.org>2021-03-03 13:36:28 +0100
commit65470c21733b0850656503f09f9878e2780b7984 (patch)
tree1e7aee5f484b05ea2027b21662d8204168b1867d /lib/asyncsafe-spin.c
parent3b0808afa4236e6fa221eac2ec25dc2a8ef09557 (diff)
downloadgnulib-65470c21733b0850656503f09f9878e2780b7984.tar.gz
asyncsafe-spin, simple-atomic: Add support for tcc.
* lib/asyncsafe-spin.c (memory_barrier, atomic_compare_and_swap): On i386 and x86_64, treat tcc like older GCC or clang. * lib/simple-atomic.c (memory_barrier, atomic_compare_and_swap, atomic_compare_and_swap_ptr): Likewise.
Diffstat (limited to 'lib/asyncsafe-spin.c')
-rw-r--r--lib/asyncsafe-spin.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/asyncsafe-spin.c b/lib/asyncsafe-spin.c
index ba22b9c1e5..cece6230d5 100644
--- a/lib/asyncsafe-spin.c
+++ b/lib/asyncsafe-spin.c
@@ -190,7 +190,7 @@ do_unlock (asyncsafe_spinlock_t *lock)
abort ();
}
-# elif (defined __GNUC__ || defined __clang__ || defined __SUNPRO_C) && (defined __sparc || defined __i386 || defined __x86_64__)
+# elif ((defined __GNUC__ || defined __clang__ || defined __SUNPRO_C) && (defined __sparc || defined __i386 || defined __x86_64__)) || (defined __TINYC__ && (defined __i386 || defined __x86_64__))
/* For older versions of GCC or clang, use inline assembly.
GCC, clang, and the Oracle Studio C 12 compiler understand GCC's extended
asm syntax, but the plain Oracle Studio C 11 compiler understands only
@@ -200,7 +200,7 @@ do_unlock (asyncsafe_spinlock_t *lock)
static void
memory_barrier (void)
{
-# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590
+# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590 || defined __TINYC__
# if defined __i386 || defined __x86_64__
asm volatile ("mfence");
# endif
@@ -223,7 +223,7 @@ static unsigned int
atomic_compare_and_swap (volatile unsigned int *vp, unsigned int cmp,
unsigned int newval)
{
-# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590
+# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590 || defined __TINYC__
unsigned int oldval;
# if defined __i386 || defined __x86_64__
asm volatile (" lock\n cmpxchgl %3,(%1)"