summaryrefslogtreecommitdiffstats
path: root/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h')
-rw-r--r--openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
new file mode 100644
index 00000000000..610469527cf
--- /dev/null
+++ b/openmp/libomptarget/deviceRTLs/nvptx/src/target_impl.h
@@ -0,0 +1,41 @@
+//===------------ target_impl.h - NVPTX OpenMP GPU options ------- CUDA -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Definitions of target specific functions
+//
+//===----------------------------------------------------------------------===//
+#ifndef _TARGET_IMPL_H_
+#define _TARGET_IMPL_H_
+
+#include <stdint.h>
+
+#include "option.h"
+
+INLINE void __kmpc_impl_unpack(int64_t val, int32_t &lo, int32_t &hi) {
+ asm volatile("mov.b64 {%0,%1}, %2;" : "=r"(lo), "=r"(hi) : "l"(val));
+}
+
+INLINE int64_t __kmpc_impl_pack(int32_t lo, int32_t hi) {
+ int64_t val;
+ asm volatile("mov.b64 %0, {%1,%2};" : "=l"(val) : "r"(lo), "r"(hi));
+ return val;
+}
+
+typedef uint32_t __kmpc_impl_lanemask_t;
+
+INLINE __kmpc_impl_lanemask_t __kmpc_impl_lanemask_lt() {
+ __kmpc_impl_lanemask_t res;
+ asm("mov.u32 %0, %%lanemask_lt;" : "=r"(res));
+ return res;
+}
+
+INLINE int __kmpc_impl_ffs(uint32_t x) { return __ffs(x); }
+
+INLINE int __kmpc_impl_popc(uint32_t x) { return __popc(x); }
+
+#endif
OpenPOWER on IntegriCloud