add rbit fallback

GCC 12.2 added `__rbitll` intrinsic to `arm_acle.h`, so we can add a fallback for older versions

Clang 10 (our new minimum supported version) is unaffected by all this

closes https://github.com/official-stockfish/Stockfish/pull/6949

No functional change
This commit is contained in:
Timothy Herchen
2026-07-06 11:31:28 +02:00
committed by Joost VandeVondele
parent 22548cb0c0
commit 4436524a3e
2 changed files with 18 additions and 2 deletions
+14 -2
View File
@@ -43,12 +43,24 @@ void init();
#ifdef USE_HYPERBOLA_QUINT
inline Bitboard reverse_bb(Bitboard bb) {
#ifdef __aarch64__
#if __has_builtin(__builtin_bitreverse64)
return __builtin_bitreverse64(bb);
#else
#ifdef __aarch64__
#if defined(__GNUC__) && !defined(__clang__) \
&& (__GNUC__ < 12 || (__GNUC__ == 12 && __GNUC_MINOR__ < 2))
// no rbit in arm_acle.h
Bitboard out;
asm("rbit %0, %1" : "=r"(out) : "r"(bb));
return out;
#else
return __rbitll(bb);
#else // loongarch
#endif
#else // loongarch
Bitboard out;
asm("bitrev.d %0, %1" : "=r"(out) : "r"(bb));
return out;
#endif
#endif
}
+4
View File
@@ -561,6 +561,10 @@ void move_to_front(std::vector<T>& vec, Predicate pred) {
}
}
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
#if defined(__GNUC__)
#define sf_always_inline __attribute__((always_inline))
#elif defined(_MSC_VER)