[NFC][Py Reformat] Reformat python files in llvm
[llvm-project.git] / libclc / amdgcn / lib / workitem / get_global_offset.cl
blob73d5694523ac2a2cc42afd871c3c1e566123e664
1 #include <clc/clc.h>
3 #if __clang_major__ >= 8
4 #define CONST_AS __constant
5 #elif __clang_major__ >= 7
6 #define CONST_AS __attribute__((address_space(4)))
7 #else
8 #define CONST_AS __attribute__((address_space(2)))
9 #endif
11 _CLC_DEF _CLC_OVERLOAD size_t get_global_offset(uint dim) {
12 CONST_AS uint *ptr = (CONST_AS uint *)__builtin_amdgcn_implicitarg_ptr();
13 if (dim < 3)
14 return ptr[dim + 1];
15 return 0;