]> git.sesse.net Git - stockfish/commitdiff
Skip the alignment bug workaround for Clang
authorsyzygy1 <3028851+syzygy1@users.noreply.github.com>
Sat, 22 Aug 2020 11:36:34 +0000 (13:36 +0200)
committerStéphane Nicolet <cassio@free.fr>
Sun, 23 Aug 2020 21:09:31 +0000 (23:09 +0200)
Clang-10.0.0 poses as gcc-4.2:

$ clang++ -E -dM - </dev/null | grep GNUC

This means that Clang is using the workaround for the alignment bug of gcc-8
even though it does not have the bug (as far as I know).

This patch should speed up AVX2 and AVX512 compiles on Windows (when using Clang),
because it disables (for Clang) the gcc workaround we had introduced in this commit:
https://github.com/official-stockfish/Stockfish/commit/875183b310a8249922c2155e82cb4cecfae2097e

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

No functional change.

src/nnue/nnue_common.h

index 4c93e3d164d48eba63a53ba07b3b704e93674de7..a9d8e5af98d1f0756f517a969d6d17a8add32fb5 100644 (file)
@@ -47,7 +47,7 @@
 //       compiled with older g++ crashes because the output memory is not aligned
 //       even though alignas is specified.
 #if defined(USE_AVX2)
-#if defined(__GNUC__ ) && (__GNUC__ < 9) && defined(_WIN32)
+#if defined(__GNUC__ ) && (__GNUC__ < 9) && defined(_WIN32) && !defined(__clang__)
 #define _mm256_loadA_si256  _mm256_loadu_si256
 #define _mm256_storeA_si256 _mm256_storeu_si256
 #else
@@ -57,7 +57,7 @@
 #endif
 
 #if defined(USE_AVX512)
-#if defined(__GNUC__ ) && (__GNUC__ < 9) && defined(_WIN32)
+#if defined(__GNUC__ ) && (__GNUC__ < 9) && defined(_WIN32) && !defined(__clang__)
 #define _mm512_loadA_si512   _mm512_loadu_si512
 #define _mm512_storeA_si512  _mm512_storeu_si512
 #else