1# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx803 -run-pass=none %s -o - | FileCheck --check-prefix=GCN %s
2
3--- |
4  ; ModuleID = '<stdin>'
5  source_filename = "<stdin>"
6  target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
7  target triple = "amdgcn-amd-amdhsa"
8
9  define void @syncscopes(i32 %agent, i32 addrspace(4)* %agent_out, i32 %workgroup, i32 addrspace(4)* %workgroup_out, i32 %wavefront, i32 addrspace(4)* %wavefront_out) #0 {
10  entry:
11    store atomic i32 %agent, i32 addrspace(4)* %agent_out syncscope("agent") seq_cst, align 4, !nontemporal !0
12    store atomic i32 %workgroup, i32 addrspace(4)* %workgroup_out syncscope("workgroup") seq_cst, align 4, !nontemporal !0
13    store atomic i32 %wavefront, i32 addrspace(4)* %wavefront_out syncscope("wavefront") seq_cst, align 4, !nontemporal !0
14    ret void
15  }
16
17  ; Function Attrs: convergent nounwind
18  declare { i1, i64 } @llvm.amdgcn.if(i1) #1
19
20  ; Function Attrs: convergent nounwind
21  declare { i1, i64 } @llvm.amdgcn.else(i64) #1
22
23  ; Function Attrs: convergent nounwind readnone
24  declare i64 @llvm.amdgcn.break(i64) #2
25
26  ; Function Attrs: convergent nounwind readnone
27  declare i64 @llvm.amdgcn.if.break(i1, i64) #2
28
29  ; Function Attrs: convergent nounwind readnone
30  declare i64 @llvm.amdgcn.else.break(i64, i64) #2
31
32  ; Function Attrs: convergent nounwind
33  declare i1 @llvm.amdgcn.loop(i64) #1
34
35  ; Function Attrs: convergent nounwind
36  declare void @llvm.amdgcn.end.cf(i64) #1
37
38  attributes #0 = { "target-cpu"="gfx803" }
39  attributes #1 = { convergent nounwind }
40  attributes #2 = { convergent nounwind readnone }
41
42  !0 = !{i32 1}
43
44# GCN-LABEL: name: syncscopes
45# GCN: FLAT_STORE_DWORD killed %vgpr0_vgpr1, killed %vgpr2, 0, -1, 0, implicit %exec, implicit %flat_scr :: (volatile non-temporal store syncscope("agent") seq_cst 4 into %ir.agent_out)
46# GCN: FLAT_STORE_DWORD killed %vgpr0_vgpr1, killed %vgpr2, 0, -1, 0, implicit %exec, implicit %flat_scr :: (volatile non-temporal store syncscope("workgroup") seq_cst 4 into %ir.workgroup_out)
47# GCN: FLAT_STORE_DWORD killed %vgpr0_vgpr1, killed %vgpr2, 0, -1, 0, implicit %exec, implicit %flat_scr :: (volatile non-temporal store syncscope("wavefront") seq_cst 4 into %ir.wavefront_out)
48...
49---
50name:            syncscopes
51alignment:       0
52exposesReturnsTwice: false
53legalized:       false
54regBankSelected: false
55selected:        false
56tracksRegLiveness: true
57liveins:
58  - { reg: '%sgpr4_sgpr5' }
59frameInfo:
60  isFrameAddressTaken: false
61  isReturnAddressTaken: false
62  hasStackMap:     false
63  hasPatchPoint:   false
64  stackSize:       0
65  offsetAdjustment: 0
66  maxAlignment:    0
67  adjustsStack:    false
68  hasCalls:        false
69  hasOpaqueSPAdjustment: false
70  hasVAStart:      false
71  hasMustTailInVarArgFunc: false
72body:             |
73  bb.0.entry:
74    liveins: %sgpr4_sgpr5
75
76    S_WAITCNT 0
77    %sgpr0_sgpr1 = S_LOAD_DWORDX2_IMM %sgpr4_sgpr5, 8, 0 :: (non-temporal dereferenceable invariant load 8 from `i64 addrspace(2)* undef`)
78    %sgpr6 = S_LOAD_DWORD_IMM %sgpr4_sgpr5, 0, 0 :: (non-temporal dereferenceable invariant load 4 from `i32 addrspace(2)* undef`)
79    %sgpr2_sgpr3 = S_LOAD_DWORDX2_IMM %sgpr4_sgpr5, 24, 0 :: (non-temporal dereferenceable invariant load 8 from `i64 addrspace(2)* undef`)
80    %sgpr7 = S_LOAD_DWORD_IMM %sgpr4_sgpr5, 16, 0 :: (non-temporal dereferenceable invariant load 4 from `i32 addrspace(2)* undef`)
81    %sgpr8 = S_LOAD_DWORD_IMM %sgpr4_sgpr5, 32, 0 :: (non-temporal dereferenceable invariant load 4 from `i32 addrspace(2)* undef`)
82    S_WAITCNT 127
83    %vgpr0 = V_MOV_B32_e32 %sgpr0, implicit %exec, implicit-def %vgpr0_vgpr1, implicit %sgpr0_sgpr1
84    %sgpr4_sgpr5 = S_LOAD_DWORDX2_IMM killed %sgpr4_sgpr5, 40, 0 :: (non-temporal dereferenceable invariant load 8 from `i64 addrspace(2)* undef`)
85    %vgpr1 = V_MOV_B32_e32 killed %sgpr1, implicit %exec, implicit killed %sgpr0_sgpr1, implicit %sgpr0_sgpr1, implicit %exec
86    %vgpr2 = V_MOV_B32_e32 killed %sgpr6, implicit %exec, implicit %exec
87    FLAT_STORE_DWORD killed %vgpr0_vgpr1, killed %vgpr2, 0, -1, 0, implicit %exec, implicit %flat_scr :: (volatile non-temporal store syncscope("agent") seq_cst 4 into %ir.agent_out)
88    S_WAITCNT 112
89    %vgpr0 = V_MOV_B32_e32 %sgpr2, implicit %exec, implicit-def %vgpr0_vgpr1, implicit %sgpr2_sgpr3
90    %vgpr1 = V_MOV_B32_e32 killed %sgpr3, implicit %exec, implicit killed %sgpr2_sgpr3, implicit %sgpr2_sgpr3, implicit %exec
91    %vgpr2 = V_MOV_B32_e32 killed %sgpr7, implicit %exec, implicit %exec
92    FLAT_STORE_DWORD killed %vgpr0_vgpr1, killed %vgpr2, 0, -1, 0, implicit %exec, implicit %flat_scr :: (volatile non-temporal store syncscope("workgroup") seq_cst 4 into %ir.workgroup_out)
93    S_WAITCNT 112
94    %vgpr0 = V_MOV_B32_e32 %sgpr4, implicit %exec, implicit-def %vgpr0_vgpr1, implicit %sgpr4_sgpr5
95    %vgpr1 = V_MOV_B32_e32 killed %sgpr5, implicit %exec, implicit killed %sgpr4_sgpr5, implicit %sgpr4_sgpr5, implicit %exec
96    %vgpr2 = V_MOV_B32_e32 killed %sgpr8, implicit %exec, implicit %exec
97    FLAT_STORE_DWORD killed %vgpr0_vgpr1, killed %vgpr2, 0, -1, 0, implicit %exec, implicit %flat_scr :: (volatile non-temporal store syncscope("wavefront") seq_cst 4 into %ir.wavefront_out)
98    S_ENDPGM
99
100...
101