| 1 |
// REQUIRES: amdgpu-registered-target |
| 2 |
// RUN: %clang_cc1 -std=c++20 -triple amdgcn -target-cpu tahiti -emit-llvm -fcuda-is-device -verify=no-memrealtime -o - %s |
| 3 |
// RUN: %clang_cc1 -std=c++20 -triple amdgcn -target-cpu gfx950 -emit-llvm -fcuda-is-device -o - %s |
| 4 |
|
| 5 |
#define __device__ __attribute__((device)) |
| 6 |
#define __shared__ __attribute__((shared)) |
| 7 |
|
| 8 |
struct S { |
| 9 |
static constexpr auto memrealtime_lambda = []() { |
| 10 |
__builtin_amdgcn_s_memrealtime(); // no-memrealtime-error{{'__builtin_amdgcn_s_memrealtime' needs target feature s-memrealtime}} |
| 11 |
}; |
| 12 |
}; |
| 13 |
|
| 14 |
__attribute__((target("s-memrealtime"))) |
| 15 |
__device__ void test_target_dependant_builtin_attr_fail() { |
| 16 |
S::memrealtime_lambda(); |
| 17 |
} |
| 18 |
|
| 19 |
constexpr auto memrealtime_lambda = []() { |
| 20 |
__builtin_amdgcn_s_memrealtime(); // no-memrealtime-error{{'__builtin_amdgcn_s_memrealtime' needs target feature s-memrealtime}} |
| 21 |
}; |
| 22 |
|
| 23 |
__attribute__((target("s-memrealtime"))) |
| 24 |
__device__ void global_test_target_dependant_builtin_attr_fail() { |
| 25 |
memrealtime_lambda(); |
| 26 |
} |
| 27 |
|
| 28 |
__attribute__((target("s-memrealtime"))) |
| 29 |
__device__ void local_test_target_dependant_builtin_attr_fail() { |
| 30 |
static constexpr auto f = []() { |
| 31 |
__builtin_amdgcn_s_memrealtime(); // no-memrealtime-error{{'__builtin_amdgcn_s_memrealtime' needs target feature s-memrealtime}} |
| 32 |
}; |
| 33 |
f(); |
| 34 |
} |