1 ; RUN: llc -mtriple=amdgcn -mcpu=gfx900 - < %s | FileCheck %s
3 @local = addrspace(3) global i32 undef
5 define amdgpu_kernel void @reducible() {
6 ; CHECK-LABEL: reducible:
9 %x = call i32 @llvm.amdgcn.workitem.id.x()
12 %i = phi i32 [ 0, %entry ], [ %i1, %loop ]
13 %gep = getelementptr i32, ptr addrspace(3) @local, i32 %i
14 %cond = icmp ult i32 %i, %x
16 br i1 %cond, label %loop, label %exit
18 %old = atomicrmw add ptr addrspace(3) %gep, i32 %x acq_rel
22 define amdgpu_kernel void @def_in_nested_cycle() {
23 ; CHECK-LABEL: def_in_nested_cycle:
26 %x = call i32 @llvm.amdgcn.workitem.id.x()
29 %i = phi i32 [ 0, %entry ], [ 0, %innerloop ], [ %i1, %loop ]
30 %cond = icmp ult i32 %i, %x
32 br i1 %cond, label %innerloop, label %loop
34 %i.inner = phi i32 [ 0, %loop ], [ %i1.inner, %innerloop ]
35 %gep = getelementptr i32, ptr addrspace(3) @local, i32 %i
36 %i1.inner = add i32 %i, 1
37 %cond.inner = icmp ult i32 %i, %x
38 br i1 %cond, label %innerloop, label %loop
40 %old = atomicrmw add ptr addrspace(3) %gep, i32 %x acq_rel
44 declare i32 @llvm.amdgcn.workitem.id.x()