1 ; RUN: opt -mtriple amdgcn-unknown-amdhsa -analyze -divergence -use-gpu-divergence-analysis %s | FileCheck %s
3 declare i32 @llvm.amdgcn.workitem.id.x() #0
4 declare i32 @llvm.amdgcn.workitem.id.y() #0
5 declare i32 @llvm.amdgcn.workitem.id.z() #0
6 declare i32 @llvm.amdgcn.mbcnt.lo(i32, i32) #0
7 declare i32 @llvm.amdgcn.mbcnt.hi(i32, i32) #0
9 ; CHECK: DIVERGENT: %id.x = call i32 @llvm.amdgcn.workitem.id.x()
10 define amdgpu_kernel void @workitem_id_x() #1 {
11 %id.x = call i32 @llvm.amdgcn.workitem.id.x()
12 store volatile i32 %id.x, i32 addrspace(1)* undef
16 ; CHECK: DIVERGENT: %id.y = call i32 @llvm.amdgcn.workitem.id.y()
17 define amdgpu_kernel void @workitem_id_y() #1 {
18 %id.y = call i32 @llvm.amdgcn.workitem.id.y()
19 store volatile i32 %id.y, i32 addrspace(1)* undef
23 ; CHECK: DIVERGENT: %id.z = call i32 @llvm.amdgcn.workitem.id.z()
24 define amdgpu_kernel void @workitem_id_z() #1 {
25 %id.z = call i32 @llvm.amdgcn.workitem.id.z()
26 store volatile i32 %id.z, i32 addrspace(1)* undef
30 ; CHECK: DIVERGENT: %mbcnt.lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 0, i32 0)
31 define amdgpu_kernel void @mbcnt_lo() #1 {
32 %mbcnt.lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 0, i32 0)
33 store volatile i32 %mbcnt.lo, i32 addrspace(1)* undef
37 ; CHECK: DIVERGENT: %mbcnt.hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 0, i32 0)
38 define amdgpu_kernel void @mbcnt_hi() #1 {
39 %mbcnt.hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 0, i32 0)
40 store volatile i32 %mbcnt.hi, i32 addrspace(1)* undef
44 attributes #0 = { nounwind readnone }
45 attributes #1 = { nounwind }