1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc -mtriple=amdgcn-amd-amdpal < %s | FileCheck -check-prefix=GCN %s
4 define amdgpu_kernel void @global_atomic_fadd_ret_f32_wrong_subtarget(ptr addrspace(1) %ptr) #1 {
5 ; GCN-LABEL: global_atomic_fadd_ret_f32_wrong_subtarget:
7 ; GCN-NEXT: s_mov_b64 s[0:1], exec
8 ; GCN-NEXT: v_mbcnt_lo_u32_b32 v0, s0, 0
9 ; GCN-NEXT: v_mbcnt_hi_u32_b32 v0, s1, v0
10 ; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0
11 ; GCN-NEXT: ; implicit-def: $vgpr1
12 ; GCN-NEXT: s_and_saveexec_b64 s[2:3], vcc
13 ; GCN-NEXT: s_cbranch_execz .LBB0_4
15 ; GCN-NEXT: s_load_dwordx2 s[4:5], s[4:5], 0x0
16 ; GCN-NEXT: s_bcnt1_i32_b64 s0, s[0:1]
17 ; GCN-NEXT: v_cvt_f32_ubyte0_e32 v1, s0
18 ; GCN-NEXT: s_mov_b64 s[6:7], 0
19 ; GCN-NEXT: v_mul_f32_e32 v2, 4.0, v1
20 ; GCN-NEXT: s_waitcnt lgkmcnt(0)
21 ; GCN-NEXT: s_load_dword s8, s[4:5], 0x0
22 ; GCN-NEXT: v_mov_b32_e32 v3, 0
23 ; GCN-NEXT: s_waitcnt lgkmcnt(0)
24 ; GCN-NEXT: v_mov_b32_e32 v1, s8
25 ; GCN-NEXT: .LBB0_2: ; %atomicrmw.start
26 ; GCN-NEXT: ; =>This Inner Loop Header: Depth=1
27 ; GCN-NEXT: v_mov_b32_e32 v5, v1
28 ; GCN-NEXT: v_add_f32_e32 v4, v5, v2
29 ; GCN-NEXT: global_atomic_cmpswap v1, v3, v[4:5], s[4:5] glc
30 ; GCN-NEXT: s_waitcnt vmcnt(0)
31 ; GCN-NEXT: buffer_wbinvl1
32 ; GCN-NEXT: v_cmp_eq_u32_e64 s[0:1], v1, v5
33 ; GCN-NEXT: s_or_b64 s[6:7], s[0:1], s[6:7]
34 ; GCN-NEXT: s_andn2_b64 exec, exec, s[6:7]
35 ; GCN-NEXT: s_cbranch_execnz .LBB0_2
36 ; GCN-NEXT: ; %bb.3: ; %Flow
37 ; GCN-NEXT: s_or_b64 exec, exec, s[6:7]
38 ; GCN-NEXT: .LBB0_4: ; %Flow2
39 ; GCN-NEXT: s_or_b64 exec, exec, s[2:3]
40 ; GCN-NEXT: v_readfirstlane_b32 s0, v1
41 ; GCN-NEXT: v_cvt_f32_ubyte0_e32 v0, v0
42 ; GCN-NEXT: v_mov_b32_e32 v1, s0
43 ; GCN-NEXT: v_mad_f32 v0, v0, 4.0, s0
44 ; GCN-NEXT: v_cndmask_b32_e32 v0, v0, v1, vcc
45 ; GCN-NEXT: global_store_dword v[0:1], v0, off
47 %result = atomicrmw fadd ptr addrspace(1) %ptr, float 4.0 syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
48 store float %result, ptr addrspace(1) undef
52 define amdgpu_kernel void @global_atomic_fadd_noret_f32_wrong_subtarget(ptr addrspace(1) %ptr) #1 {
53 ; GCN-LABEL: global_atomic_fadd_noret_f32_wrong_subtarget:
55 ; GCN-NEXT: s_mov_b64 s[0:1], exec
56 ; GCN-NEXT: v_mbcnt_lo_u32_b32 v0, s0, 0
57 ; GCN-NEXT: v_mbcnt_hi_u32_b32 v0, s1, v0
58 ; GCN-NEXT: v_cmp_eq_u32_e32 vcc, 0, v0
59 ; GCN-NEXT: s_and_saveexec_b64 s[2:3], vcc
60 ; GCN-NEXT: s_cbranch_execz .LBB1_2
62 ; GCN-NEXT: s_load_dwordx2 s[2:3], s[4:5], 0x0
63 ; GCN-NEXT: s_bcnt1_i32_b64 s0, s[0:1]
64 ; GCN-NEXT: v_cvt_f32_ubyte0_e32 v1, s0
65 ; GCN-NEXT: v_mov_b32_e32 v0, 0
66 ; GCN-NEXT: v_mul_f32_e32 v1, 4.0, v1
67 ; GCN-NEXT: s_waitcnt lgkmcnt(0)
68 ; GCN-NEXT: global_atomic_add_f32 v0, v1, s[2:3]
69 ; GCN-NEXT: s_waitcnt vmcnt(0)
70 ; GCN-NEXT: buffer_wbinvl1
73 %result = atomicrmw fadd ptr addrspace(1) %ptr, float 4.0 syncscope("agent") seq_cst, !amdgpu.no.fine.grained.memory !0, !amdgpu.ignore.denormal.mode !0
77 attributes #1 = { "denormal-fp-math-f32"="preserve-sign,preserve-sign" "target-cpu"="gfx803" "target-features"="+atomic-fadd-no-rtn-insts" }