From: MinetaS Date: Tue, 17 Oct 2023 19:03:39 +0000 (+0900) Subject: Fix a compiler bug on Clang 15+ with AVX-512 X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=40c6a84434ea4600b5ebdd1020b34516317be1a9 Fix a compiler bug on Clang 15+ with AVX-512 fixes https://github.com/official-stockfish/Stockfish/issues/4450 closes https://github.com/official-stockfish/Stockfish/pull/4830 No functional change. --- diff --git a/src/syzygy/tbprobe.cpp b/src/syzygy/tbprobe.cpp index c8e60ab6..31597f83 100644 --- a/src/syzygy/tbprobe.cpp +++ b/src/syzygy/tbprobe.cpp @@ -690,6 +690,17 @@ int map_score(TBTable* entry, File f, int value, WDLScore wdl) { return value + 1; } +// A temporary fix for the compiler bug with AVX-512. (#4450) +#ifdef USE_AVX512 + #if defined(__clang__) && defined(__clang_major__) && __clang_major__ >= 15 + #define CLANG_AVX512_BUG_FIX __attribute__((optnone)) + #endif +#endif + +#ifndef CLANG_AVX512_BUG_FIX + #define CLANG_AVX512_BUG_FIX +#endif + // Compute a unique index out of a position and use it to probe the TB file. To // encode k pieces of the same type and color, first sort the pieces by square in // ascending order s1 <= s2 <= ... <= sk then compute the unique index as: @@ -697,7 +708,8 @@ int map_score(TBTable* entry, File f, int value, WDLScore wdl) { // idx = Binomial[1][s1] + Binomial[2][s2] + ... + Binomial[k][sk] // template -Ret do_probe_table(const Position& pos, T* entry, WDLScore wdl, ProbeState* result) { +CLANG_AVX512_BUG_FIX Ret +do_probe_table(const Position& pos, T* entry, WDLScore wdl, ProbeState* result) { Square squares[TBPIECES]; Piece pieces[TBPIECES];