r336025 - [CUDA] Make min/max shims host+device.
Justin Lebar via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 29 15:27:56 PDT 2018
Author: jlebar
Date: Fri Jun 29 15:27:56 2018
New Revision: 336025
URL: http://llvm.org/viewvc/llvm-project?rev=336025&view=rev
Log:
[CUDA] Make min/max shims host+device.
Summary:
Fixes PR37753: min/max can't be called from __host__ __device__
functions in C++14 mode.
Testcase in a separate test-suite commit.
Reviewers: rsmith
Subscribers: sanjoy, lahwaacz, cfe-commits
Differential Revision: https://reviews.llvm.org/D48036
Modified:
cfe/trunk/lib/Headers/cuda_wrappers/algorithm
Modified: cfe/trunk/lib/Headers/cuda_wrappers/algorithm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/cuda_wrappers/algorithm?rev=336025&r1=336024&r2=336025&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/cuda_wrappers/algorithm (original)
+++ cfe/trunk/lib/Headers/cuda_wrappers/algorithm Fri Jun 29 15:27:56 2018
@@ -69,28 +69,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class __T, class __Cmp>
__attribute__((enable_if(true, "")))
-inline __device__ const __T &
+inline __host__ __device__ const __T &
max(const __T &__a, const __T &__b, __Cmp __cmp) {
return __cmp(__a, __b) ? __b : __a;
}
template <class __T>
__attribute__((enable_if(true, "")))
-inline __device__ const __T &
+inline __host__ __device__ const __T &
max(const __T &__a, const __T &__b) {
return __a < __b ? __b : __a;
}
template <class __T, class __Cmp>
__attribute__((enable_if(true, "")))
-inline __device__ const __T &
+inline __host__ __device__ const __T &
min(const __T &__a, const __T &__b, __Cmp __cmp) {
return __cmp(__b, __a) ? __b : __a;
}
template <class __T>
__attribute__((enable_if(true, "")))
-inline __device__ const __T &
+inline __host__ __device__ const __T &
min(const __T &__a, const __T &__b) {
return __a < __b ? __a : __b;
}
More information about the cfe-commits
mailing list