1; RUN: opt -mtriple amdgcn-unknown-amdhsa -amdgpu-use-legacy-divergence-analysis -analyze -divergence %s | FileCheck %s 2 3declare i32 @llvm.amdgcn.workitem.id.x() #0 4declare i32 @llvm.amdgcn.workitem.id.y() #0 5declare i32 @llvm.amdgcn.workitem.id.z() #0 6declare i32 @llvm.amdgcn.mbcnt.lo(i32, i32) #0 7declare i32 @llvm.amdgcn.mbcnt.hi(i32, i32) #0 8 9; CHECK: DIVERGENT: %id.x = call i32 @llvm.amdgcn.workitem.id.x() 10define 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 13 ret void 14} 15 16; CHECK: DIVERGENT: %id.y = call i32 @llvm.amdgcn.workitem.id.y() 17define 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 20 ret void 21} 22 23; CHECK: DIVERGENT: %id.z = call i32 @llvm.amdgcn.workitem.id.z() 24define 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 27 ret void 28} 29 30; CHECK: DIVERGENT: %mbcnt.lo = call i32 @llvm.amdgcn.mbcnt.lo(i32 0, i32 0) 31define 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 34 ret void 35} 36 37; CHECK: DIVERGENT: %mbcnt.hi = call i32 @llvm.amdgcn.mbcnt.hi(i32 0, i32 0) 38define 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 41 ret void 42} 43 44attributes #0 = { nounwind readnone } 45attributes #1 = { nounwind } 46