llvm-for-llvmta/tools/clang/test/CodeGenCXX/builtin-amdgcn-fence.cpp

23 lines
682 B
C++
Raw Normal View History

2022-04-25 13:02:35 +02:00
// REQUIRES: amdgpu-registered-target
// RUN: %clang_cc1 %s -emit-llvm -O0 -o - \
// RUN: -triple=amdgcn-amd-amdhsa | opt -S | FileCheck %s
void test_memory_fence_success() {
// CHECK-LABEL: test_memory_fence_success
// CHECK: fence syncscope("workgroup") seq_cst
__builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "workgroup");
// CHECK: fence syncscope("agent") acquire
__builtin_amdgcn_fence(__ATOMIC_ACQUIRE, "agent");
// CHECK: fence seq_cst
__builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "");
// CHECK: fence syncscope("agent") acq_rel
__builtin_amdgcn_fence(4, "agent");
// CHECK: fence syncscope("workgroup") release
__builtin_amdgcn_fence(3, "workgroup");
}