summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Lebar <jlebar@google.com>2018-06-29 22:27:56 +0000
committerJustin Lebar <jlebar@google.com>2018-06-29 22:27:56 +0000
commit5cb41c2acf83c6bbdffac928d40939c08c7f5aad (patch)
tree242e9fedb9cdfb7dbab57abf80c7aa65c6592ee8
parent68e1919d1481300c150da4b614aebe0606316094 (diff)
downloadbcm5719-llvm-5cb41c2acf83c6bbdffac928d40939c08c7f5aad.tar.gz
bcm5719-llvm-5cb41c2acf83c6bbdffac928d40939c08c7f5aad.zip
[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 llvm-svn: 336025
-rw-r--r--clang/lib/Headers/cuda_wrappers/algorithm8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Headers/cuda_wrappers/algorithm b/clang/lib/Headers/cuda_wrappers/algorithm
index 8ee84f7fb02..d8658bf1c7d 100644
--- a/clang/lib/Headers/cuda_wrappers/algorithm
+++ b/clang/lib/Headers/cuda_wrappers/algorithm
@@ -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;
}
OpenPOWER on IntegriCloud