Debian Codegraph @

libclc/clc/lib/amdgcn/workitem/clc_get_global_offset.cl

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include <clc/workitem/clc_get_global_offset.h>
10
11 #if __clang_major__ >= 8
12 #define CONST_AS __constant
13 #elif __clang_major__ >= 7
14 #define CONST_AS __attribute__((address_space(4)))
15 #else
16 #define CONST_AS __attribute__((address_space(2)))
17 #endif
18
19 _CLC_DEF _CLC_OVERLOAD size_t __clc_get_global_offset(uint dim) {
20 CONST_AS uint *ptr = (CONST_AS uint *)__builtin_amdgcn_implicitarg_ptr();
21 if (dim < 3)
22 return ptr[dim + 1];
23 return 0;
24 }