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

Adds __popc and __max #116

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions include/cupla/cudaToCupla/runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,15 @@
#define __fdividef(a,b) ((a)/(b))
#define __expf(a) alpaka::math::exp(acc,a)
#define __logf(a) alpaka::math::log(acc,a)
#define __max(a,b) alpaka::math::max(acc,a,b)
#endif

#if !defined(ALPAKA_ACC_GPU_CUDA_ENABLED) && !defined(ALPAKA_ACC_GPU_HIP_ENABLED)
#if defined(__GNUC__) || defined(__GNUG__)
#define __popc __builtin_popcount
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is better as a function-style macro (taking an argument explicitly) for consistency with others?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we should use a function style macro!+1 for function style macro

#endif
#ifdef _MSC_VER
#include <intrin.h>
#define __popc __popcnt
#endif
#endif