Fixes NVIDIA HPC compiler and Intel ICC compatibility

This commit is contained in:
Federico Busato 2022-01-25 11:59:50 -08:00
parent a7aecbfcaa
commit 394f729493
2 changed files with 12 additions and 4 deletions

View File

@ -49,6 +49,12 @@
# define FMT_ICC_VERSION 0
#endif
#ifdef __NVCOMPILER
# define FMT_NVHPC_VERSION (__NVCOMPILER_MAJOR__ * 100 + __NVCOMPILER_MINOR__)
#else
# define FMT_NVHPC_VERSION 0
#endif
#ifdef __NVCC__
# define FMT_NVCC __NVCC__
#else
@ -287,7 +293,7 @@
// Enable minimal optimizations for more compact code in debug mode.
FMT_GCC_PRAGMA("GCC push_options")
#ifndef __OPTIMIZE__
#ifndef __OPTIMIZE__ && !FMT_NVHPC_VERSION
FMT_GCC_PRAGMA("GCC optimize(\"Og\")")
#endif

View File

@ -159,10 +159,12 @@ FMT_END_NAMESPACE
// __builtin_ctz is broken in Intel Compiler Classic on Windows:
// https://github.com/fmtlib/fmt/issues/2510.
#ifndef __ICL
# if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION || FMT_ICC_VERSION
# if FMT_HAS_BUILTIN(__builtin_ctz) || FMT_GCC_VERSION || \
FMT_ICC_VERSION || FMT_NVHPC_VERSION
# define FMT_BUILTIN_CTZ(n) __builtin_ctz(n)
# endif
# if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || FMT_ICC_VERSION
# if FMT_HAS_BUILTIN(__builtin_ctzll) || FMT_GCC_VERSION || \
FMT_ICC_VERSION || FMT_NVHPC_VERSION
# define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n)
# endif
#endif
@ -354,7 +356,7 @@ template <> constexpr auto num_bits<fallback_uintptr>() -> int {
FMT_INLINE void assume(bool condition) {
(void)condition;
#if FMT_HAS_BUILTIN(__builtin_assume)
#if FMT_HAS_BUILTIN(__builtin_assume) && !FMT_ICC_VERSION
__builtin_assume(condition);
#endif
}