diff --git a/hwy/base.h b/hwy/base.h index ae4f226d2b..764352a443 100644 --- a/hwy/base.h +++ b/hwy/base.h @@ -410,8 +410,9 @@ HWY_DLLEXPORT HWY_NORETURN void HWY_FORMAT(3, 4) #if !defined(HWY_IS_DEBUG_BUILD) // Clang does not define NDEBUG, but it and GCC define __OPTIMIZE__, and recent // MSVC defines NDEBUG (if not, could instead check _DEBUG). -#if (!defined(__OPTIMIZE__) && !defined(NDEBUG)) || \ - (HWY_IS_SANITIZER && !HWY_IS_UBSAN) || defined(__clang_analyzer__) +#if (!defined(__OPTIMIZE__) && !defined(NDEBUG)) || \ + (HWY_IS_ASAN || (HWY_IS_SANITIZER && !HWY_IS_UBSAN)) || \ + defined(__clang_analyzer__) #define HWY_IS_DEBUG_BUILD 1 #else #define HWY_IS_DEBUG_BUILD 0 @@ -1746,7 +1747,11 @@ HWY_F16_CONSTEXPR inline std::partial_ordering operator<=>( #ifndef HWY_HAVE_SCALAR_BF16_OPERATORS // Recent enough compiler also has operators. aarch64 clang 18 hits internal // compiler errors on bf16 ToString, hence only enable on GCC for now. -#if HWY_HAVE_SCALAR_BF16_TYPE && (HWY_COMPILER_GCC_ACTUAL >= 1300) +// GCC >= 13 will insert a function call to the __extendbfsf2 helper function +// for scalar conversions from __bf16 to float. This is prohibitively expensive, +// so refrain from using scalar BF16 operators on these compiler versions. +// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121853 +#if HWY_HAVE_SCALAR_BF16_TYPE && (HWY_COMPILER_GCC_ACTUAL >= 1700) #define HWY_HAVE_SCALAR_BF16_OPERATORS 1 #else #define HWY_HAVE_SCALAR_BF16_OPERATORS 0