Commit ebd52051 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-26467 fixup for clang-9 and earlier

Before clang-10, asm goto was not supported, so we must use fetch_or().
parent d8b8258a
...@@ -1539,7 +1539,10 @@ inline void fil_space_t::reacquire() ...@@ -1539,7 +1539,10 @@ inline void fil_space_t::reacquire()
inline bool fil_space_t::set_stopping_check() inline bool fil_space_t::set_stopping_check()
{ {
mysql_mutex_assert_owner(&fil_system.mutex); mysql_mutex_assert_owner(&fil_system.mutex);
#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) #if defined __clang_major__ && __clang_major__ < 10
/* Only clang-10 introduced support for asm goto */
return n_pending.fetch_or(STOPPING, std::memory_order_relaxed) & STOPPING;
#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__)
static_assert(STOPPING == 1U << 31, "compatibility"); static_assert(STOPPING == 1U << 31, "compatibility");
__asm__ goto("lock btsl $31, %0\t\njnc %l1" : : "m" (n_pending) __asm__ goto("lock btsl $31, %0\t\njnc %l1" : : "m" (n_pending)
: "cc", "memory" : not_stopped); : "cc", "memory" : not_stopped);
......
...@@ -308,7 +308,10 @@ Hence, we will manually translate fetch_or() using GCC-style inline ...@@ -308,7 +308,10 @@ Hence, we will manually translate fetch_or() using GCC-style inline
assembler code or a Microsoft intrinsic function. assembler code or a Microsoft intrinsic function.
*/ */
#if defined __GNUC__ && (defined __i386__ || defined __x86_64__)
#if defined __clang_major__ && __clang_major__ < 10
/* Only clang-10 introduced support for asm goto */
#elif defined __GNUC__ && (defined __i386__ || defined __x86_64__)
# define IF_FETCH_OR_GOTO(mem, bit, label) \ # define IF_FETCH_OR_GOTO(mem, bit, label) \
__asm__ goto("lock btsl $" #bit ", %0\n\t" \ __asm__ goto("lock btsl $" #bit ", %0\n\t" \
"jc %l1" : : "m" (mem) : "cc", "memory" : label); "jc %l1" : : "m" (mem) : "cc", "memory" : label);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment