@@ -153,14 +153,23 @@ 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
+ // NVVM_PureSpecialRegisterOp represents special register ops that can
157
+ // speculated and does not touch memory. These operations are always
158
+ // legal to hoist or sink.
159
+ class NVVM_PureSpecialRegisterOp<string mnemonic, list<Trait> traits = []> :
157
160
NVVM_IntrOp<mnemonic, !listconcat(traits, [Pure]), 1> {
158
161
let arguments = (ins);
159
162
let assemblyFormat = "attr-dict `:` type($res)";
160
163
}
161
164
165
+ class NVVM_SpecialRegisterOp<string mnemonic, list<Trait> traits = []> :
166
+ NVVM_IntrOp<mnemonic, traits, 1> {
167
+ let arguments = (ins);
168
+ let assemblyFormat = "attr-dict `:` type($res)";
169
+ }
170
+
162
171
class NVVM_SpecialRangeableRegisterOp<string mnemonic, list<Trait> traits = []> :
163
- NVVM_SpecialRegisterOp <mnemonic,
172
+ NVVM_PureSpecialRegisterOp <mnemonic,
164
173
!listconcat(traits,
165
174
[DeclareOpInterfaceMethods<InferIntRangeInterface, ["inferResultRanges"]>])> {
166
175
let arguments = (ins OptionalAttr<LLVM_ConstantRangeAttr>:$range);
@@ -199,11 +208,11 @@ def NVVM_GridIdOp : NVVM_SpecialRangeableRegisterOp<"read.ptx.sreg.gridid">;
199
208
200
209
//===----------------------------------------------------------------------===//
201
210
// 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">;
211
+ def NVVM_LaneMaskEqOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.eq">;
212
+ def NVVM_LaneMaskLeOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.le">;
213
+ def NVVM_LaneMaskLtOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.lt">;
214
+ def NVVM_LaneMaskGeOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.ge">;
215
+ def NVVM_LaneMaskGtOp : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.lanemask.gt">;
207
216
208
217
//===----------------------------------------------------------------------===//
209
218
// Thread index and range
@@ -256,7 +265,7 @@ def NVVM_GlobalTimerOp : NVVM_SpecialRegisterOp<"read.ptx.sreg.globaltimer">;
256
265
//===----------------------------------------------------------------------===//
257
266
// envreg registers
258
267
foreach index = !range(0, 32) in {
259
- def NVVM_EnvReg # index # Op : NVVM_SpecialRegisterOp <"read.ptx.sreg.envreg" # index>;
268
+ def NVVM_EnvReg # index # Op : NVVM_PureSpecialRegisterOp <"read.ptx.sreg.envreg" # index>;
260
269
}
261
270
262
271
//===----------------------------------------------------------------------===//
0 commit comments