1; RUN: not llc -mtriple=amdgcn-amd- -mcpu=gfx803 -verify-machineinstrs < %s 2>&1 | FileCheck %s
2; RUN: not llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -verify-machineinstrs < %s 2>&1 | FileCheck %s
3
4; CHECK: error: <unknown>:0:0: in function invalid_fence void (): Unsupported atomic synchronization scope
5define amdgpu_kernel void @invalid_fence() {
6entry:
7  fence syncscope("invalid") seq_cst
8  ret void
9}
10
11; CHECK: error: <unknown>:0:0: in function invalid_load void (i32*, i32*): Unsupported non-inclusive atomic synchronization scope
12define amdgpu_kernel void @invalid_load(
13    i32* %in, i32* %out) {
14entry:
15  %val = load atomic i32, i32* %in syncscope("invalid") seq_cst, align 4
16  store i32 %val, i32* %out
17  ret void
18}
19
20; CHECK: error: <unknown>:0:0: in function invalid_store void (i32, i32*): Unsupported non-inclusive atomic synchronization scope
21define amdgpu_kernel void @invalid_store(
22    i32 %in, i32* %out) {
23entry:
24  store atomic i32 %in, i32* %out syncscope("invalid") seq_cst, align 4
25  ret void
26}
27
28; CHECK: error: <unknown>:0:0: in function invalid_cmpxchg void (i32*, i32, i32): Unsupported non-inclusive atomic synchronization scope
29define amdgpu_kernel void @invalid_cmpxchg(
30    i32* %out, i32 %in, i32 %old) {
31entry:
32  %gep = getelementptr i32, i32* %out, i32 4
33  %val = cmpxchg volatile i32* %gep, i32 %old, i32 %in syncscope("invalid") seq_cst seq_cst
34  ret void
35}
36
37; CHECK: error: <unknown>:0:0: in function invalid_rmw void (i32*, i32): Unsupported non-inclusive atomic synchronization scope
38define amdgpu_kernel void @invalid_rmw(
39    i32* %out, i32 %in) {
40entry:
41  %val = atomicrmw volatile xchg i32* %out, i32 %in syncscope("invalid") seq_cst
42  ret void
43}
44