1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -verify-machineinstrs < %s | FileCheck -enable-var-scope --check-prefix=GCN %s
4 define void @shl_base_atomicrmw_global_ptr(ptr addrspace(1) %out, ptr addrspace(1) %extra.use, ptr addrspace(1) %ptr) #0 {
5 ; GCN-LABEL: shl_base_atomicrmw_global_ptr:
7 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
8 ; GCN-NEXT: v_lshlrev_b64 v[0:1], 2, v[4:5]
9 ; GCN-NEXT: v_mov_b32_e32 v6, 3
10 ; GCN-NEXT: global_atomic_and v[0:1], v6, off offset:512
11 ; GCN-NEXT: s_waitcnt vmcnt(0)
12 ; GCN-NEXT: buffer_wbinvl1_vol
13 ; GCN-NEXT: v_add_co_u32_e32 v0, vcc, 0x80, v4
14 ; GCN-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v5, vcc
15 ; GCN-NEXT: global_store_dwordx2 v[2:3], v[0:1], off
16 ; GCN-NEXT: s_waitcnt vmcnt(0)
17 ; GCN-NEXT: s_setpc_b64 s[30:31]
18 %arrayidx0 = getelementptr inbounds [512 x i32], ptr addrspace(1) %ptr, i64 0, i64 32
19 %cast = ptrtoint ptr addrspace(1) %arrayidx0 to i64
20 %shl = shl i64 %cast, 2
21 %castback = inttoptr i64 %shl to ptr addrspace(1)
22 %val = atomicrmw and ptr addrspace(1) %castback, i32 3 syncscope("agent") seq_cst
23 store volatile i64 %cast, ptr addrspace(1) %extra.use, align 4
27 define void @shl_base_global_ptr_global_atomic_fadd(ptr addrspace(1) %out, ptr addrspace(1) %extra.use, ptr addrspace(1) %ptr) #0 {
28 ; GCN-LABEL: shl_base_global_ptr_global_atomic_fadd:
30 ; GCN-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
31 ; GCN-NEXT: v_lshlrev_b64 v[0:1], 2, v[4:5]
32 ; GCN-NEXT: v_mov_b32_e32 v6, 0x42c80000
33 ; GCN-NEXT: global_atomic_add_f32 v[0:1], v6, off offset:512
34 ; GCN-NEXT: v_add_co_u32_e32 v0, vcc, 0x80, v4
35 ; GCN-NEXT: v_addc_co_u32_e32 v1, vcc, 0, v5, vcc
36 ; GCN-NEXT: global_store_dwordx2 v[2:3], v[0:1], off
37 ; GCN-NEXT: s_waitcnt vmcnt(0)
38 ; GCN-NEXT: s_setpc_b64 s[30:31]
39 %arrayidx0 = getelementptr inbounds [512 x i32], ptr addrspace(1) %ptr, i64 0, i64 32
40 %cast = ptrtoint ptr addrspace(1) %arrayidx0 to i64
41 %shl = shl i64 %cast, 2
42 %castback = inttoptr i64 %shl to ptr addrspace(1)
43 call float @llvm.amdgcn.global.atomic.fadd.f32.p1.f32(ptr addrspace(1) %castback, float 100.0)
44 store volatile i64 %cast, ptr addrspace(1) %extra.use, align 4
48 declare float @llvm.amdgcn.global.atomic.fadd.f32.p1.f32(ptr addrspace(1) nocapture, float) #1
50 attributes #0 = { nounwind }
51 attributes #1 = { argmemonly nounwind willreturn }