16#if (ALPAKA_LANG_CUDA || ALPAKA_LANG_HIP)
17namespace alpaka::internal::intrinsic
19 template<
typename T_Arg>
20 struct Popcount::Op<
alpaka::internal::CudaHipIntrinsic, T_Arg>
22 inline __device__
auto operator()(alpaka::internal::CudaHipIntrinsic
const, T_Arg
const& val)
const
24 if constexpr(
sizeof(T_Arg) == 4u)
26 return __popc(std::bit_cast<unsigned int>(val));
28 else if constexpr(
sizeof(T_Arg) == 8u)
30 return __popcll(std::bit_cast<unsigned long long>(val));
33 static_assert(!
sizeof(T_Arg),
"Unsupported data type, sizeof() must be 4 or 8");
39 template<
typename T_Arg>
40 struct Ffs::Op<
alpaka::internal::CudaHipIntrinsic, T_Arg>
42 inline __device__
auto operator()(alpaka::internal::CudaHipIntrinsic
const, T_Arg
const& val)
const
44 if constexpr(
sizeof(T_Arg) == 4u)
46 return __ffs(std::bit_cast<int>(val));
48 else if constexpr(
sizeof(T_Arg) == 8u)
50 return __ffsll(std::bit_cast<long long int>(val));
53 static_assert(!
sizeof(T_Arg),
"Unsupported data type, sizeof() must be 4 or 8");
59 template<
typename T_Arg>
60 struct Clz::Op<
alpaka::internal::CudaHipIntrinsic, T_Arg>
62 inline __device__
auto operator()(alpaka::internal::CudaHipIntrinsic
const, T_Arg
const& val)
const
64 if constexpr(
sizeof(T_Arg) == 4u)
66 return __clz(std::bit_cast<int>(val));
68 else if constexpr(
sizeof(T_Arg) == 8u)
70 return __clzll(std::bit_cast<long long int>(val));
73 static_assert(!
sizeof(T_Arg),
"Unsupported data type, sizeof() must be 4 or 8");
#define ALPAKA_UNREACHABLE(...)
Before CUDA 11.5 nvcc is unable to correctly identify return statements in 'if constexpr' branches....