1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx90a -run-pass=legalizer -o - %s | FileCheck -check-prefix=GCN %s
5 define amdgpu_kernel void @test_workitem_id_x_unpacked() !reqd_work_group_size !0 {
9 define amdgpu_kernel void @test_workitem_id_y_unpacked() !reqd_work_group_size !0 {
13 define amdgpu_kernel void @test_workitem_id_z_unpacked() !reqd_work_group_size !0 {
17 define amdgpu_kernel void @test_workitem_id_x_packed() !reqd_work_group_size !0 {
21 define amdgpu_kernel void @test_workitem_id_y_packed() !reqd_work_group_size !0 {
25 define amdgpu_kernel void @test_workitem_id_z_packed() !reqd_work_group_size !0 {
29 define amdgpu_kernel void @missing_arg_info() "amdgpu-no-workitem-id-x" {
33 !0 = !{i32 256, i32 8, i32 4}
36 name: test_workitem_id_x_unpacked
39 workGroupIDX: { reg: '$sgpr2' }
40 workItemIDX: { reg: '$vgpr0' }
41 workItemIDY: { reg: '$vgpr1' }
42 workItemIDZ: { reg: '$vgpr2' }
45 ; GCN-LABEL: name: test_workitem_id_x_unpacked
46 ; GCN: liveins: $vgpr0
48 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr0
49 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
50 ; GCN-NEXT: [[ASSERT_ZEXT:%[0-9]+]]:_(s32) = G_ASSERT_ZEXT [[COPY1]], 8
51 ; GCN-NEXT: S_ENDPGM 0, implicit [[ASSERT_ZEXT]](s32)
52 %0:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.x)
53 S_ENDPGM 0, implicit %0
57 name: test_workitem_id_y_unpacked
60 workGroupIDX: { reg: '$sgpr2' }
61 workItemIDX: { reg: '$vgpr0' }
62 workItemIDY: { reg: '$vgpr1' }
63 workItemIDZ: { reg: '$vgpr2' }
66 ; GCN-LABEL: name: test_workitem_id_y_unpacked
67 ; GCN: liveins: $vgpr1
69 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr1
70 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
71 ; GCN-NEXT: [[ASSERT_ZEXT:%[0-9]+]]:_(s32) = G_ASSERT_ZEXT [[COPY1]], 3
72 ; GCN-NEXT: S_ENDPGM 0, implicit [[ASSERT_ZEXT]](s32)
73 %0:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.y)
74 S_ENDPGM 0, implicit %0
78 name: test_workitem_id_z_unpacked
81 workGroupIDX: { reg: '$sgpr2' }
82 workItemIDX: { reg: '$vgpr0' }
83 workItemIDY: { reg: '$vgpr1' }
84 workItemIDZ: { reg: '$vgpr2' }
87 ; GCN-LABEL: name: test_workitem_id_z_unpacked
88 ; GCN: liveins: $vgpr2
90 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr2
91 ; GCN-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
92 ; GCN-NEXT: [[ASSERT_ZEXT:%[0-9]+]]:_(s32) = G_ASSERT_ZEXT [[COPY1]], 2
93 ; GCN-NEXT: S_ENDPGM 0, implicit [[ASSERT_ZEXT]](s32)
94 %0:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.z)
95 S_ENDPGM 0, implicit %0
99 name: test_workitem_id_x_packed
102 workItemIDX: { reg: '$vgpr0', mask: 1023 }
103 workItemIDY: { reg: '$vgpr0', mask: 1047552 }
104 workItemIDZ: { reg: '$vgpr0', mask: 1072693248 }
107 ; GCN-LABEL: name: test_workitem_id_x_packed
108 ; GCN: liveins: $vgpr0
110 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr0
111 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1023
112 ; GCN-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
113 ; GCN-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
114 %0:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.x)
115 S_ENDPGM 0, implicit %0
119 name: test_workitem_id_y_packed
122 workItemIDX: { reg: '$vgpr0', mask: 1023 }
123 workItemIDY: { reg: '$vgpr0', mask: 1047552 }
124 workItemIDZ: { reg: '$vgpr0', mask: 1072693248 }
127 ; GCN-LABEL: name: test_workitem_id_y_packed
128 ; GCN: liveins: $vgpr0
130 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr0
131 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 10
132 ; GCN-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY]], [[C]](s32)
133 ; GCN-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1023
134 ; GCN-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[LSHR]], [[C1]]
135 ; GCN-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
136 %0:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.y)
137 S_ENDPGM 0, implicit %0
141 name: test_workitem_id_z_packed
144 workItemIDX: { reg: '$vgpr0', mask: 1023 }
145 workItemIDY: { reg: '$vgpr0', mask: 1047552 }
146 workItemIDZ: { reg: '$vgpr0', mask: 1072693248 }
149 ; GCN-LABEL: name: test_workitem_id_z_packed
150 ; GCN: liveins: $vgpr0
152 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32(s32) = COPY $vgpr0
153 ; GCN-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 20
154 ; GCN-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY]], [[C]](s32)
155 ; GCN-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1023
156 ; GCN-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[LSHR]], [[C1]]
157 ; GCN-NEXT: S_ENDPGM 0, implicit [[AND]](s32)
158 %0:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.z)
159 S_ENDPGM 0, implicit %0
163 name: missing_arg_info
166 ; GCN-LABEL: name: missing_arg_info
167 ; GCN: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
168 ; GCN-NEXT: S_ENDPGM 0, implicit [[DEF]](s32)
169 %0:_(s32) = G_INTRINSIC intrinsic(@llvm.amdgcn.workitem.id.z)
170 S_ENDPGM 0, implicit %0