1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3 ; Make sure that m0 is not reinitialized in the loop.
5 ; GCN-LABEL: {{^}}copy_local_to_global_loop_m0_init:
6 ; GCN: s_cbranch_scc1 .LBB0_3
8 ; Initialize in preheader
9 ; GCN: s_mov_b32 m0, -1
15 ; GCN: buffer_store_dword
17 ; GCN: s_cbranch_scc0 .LBB0_2
21 define amdgpu_kernel void @copy_local_to_global_loop_m0_init(ptr addrspace(1) noalias nocapture %out, ptr addrspace(3) noalias nocapture readonly %in, i32 %n) #0 {
23 %tmp = icmp sgt i32 %n, 0
24 br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge
26 .lr.ph.preheader: ; preds = %bb
29 ._crit_edge.loopexit: ; preds = %.lr.ph
32 ._crit_edge: ; preds = %._crit_edge.loopexit, %bb
35 .lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader
36 %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ]
37 %i.01 = phi i32 [ %tmp4, %.lr.ph ], [ 0, %.lr.ph.preheader ]
38 %tmp1 = getelementptr inbounds i32, ptr addrspace(3) %in, i32 %i.01
39 %tmp2 = load i32, ptr addrspace(3) %tmp1, align 4
40 %tmp3 = getelementptr inbounds i32, ptr addrspace(1) %out, i64 %indvars.iv
41 store i32 %tmp2, ptr addrspace(1) %tmp3, align 4
42 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
43 %tmp4 = add nuw nsw i32 %i.01, 1
44 %lftr.wideiv = trunc i64 %indvars.iv.next to i32
45 %exitcond = icmp eq i32 %lftr.wideiv, %n
46 br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph
49 attributes #0 = { nounwind }