2011-06-23 18:10:08 +00:00
|
|
|
; RUN: llc < %s -march=ptx32 -mattr=+ptx20 | FileCheck %s
|
2011-03-05 14:17:37 +00:00
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_tid_x() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %tid.x;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.tid.x()
|
|
|
|
ret i32 %x
|
2011-03-05 14:17:37 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_tid_y() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %tid.y;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.tid.y()
|
|
|
|
ret i32 %x
|
2011-03-05 14:17:37 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_tid_z() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %tid.z;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.tid.z()
|
|
|
|
ret i32 %x
|
2011-03-05 14:17:37 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_tid_w() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %tid.w;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.tid.w()
|
|
|
|
ret i32 %x
|
2011-03-05 14:17:37 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_ntid_x() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %ntid.x;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.ntid.x()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_ntid_y() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %ntid.y;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.ntid.y()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_ntid_z() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %ntid.z;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.ntid.z()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_ntid_w() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %ntid.w;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.ntid.w()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-10 04:05:57 +00:00
|
|
|
define ptx_device i32 @test_laneid() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %laneid;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.laneid()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_warpid() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %warpid;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.warpid()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_nwarpid() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %nwarpid;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.nwarpid()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_ctaid_x() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %ctaid.x;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.ctaid.x()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_ctaid_y() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %ctaid.y;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.ctaid.y()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_ctaid_z() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %ctaid.z;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.ctaid.z()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_ctaid_w() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %ctaid.w;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.ctaid.w()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_nctaid_x() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %nctaid.x;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.nctaid.x()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_nctaid_y() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %nctaid.y;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.nctaid.y()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_nctaid_z() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %nctaid.z;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.nctaid.z()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
define ptx_device i32 @test_nctaid_w() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %nctaid.w;
|
|
|
|
; CHECK: ret;
|
2011-03-15 13:24:15 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.nctaid.w()
|
|
|
|
ret i32 %x
|
2011-03-08 14:10:18 +00:00
|
|
|
}
|
|
|
|
|
2011-03-10 04:05:57 +00:00
|
|
|
define ptx_device i32 @test_smid() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %smid;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.smid()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_nsmid() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %nsmid;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.nsmid()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_gridid() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %gridid;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.gridid()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_lanemask_eq() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %lanemask_eq;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.lanemask.eq()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_lanemask_le() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %lanemask_le;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.lanemask.le()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_lanemask_lt() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %lanemask_lt;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.lanemask.lt()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_lanemask_ge() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %lanemask_ge;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.lanemask.ge()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_lanemask_gt() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %lanemask_gt;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.lanemask.gt()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_clock() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %clock;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.clock()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i64 @test_clock64() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u64 %ret0, %clock64;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i64 @llvm.ptx.read.clock64()
|
|
|
|
ret i64 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_pm0() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %pm0;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.pm0()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_pm1() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %pm1;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.pm1()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_pm2() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %pm2;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.pm2()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device i32 @test_pm3() {
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: mov.u32 %ret0, %pm3;
|
|
|
|
; CHECK: ret;
|
2011-03-10 04:05:57 +00:00
|
|
|
%x = call i32 @llvm.ptx.read.pm3()
|
|
|
|
ret i32 %x
|
|
|
|
}
|
|
|
|
|
|
|
|
define ptx_device void @test_bar_sync() {
|
2011-03-05 14:17:37 +00:00
|
|
|
; CHECK: bar.sync 0
|
2011-09-22 16:45:51 +00:00
|
|
|
; CHECK: ret;
|
2011-03-05 14:17:37 +00:00
|
|
|
call void @llvm.ptx.bar.sync(i32 0)
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
declare i32 @llvm.ptx.read.tid.x()
|
|
|
|
declare i32 @llvm.ptx.read.tid.y()
|
|
|
|
declare i32 @llvm.ptx.read.tid.z()
|
|
|
|
declare i32 @llvm.ptx.read.tid.w()
|
|
|
|
declare i32 @llvm.ptx.read.ntid.x()
|
|
|
|
declare i32 @llvm.ptx.read.ntid.y()
|
|
|
|
declare i32 @llvm.ptx.read.ntid.z()
|
|
|
|
declare i32 @llvm.ptx.read.ntid.w()
|
2011-03-10 04:05:57 +00:00
|
|
|
|
|
|
|
declare i32 @llvm.ptx.read.laneid()
|
|
|
|
declare i32 @llvm.ptx.read.warpid()
|
|
|
|
declare i32 @llvm.ptx.read.nwarpid()
|
|
|
|
|
2011-03-15 13:24:15 +00:00
|
|
|
declare i32 @llvm.ptx.read.ctaid.x()
|
|
|
|
declare i32 @llvm.ptx.read.ctaid.y()
|
|
|
|
declare i32 @llvm.ptx.read.ctaid.z()
|
|
|
|
declare i32 @llvm.ptx.read.ctaid.w()
|
|
|
|
declare i32 @llvm.ptx.read.nctaid.x()
|
|
|
|
declare i32 @llvm.ptx.read.nctaid.y()
|
|
|
|
declare i32 @llvm.ptx.read.nctaid.z()
|
|
|
|
declare i32 @llvm.ptx.read.nctaid.w()
|
2011-03-05 14:17:37 +00:00
|
|
|
|
2011-03-10 04:05:57 +00:00
|
|
|
declare i32 @llvm.ptx.read.smid()
|
|
|
|
declare i32 @llvm.ptx.read.nsmid()
|
|
|
|
declare i32 @llvm.ptx.read.gridid()
|
|
|
|
|
|
|
|
declare i32 @llvm.ptx.read.lanemask.eq()
|
|
|
|
declare i32 @llvm.ptx.read.lanemask.le()
|
|
|
|
declare i32 @llvm.ptx.read.lanemask.lt()
|
|
|
|
declare i32 @llvm.ptx.read.lanemask.ge()
|
|
|
|
declare i32 @llvm.ptx.read.lanemask.gt()
|
|
|
|
|
|
|
|
declare i32 @llvm.ptx.read.clock()
|
|
|
|
declare i64 @llvm.ptx.read.clock64()
|
|
|
|
|
|
|
|
declare i32 @llvm.ptx.read.pm0()
|
|
|
|
declare i32 @llvm.ptx.read.pm1()
|
|
|
|
declare i32 @llvm.ptx.read.pm2()
|
|
|
|
declare i32 @llvm.ptx.read.pm3()
|
|
|
|
|
2011-03-05 14:17:37 +00:00
|
|
|
declare void @llvm.ptx.bar.sync(i32 %i)
|