• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===- PTXIntrinsicInstrInfo.td - Defines PTX intrinsics ---*- tablegen -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines all of the PTX-specific intrinsic instructions.
11//
12//===----------------------------------------------------------------------===//
13
14// PTX Special Purpose Register Accessor Intrinsics
15
16class PTX_READ_SPECIAL_REGISTER_R64<string regname, Intrinsic intop>
17  : InstPTX<(outs RegI64:$d), (ins),
18            !strconcat("mov.u64\t$d, %", regname),
19            [(set RegI64:$d, (intop))]>;
20
21class PTX_READ_SPECIAL_REGISTER_R32<string regname, Intrinsic intop>
22  : InstPTX<(outs RegI32:$d), (ins),
23            !strconcat("mov.u32\t$d, %", regname),
24            [(set RegI32:$d, (intop))]>;
25
26// TODO Add read vector-version of special registers
27
28//def PTX_READ_TID_R64 : PTX_READ_SPECIAL_REGISTER_R64<"tid",
29//                                                     int_ptx_read_tid_r64>;
30def PTX_READ_TID_X   : PTX_READ_SPECIAL_REGISTER_R32<"tid.x",
31                                                     int_ptx_read_tid_x>;
32def PTX_READ_TID_Y   : PTX_READ_SPECIAL_REGISTER_R32<"tid.y",
33                                                     int_ptx_read_tid_y>;
34def PTX_READ_TID_Z   : PTX_READ_SPECIAL_REGISTER_R32<"tid.z",
35                                                     int_ptx_read_tid_z>;
36def PTX_READ_TID_W   : PTX_READ_SPECIAL_REGISTER_R32<"tid.w",
37                                                     int_ptx_read_tid_w>;
38
39//def PTX_READ_NTID_R64 : PTX_READ_SPECIAL_REGISTER_R64<"ntid",
40//                                                      int_ptx_read_ntid_r64>;
41def PTX_READ_NTID_X   : PTX_READ_SPECIAL_REGISTER_R32<"ntid.x",
42                                                      int_ptx_read_ntid_x>;
43def PTX_READ_NTID_Y   : PTX_READ_SPECIAL_REGISTER_R32<"ntid.y",
44                                                      int_ptx_read_ntid_y>;
45def PTX_READ_NTID_Z   : PTX_READ_SPECIAL_REGISTER_R32<"ntid.z",
46                                                      int_ptx_read_ntid_z>;
47def PTX_READ_NTID_W   : PTX_READ_SPECIAL_REGISTER_R32<"ntid.w",
48                                                      int_ptx_read_ntid_w>;
49
50def PTX_READ_LANEID  : PTX_READ_SPECIAL_REGISTER_R32<"laneid",
51                                                     int_ptx_read_laneid>;
52def PTX_READ_WARPID  : PTX_READ_SPECIAL_REGISTER_R32<"warpid",
53                                                     int_ptx_read_warpid>;
54def PTX_READ_NWARPID : PTX_READ_SPECIAL_REGISTER_R32<"nwarpid",
55                                                     int_ptx_read_nwarpid>;
56
57//def PTX_READ_CTAID_R64 :
58//PTX_READ_SPECIAL_REGISTER_R64<"ctaid", int_ptx_read_ctaid_r64>;
59def PTX_READ_CTAID_X   : PTX_READ_SPECIAL_REGISTER_R32<"ctaid.x",
60                                                       int_ptx_read_ctaid_x>;
61def PTX_READ_CTAID_Y   : PTX_READ_SPECIAL_REGISTER_R32<"ctaid.y",
62                                                       int_ptx_read_ctaid_y>;
63def PTX_READ_CTAID_Z   : PTX_READ_SPECIAL_REGISTER_R32<"ctaid.z",
64                                                       int_ptx_read_ctaid_z>;
65def PTX_READ_CTAID_W   : PTX_READ_SPECIAL_REGISTER_R32<"ctaid.w",
66                                                       int_ptx_read_ctaid_w>;
67
68//def PTX_READ_NCTAID_R64 :
69//PTX_READ_SPECIAL_REGISTER_R64<"nctaid", int_ptx_read_nctaid_r64>;
70def PTX_READ_NCTAID_X   : PTX_READ_SPECIAL_REGISTER_R32<"nctaid.x",
71                                                        int_ptx_read_nctaid_x>;
72def PTX_READ_NCTAID_Y   : PTX_READ_SPECIAL_REGISTER_R32<"nctaid.y",
73                                                        int_ptx_read_nctaid_y>;
74def PTX_READ_NCTAID_Z   : PTX_READ_SPECIAL_REGISTER_R32<"nctaid.z",
75                                                        int_ptx_read_nctaid_z>;
76def PTX_READ_NCTAID_W   : PTX_READ_SPECIAL_REGISTER_R32<"nctaid.w",
77                                                        int_ptx_read_nctaid_w>;
78
79def PTX_READ_SMID  : PTX_READ_SPECIAL_REGISTER_R32<"smid",
80                                                   int_ptx_read_smid>;
81def PTX_READ_NSMID  : PTX_READ_SPECIAL_REGISTER_R32<"nsmid",
82                                                    int_ptx_read_nsmid>;
83def PTX_READ_GRIDID  : PTX_READ_SPECIAL_REGISTER_R32<"gridid",
84                                                     int_ptx_read_gridid>;
85
86def PTX_READ_LANEMASK_EQ
87  : PTX_READ_SPECIAL_REGISTER_R32<"lanemask_eq", int_ptx_read_lanemask_eq>;
88def PTX_READ_LANEMASK_LE
89  : PTX_READ_SPECIAL_REGISTER_R32<"lanemask_le", int_ptx_read_lanemask_le>;
90def PTX_READ_LANEMASK_LT
91  : PTX_READ_SPECIAL_REGISTER_R32<"lanemask_lt", int_ptx_read_lanemask_lt>;
92def PTX_READ_LANEMASK_GE
93  : PTX_READ_SPECIAL_REGISTER_R32<"lanemask_ge", int_ptx_read_lanemask_ge>;
94def PTX_READ_LANEMASK_GT
95  : PTX_READ_SPECIAL_REGISTER_R32<"lanemask_gt", int_ptx_read_lanemask_gt>;
96
97def PTX_READ_CLOCK
98  : PTX_READ_SPECIAL_REGISTER_R32<"clock", int_ptx_read_clock>;
99def PTX_READ_CLOCK64
100  : PTX_READ_SPECIAL_REGISTER_R64<"clock64", int_ptx_read_clock64>;
101
102def PTX_READ_PM0 : PTX_READ_SPECIAL_REGISTER_R32<"pm0", int_ptx_read_pm0>;
103def PTX_READ_PM1 : PTX_READ_SPECIAL_REGISTER_R32<"pm1", int_ptx_read_pm1>;
104def PTX_READ_PM2 : PTX_READ_SPECIAL_REGISTER_R32<"pm2", int_ptx_read_pm2>;
105def PTX_READ_PM3 : PTX_READ_SPECIAL_REGISTER_R32<"pm3", int_ptx_read_pm3>;
106
107// PTX Parallel Synchronization and Communication Intrinsics
108
109def PTX_BAR_SYNC : InstPTX<(outs), (ins i32imm:$i), "bar.sync\t$i",
110                           [(int_ptx_bar_sync imm:$i)]>;
111