@@ -153,14 +153,21 @@ class NVVM_IntrOp<string mnem, list<Trait> traits = [],
153
153
// NVVM special register op definitions
154
154
//===----------------------------------------------------------------------===//
155
155
156
- class NVVM_SpecialRegisterOp <string mnemonic, list<Trait> traits = []> :
156
+ class NVVM_PureSpecialRegisterOp <string mnemonic, list<Trait> traits = []> :
157
157
NVVM_IntrOp<mnemonic, !listconcat(traits, [Pure]), 1> {
158
158
let arguments = (ins);
159
159
let assemblyFormat = "attr-dict `:` type($res)";
160
160
}
161
161
162
+ // NVVM_SpecialRegisterOp represents a non-constant special register
163
+ class NVVM_SpecialRegisterOp<string mnemonic, list<Trait> traits = []> :
164
+ NVVM_IntrOp<mnemonic, traits, 1> {
165
+ let arguments = (ins);
166
+ let assemblyFormat = "attr-dict `:` type($res)";
167
+ }
168
+
162
169
class NVVM_SpecialRangeableRegisterOp<string mnemonic, list<Trait> traits = []> :
163
- NVVM_SpecialRegisterOp <mnemonic,
170
+ NVVM_PureSpecialRegisterOp <mnemonic,
164
171
!listconcat(traits,
165
172
[DeclareOpInterfaceMethods<InferIntRangeInterface, ["inferResultRanges"]>])> {
166
173
let arguments = (ins OptionalAttr<LLVM_ConstantRangeAttr>:$range);
@@ -199,11 +206,11 @@ def NVVM_GridIdOp : NVVM_SpecialRangeableRegisterOp<"read.ptx.sreg.gridid">;
199
206
200
207
//===----------------------------------------------------------------------===//
201
208
// Lane Mask Comparison Ops
202
- def NVVM_LaneMaskEqOp : NVVM_SpecialRegisterOp <"read.ptx.sreg.lanemask.eq">;
203
- def NVVM_LaneMaskLeOp : NVVM_SpecialRegisterOp <"read.ptx.sreg.lanemask.le">;
204
- def NVVM_LaneMaskLtOp : NVVM_SpecialRegisterOp <"read.ptx.sreg.lanemask.lt">;
205
- def NVVM_LaneMaskGeOp : NVVM_SpecialRegisterOp <"read.ptx.sreg.lanemask.ge">;
206
- def NVVM_LaneMaskGtOp : NVVM_SpecialRegisterOp <"read.ptx.sreg.lanemask.gt">;
209
+ def NVVM_LaneMaskEqOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.eq">;
210
+ def NVVM_LaneMaskLeOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.le">;
211
+ def NVVM_LaneMaskLtOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.lt">;
212
+ def NVVM_LaneMaskGeOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.ge">;
213
+ def NVVM_LaneMaskGtOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.gt">;
207
214
208
215
//===----------------------------------------------------------------------===//
209
216
// Thread index and range
@@ -256,7 +263,7 @@ def NVVM_GlobalTimerOp : NVVM_SpecialRegisterOp<"read.ptx.sreg.globaltimer">;
256
263
//===----------------------------------------------------------------------===//
257
264
// envreg registers
258
265
foreach index = !range(0, 32) in {
259
- def NVVM_EnvReg # index # Op : NVVM_SpecialRegisterOp <"read.ptx.sreg.envreg" # index>;
266
+ def NVVM_EnvReg # index # Op : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.envreg" # index>;
260
267
}
261
268
262
269
//===----------------------------------------------------------------------===//
0 commit comments