1; RUN: llc -march=amdgcn -mcpu=gfx900 -amdgpu-atomic-optimizations=true < %s | FileCheck %s
2; RUN: llc -march=amdgcn -mcpu=gfx900 -amdgpu-atomic-optimizations=true < %s -use-gpu-divergence-analysis | FileCheck %s
3
4@local = addrspace(3) global i32 undef
5
6define amdgpu_kernel void @reducible(i32 %x) {
7; CHECK-LABEL: reducible:
8; CHECK-NOT: dpp
9entry:
10  br label %loop
11loop:
12  %i = phi i32 [ 0, %entry ], [ %i1, %loop ]
13  %gep = getelementptr i32, i32 addrspace(3)* @local, i32 %i
14  %cond = icmp ult i32 %i, %x
15  %i1 = add i32 %i, 1
16  br i1 %cond, label %loop, label %exit
17exit:
18  %old = atomicrmw add i32 addrspace(3)* %gep, i32 %x acq_rel
19  ret void
20}
21