xref: /openbsd-src/gnu/llvm/clang/lib/Headers/openmp_wrappers/time.h (revision ec727ea710c91afd8ce4f788c5aaa8482b7b69b2)
1*ec727ea7Spatrick /*===---- time.h - OpenMP time header wrapper ------------------------ c ---===
2*ec727ea7Spatrick  *
3*ec727ea7Spatrick  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*ec727ea7Spatrick  * See https://llvm.org/LICENSE.txt for license information.
5*ec727ea7Spatrick  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*ec727ea7Spatrick  *
7*ec727ea7Spatrick  *===-----------------------------------------------------------------------===
8*ec727ea7Spatrick  */
9*ec727ea7Spatrick 
10*ec727ea7Spatrick #ifndef __CLANG_OPENMP_TIME_H__
11*ec727ea7Spatrick #define __CLANG_OPENMP_TIME_H__
12*ec727ea7Spatrick 
13*ec727ea7Spatrick #ifndef _OPENMP
14*ec727ea7Spatrick #error "This file is for OpenMP compilation only."
15*ec727ea7Spatrick #endif
16*ec727ea7Spatrick 
17*ec727ea7Spatrick #if defined(__cplusplus)
18*ec727ea7Spatrick #define __DEVICE__ static constexpr __attribute__((always_inline, nothrow))
19*ec727ea7Spatrick #else
20*ec727ea7Spatrick #define __DEVICE__ static __attribute__((always_inline, nothrow))
21*ec727ea7Spatrick #endif
22*ec727ea7Spatrick 
23*ec727ea7Spatrick #include_next <time.h>
24*ec727ea7Spatrick 
25*ec727ea7Spatrick #pragma omp begin declare variant match(                                       \
26*ec727ea7Spatrick     device = {arch(nvptx, nvptx64)}, implementation = {extension(match_any)})
27*ec727ea7Spatrick 
clock()28*ec727ea7Spatrick __DEVICE__ clock_t clock() { return __nvvm_read_ptx_sreg_clock(); }
29*ec727ea7Spatrick 
30*ec727ea7Spatrick #pragma omp end declare variant
31*ec727ea7Spatrick 
32*ec727ea7Spatrick #endif
33