]> granicus.if.org Git - clang/commitdiff
[CUDA] Added overloads for '[unsigned] long' variants of shfl builtins.
authorArtem Belevich <tra@google.com>
Wed, 6 Dec 2017 17:40:35 +0000 (17:40 +0000)
committerArtem Belevich <tra@google.com>
Wed, 6 Dec 2017 17:40:35 +0000 (17:40 +0000)
Differential Revision: https://reviews.llvm.org/D40871

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@319908 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/__clang_cuda_intrinsics.h

index bc5b876577f34d453267413961398eeda662608f..3f14b4f2dded3d998d1fd328c6fdd6b0e7bc1782 100644 (file)
@@ -135,6 +135,24 @@ __MAKE_SHUFFLES(__shfl_xor, __nvvm_shfl_bfly_i32, __nvvm_shfl_bfly_f32, 0x1f);
     return static_cast<unsigned long long>(::__FnName(                         \
         __mask, static_cast<unsigned long long>(__val), __offset, __width));   \
   }                                                                            \
+  inline __device__ long __FnName(unsigned int __mask, long __val,             \
+                                  int __offset, int __width = warpSize) {      \
+    _Static_assert(sizeof(long) == sizeof(long long) ||                        \
+                   sizeof(long) == sizeof(int));                               \
+    if (sizeof(long) == sizeof(long long)) {                                   \
+      return static_cast<long>(::__FnName(                                     \
+          __mask, static_cast<long long>(__val), __offset, __width));          \
+    } else if (sizeof(long) == sizeof(int)) {                                  \
+      return static_cast<long>(                                                \
+          ::__FnName(__mask, static_cast<int>(__val), __offset, __width));     \
+    }                                                                          \
+  }                                                                            \
+  inline __device__ unsigned long __FnName(unsigned int __mask,                \
+                                           unsigned long __val, int __offset,  \
+                                           int __width = warpSize) {           \
+    return static_cast<unsigned long>(                                         \
+        ::__FnName(__mask, static_cast<long>(__val), __offset, __width));      \
+  }                                                                            \
   inline __device__ double __FnName(unsigned int __mask, double __val,         \
                                     int __offset, int __width = warpSize) {    \
     long long __tmp;                                                           \