xref: /llvm-project/clang/test/Sema/builtin-spirv-amdgcn-atomic-inc-dec-failure.cpp (revision 88e2bb40921f35663e16e45514de20018615c36f)
1 // RUN: %clang_cc1 %s -x hip -fcuda-is-device -o - \
2 // RUN:   -triple=spirv64-amd-amdhsa -fsyntax-only \
3 // RUN:   -verify=dev
4 // RUN: %clang_cc1 %s -x hip -triple x86_64 -o - \
5 // RUN:   -aux-triple spirv64-amd-amdhsa -fsyntax-only \
6 // RUN:   -verify=host
7 
8 // dev-no-diagnostics
9 
test_host()10 void test_host() {
11   __UINT32_TYPE__ val32;
12   __UINT64_TYPE__ val64;
13 
14   // host-error@+1 {{reference to __device__ function '__builtin_amdgcn_atomic_inc32' in __host__ function}}
15   val32 = __builtin_amdgcn_atomic_inc32(&val32, val32, __ATOMIC_SEQ_CST, "");
16 
17   // host-error@+1 {{reference to __device__ function '__builtin_amdgcn_atomic_inc64' in __host__ function}}
18   val64 = __builtin_amdgcn_atomic_inc64(&val64, val64, __ATOMIC_SEQ_CST, "");
19 
20   // host-error@+1 {{reference to __device__ function '__builtin_amdgcn_atomic_dec32' in __host__ function}}
21   val32 = __builtin_amdgcn_atomic_dec32(&val32, val32, __ATOMIC_SEQ_CST, "");
22 
23   // host-error@+1 {{reference to __device__ function '__builtin_amdgcn_atomic_dec64' in __host__ function}}
24   val64 = __builtin_amdgcn_atomic_dec64(&val64, val64, __ATOMIC_SEQ_CST, "");
25 }
26