1 ; RUN: opt -mtriple amdgcn-unknown-amdhsa -analyze -divergence %s | FileCheck %s 2 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 8 9 ; CHECK: DIVERGENT: %id.x = call i32 @llvm.amdgcn.workitem.id.x() 10 define 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() 17 define 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() 24 define 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) 31 define 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) 38 define 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 44 attributes #0 = { nounwind readnone } 45 attributes #1 = { nounwind } 46