1 ; RUN: opt -mtriple amdgcn-unknown-amdhsa -passes='print<uniformity>' -disable-output %s 2>&1 | 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, ptr 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, ptr 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, ptr 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, ptr 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, ptr addrspace(1) undef
44 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_x_singlethreaded':
45 ; CHECK-NOT: DIVERGENT
46 define amdgpu_kernel void @workitem_id_x_singlethreaded() #2 {
47 %id.x = call i32 @llvm.amdgcn.workitem.id.x()
48 store volatile i32 %id.x, ptr addrspace(1) undef
52 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_y_singlethreaded':
53 ; CHECK-NOT: DIVERGENT
54 define amdgpu_kernel void @workitem_id_y_singlethreaded() #2 {
55 %id.x = call i32 @llvm.amdgcn.workitem.id.y()
56 store volatile i32 %id.x, ptr addrspace(1) undef
60 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_z_singlethreaded':
61 ; CHECK-NOT: DIVERGENT
62 define amdgpu_kernel void @workitem_id_z_singlethreaded() #2 {
63 %id.x = call i32 @llvm.amdgcn.workitem.id.y()
64 store volatile i32 %id.x, ptr addrspace(1) undef
68 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_x_singlethreaded_md':
69 ; CHECK-NOT: DIVERGENT
70 define amdgpu_kernel void @workitem_id_x_singlethreaded_md() !reqd_work_group_size !0 {
71 %id.x = call i32 @llvm.amdgcn.workitem.id.x()
72 store volatile i32 %id.x, ptr addrspace(1) undef
76 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_y_singlethreaded_md':
77 ; CHECK-NOT: DIVERGENT
78 define amdgpu_kernel void @workitem_id_y_singlethreaded_md() !reqd_work_group_size !0 {
79 %id.x = call i32 @llvm.amdgcn.workitem.id.y()
80 store volatile i32 %id.x, ptr addrspace(1) undef
84 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_z_singlethreaded_md':
85 ; CHECK-NOT: DIVERGENT
86 define amdgpu_kernel void @workitem_id_z_singlethreaded_md() !reqd_work_group_size !0 {
87 %id.x = call i32 @llvm.amdgcn.workitem.id.y()
88 store volatile i32 %id.x, ptr addrspace(1) undef
92 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_x_not_singlethreaded_dimx':
93 ; CHECK: DIVERGENT: %id.x = call i32 @llvm.amdgcn.workitem.id.x()
94 define amdgpu_kernel void @workitem_id_x_not_singlethreaded_dimx() !reqd_work_group_size !1 {
95 %id.x = call i32 @llvm.amdgcn.workitem.id.x()
96 store volatile i32 %id.x, ptr addrspace(1) undef
100 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_x_not_singlethreaded_dimy':
101 ; CHECK: DIVERGENT: %id.x = call i32 @llvm.amdgcn.workitem.id.x()
102 define amdgpu_kernel void @workitem_id_x_not_singlethreaded_dimy() !reqd_work_group_size !2 {
103 %id.x = call i32 @llvm.amdgcn.workitem.id.x()
104 store volatile i32 %id.x, ptr addrspace(1) undef
108 ; CHECK-LABEL: UniformityInfo for function 'workitem_id_x_not_singlethreaded_dimz':
109 ; CHECK: DIVERGENT: %id.x = call i32 @llvm.amdgcn.workitem.id.x()
110 define amdgpu_kernel void @workitem_id_x_not_singlethreaded_dimz() !reqd_work_group_size !3 {
111 %id.x = call i32 @llvm.amdgcn.workitem.id.x()
112 store volatile i32 %id.x, ptr addrspace(1) undef
116 attributes #0 = { nounwind readnone }
117 attributes #1 = { nounwind }
118 attributes #2 = { "amdgpu-flat-work-group-size"="1,1" }
120 !0 = !{i32 1, i32 1, i32 1}
121 !1 = !{i32 2, i32 1, i32 1}
122 !2 = !{i32 1, i32 2, i32 1}
123 !3 = !{i32 1, i32 1, i32 2}