xref: /llvm-project/llvm/test/CodeGen/AMDGPU/atomic-optimizer-strict-wqm.ll (revision 9e9907f1cfa424366fba58d9520f9305b537cec9)
1879ac410SJay Foad; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2*9e9907f1SFangrui Song; RUN: llc -mtriple=amdgcn -mcpu=gfx1010 < %s | FileCheck %s -check-prefixes=GFX10
3879ac410SJay Foad
4879ac410SJay Foaddeclare void @llvm.amdgcn.exp.f32(i32 immarg, i32 immarg, float, float, float, float, i1 immarg, i1 immarg)
5faa2c678SKrzysztof Drewniakdeclare i32 @llvm.amdgcn.raw.ptr.buffer.atomic.and.i32(i32, ptr addrspace(8), i32, i32, i32 immarg)
6879ac410SJay Foaddeclare float @llvm.amdgcn.strict.wqm.f32(float)
7879ac410SJay Foad
8879ac410SJay Foaddefine amdgpu_ps void @main(i32 %arg) {
9879ac410SJay Foad; GFX10-LABEL: main:
10879ac410SJay Foad; GFX10:       ; %bb.0: ; %bb
11879ac410SJay Foad; GFX10-NEXT:    v_cmp_eq_u32_e32 vcc_lo, 1, v0
12879ac410SJay Foad; GFX10-NEXT:    v_mov_b32_e32 v0, 0
13879ac410SJay Foad; GFX10-NEXT:    s_mov_b32 s1, exec_lo
14879ac410SJay Foad; GFX10-NEXT:    s_mov_b32 s4, 0
15879ac410SJay Foad; GFX10-NEXT:    s_mov_b32 s2, 0
16879ac410SJay Foad; GFX10-NEXT:    s_branch .LBB0_2
176ef6c954SPravin Jagtap; GFX10-NEXT:  .LBB0_1: ; in Loop: Header=BB0_2 Depth=1
18879ac410SJay Foad; GFX10-NEXT:    s_waitcnt_depctr 0xffe3
19879ac410SJay Foad; GFX10-NEXT:    s_or_b32 exec_lo, exec_lo, s3
20be3f4591SRuiling Song; GFX10-NEXT:    s_and_b32 s0, exec_lo, vcc_lo
21be3f4591SRuiling Song; GFX10-NEXT:    s_or_b32 s2, s0, s2
22879ac410SJay Foad; GFX10-NEXT:    s_andn2_b32 exec_lo, exec_lo, s2
23879ac410SJay Foad; GFX10-NEXT:    s_cbranch_execz .LBB0_5
24879ac410SJay Foad; GFX10-NEXT:  .LBB0_2: ; %bb4
25879ac410SJay Foad; GFX10-NEXT:    ; =>This Inner Loop Header: Depth=1
26879ac410SJay Foad; GFX10-NEXT:    s_and_saveexec_b32 s3, s1
27879ac410SJay Foad; GFX10-NEXT:    s_cbranch_execz .LBB0_1
28879ac410SJay Foad; GFX10-NEXT:  ; %bb.3: ; in Loop: Header=BB0_2 Depth=1
29879ac410SJay Foad; GFX10-NEXT:    v_mbcnt_lo_u32_b32 v1, exec_lo, 0
30879ac410SJay Foad; GFX10-NEXT:    v_cmp_eq_u32_e64 s0, 0, v1
31879ac410SJay Foad; GFX10-NEXT:    s_and_b32 exec_lo, exec_lo, s0
32879ac410SJay Foad; GFX10-NEXT:    s_cbranch_execz .LBB0_1
33879ac410SJay Foad; GFX10-NEXT:  ; %bb.4: ; in Loop: Header=BB0_2 Depth=1
34879ac410SJay Foad; GFX10-NEXT:    s_mov_b32 s5, s4
35879ac410SJay Foad; GFX10-NEXT:    s_mov_b32 s6, s4
36879ac410SJay Foad; GFX10-NEXT:    s_mov_b32 s7, s4
37879ac410SJay Foad; GFX10-NEXT:    buffer_atomic_and v0, off, s[4:7], 0
38879ac410SJay Foad; GFX10-NEXT:    s_branch .LBB0_1
39879ac410SJay Foad; GFX10-NEXT:  .LBB0_5: ; %bb8
40879ac410SJay Foad; GFX10-NEXT:    s_or_b32 exec_lo, exec_lo, s2
41879ac410SJay Foad; GFX10-NEXT:    s_mov_b32 s0, 0
42879ac410SJay Foad; GFX10-NEXT:    v_mov_b32_e32 v1, 0
43879ac410SJay Foad; GFX10-NEXT:    v_mov_b32_e32 v0, s0
44879ac410SJay Foad; GFX10-NEXT:    exp mrt0 off, off, off, off
45879ac410SJay Foad; GFX10-NEXT:    s_endpgm
46879ac410SJay Foadbb:
47879ac410SJay Foad  br label %bb4
48879ac410SJay Foad
49879ac410SJay Foadbb4:
50faa2c678SKrzysztof Drewniak  %i5 = call i32 @llvm.amdgcn.raw.ptr.buffer.atomic.and.i32(i32 0, ptr addrspace(8) null, i32 0, i32 0, i32 0)
51879ac410SJay Foad  %i7 = icmp eq i32 %arg, 1
52879ac410SJay Foad  br i1 %i7, label %bb8, label %bb4
53879ac410SJay Foad
54879ac410SJay Foadbb8:
55879ac410SJay Foad  %i9 = call float @llvm.amdgcn.strict.wqm.f32(float 0.0)
56879ac410SJay Foad  call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float %i9, float 0.0, float 0.0, float 0.0, i1 false, i1 false)
57879ac410SJay Foad  ret void
58879ac410SJay Foad}
59