Skip to content

Commit

Permalink
Kokkos_BitManipulation: KOKKOS_COMPILER_GCC->KOKKOS_COMPILER_GNU (kok…
Browse files Browse the repository at this point in the history
…kos#6119)

* Kokkos_BitManipulation: KOKKOS_COMPILER_GCC->KOKKOS_COMPILER_GNU

* Check for existence of _has_builtin
  • Loading branch information
masterleinad committed May 10, 2023
1 parent 7009a28 commit e94b5dd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions core/src/Kokkos_BitManipulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ rotr(T x, int s) noexcept {
namespace Kokkos::Impl {

#if defined(KOKKOS_COMPILER_CLANG) || defined(KOKKOS_COMPILER_INTEL_LLVM) || \
defined(KOKKOS_COMPILER_GCC)
defined(KOKKOS_COMPILER_GNU)
#define KOKKOS_IMPL_USE_GCC_BUILT_IN_FUNCTIONS
#endif

Expand All @@ -259,12 +259,13 @@ KOKKOS_IMPL_HOST_FUNCTION T byteswap_builtin_host(T x) noexcept {
} else if constexpr (sizeof(T) == 8) {
return __builtin_bswap64(x);
} else if constexpr (sizeof(T) == 16) {
#if defined(__has_builtin)
#if __has_builtin(__builtin_bswap128)
return __builtin_bswap128(x);
#else
#endif
#endif
return (__builtin_bswap64(x >> 64) |
(static_cast<T>(__builtin_bswap64(x)) << 64));
#endif
}
#endif

Expand Down

0 comments on commit e94b5dd

Please sign in to comment.