1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -march=amdgcn -mcpu=gfx940 -verify-machineinstrs < %s | FileCheck --check-prefixes=GCN,FORCESC0SC1 %s
3 ; RUN: llc -march=amdgcn -mcpu=gfx941 -verify-machineinstrs < %s | FileCheck --check-prefixes=GCN,FORCESC0SC1 %s
4 ; RUN: llc -march=amdgcn -mcpu=gfx942 -verify-machineinstrs -mattr=-forcestoresc1 < %s | FileCheck --check-prefixes=GCN,NOSC0SC1 %s
6 define amdgpu_kernel void @store_global(ptr addrspace(1) %ptr) {
7 ; FORCESC0SC1-LABEL: store_global:
8 ; FORCESC0SC1: ; %bb.0: ; %entry
9 ; FORCESC0SC1-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
10 ; FORCESC0SC1-NEXT: v_mov_b32_e32 v0, 0
11 ; FORCESC0SC1-NEXT: v_mov_b32_e32 v1, 1.0
12 ; FORCESC0SC1-NEXT: s_waitcnt lgkmcnt(0)
13 ; FORCESC0SC1-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
14 ; FORCESC0SC1-NEXT: s_endpgm
16 ; NOSC0SC1-LABEL: store_global:
17 ; NOSC0SC1: ; %bb.0: ; %entry
18 ; NOSC0SC1-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
19 ; NOSC0SC1-NEXT: v_mov_b32_e32 v0, 0
20 ; NOSC0SC1-NEXT: v_mov_b32_e32 v1, 1.0
21 ; NOSC0SC1-NEXT: s_waitcnt lgkmcnt(0)
22 ; NOSC0SC1-NEXT: global_store_dword v0, v1, s[0:1]
23 ; NOSC0SC1-NEXT: s_endpgm
25 store float 1.000000e+00, ptr addrspace(1) %ptr, align 4
29 define amdgpu_kernel void @store_flat(ptr addrspace(0) %ptr) {
30 ; FORCESC0SC1-LABEL: store_flat:
31 ; FORCESC0SC1: ; %bb.0: ; %entry
32 ; FORCESC0SC1-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
33 ; FORCESC0SC1-NEXT: v_mov_b32_e32 v2, 1.0
34 ; FORCESC0SC1-NEXT: s_waitcnt lgkmcnt(0)
35 ; FORCESC0SC1-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
36 ; FORCESC0SC1-NEXT: flat_store_dword v[0:1], v2 sc0 sc1
37 ; FORCESC0SC1-NEXT: s_endpgm
39 ; NOSC0SC1-LABEL: store_flat:
40 ; NOSC0SC1: ; %bb.0: ; %entry
41 ; NOSC0SC1-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
42 ; NOSC0SC1-NEXT: v_mov_b32_e32 v2, 1.0
43 ; NOSC0SC1-NEXT: s_waitcnt lgkmcnt(0)
44 ; NOSC0SC1-NEXT: v_mov_b64_e32 v[0:1], s[0:1]
45 ; NOSC0SC1-NEXT: flat_store_dword v[0:1], v2
46 ; NOSC0SC1-NEXT: s_endpgm
48 store float 1.000000e+00, ptr addrspace(0) %ptr, align 4
52 define amdgpu_kernel void @store_lds(ptr addrspace(3) %ptr) {
53 ; GCN-LABEL: store_lds:
54 ; GCN: ; %bb.0: ; %entry
55 ; GCN-NEXT: s_load_dword s0, s[0:1], 0x24
56 ; GCN-NEXT: v_mov_b32_e32 v0, 1.0
57 ; GCN-NEXT: s_waitcnt lgkmcnt(0)
58 ; GCN-NEXT: v_mov_b32_e32 v1, s0
59 ; GCN-NEXT: ds_write_b32 v1, v0
62 store float 1.000000e+00, ptr addrspace(3) %ptr, align 4
66 define amdgpu_kernel void @store_scratch(ptr addrspace(5) %ptr) {
67 ; FORCESC0SC1-LABEL: store_scratch:
68 ; FORCESC0SC1: ; %bb.0: ; %entry
69 ; FORCESC0SC1-NEXT: s_load_dword s0, s[0:1], 0x24
70 ; FORCESC0SC1-NEXT: v_mov_b32_e32 v0, 1.0
71 ; FORCESC0SC1-NEXT: s_waitcnt lgkmcnt(0)
72 ; FORCESC0SC1-NEXT: scratch_store_dword off, v0, s0 sc0 sc1
73 ; FORCESC0SC1-NEXT: s_endpgm
75 ; NOSC0SC1-LABEL: store_scratch:
76 ; NOSC0SC1: ; %bb.0: ; %entry
77 ; NOSC0SC1-NEXT: s_load_dword s0, s[0:1], 0x24
78 ; NOSC0SC1-NEXT: v_mov_b32_e32 v0, 1.0
79 ; NOSC0SC1-NEXT: s_waitcnt lgkmcnt(0)
80 ; NOSC0SC1-NEXT: scratch_store_dword off, v0, s0
81 ; NOSC0SC1-NEXT: s_endpgm
83 store float 1.000000e+00, ptr addrspace(5) %ptr, align 4
87 define amdgpu_ps void @store_buffer(<4 x i32> inreg %rsrc, float %data, i32 %index) {
88 ; FORCESC0SC1-LABEL: store_buffer:
89 ; FORCESC0SC1: ; %bb.0: ; %main_body
90 ; FORCESC0SC1-NEXT: buffer_store_dword v0, v1, s[0:3], 0 idxen sc0 sc1
91 ; FORCESC0SC1-NEXT: s_endpgm
93 ; NOSC0SC1-LABEL: store_buffer:
94 ; NOSC0SC1: ; %bb.0: ; %main_body
95 ; NOSC0SC1-NEXT: buffer_store_dword v0, v1, s[0:3], 0 idxen
96 ; NOSC0SC1-NEXT: s_endpgm
98 call void @llvm.amdgcn.buffer.store.f32(float %data, <4 x i32> %rsrc, i32 %index, i32 0, i1 0, i1 0)
102 define amdgpu_kernel void @store_global_atomic(ptr addrspace(1) %ptr) {
103 ; FORCESC0SC1-LABEL: store_global_atomic:
104 ; FORCESC0SC1: ; %bb.0: ; %entry
105 ; FORCESC0SC1-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
106 ; FORCESC0SC1-NEXT: v_mov_b32_e32 v0, 0
107 ; FORCESC0SC1-NEXT: v_mov_b32_e32 v1, 1.0
108 ; FORCESC0SC1-NEXT: buffer_wbl2 sc1
109 ; FORCESC0SC1-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
110 ; FORCESC0SC1-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
111 ; FORCESC0SC1-NEXT: s_endpgm
113 ; NOSC0SC1-LABEL: store_global_atomic:
114 ; NOSC0SC1: ; %bb.0: ; %entry
115 ; NOSC0SC1-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
116 ; NOSC0SC1-NEXT: v_mov_b32_e32 v0, 0
117 ; NOSC0SC1-NEXT: v_mov_b32_e32 v1, 1.0
118 ; NOSC0SC1-NEXT: buffer_wbl2 sc1
119 ; NOSC0SC1-NEXT: s_waitcnt vmcnt(0) lgkmcnt(0)
120 ; NOSC0SC1-NEXT: global_store_dword v0, v1, s[0:1] sc1
121 ; NOSC0SC1-NEXT: s_endpgm
123 store atomic float 1.000000e+00, ptr addrspace(1) %ptr syncscope("agent-one-as") seq_cst, align 4
127 define amdgpu_kernel void @store_global_atomic_system(ptr addrspace(1) %ptr) {
128 ; GCN-LABEL: store_global_atomic_system:
130 ; GCN-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
131 ; GCN-NEXT: v_mov_b32_e32 v0, 0
132 ; GCN-NEXT: v_mov_b32_e32 v1, 1.0
133 ; GCN-NEXT: s_waitcnt lgkmcnt(0)
134 ; GCN-NEXT: global_store_dword v0, v1, s[0:1] sc0 sc1
136 store atomic float 1.000000e+00, ptr addrspace(1) %ptr monotonic, align 4
141 declare void @llvm.amdgcn.buffer.store.f32(float, <4 x i32>, i32, i32, i1, i1)