Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes NVIDIA HPC compiler and Intel ICC compatibility #2732

Merged
merged 3 commits into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
# define FMT_ICC_VERSION 0
#endif

#ifdef __NVCOMPILER
# define FMT_NVCOMPILER_VERSION \
(__NVCOMPILER_MAJOR__ * 100 + __NVCOMPILER_MINOR__)
#else
# define FMT_NVCOMPILER_VERSION 0
#endif

#ifdef __NVCC__
# define FMT_NVCC __NVCC__
#else
Expand Down Expand Up @@ -287,7 +294,7 @@

// Enable minimal optimizations for more compact code in debug mode.
FMT_GCC_PRAGMA("GCC push_options")
#ifndef __OPTIMIZE__
#if !defined(__OPTIMIZE__) && !FMT_NVCOMPILER_VERSION
FMT_GCC_PRAGMA("GCC optimize(\"Og\")")
#endif

Expand Down
8 changes: 5 additions & 3 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_NVCOMPILER_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_NVCOMPILER_VERSION
# define FMT_BUILTIN_CTZLL(n) __builtin_ctzll(n)
# endif
#endif
Expand Down Expand Up @@ -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
}
Expand Down