| 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_work_dim.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_OVERLOAD _CLC_DEF uint __clc_get_work_dim() { |
| 20 |
CONST_AS uint *ptr = (CONST_AS uint *)__builtin_amdgcn_implicitarg_ptr(); |
| 21 |
return ptr[0]; |
| 22 |
} |