* lib/asyncsafe-spin.c (memory_barrier): With tcc/x86, don't use the
'mfence' instruction.
* lib/simple-atomic.c (memory_barrier): Likewise.
2021-03-03 Bruno Haible <bruno@clisp.org>
+ asyncsafe-spin, simple-atomic: Add support for tcc/x86.
+ * lib/asyncsafe-spin.c (memory_barrier): With tcc/x86, don't use the
+ 'mfence' instruction.
+ * lib/simple-atomic.c (memory_barrier): Likewise.
+
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.
{
# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590 || defined __TINYC__
# if defined __i386 || defined __x86_64__
+# if defined __TINYC__ && defined __i386
+ /* Cannot use the SSE instruction "mfence" with this compiler. */
+ asm volatile ("lock orl $0,(%esp)");
+# else
asm volatile ("mfence");
+# endif
# endif
# if defined __sparc
asm volatile ("membar 2");
{
# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590 || defined __TINYC__
# if defined __i386 || defined __x86_64__
+# if defined __TINYC__ && defined __i386
+ /* Cannot use the SSE instruction "mfence" with this compiler. */
+ asm volatile ("lock orl $0,(%esp)");
+# else
asm volatile ("mfence");
+# endif
# endif
# if defined __sparc
asm volatile ("membar 2");