1 ; RUN: llc < %s -march=amdgcn -mcpu=SI -verify-machineinstrs | FileCheck --check-prefix=GCN --check-prefix=SI --check-prefix=FUNC %s 2 ; RUN: llc < %s -march=amdgcn -mcpu=tonga -verify-machineinstrs | FileCheck --check-prefix=GCN --check-prefix=VI --check-prefix=FUNC %s 3 4 5 ; FUNC-LABEL: {{^}}atomic_add_i32_offset: 6 ; GCN: buffer_atomic_add v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 7 define void @atomic_add_i32_offset(i32 addrspace(1)* %out, i32 %in) { 8 entry: 9 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 10 %0 = atomicrmw volatile add i32 addrspace(1)* %gep, i32 %in seq_cst 11 ret void 12 } 13 14 ; FUNC-LABEL: {{^}}atomic_add_i32_ret_offset: 15 ; GCN: buffer_atomic_add [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 16 ; GCN: buffer_store_dword [[RET]] 17 define void @atomic_add_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 18 entry: 19 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 20 %0 = atomicrmw volatile add i32 addrspace(1)* %gep, i32 %in seq_cst 21 store i32 %0, i32 addrspace(1)* %out2 22 ret void 23 } 24 25 ; FUNC-LABEL: {{^}}atomic_add_i32_addr64_offset: 26 ; SI: buffer_atomic_add v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 27 ; VI: s_movk_i32 flat_scratch_lo, 0x0 28 ; VI: s_movk_i32 flat_scratch_hi, 0x0 29 ; VI: flat_atomic_add v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 30 31 define void @atomic_add_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 32 entry: 33 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 34 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 35 %0 = atomicrmw volatile add i32 addrspace(1)* %gep, i32 %in seq_cst 36 ret void 37 } 38 39 ; FUNC-LABEL: {{^}}atomic_add_i32_ret_addr64_offset: 40 ; SI: buffer_atomic_add [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 41 ; VI: s_movk_i32 flat_scratch_lo, 0x0 42 ; VI: s_movk_i32 flat_scratch_hi, 0x0 43 ; VI: flat_atomic_add [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 44 ; GCN: buffer_store_dword [[RET]] 45 define void @atomic_add_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 46 entry: 47 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 48 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 49 %0 = atomicrmw volatile add i32 addrspace(1)* %gep, i32 %in seq_cst 50 store i32 %0, i32 addrspace(1)* %out2 51 ret void 52 } 53 54 ; FUNC-LABEL: {{^}}atomic_add_i32: 55 ; GCN: buffer_atomic_add v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 56 define void @atomic_add_i32(i32 addrspace(1)* %out, i32 %in) { 57 entry: 58 %0 = atomicrmw volatile add i32 addrspace(1)* %out, i32 %in seq_cst 59 ret void 60 } 61 62 ; FUNC-LABEL: {{^}}atomic_add_i32_ret: 63 ; GCN: buffer_atomic_add [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 64 ; GCN: buffer_store_dword [[RET]] 65 define void @atomic_add_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 66 entry: 67 %0 = atomicrmw volatile add i32 addrspace(1)* %out, i32 %in seq_cst 68 store i32 %0, i32 addrspace(1)* %out2 69 ret void 70 } 71 72 ; FUNC-LABEL: {{^}}atomic_add_i32_addr64: 73 ; SI: buffer_atomic_add v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 74 ; VI: s_movk_i32 flat_scratch_lo, 0x0 75 ; VI: s_movk_i32 flat_scratch_hi, 0x0 76 ; VI: flat_atomic_add v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 77 define void @atomic_add_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 78 entry: 79 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 80 %0 = atomicrmw volatile add i32 addrspace(1)* %ptr, i32 %in seq_cst 81 ret void 82 } 83 84 ; FUNC-LABEL: {{^}}atomic_add_i32_ret_addr64: 85 ; SI: buffer_atomic_add [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 86 ; VI: s_movk_i32 flat_scratch_lo, 0x0 87 ; VI: s_movk_i32 flat_scratch_hi, 0x0 88 ; VI: flat_atomic_add [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 89 ; GCN: buffer_store_dword [[RET]] 90 define void @atomic_add_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 91 entry: 92 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 93 %0 = atomicrmw volatile add i32 addrspace(1)* %ptr, i32 %in seq_cst 94 store i32 %0, i32 addrspace(1)* %out2 95 ret void 96 } 97 98 ; FUNC-LABEL: {{^}}atomic_and_i32_offset: 99 ; GCN: buffer_atomic_and v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 100 define void @atomic_and_i32_offset(i32 addrspace(1)* %out, i32 %in) { 101 entry: 102 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 103 %0 = atomicrmw volatile and i32 addrspace(1)* %gep, i32 %in seq_cst 104 ret void 105 } 106 107 ; FUNC-LABEL: {{^}}atomic_and_i32_ret_offset: 108 ; GCN: buffer_atomic_and [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 109 ; GCN: buffer_store_dword [[RET]] 110 define void @atomic_and_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 111 entry: 112 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 113 %0 = atomicrmw volatile and i32 addrspace(1)* %gep, i32 %in seq_cst 114 store i32 %0, i32 addrspace(1)* %out2 115 ret void 116 } 117 118 ; FUNC-LABEL: {{^}}atomic_and_i32_addr64_offset: 119 ; SI: buffer_atomic_and v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 120 ; VI: s_movk_i32 flat_scratch_lo, 0x0 121 ; VI: s_movk_i32 flat_scratch_hi, 0x0 122 ; VI: flat_atomic_and v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 123 define void @atomic_and_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 124 entry: 125 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 126 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 127 %0 = atomicrmw volatile and i32 addrspace(1)* %gep, i32 %in seq_cst 128 ret void 129 } 130 131 ; FUNC-LABEL: {{^}}atomic_and_i32_ret_addr64_offset: 132 ; SI: buffer_atomic_and [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 133 ; VI: s_movk_i32 flat_scratch_lo, 0x0 134 ; VI: s_movk_i32 flat_scratch_hi, 0x0 135 ; VI: flat_atomic_and [[RET:v[0-9]]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 136 ; GCN: buffer_store_dword [[RET]] 137 define void @atomic_and_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 138 entry: 139 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 140 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 141 %0 = atomicrmw volatile and i32 addrspace(1)* %gep, i32 %in seq_cst 142 store i32 %0, i32 addrspace(1)* %out2 143 ret void 144 } 145 146 ; FUNC-LABEL: {{^}}atomic_and_i32: 147 ; GCN: buffer_atomic_and v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 148 define void @atomic_and_i32(i32 addrspace(1)* %out, i32 %in) { 149 entry: 150 %0 = atomicrmw volatile and i32 addrspace(1)* %out, i32 %in seq_cst 151 ret void 152 } 153 154 ; FUNC-LABEL: {{^}}atomic_and_i32_ret: 155 ; GCN: buffer_atomic_and [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 156 ; GCN: buffer_store_dword [[RET]] 157 define void @atomic_and_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 158 entry: 159 %0 = atomicrmw volatile and i32 addrspace(1)* %out, i32 %in seq_cst 160 store i32 %0, i32 addrspace(1)* %out2 161 ret void 162 } 163 164 ; FUNC-LABEL: {{^}}atomic_and_i32_addr64: 165 ; SI: buffer_atomic_and v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 166 ; VI: s_movk_i32 flat_scratch_lo, 0x0 167 ; VI: s_movk_i32 flat_scratch_hi, 0x0 168 ; VI: flat_atomic_and v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 169 define void @atomic_and_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 170 entry: 171 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 172 %0 = atomicrmw volatile and i32 addrspace(1)* %ptr, i32 %in seq_cst 173 ret void 174 } 175 176 ; FUNC-LABEL: {{^}}atomic_and_i32_ret_addr64: 177 ; SI: buffer_atomic_and [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 178 ; VI: s_movk_i32 flat_scratch_lo, 0x0 179 ; VI: s_movk_i32 flat_scratch_hi, 0x0 180 ; VI: flat_atomic_and [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 181 ; GCN: buffer_store_dword [[RET]] 182 define void @atomic_and_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 183 entry: 184 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 185 %0 = atomicrmw volatile and i32 addrspace(1)* %ptr, i32 %in seq_cst 186 store i32 %0, i32 addrspace(1)* %out2 187 ret void 188 } 189 190 ; FUNC-LABEL: {{^}}atomic_sub_i32_offset: 191 ; GCN: buffer_atomic_sub v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 192 define void @atomic_sub_i32_offset(i32 addrspace(1)* %out, i32 %in) { 193 entry: 194 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 195 %0 = atomicrmw volatile sub i32 addrspace(1)* %gep, i32 %in seq_cst 196 ret void 197 } 198 199 ; FUNC-LABEL: {{^}}atomic_sub_i32_ret_offset: 200 ; GCN: buffer_atomic_sub [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 201 ; GCN: buffer_store_dword [[RET]] 202 define void @atomic_sub_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 203 entry: 204 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 205 %0 = atomicrmw volatile sub i32 addrspace(1)* %gep, i32 %in seq_cst 206 store i32 %0, i32 addrspace(1)* %out2 207 ret void 208 } 209 210 ; FUNC-LABEL: {{^}}atomic_sub_i32_addr64_offset: 211 ; SI: buffer_atomic_sub v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 212 ; VI: s_movk_i32 flat_scratch_lo, 0x0 213 ; VI: s_movk_i32 flat_scratch_hi, 0x0 214 ; VI: flat_atomic_sub v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 215 define void @atomic_sub_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 216 entry: 217 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 218 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 219 %0 = atomicrmw volatile sub i32 addrspace(1)* %gep, i32 %in seq_cst 220 ret void 221 } 222 223 ; FUNC-LABEL: {{^}}atomic_sub_i32_ret_addr64_offset: 224 ; SI: buffer_atomic_sub [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 225 ; VI: s_movk_i32 flat_scratch_lo, 0x0 226 ; VI: s_movk_i32 flat_scratch_hi, 0x0 227 ; VI: flat_atomic_sub [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 228 ; GCN: buffer_store_dword [[RET]] 229 define void @atomic_sub_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 230 entry: 231 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 232 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 233 %0 = atomicrmw volatile sub i32 addrspace(1)* %gep, i32 %in seq_cst 234 store i32 %0, i32 addrspace(1)* %out2 235 ret void 236 } 237 238 ; FUNC-LABEL: {{^}}atomic_sub_i32: 239 ; GCN: buffer_atomic_sub v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 240 define void @atomic_sub_i32(i32 addrspace(1)* %out, i32 %in) { 241 entry: 242 %0 = atomicrmw volatile sub i32 addrspace(1)* %out, i32 %in seq_cst 243 ret void 244 } 245 246 ; FUNC-LABEL: {{^}}atomic_sub_i32_ret: 247 ; GCN: buffer_atomic_sub [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 248 ; GCN: buffer_store_dword [[RET]] 249 define void @atomic_sub_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 250 entry: 251 %0 = atomicrmw volatile sub i32 addrspace(1)* %out, i32 %in seq_cst 252 store i32 %0, i32 addrspace(1)* %out2 253 ret void 254 } 255 256 ; FUNC-LABEL: {{^}}atomic_sub_i32_addr64: 257 ; SI: buffer_atomic_sub v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 258 ; VI: s_movk_i32 flat_scratch_lo, 0x0 259 ; VI: s_movk_i32 flat_scratch_hi, 0x0 260 ; VI: flat_atomic_sub v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 261 define void @atomic_sub_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 262 entry: 263 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 264 %0 = atomicrmw volatile sub i32 addrspace(1)* %ptr, i32 %in seq_cst 265 ret void 266 } 267 268 ; FUNC-LABEL: {{^}}atomic_sub_i32_ret_addr64: 269 ; SI: buffer_atomic_sub [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 270 ; VI: s_movk_i32 flat_scratch_lo, 0x0 271 ; VI: s_movk_i32 flat_scratch_hi, 0x0 272 ; VI: flat_atomic_sub [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 273 ; GCN: buffer_store_dword [[RET]] 274 define void @atomic_sub_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 275 entry: 276 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 277 %0 = atomicrmw volatile sub i32 addrspace(1)* %ptr, i32 %in seq_cst 278 store i32 %0, i32 addrspace(1)* %out2 279 ret void 280 } 281 282 ; FUNC-LABEL: {{^}}atomic_max_i32_offset: 283 ; GCN: buffer_atomic_smax v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 284 define void @atomic_max_i32_offset(i32 addrspace(1)* %out, i32 %in) { 285 entry: 286 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 287 %0 = atomicrmw volatile max i32 addrspace(1)* %gep, i32 %in seq_cst 288 ret void 289 } 290 291 ; FUNC-LABEL: {{^}}atomic_max_i32_ret_offset: 292 ; GCN: buffer_atomic_smax [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 293 ; GCN: buffer_store_dword [[RET]] 294 define void @atomic_max_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 295 entry: 296 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 297 %0 = atomicrmw volatile max i32 addrspace(1)* %gep, i32 %in seq_cst 298 store i32 %0, i32 addrspace(1)* %out2 299 ret void 300 } 301 302 ; FUNC-LABEL: {{^}}atomic_max_i32_addr64_offset: 303 ; SI: buffer_atomic_smax v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 304 ; VI: s_movk_i32 flat_scratch_lo, 0x0 305 ; VI: s_movk_i32 flat_scratch_hi, 0x0 306 ; VI: flat_atomic_smax v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 307 define void @atomic_max_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 308 entry: 309 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 310 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 311 %0 = atomicrmw volatile max i32 addrspace(1)* %gep, i32 %in seq_cst 312 ret void 313 } 314 315 ; FUNC-LABEL: {{^}}atomic_max_i32_ret_addr64_offset: 316 ; SI: buffer_atomic_smax [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 317 ; VI: s_movk_i32 flat_scratch_lo, 0x0 318 ; VI: s_movk_i32 flat_scratch_hi, 0x0 319 ; VI: flat_atomic_smax [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 320 ; GCN: buffer_store_dword [[RET]] 321 define void @atomic_max_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 322 entry: 323 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 324 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 325 %0 = atomicrmw volatile max i32 addrspace(1)* %gep, i32 %in seq_cst 326 store i32 %0, i32 addrspace(1)* %out2 327 ret void 328 } 329 330 ; FUNC-LABEL: {{^}}atomic_max_i32: 331 ; GCN: buffer_atomic_smax v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 332 define void @atomic_max_i32(i32 addrspace(1)* %out, i32 %in) { 333 entry: 334 %0 = atomicrmw volatile max i32 addrspace(1)* %out, i32 %in seq_cst 335 ret void 336 } 337 338 ; FUNC-LABEL: {{^}}atomic_max_i32_ret: 339 ; GCN: buffer_atomic_smax [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 340 ; GCN: buffer_store_dword [[RET]] 341 define void @atomic_max_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 342 entry: 343 %0 = atomicrmw volatile max i32 addrspace(1)* %out, i32 %in seq_cst 344 store i32 %0, i32 addrspace(1)* %out2 345 ret void 346 } 347 348 ; FUNC-LABEL: {{^}}atomic_max_i32_addr64: 349 ; SI: buffer_atomic_smax v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 350 ; VI: s_movk_i32 flat_scratch_lo, 0x0 351 ; VI: s_movk_i32 flat_scratch_hi, 0x0 352 ; VI: flat_atomic_smax v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 353 define void @atomic_max_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 354 entry: 355 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 356 %0 = atomicrmw volatile max i32 addrspace(1)* %ptr, i32 %in seq_cst 357 ret void 358 } 359 360 ; FUNC-LABEL: {{^}}atomic_max_i32_ret_addr64: 361 ; SI: buffer_atomic_smax [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 362 ; VI: s_movk_i32 flat_scratch_lo, 0x0 363 ; VI: s_movk_i32 flat_scratch_hi, 0x0 364 ; VI: flat_atomic_smax [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 365 ; GCN: buffer_store_dword [[RET]] 366 define void @atomic_max_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 367 entry: 368 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 369 %0 = atomicrmw volatile max i32 addrspace(1)* %ptr, i32 %in seq_cst 370 store i32 %0, i32 addrspace(1)* %out2 371 ret void 372 } 373 374 ; FUNC-LABEL: {{^}}atomic_umax_i32_offset: 375 ; GCN: buffer_atomic_umax v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 376 define void @atomic_umax_i32_offset(i32 addrspace(1)* %out, i32 %in) { 377 entry: 378 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 379 %0 = atomicrmw volatile umax i32 addrspace(1)* %gep, i32 %in seq_cst 380 ret void 381 } 382 383 ; FUNC-LABEL: {{^}}atomic_umax_i32_ret_offset: 384 ; GCN: buffer_atomic_umax [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 385 ; GCN: buffer_store_dword [[RET]] 386 define void @atomic_umax_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 387 entry: 388 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 389 %0 = atomicrmw volatile umax i32 addrspace(1)* %gep, i32 %in seq_cst 390 store i32 %0, i32 addrspace(1)* %out2 391 ret void 392 } 393 394 ; FUNC-LABEL: {{^}}atomic_umax_i32_addr64_offset: 395 ; SI: buffer_atomic_umax v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 396 ; VI: s_movk_i32 flat_scratch_lo, 0x0 397 ; VI: s_movk_i32 flat_scratch_hi, 0x0 398 ; VI: flat_atomic_umax v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 399 define void @atomic_umax_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 400 entry: 401 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 402 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 403 %0 = atomicrmw volatile umax i32 addrspace(1)* %gep, i32 %in seq_cst 404 ret void 405 } 406 407 ; FUNC-LABEL: {{^}}atomic_umax_i32_ret_addr64_offset: 408 ; SI: buffer_atomic_umax [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 409 ; VI: s_movk_i32 flat_scratch_lo, 0x0 410 ; VI: s_movk_i32 flat_scratch_hi, 0x0 411 ; VI: flat_atomic_umax [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 412 ; GCN: buffer_store_dword [[RET]] 413 define void @atomic_umax_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 414 entry: 415 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 416 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 417 %0 = atomicrmw volatile umax i32 addrspace(1)* %gep, i32 %in seq_cst 418 store i32 %0, i32 addrspace(1)* %out2 419 ret void 420 } 421 422 ; FUNC-LABEL: {{^}}atomic_umax_i32: 423 ; GCN: buffer_atomic_umax v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 424 define void @atomic_umax_i32(i32 addrspace(1)* %out, i32 %in) { 425 entry: 426 %0 = atomicrmw volatile umax i32 addrspace(1)* %out, i32 %in seq_cst 427 ret void 428 } 429 430 ; FUNC-LABEL: {{^}}atomic_umax_i32_ret: 431 ; GCN: buffer_atomic_umax [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 432 ; GCN: buffer_store_dword [[RET]] 433 define void @atomic_umax_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 434 entry: 435 %0 = atomicrmw volatile umax i32 addrspace(1)* %out, i32 %in seq_cst 436 store i32 %0, i32 addrspace(1)* %out2 437 ret void 438 } 439 440 ; FUNC-LABEL: {{^}}atomic_umax_i32_addr64: 441 ; SI: buffer_atomic_umax v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 442 ; VI: s_movk_i32 flat_scratch_lo, 0x0 443 ; VI: s_movk_i32 flat_scratch_hi, 0x0 444 ; VI: flat_atomic_umax v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 445 define void @atomic_umax_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 446 entry: 447 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 448 %0 = atomicrmw volatile umax i32 addrspace(1)* %ptr, i32 %in seq_cst 449 ret void 450 } 451 452 ; FUNC-LABEL: {{^}}atomic_umax_i32_ret_addr64: 453 ; SI: buffer_atomic_umax [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 454 ; VI: s_movk_i32 flat_scratch_lo, 0x0 455 ; VI: s_movk_i32 flat_scratch_hi, 0x0 456 ; VI: flat_atomic_umax [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 457 ; GCN: buffer_store_dword [[RET]] 458 define void @atomic_umax_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 459 entry: 460 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 461 %0 = atomicrmw volatile umax i32 addrspace(1)* %ptr, i32 %in seq_cst 462 store i32 %0, i32 addrspace(1)* %out2 463 ret void 464 } 465 466 ; FUNC-LABEL: {{^}}atomic_min_i32_offset: 467 ; GCN: buffer_atomic_smin v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 468 define void @atomic_min_i32_offset(i32 addrspace(1)* %out, i32 %in) { 469 entry: 470 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 471 %0 = atomicrmw volatile min i32 addrspace(1)* %gep, i32 %in seq_cst 472 ret void 473 } 474 475 ; FUNC-LABEL: {{^}}atomic_min_i32_ret_offset: 476 ; GCN: buffer_atomic_smin [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 477 ; GCN: buffer_store_dword [[RET]] 478 define void @atomic_min_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 479 entry: 480 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 481 %0 = atomicrmw volatile min i32 addrspace(1)* %gep, i32 %in seq_cst 482 store i32 %0, i32 addrspace(1)* %out2 483 ret void 484 } 485 486 ; FUNC-LABEL: {{^}}atomic_min_i32_addr64_offset: 487 ; SI: buffer_atomic_smin v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 488 ; VI: s_movk_i32 flat_scratch_lo, 0x0 489 ; VI: s_movk_i32 flat_scratch_hi, 0x0 490 ; VI: flat_atomic_smin v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 491 define void @atomic_min_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 492 entry: 493 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 494 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 495 %0 = atomicrmw volatile min i32 addrspace(1)* %gep, i32 %in seq_cst 496 ret void 497 } 498 499 ; FUNC-LABEL: {{^}}atomic_min_i32_ret_addr64_offset: 500 ; SI: buffer_atomic_smin [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 501 ; VI: s_movk_i32 flat_scratch_lo, 0x0 502 ; VI: s_movk_i32 flat_scratch_hi, 0x0 503 ; VI: flat_atomic_smin [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 504 ; GCN: buffer_store_dword [[RET]] 505 define void @atomic_min_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 506 entry: 507 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 508 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 509 %0 = atomicrmw volatile min i32 addrspace(1)* %gep, i32 %in seq_cst 510 store i32 %0, i32 addrspace(1)* %out2 511 ret void 512 } 513 514 ; FUNC-LABEL: {{^}}atomic_min_i32: 515 ; GCN: buffer_atomic_smin v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 516 define void @atomic_min_i32(i32 addrspace(1)* %out, i32 %in) { 517 entry: 518 %0 = atomicrmw volatile min i32 addrspace(1)* %out, i32 %in seq_cst 519 ret void 520 } 521 522 ; FUNC-LABEL: {{^}}atomic_min_i32_ret: 523 ; GCN: buffer_atomic_smin [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 524 ; GCN: buffer_store_dword [[RET]] 525 define void @atomic_min_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 526 entry: 527 %0 = atomicrmw volatile min i32 addrspace(1)* %out, i32 %in seq_cst 528 store i32 %0, i32 addrspace(1)* %out2 529 ret void 530 } 531 532 ; FUNC-LABEL: {{^}}atomic_min_i32_addr64: 533 ; SI: buffer_atomic_smin v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 534 ; VI: s_movk_i32 flat_scratch_lo, 0x0 535 ; VI: s_movk_i32 flat_scratch_hi, 0x0 536 ; VI: flat_atomic_smin v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 537 define void @atomic_min_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 538 entry: 539 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 540 %0 = atomicrmw volatile min i32 addrspace(1)* %ptr, i32 %in seq_cst 541 ret void 542 } 543 544 ; FUNC-LABEL: {{^}}atomic_min_i32_ret_addr64: 545 ; SI: buffer_atomic_smin [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 546 ; VI: s_movk_i32 flat_scratch_lo, 0x0 547 ; VI: s_movk_i32 flat_scratch_hi, 0x0 548 ; VI: flat_atomic_smin [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 549 ; GCN: buffer_store_dword [[RET]] 550 define void @atomic_min_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 551 entry: 552 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 553 %0 = atomicrmw volatile min i32 addrspace(1)* %ptr, i32 %in seq_cst 554 store i32 %0, i32 addrspace(1)* %out2 555 ret void 556 } 557 558 ; FUNC-LABEL: {{^}}atomic_umin_i32_offset: 559 ; GCN: buffer_atomic_umin v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 560 define void @atomic_umin_i32_offset(i32 addrspace(1)* %out, i32 %in) { 561 entry: 562 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 563 %0 = atomicrmw volatile umin i32 addrspace(1)* %gep, i32 %in seq_cst 564 ret void 565 } 566 567 ; FUNC-LABEL: {{^}}atomic_umin_i32_ret_offset: 568 ; GCN: buffer_atomic_umin [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 569 ; GCN: buffer_store_dword [[RET]] 570 define void @atomic_umin_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 571 entry: 572 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 573 %0 = atomicrmw volatile umin i32 addrspace(1)* %gep, i32 %in seq_cst 574 store i32 %0, i32 addrspace(1)* %out2 575 ret void 576 } 577 578 ; FUNC-LABEL: {{^}}atomic_umin_i32_addr64_offset: 579 ; SI: buffer_atomic_umin v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 580 ; VI: s_movk_i32 flat_scratch_lo, 0x0 581 ; VI: s_movk_i32 flat_scratch_hi, 0x0 582 ; VI: flat_atomic_umin v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 583 define void @atomic_umin_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 584 entry: 585 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 586 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 587 %0 = atomicrmw volatile umin i32 addrspace(1)* %gep, i32 %in seq_cst 588 ret void 589 } 590 591 ; FUNC-LABEL: {{^}}atomic_umin_i32_ret_addr64_offset: 592 ; SI: buffer_atomic_umin [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 593 ; VI: s_movk_i32 flat_scratch_lo, 0x0 594 ; VI: s_movk_i32 flat_scratch_hi, 0x0 595 ; VI: flat_atomic_umin [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 596 ; GCN: buffer_store_dword [[RET]] 597 define void @atomic_umin_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 598 entry: 599 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 600 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 601 %0 = atomicrmw volatile umin i32 addrspace(1)* %gep, i32 %in seq_cst 602 store i32 %0, i32 addrspace(1)* %out2 603 ret void 604 } 605 606 ; FUNC-LABEL: {{^}}atomic_umin_i32: 607 ; GCN: buffer_atomic_umin v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 608 define void @atomic_umin_i32(i32 addrspace(1)* %out, i32 %in) { 609 entry: 610 %0 = atomicrmw volatile umin i32 addrspace(1)* %out, i32 %in seq_cst 611 ret void 612 } 613 614 ; FUNC-LABEL: {{^}}atomic_umin_i32_ret: 615 ; SI: buffer_atomic_umin [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 616 ; GCN: buffer_store_dword [[RET]] 617 define void @atomic_umin_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 618 entry: 619 %0 = atomicrmw volatile umin i32 addrspace(1)* %out, i32 %in seq_cst 620 store i32 %0, i32 addrspace(1)* %out2 621 ret void 622 } 623 624 ; FUNC-LABEL: {{^}}atomic_umin_i32_addr64: 625 ; SI: buffer_atomic_umin v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 626 ; VI: s_movk_i32 flat_scratch_lo, 0x0 627 ; VI: s_movk_i32 flat_scratch_hi, 0x0 628 ; VI: flat_atomic_umin v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 629 define void @atomic_umin_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 630 entry: 631 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 632 %0 = atomicrmw volatile umin i32 addrspace(1)* %ptr, i32 %in seq_cst 633 ret void 634 } 635 636 ; FUNC-LABEL: {{^}}atomic_umin_i32_ret_addr64: 637 ; SI: buffer_atomic_umin [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 638 ; VI: s_movk_i32 flat_scratch_lo, 0x0 639 ; VI: s_movk_i32 flat_scratch_hi, 0x0 640 ; VI: flat_atomic_umin [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 641 ; GCN: buffer_store_dword [[RET]] 642 define void @atomic_umin_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 643 entry: 644 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 645 %0 = atomicrmw volatile umin i32 addrspace(1)* %ptr, i32 %in seq_cst 646 store i32 %0, i32 addrspace(1)* %out2 647 ret void 648 } 649 650 ; FUNC-LABEL: {{^}}atomic_or_i32_offset: 651 ; GCN: buffer_atomic_or v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 652 define void @atomic_or_i32_offset(i32 addrspace(1)* %out, i32 %in) { 653 entry: 654 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 655 %0 = atomicrmw volatile or i32 addrspace(1)* %gep, i32 %in seq_cst 656 ret void 657 } 658 659 ; FUNC-LABEL: {{^}}atomic_or_i32_ret_offset: 660 ; GCN: buffer_atomic_or [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 661 ; GCN: buffer_store_dword [[RET]] 662 define void @atomic_or_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 663 entry: 664 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 665 %0 = atomicrmw volatile or i32 addrspace(1)* %gep, i32 %in seq_cst 666 store i32 %0, i32 addrspace(1)* %out2 667 ret void 668 } 669 670 ; FUNC-LABEL: {{^}}atomic_or_i32_addr64_offset: 671 ; SI: buffer_atomic_or v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 672 ; VI: s_movk_i32 flat_scratch_lo, 0x0 673 ; VI: s_movk_i32 flat_scratch_hi, 0x0 674 ; VI: flat_atomic_or v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 675 define void @atomic_or_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 676 entry: 677 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 678 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 679 %0 = atomicrmw volatile or i32 addrspace(1)* %gep, i32 %in seq_cst 680 ret void 681 } 682 683 ; FUNC-LABEL: {{^}}atomic_or_i32_ret_addr64_offset: 684 ; SI: buffer_atomic_or [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 685 ; VI: s_movk_i32 flat_scratch_lo, 0x0 686 ; VI: s_movk_i32 flat_scratch_hi, 0x0 687 ; VI: flat_atomic_or [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 688 ; GCN: buffer_store_dword [[RET]] 689 define void @atomic_or_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 690 entry: 691 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 692 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 693 %0 = atomicrmw volatile or i32 addrspace(1)* %gep, i32 %in seq_cst 694 store i32 %0, i32 addrspace(1)* %out2 695 ret void 696 } 697 698 ; FUNC-LABEL: {{^}}atomic_or_i32: 699 ; GCN: buffer_atomic_or v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 700 define void @atomic_or_i32(i32 addrspace(1)* %out, i32 %in) { 701 entry: 702 %0 = atomicrmw volatile or i32 addrspace(1)* %out, i32 %in seq_cst 703 ret void 704 } 705 706 ; FUNC-LABEL: {{^}}atomic_or_i32_ret: 707 ; GCN: buffer_atomic_or [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 708 ; GCN: buffer_store_dword [[RET]] 709 define void @atomic_or_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 710 entry: 711 %0 = atomicrmw volatile or i32 addrspace(1)* %out, i32 %in seq_cst 712 store i32 %0, i32 addrspace(1)* %out2 713 ret void 714 } 715 716 ; FUNC-LABEL: {{^}}atomic_or_i32_addr64: 717 ; SI: buffer_atomic_or v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 718 ; VI: s_movk_i32 flat_scratch_lo, 0x0 719 ; VI: s_movk_i32 flat_scratch_hi, 0x0 720 ; VI: flat_atomic_or v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 721 define void @atomic_or_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 722 entry: 723 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 724 %0 = atomicrmw volatile or i32 addrspace(1)* %ptr, i32 %in seq_cst 725 ret void 726 } 727 728 ; FUNC-LABEL: {{^}}atomic_or_i32_ret_addr64: 729 ; SI: buffer_atomic_or [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 730 ; VI: s_movk_i32 flat_scratch_lo, 0x0 731 ; VI: s_movk_i32 flat_scratch_hi, 0x0 732 ; VI: flat_atomic_or [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 733 ; GCN: buffer_store_dword [[RET]] 734 define void @atomic_or_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 735 entry: 736 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 737 %0 = atomicrmw volatile or i32 addrspace(1)* %ptr, i32 %in seq_cst 738 store i32 %0, i32 addrspace(1)* %out2 739 ret void 740 } 741 742 ; FUNC-LABEL: {{^}}atomic_xchg_i32_offset: 743 ; GCN: buffer_atomic_swap v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 744 define void @atomic_xchg_i32_offset(i32 addrspace(1)* %out, i32 %in) { 745 entry: 746 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 747 %0 = atomicrmw volatile xchg i32 addrspace(1)* %gep, i32 %in seq_cst 748 ret void 749 } 750 751 ; FUNC-LABEL: {{^}}atomic_xchg_i32_ret_offset: 752 ; GCN: buffer_atomic_swap [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 753 ; GCN: buffer_store_dword [[RET]] 754 define void @atomic_xchg_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 755 entry: 756 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 757 %0 = atomicrmw volatile xchg i32 addrspace(1)* %gep, i32 %in seq_cst 758 store i32 %0, i32 addrspace(1)* %out2 759 ret void 760 } 761 762 ; FUNC-LABEL: {{^}}atomic_xchg_i32_addr64_offset: 763 ; SI: buffer_atomic_swap v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 764 define void @atomic_xchg_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 765 entry: 766 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 767 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 768 %0 = atomicrmw volatile xchg i32 addrspace(1)* %gep, i32 %in seq_cst 769 ret void 770 } 771 772 ; FUNC-LABEL: {{^}}atomic_xchg_i32_ret_addr64_offset: 773 ; SI: buffer_atomic_swap [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 774 ; VI: s_movk_i32 flat_scratch_lo, 0x0 775 ; VI: s_movk_i32 flat_scratch_hi, 0x0 776 ; VI: flat_atomic_swap [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 777 ; GCN: buffer_store_dword [[RET]] 778 define void @atomic_xchg_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 779 entry: 780 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 781 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 782 %0 = atomicrmw volatile xchg i32 addrspace(1)* %gep, i32 %in seq_cst 783 store i32 %0, i32 addrspace(1)* %out2 784 ret void 785 } 786 787 ; FUNC-LABEL: {{^}}atomic_xchg_i32: 788 ; GCN: buffer_atomic_swap v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 789 define void @atomic_xchg_i32(i32 addrspace(1)* %out, i32 %in) { 790 entry: 791 %0 = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in seq_cst 792 ret void 793 } 794 795 ; FUNC-LABEL: {{^}}atomic_xchg_i32_ret: 796 ; GCN: buffer_atomic_swap [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 797 ; GCN: buffer_store_dword [[RET]] 798 define void @atomic_xchg_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 799 entry: 800 %0 = atomicrmw volatile xchg i32 addrspace(1)* %out, i32 %in seq_cst 801 store i32 %0, i32 addrspace(1)* %out2 802 ret void 803 } 804 805 ; FUNC-LABEL: {{^}}atomic_xchg_i32_addr64: 806 ; SI: buffer_atomic_swap v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 807 ; VI: s_movk_i32 flat_scratch_lo, 0x0 808 ; VI: s_movk_i32 flat_scratch_hi, 0x0 809 ; VI: flat_atomic_swap v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 810 define void @atomic_xchg_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 811 entry: 812 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 813 %0 = atomicrmw volatile xchg i32 addrspace(1)* %ptr, i32 %in seq_cst 814 ret void 815 } 816 817 ; FUNC-LABEL: {{^}}atomic_xchg_i32_ret_addr64: 818 ; SI: buffer_atomic_swap [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 819 ; VI: s_movk_i32 flat_scratch_lo, 0x0 820 ; VI: s_movk_i32 flat_scratch_hi, 0x0 821 ; VI: flat_atomic_swap [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 822 ; GCN: buffer_store_dword [[RET]] 823 define void @atomic_xchg_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 824 entry: 825 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 826 %0 = atomicrmw volatile xchg i32 addrspace(1)* %ptr, i32 %in seq_cst 827 store i32 %0, i32 addrspace(1)* %out2 828 ret void 829 } 830 831 ; FUNC-LABEL: {{^}}atomic_xor_i32_offset: 832 ; GCN: buffer_atomic_xor v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16{{$}} 833 define void @atomic_xor_i32_offset(i32 addrspace(1)* %out, i32 %in) { 834 entry: 835 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 836 %0 = atomicrmw volatile xor i32 addrspace(1)* %gep, i32 %in seq_cst 837 ret void 838 } 839 840 ; FUNC-LABEL: {{^}}atomic_xor_i32_ret_offset: 841 ; GCN: buffer_atomic_xor [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 offset:16 glc{{$}} 842 ; GCN: buffer_store_dword [[RET]] 843 define void @atomic_xor_i32_ret_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 844 entry: 845 %gep = getelementptr i32, i32 addrspace(1)* %out, i32 4 846 %0 = atomicrmw volatile xor i32 addrspace(1)* %gep, i32 %in seq_cst 847 store i32 %0, i32 addrspace(1)* %out2 848 ret void 849 } 850 851 ; FUNC-LABEL: {{^}}atomic_xor_i32_addr64_offset: 852 ; SI: buffer_atomic_xor v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16{{$}} 853 ; VI: s_movk_i32 flat_scratch_lo, 0x0 854 ; VI: s_movk_i32 flat_scratch_hi, 0x0 855 ; VI: flat_atomic_xor v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 856 define void @atomic_xor_i32_addr64_offset(i32 addrspace(1)* %out, i32 %in, i64 %index) { 857 entry: 858 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 859 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 860 %0 = atomicrmw volatile xor i32 addrspace(1)* %gep, i32 %in seq_cst 861 ret void 862 } 863 864 ; FUNC-LABEL: {{^}}atomic_xor_i32_ret_addr64_offset: 865 ; SI: buffer_atomic_xor [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 offset:16 glc{{$}} 866 ; VI: s_movk_i32 flat_scratch_lo, 0x0 867 ; VI: s_movk_i32 flat_scratch_hi, 0x0 868 ; VI: flat_atomic_xor [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 869 ; GCN: buffer_store_dword [[RET]] 870 define void @atomic_xor_i32_ret_addr64_offset(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 871 entry: 872 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 873 %gep = getelementptr i32, i32 addrspace(1)* %ptr, i32 4 874 %0 = atomicrmw volatile xor i32 addrspace(1)* %gep, i32 %in seq_cst 875 store i32 %0, i32 addrspace(1)* %out2 876 ret void 877 } 878 879 ; FUNC-LABEL: {{^}}atomic_xor_i32: 880 ; GCN: buffer_atomic_xor v{{[0-9]+}}, s[{{[0-9]+}}:{{[0-9]+}}], 0{{$}} 881 define void @atomic_xor_i32(i32 addrspace(1)* %out, i32 %in) { 882 entry: 883 %0 = atomicrmw volatile xor i32 addrspace(1)* %out, i32 %in seq_cst 884 ret void 885 } 886 887 ; FUNC-LABEL: {{^}}atomic_xor_i32_ret: 888 ; GCN: buffer_atomic_xor [[RET:v[0-9]+]], s[{{[0-9]+}}:{{[0-9]+}}], 0 glc 889 ; GCN: buffer_store_dword [[RET]] 890 define void @atomic_xor_i32_ret(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in) { 891 entry: 892 %0 = atomicrmw volatile xor i32 addrspace(1)* %out, i32 %in seq_cst 893 store i32 %0, i32 addrspace(1)* %out2 894 ret void 895 } 896 897 ; FUNC-LABEL: {{^}}atomic_xor_i32_addr64: 898 ; SI: buffer_atomic_xor v{{[0-9]+}}, v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64{{$}} 899 ; VI: s_movk_i32 flat_scratch_lo, 0x0 900 ; VI: s_movk_i32 flat_scratch_hi, 0x0 901 ; VI: flat_atomic_xor v[{{[0-9]+:[0-9]+}}], v{{[0-9]+$}} 902 define void @atomic_xor_i32_addr64(i32 addrspace(1)* %out, i32 %in, i64 %index) { 903 entry: 904 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 905 %0 = atomicrmw volatile xor i32 addrspace(1)* %ptr, i32 %in seq_cst 906 ret void 907 } 908 909 ; FUNC-LABEL: {{^}}atomic_xor_i32_ret_addr64: 910 ; SI: buffer_atomic_xor [[RET:v[0-9]+]], v[{{[0-9]+}}:{{[0-9]+}}], s[{{[0-9]+}}:{{[0-9]+}}], 0 addr64 glc{{$}} 911 ; VI: s_movk_i32 flat_scratch_lo, 0x0 912 ; VI: s_movk_i32 flat_scratch_hi, 0x0 913 ; VI: flat_atomic_xor [[RET:v[0-9]+]], v[{{[0-9]+:[0-9]+}}], v{{[0-9]+}} glc{{$}} 914 ; GCN: buffer_store_dword [[RET]] 915 define void @atomic_xor_i32_ret_addr64(i32 addrspace(1)* %out, i32 addrspace(1)* %out2, i32 %in, i64 %index) { 916 entry: 917 %ptr = getelementptr i32, i32 addrspace(1)* %out, i64 %index 918 %0 = atomicrmw volatile xor i32 addrspace(1)* %ptr, i32 %in seq_cst 919 store i32 %0, i32 addrspace(1)* %out2 920 ret void 921 } 922