| 1 |
// REQUIRES: amdgpu-registered-target |
| 2 |
// RUN: %clang_cc1 -cl-std=CL2.0 -triple amdgcn-unknown-unknown -target-cpu tahiti -emit-llvm -disable-llvm-passes -o - %s | FileCheck -enable-var-scope %s |
| 3 |
|
| 4 |
// SI did not actually support flat addressing, but we can codegen the address |
| 5 |
// space test builtins. The target specfic part is a load from the implicit |
| 6 |
// argument buffer to use for the high pointer bits. It's just that buffer won't |
| 7 |
// be initialized to something useful. The proper way to diagnose invalid flat |
| 8 |
// usage is to forbid flat pointers on unsupported targets. |
| 9 |
|
| 10 |
// CHECK-LABEL: @test_is_shared_global( |
| 11 |
// CHECK: [[CAST:%[0-9]+]] = addrspacecast ptr addrspace(1) %{{[0-9]+}} to ptr |
| 12 |
// CHECK: call i1 @llvm.amdgcn.is.shared(ptr [[CAST]] |
| 13 |
int test_is_shared_global(const global int* ptr) { |
| 14 |
return __builtin_amdgcn_is_shared(ptr); |
| 15 |
} |
| 16 |
|
| 17 |
// CHECK-LABEL: @test_is_private_global( |
| 18 |
// CHECK: [[CAST:%[0-9]+]] = addrspacecast ptr addrspace(1) %{{[0-9]+}} to ptr |
| 19 |
// CHECK: call i1 @llvm.amdgcn.is.private(ptr [[CAST]] |
| 20 |
int test_is_private_global(const global int* ptr) { |
| 21 |
return __builtin_amdgcn_is_private(ptr); |
| 22 |
} |