brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 28f418f Raw
23 lines · plain
1// REQUIRES: amdgpu-registered-target2// 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 %s3 4// SI did not actually support flat addressing, but we can codegen the address5// space test builtins. The target specfic part is a load from the implicit6// argument buffer to use for the high pointer bits. It's just that buffer won't7// be initialized to something useful. The proper way to diagnose invalid flat8// 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 ptr12// CHECK: call i1 @llvm.amdgcn.is.shared(ptr [[CAST]]13int 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 ptr19// CHECK: call i1 @llvm.amdgcn.is.private(ptr [[CAST]]20int test_is_private_global(const global int* ptr) {21  return __builtin_amdgcn_is_private(ptr);22}23