1 ; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
2 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
4 define ptx_device i32 @test_tid_x() {
5 ; CHECK: mov.u32 %r{{[0-9]+}}, %tid.x;
7 %x = call i32 @llvm.ptx.read.tid.x()
11 define ptx_device i32 @test_tid_y() {
12 ; CHECK: mov.u32 %r{{[0-9]+}}, %tid.y;
14 %x = call i32 @llvm.ptx.read.tid.y()
18 define ptx_device i32 @test_tid_z() {
19 ; CHECK: mov.u32 %r{{[0-9]+}}, %tid.z;
21 %x = call i32 @llvm.ptx.read.tid.z()
25 define ptx_device i32 @test_tid_w() {
26 ; CHECK: mov.u32 %r{{[0-9]+}}, %tid.w;
28 %x = call i32 @llvm.ptx.read.tid.w()
32 define ptx_device i32 @test_ntid_x() {
33 ; CHECK: mov.u32 %r{{[0-9]+}}, %ntid.x;
35 %x = call i32 @llvm.ptx.read.ntid.x()
39 define ptx_device i32 @test_ntid_y() {
40 ; CHECK: mov.u32 %r{{[0-9]+}}, %ntid.y;
42 %x = call i32 @llvm.ptx.read.ntid.y()
46 define ptx_device i32 @test_ntid_z() {
47 ; CHECK: mov.u32 %r{{[0-9]+}}, %ntid.z;
49 %x = call i32 @llvm.ptx.read.ntid.z()
53 define ptx_device i32 @test_ntid_w() {
54 ; CHECK: mov.u32 %r{{[0-9]+}}, %ntid.w;
56 %x = call i32 @llvm.ptx.read.ntid.w()
60 define ptx_device i32 @test_laneid() {
61 ; CHECK: mov.u32 %r{{[0-9]+}}, %laneid;
63 %x = call i32 @llvm.ptx.read.laneid()
67 define ptx_device i32 @test_warpid() {
68 ; CHECK: mov.u32 %r{{[0-9]+}}, %warpid;
70 %x = call i32 @llvm.ptx.read.warpid()
74 define ptx_device i32 @test_nwarpid() {
75 ; CHECK: mov.u32 %r{{[0-9]+}}, %nwarpid;
77 %x = call i32 @llvm.ptx.read.nwarpid()
81 define ptx_device i32 @test_ctaid_x() {
82 ; CHECK: mov.u32 %r{{[0-9]+}}, %ctaid.x;
84 %x = call i32 @llvm.ptx.read.ctaid.x()
88 define ptx_device i32 @test_ctaid_y() {
89 ; CHECK: mov.u32 %r{{[0-9]+}}, %ctaid.y;
91 %x = call i32 @llvm.ptx.read.ctaid.y()
95 define ptx_device i32 @test_ctaid_z() {
96 ; CHECK: mov.u32 %r{{[0-9]+}}, %ctaid.z;
98 %x = call i32 @llvm.ptx.read.ctaid.z()
102 define ptx_device i32 @test_ctaid_w() {
103 ; CHECK: mov.u32 %r{{[0-9]+}}, %ctaid.w;
105 %x = call i32 @llvm.ptx.read.ctaid.w()
109 define ptx_device i32 @test_nctaid_x() {
110 ; CHECK: mov.u32 %r{{[0-9]+}}, %nctaid.x;
112 %x = call i32 @llvm.ptx.read.nctaid.x()
116 define ptx_device i32 @test_nctaid_y() {
117 ; CHECK: mov.u32 %r{{[0-9]+}}, %nctaid.y;
119 %x = call i32 @llvm.ptx.read.nctaid.y()
123 define ptx_device i32 @test_nctaid_z() {
124 ; CHECK: mov.u32 %r{{[0-9]+}}, %nctaid.z;
126 %x = call i32 @llvm.ptx.read.nctaid.z()
130 define ptx_device i32 @test_nctaid_w() {
131 ; CHECK: mov.u32 %r{{[0-9]+}}, %nctaid.w;
133 %x = call i32 @llvm.ptx.read.nctaid.w()
137 define ptx_device i32 @test_smid() {
138 ; CHECK: mov.u32 %r{{[0-9]+}}, %smid;
140 %x = call i32 @llvm.ptx.read.smid()
144 define ptx_device i32 @test_nsmid() {
145 ; CHECK: mov.u32 %r{{[0-9]+}}, %nsmid;
147 %x = call i32 @llvm.ptx.read.nsmid()
151 define ptx_device i32 @test_gridid() {
152 ; CHECK: mov.u32 %r{{[0-9]+}}, %gridid;
154 %x = call i32 @llvm.ptx.read.gridid()
158 define ptx_device i32 @test_lanemask_eq() {
159 ; CHECK: mov.u32 %r{{[0-9]+}}, %lanemask_eq;
161 %x = call i32 @llvm.ptx.read.lanemask.eq()
165 define ptx_device i32 @test_lanemask_le() {
166 ; CHECK: mov.u32 %r{{[0-9]+}}, %lanemask_le;
168 %x = call i32 @llvm.ptx.read.lanemask.le()
172 define ptx_device i32 @test_lanemask_lt() {
173 ; CHECK: mov.u32 %r{{[0-9]+}}, %lanemask_lt;
175 %x = call i32 @llvm.ptx.read.lanemask.lt()
179 define ptx_device i32 @test_lanemask_ge() {
180 ; CHECK: mov.u32 %r{{[0-9]+}}, %lanemask_ge;
182 %x = call i32 @llvm.ptx.read.lanemask.ge()
186 define ptx_device i32 @test_lanemask_gt() {
187 ; CHECK: mov.u32 %r{{[0-9]+}}, %lanemask_gt;
189 %x = call i32 @llvm.ptx.read.lanemask.gt()
193 define ptx_device i32 @test_clock() {
194 ; CHECK: mov.u32 %r{{[0-9]+}}, %clock;
196 %x = call i32 @llvm.ptx.read.clock()
200 define ptx_device i64 @test_clock64() {
201 ; CHECK: mov.u64 %rd{{[0-9]+}}, %clock64;
203 %x = call i64 @llvm.ptx.read.clock64()
207 define ptx_device i32 @test_pm0() {
208 ; CHECK: mov.u32 %r{{[0-9]+}}, %pm0;
210 %x = call i32 @llvm.ptx.read.pm0()
214 define ptx_device i32 @test_pm1() {
215 ; CHECK: mov.u32 %r{{[0-9]+}}, %pm1;
217 %x = call i32 @llvm.ptx.read.pm1()
221 define ptx_device i32 @test_pm2() {
222 ; CHECK: mov.u32 %r{{[0-9]+}}, %pm2;
224 %x = call i32 @llvm.ptx.read.pm2()
228 define ptx_device i32 @test_pm3() {
229 ; CHECK: mov.u32 %r{{[0-9]+}}, %pm3;
231 %x = call i32 @llvm.ptx.read.pm3()
235 define ptx_device void @test_bar_sync() {
238 call void @llvm.ptx.bar.sync(i32 0)
242 declare i32 @llvm.ptx.read.tid.x()
243 declare i32 @llvm.ptx.read.tid.y()
244 declare i32 @llvm.ptx.read.tid.z()
245 declare i32 @llvm.ptx.read.tid.w()
246 declare i32 @llvm.ptx.read.ntid.x()
247 declare i32 @llvm.ptx.read.ntid.y()
248 declare i32 @llvm.ptx.read.ntid.z()
249 declare i32 @llvm.ptx.read.ntid.w()
251 declare i32 @llvm.ptx.read.laneid()
252 declare i32 @llvm.ptx.read.warpid()
253 declare i32 @llvm.ptx.read.nwarpid()
255 declare i32 @llvm.ptx.read.ctaid.x()
256 declare i32 @llvm.ptx.read.ctaid.y()
257 declare i32 @llvm.ptx.read.ctaid.z()
258 declare i32 @llvm.ptx.read.ctaid.w()
259 declare i32 @llvm.ptx.read.nctaid.x()
260 declare i32 @llvm.ptx.read.nctaid.y()
261 declare i32 @llvm.ptx.read.nctaid.z()
262 declare i32 @llvm.ptx.read.nctaid.w()
264 declare i32 @llvm.ptx.read.smid()
265 declare i32 @llvm.ptx.read.nsmid()
266 declare i32 @llvm.ptx.read.gridid()
268 declare i32 @llvm.ptx.read.lanemask.eq()
269 declare i32 @llvm.ptx.read.lanemask.le()
270 declare i32 @llvm.ptx.read.lanemask.lt()
271 declare i32 @llvm.ptx.read.lanemask.ge()
272 declare i32 @llvm.ptx.read.lanemask.gt()
274 declare i32 @llvm.ptx.read.clock()
275 declare i64 @llvm.ptx.read.clock64()
277 declare i32 @llvm.ptx.read.pm0()
278 declare i32 @llvm.ptx.read.pm1()
279 declare i32 @llvm.ptx.read.pm2()
280 declare i32 @llvm.ptx.read.pm3()
282 declare void @llvm.ptx.bar.sync(i32 %i)