xref: /freebsd/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVInstrInfo.td (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
1//===-- SPIRVInstrInfo.td - Target Description for SPIR-V Target ----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file describes the SPIR-V instructions in TableGen format.
10//
11//===----------------------------------------------------------------------===//
12
13include "SPIRVInstrFormats.td"
14include "SPIRVSymbolicOperands.td"
15
16// Codegen only metadata instructions
17let isCodeGenOnly=1 in {
18  def ASSIGN_TYPE: Pseudo<(outs ANYID:$dst_id), (ins ANYID:$src_id, TYPE:$src_ty)>;
19  def DECL_TYPE: Pseudo<(outs ANYID:$dst_id), (ins ANYID:$src_id, TYPE:$src_ty)>;
20  def GET_ID: Pseudo<(outs ID:$dst_id), (ins ANYID:$src)>;
21  def GET_fID: Pseudo<(outs fID:$dst_id), (ins ANYID:$src)>;
22  def GET_pID: Pseudo<(outs pID:$dst_id), (ins ANYID:$src)>;
23  def GET_vID: Pseudo<(outs vID:$dst_id), (ins ANYID:$src)>;
24  def GET_vfID: Pseudo<(outs vfID:$dst_id), (ins ANYID:$src)>;
25}
26
27def SPVTypeBin : SDTypeProfile<1, 2, []>;
28
29def assigntype : SDNode<"SPIRVISD::AssignType", SPVTypeBin>;
30
31def : GINodeEquiv<ASSIGN_TYPE, assigntype>;
32
33class BinOp<string name, bits<16> opCode, list<dag> pattern=[]>
34                : Op<opCode, (outs ANYID:$dst), (ins TYPE:$src_ty, ANYID:$src, ANYID:$src2),
35                  "$dst = "#name#" $src_ty $src $src2", pattern>;
36
37class BinOpTyped<string name, bits<16> opCode, RegisterClass CID, SDNode node>
38                : Op<opCode, (outs ID:$dst), (ins TYPE:$src_ty, CID:$src, CID:$src2),
39                  "$dst = "#name#" $src_ty $src $src2", [(set ID:$dst, (assigntype (node CID:$src, CID:$src2), TYPE:$src_ty))]>;
40
41class TernOpTyped<string name, bits<16> opCode, RegisterClass CCond, RegisterClass CID, SDNode node>
42                : Op<opCode, (outs ID:$dst), (ins TYPE:$src_ty, CCond:$cond, CID:$src1, CID:$src2),
43                  "$dst = "#name#" $src_ty $cond $src1 $src2", [(set ID:$dst, (assigntype (node CCond:$cond, CID:$src1, CID:$src2), TYPE:$src_ty))]>;
44
45multiclass BinOpTypedGen<string name, bits<16> opCode, SDNode node, bit genF = 0, bit genV = 0> {
46  if genF then
47    def S: BinOpTyped<name, opCode, fID, node>;
48  else
49    def S: BinOpTyped<name, opCode, ID, node>;
50  if genV then {
51    if genF then
52      def V: BinOpTyped<name, opCode, vfID, node>;
53    else
54      def V: BinOpTyped<name, opCode, vID, node>;
55  }
56}
57
58multiclass TernOpTypedGen<string name, bits<16> opCode, SDNode node, bit genI = 1, bit genF = 0, bit genV = 0> {
59  if genF then {
60    def SFSCond: TernOpTyped<name, opCode, ID, fID, node>;
61    def SFVCond: TernOpTyped<name, opCode, vID, fID, node>;
62  }
63  if genI then {
64    def SISCond: TernOpTyped<name, opCode, ID, ID, node>;
65    def SIVCond: TernOpTyped<name, opCode, vID, ID, node>;
66  }
67  if genV then {
68    if genF then {
69      def VFSCond: TernOpTyped<name, opCode, ID, vfID, node>;
70      def VFVCond: TernOpTyped<name, opCode, vID, vfID, node>;
71    }
72    if genI then {
73      def VISCond: TernOpTyped<name, opCode, ID, vID, node>;
74      def VIVCond: TernOpTyped<name, opCode, vID, vID, node>;
75    }
76  }
77}
78
79class UnOp<string name, bits<16> opCode, list<dag> pattern=[]>
80                : Op<opCode, (outs ANYID:$dst), (ins TYPE:$type, ANYID:$src),
81                  "$dst = "#name#" $type $src", pattern>;
82class UnOpTyped<string name, bits<16> opCode, RegisterClass CID, SDNode node>
83                : Op<opCode, (outs ID:$dst), (ins TYPE:$src_ty, CID:$src),
84                  "$dst = "#name#" $src_ty $src", [(set ID:$dst, (assigntype (node CID:$src), TYPE:$src_ty))]>;
85
86class SimpleOp<string name, bits<16> opCode>: Op<opCode, (outs), (ins), name>;
87
88// 3.42.1 Miscellaneous Instructions
89
90def OpNop: SimpleOp<"OpNop", 0>;
91def OpUndef: Op<1, (outs ID:$res), (ins TYPE:$type), "$res = OpUndef $type">;
92def OpSizeOf: Op<321, (outs ID:$res), (ins TYPE:$ty, ID:$ptr), "$res = OpSizeOf $ty $ptr">;
93
94//  - SPV_KHR_expect_assume : Expect assume instructions
95def OpAssumeTrueKHR: Op<5630, (outs), (ins ID:$cond), "OpAssumeTrueKHR $cond">;
96def OpExpectKHR: Op<5631, (outs ID:$res), (ins TYPE:$ty, ID:$val, ID:$expected), "$res = OpExpectKHR $ty $val $expected">;
97
98// 3.42.2 Debug Instructions
99
100def OpSourceContinued: Op<2, (outs), (ins StringImm:$str, variable_ops),
101                  "OpSourceContinued $str">;
102def OpSource: Op<3, (outs), (ins SourceLanguage:$lang, i32imm:$version, variable_ops),
103                  "OpSource $lang $version">;
104def OpSourceExtension: Op<4, (outs), (ins StringImm:$extension, variable_ops),
105                  "OpSourceExtension $extension">;
106def OpName: Op<5, (outs), (ins ANY:$tar, StringImm:$name, variable_ops), "OpName $tar $name">;
107def OpMemberName: Op<6, (outs), (ins TYPE:$ty, i32imm:$mem, StringImm:$name, variable_ops),
108                  "OpMemberName $ty $mem $name">;
109def OpString: Op<7, (outs ID:$r), (ins StringImm:$s, variable_ops), "$r = OpString $s">;
110def OpLine: Op<8, (outs), (ins ID:$file, i32imm:$ln, i32imm:$col), "OpLine $file $ln $col">;
111def OpNoLine: Op<317, (outs), (ins), "OpNoLine">;
112def OpModuleProcessed: Op<330, (outs), (ins StringImm:$process, variable_ops),
113                  "OpModuleProcessed $process">;
114
115// 3.42.3 Annotation Instructions
116
117def OpDecorate: Op<71, (outs), (ins ANY:$target, Decoration:$dec, variable_ops),
118                  "OpDecorate $target $dec">;
119def OpMemberDecorate: Op<72, (outs), (ins TYPE:$t, i32imm:$m, Decoration:$d, variable_ops),
120                  "OpMemberDecorate $t $m $d">;
121
122// TODO Currently some deprecated opcodes are missing: OpDecorationGroup,
123// OpGroupDecorate and OpGroupMemberDecorate
124
125def OpDecorateId: Op<332, (outs), (ins ANY:$target, Decoration:$dec, variable_ops),
126                  "OpDecorateId $target $dec">;
127def OpDecorateString: Op<5632, (outs), (ins ANY:$t, Decoration:$d, StringImm:$s, variable_ops),
128                  "OpDecorateString $t $d $s">;
129def OpMemberDecorateString: Op<5633, (outs),
130                  (ins TYPE:$ty, i32imm:$mem, Decoration:$dec, StringImm:$str, variable_ops),
131                  "OpMemberDecorateString $ty $mem $dec $str">;
132
133// 3.42.4 Extension Instructions
134
135def OpExtension: Op<10, (outs), (ins StringImm:$name, variable_ops), "OpExtension $name">;
136def OpExtInstImport: Op<11, (outs ID:$res), (ins StringImm:$extInstsName, variable_ops),
137                  "$res = OpExtInstImport $extInstsName">;
138def OpExtInst: Op<12, (outs ID:$res), (ins TYPE:$ty, ID:$set, Extension:$inst, variable_ops),
139                  "$res = OpExtInst $ty $set $inst">;
140
141// 3.42.5 Mode-Setting Instructions
142
143def OpMemoryModel: Op<14, (outs), (ins AddressingModel:$addr, MemoryModel:$mem),
144                  "OpMemoryModel $addr $mem">;
145def OpEntryPoint: Op<15, (outs),
146                  (ins ExecutionModel:$model, ID:$entry, StringImm:$name, variable_ops),
147                  "OpEntryPoint $model $entry $name">;
148def OpExecutionMode: Op<16, (outs), (ins ID:$entry, ExecutionMode:$mode, variable_ops),
149                  "OpExecutionMode $entry $mode">;
150def OpCapability: Op<17, (outs), (ins Capability:$cap), "OpCapability $cap">;
151def OpExecutionModeId: Op<331, (outs), (ins ID:$entry, ExecutionMode:$mode, variable_ops),
152                  "OpExecutionModeId $entry $mode">;
153
154// 3.42.6 Type-Declaration Instructions
155
156def OpTypeVoid: Op<19, (outs TYPE:$type), (ins), "$type = OpTypeVoid">;
157def OpTypeBool: Op<20, (outs TYPE:$type), (ins), "$type = OpTypeBool">;
158def OpTypeInt: Op<21, (outs TYPE:$type), (ins i32imm:$width, i32imm:$signedness),
159                  "$type = OpTypeInt $width $signedness">;
160def OpTypeFloat: Op<22, (outs TYPE:$type), (ins i32imm:$width),
161                  "$type = OpTypeFloat $width">;
162def OpTypeVector: Op<23, (outs TYPE:$type), (ins TYPE:$compType, i32imm:$compCount),
163                  "$type = OpTypeVector $compType $compCount">;
164def OpTypeMatrix: Op<24, (outs TYPE:$type), (ins TYPE:$colType, i32imm:$colCount),
165                  "$type = OpTypeMatrix $colType $colCount">;
166def OpTypeImage: Op<25, (outs TYPE:$res), (ins TYPE:$sampTy, Dim:$dim, i32imm:$depth,
167      i32imm:$arrayed, i32imm:$MS, i32imm:$sampled, ImageFormat:$imFormat, variable_ops),
168                  "$res = OpTypeImage $sampTy $dim $depth $arrayed $MS $sampled $imFormat">;
169def OpTypeSampler: Op<26, (outs TYPE:$res), (ins), "$res = OpTypeSampler">;
170def OpTypeSampledImage: Op<27, (outs TYPE:$res), (ins TYPE:$imageType),
171                  "$res = OpTypeSampledImage $imageType">;
172def OpTypeArray: Op<28, (outs TYPE:$type), (ins TYPE:$elementType, ID:$length),
173                  "$type = OpTypeArray $elementType $length">;
174def OpTypeRuntimeArray: Op<29, (outs TYPE:$type), (ins TYPE:$elementType),
175                  "$type = OpTypeRuntimeArray $elementType">;
176def OpTypeStruct: Op<30, (outs TYPE:$res), (ins variable_ops), "$res = OpTypeStruct">;
177def OpTypeOpaque: Op<31, (outs TYPE:$res), (ins StringImm:$name, variable_ops),
178                  "$res = OpTypeOpaque $name">;
179def OpTypePointer: Op<32, (outs TYPE:$res), (ins StorageClass:$storage, TYPE:$type),
180                  "$res = OpTypePointer $storage $type">;
181def OpTypeFunction: Op<33, (outs TYPE:$funcType), (ins TYPE:$returnType, variable_ops),
182                  "$funcType = OpTypeFunction $returnType">;
183def OpTypeEvent: Op<34, (outs TYPE:$res), (ins), "$res = OpTypeEvent">;
184def OpTypeDeviceEvent: Op<35, (outs TYPE:$res), (ins), "$res = OpTypeDeviceEvent">;
185def OpTypeReserveId: Op<36, (outs TYPE:$res), (ins), "$res = OpTypeReserveId">;
186def OpTypeQueue: Op<37, (outs TYPE:$res), (ins), "$res = OpTypeQueue">;
187def OpTypePipe: Op<38, (outs TYPE:$res), (ins AccessQualifier:$a), "$res = OpTypePipe $a">;
188def OpTypeForwardPointer: Op<39, (outs), (ins TYPE:$ptrType, StorageClass:$storageClass),
189                  "OpTypeForwardPointer $ptrType $storageClass">;
190def OpTypePipeStorage: Op<322, (outs TYPE:$res), (ins), "$res = OpTypePipeStorage">;
191def OpTypeNamedBarrier: Op<327, (outs TYPE:$res), (ins), "$res = OpTypeNamedBarrier">;
192def OpTypeAccelerationStructureNV: Op<5341, (outs TYPE:$res), (ins),
193                  "$res = OpTypeAccelerationStructureNV">;
194def OpTypeCooperativeMatrixNV: Op<5358, (outs TYPE:$res),
195                  (ins TYPE:$compType, ID:$scope, ID:$rows, ID:$cols),
196                  "$res = OpTypeCooperativeMatrixNV $compType $scope $rows $cols">;
197
198// 3.42.7 Constant-Creation Instructions
199
200def imm_to_i32 : SDNodeXForm<imm, [{
201return CurDAG->getTargetConstant(
202  N->getValueAP().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i32);
203}]>;
204
205def fimm_to_i32 : SDNodeXForm<imm, [{
206return CurDAG->getTargetConstant(
207  N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i32);
208}]>;
209
210def gi_bitcast_fimm_to_i32 : GICustomOperandRenderer<"renderFImm32">,
211  GISDNodeXFormEquiv<fimm_to_i32>;
212
213def gi_bitcast_imm_to_i32 : GICustomOperandRenderer<"renderImm32">,
214  GISDNodeXFormEquiv<imm_to_i32>;
215
216def PseudoConstI: IntImmLeaf<i32, [{ return Imm.getBitWidth() <= 32; }], imm_to_i32>;
217def PseudoConstF: FPImmLeaf<f32, [{  return true; }], fimm_to_i32>;
218def ConstPseudoTrue: IntImmLeaf<i32, [{ return Imm.getBitWidth() == 1 && Imm.getZExtValue() == 1; }]>;
219def ConstPseudoFalse: IntImmLeaf<i32, [{ return Imm.getBitWidth() == 1 && Imm.getZExtValue() == 0; }]>;
220def ConstPseudoNull: IntImmLeaf<i64, [{ return Imm.isZero(); }]>;
221
222multiclass IntFPImm<bits<16> opCode, string name> {
223  def I: Op<opCode, (outs ID:$dst), (ins TYPE:$type, ID:$src, variable_ops),
224                  "$dst = "#name#" $type", [(set ID:$dst, (assigntype PseudoConstI:$src, TYPE:$type))]>;
225  def F: Op<opCode, (outs ID:$dst), (ins TYPE:$type, fID:$src, variable_ops),
226                  "$dst = "#name#" $type", [(set ID:$dst, (assigntype PseudoConstF:$src, TYPE:$type))]>;
227}
228
229def OpConstantTrue: Op<41, (outs ID:$dst), (ins TYPE:$src_ty), "$dst = OpConstantTrue $src_ty",
230                      [(set ID:$dst, (assigntype ConstPseudoTrue, TYPE:$src_ty))]>;
231def OpConstantFalse: Op<42, (outs ID:$dst), (ins TYPE:$src_ty), "$dst = OpConstantFalse $src_ty",
232                      [(set ID:$dst, (assigntype ConstPseudoFalse, TYPE:$src_ty))]>;
233
234defm OpConstant: IntFPImm<43, "OpConstant">;
235
236def OpConstantComposite: Op<44, (outs ID:$res), (ins TYPE:$type, variable_ops),
237                  "$res = OpConstantComposite $type">;
238def OpConstantSampler: Op<45, (outs ID:$res),
239                  (ins TYPE:$t, SamplerAddressingMode:$s, i32imm:$p, SamplerFilterMode:$f),
240                  "$res = OpConstantSampler $t $s $p $f">;
241def OpConstantNull: Op<46, (outs ID:$dst), (ins TYPE:$src_ty), "$dst = OpConstantNull $src_ty",
242                      [(set ID:$dst, (assigntype ConstPseudoNull, TYPE:$src_ty))]>;
243
244def OpSpecConstantTrue: Op<48, (outs ID:$r), (ins TYPE:$t), "$r = OpSpecConstantTrue $t">;
245def OpSpecConstantFalse: Op<49, (outs ID:$r), (ins TYPE:$t), "$r = OpSpecConstantFalse $t">;
246def OpSpecConstant: Op<50, (outs ID:$res), (ins TYPE:$type, i32imm:$imm, variable_ops),
247                  "$res = OpSpecConstant $type $imm">;
248def OpSpecConstantComposite: Op<51, (outs ID:$res), (ins TYPE:$type, variable_ops),
249                  "$res = OpSpecConstantComposite $type">;
250def OpSpecConstantOp: Op<52, (outs ID:$res), (ins TYPE:$t, i32imm:$c, ID:$o, variable_ops),
251                  "$res = OpSpecConstantOp $t $c $o">;
252
253// 3.42.8 Memory Instructions
254
255def OpVariable: Op<59, (outs ID:$res), (ins TYPE:$type, StorageClass:$sc, variable_ops),
256                  "$res = OpVariable $type $sc">;
257def OpImageTexelPointer: Op<60, (outs ID:$res),
258                  (ins TYPE:$resType, ID:$image, ID:$coord, ID:$sample),
259                  "$res = OpImageTexelPointer $resType $image $coord $sample">;
260def OpLoad: Op<61, (outs ID:$res), (ins TYPE:$resType, ID:$pointer, variable_ops),
261                  "$res = OpLoad $resType $pointer">;
262def OpStore: Op<62, (outs), (ins ID:$pointer, ID:$objectToStore, variable_ops),
263                  "OpStore $pointer $objectToStore">;
264def OpCopyMemory: Op<63, (outs), (ins ID:$dest, ID:$src, variable_ops),
265                  "OpCopyMemory $dest $src">;
266def OpCopyMemorySized: Op<64, (outs), (ins ID:$dest, ID:$src, ID:$size, variable_ops),
267                  "OpCopyMemorySized $dest $src $size">;
268def OpAccessChain: Op<65, (outs ID:$res), (ins TYPE:$type, ID:$base, variable_ops),
269                  "$res = OpAccessChain $type $base">;
270def OpInBoundsAccessChain: Op<66, (outs ID:$res),
271                  (ins TYPE:$type, ID:$base, variable_ops),
272                  "$res = OpInBoundsAccessChain $type $base">;
273def OpPtrAccessChain: Op<67, (outs ID:$res),
274                  (ins TYPE:$type, ID:$base, ID:$element, variable_ops),
275                  "$res = OpPtrAccessChain $type $base $element">;
276def OpArrayLength: Op<68, (outs ID:$res), (ins TYPE:$resTy, ID:$struct, i32imm:$arrayMember),
277                  "$res = OpArrayLength $resTy $struct $arrayMember">;
278def OpGenericPtrMemSemantics: Op<69, (outs ID:$res), (ins TYPE:$resType, ID:$pointer),
279                  "$res = OpGenericPtrMemSemantics $resType $pointer">;
280def OpInBoundsPtrAccessChain: Op<70, (outs ID:$res),
281                  (ins TYPE:$type, ID:$base, ID:$element, variable_ops),
282                  "$res = OpInBoundsPtrAccessChain $type $base $element">;
283def OpPtrEqual: Op<401, (outs ID:$res), (ins TYPE:$resType, ID:$a, ID:$b),
284                  "$res = OpPtrEqual $resType $a $b">;
285def OpPtrNotEqual: Op<402, (outs ID:$res), (ins TYPE:$resType, ID:$a, ID:$b),
286                  "$res = OpPtrNotEqual $resType $a $b">;
287def OpPtrDiff: Op<403, (outs ID:$res), (ins TYPE:$resType, ID:$a, ID:$b),
288                  "$res = OpPtrDiff $resType $a $b">;
289
290// 3.42.9 Function Instructions
291
292def OpFunction: Op<54, (outs ID:$func),
293                  (ins TYPE:$resType, FunctionControl:$funcControl, TYPE:$funcType),
294                  "$func = OpFunction $resType $funcControl $funcType">;
295def OpFunctionParameter: Op<55, (outs ID:$arg), (ins TYPE:$type),
296                  "$arg = OpFunctionParameter $type">;
297def OpFunctionEnd: Op<56, (outs), (ins), "OpFunctionEnd"> {
298  let isTerminator=1;
299}
300def OpFunctionCall: Op<57, (outs ID:$res), (ins TYPE:$resType, ID:$function, variable_ops),
301                  "$res = OpFunctionCall $resType $function">;
302
303// 3.42.10 Image Instructions
304
305def OpSampledImage: BinOp<"OpSampledImage", 86>;
306
307def OpImageSampleImplicitLod: Op<87, (outs ID:$res),
308                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, variable_ops),
309                  "$res = OpImageSampleImplicitLod $type $sampledImage $coord">;
310def OpImageSampleExplicitLod: Op<88, (outs ID:$res),
311                  (ins TYPE:$ty, ID:$sImage, ID:$uv, ImageOperand:$op, ID:$i, variable_ops),
312                  "$res = OpImageSampleExplicitLod $ty $sImage $uv $op $i">;
313
314def OpImageSampleDrefImplicitLod: Op<89, (outs ID:$res),
315                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$dref, variable_ops),
316                  "$res = OpImageSampleDrefImplicitLod $type $sampledImage $dref $coord">;
317def OpImageSampleDrefExplicitLod: Op<90, (outs ID:$res),
318                  (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops),
319                  "$res = OpImageSampleDrefExplicitLod $ty $im $uv $d $op $i">;
320
321def OpImageSampleProjImplicitLod: Op<91, (outs ID:$res),
322                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, variable_ops),
323                  "$res = OpImageSampleProjImplicitLod $type $sampledImage $coord">;
324def OpImageSampleProjExplicitLod: Op<92, (outs ID:$res),
325                  (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops),
326                  "$res = OpImageSampleProjExplicitLod $ty $im $uv $op $i">;
327
328def OpImageSampleProjDrefImplicitLod: Op<93, (outs ID:$res),
329                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$dref, variable_ops),
330                  "$res = OpImageSampleProjDrefImplicitLod $type $sampledImage $dref $coord">;
331def OpImageSampleProjDrefExplicitLod: Op<94, (outs ID:$res),
332                  (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops),
333                  "$res = OpImageSampleProjDrefExplicitLod $ty $im $uv $d $op $i">;
334
335def OpImageFetch: Op<95, (outs ID:$res),
336                  (ins TYPE:$type, ID:$image, ID:$coord, variable_ops),
337                  "$res = OpImageFetch $type $image $coord">;
338def OpImageGather: Op<96, (outs ID:$res),
339                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$component, variable_ops),
340                  "$res = OpImageGather $type $sampledImage $coord $component">;
341def OpImageDrefGather: Op<97, (outs ID:$res),
342                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$dref, variable_ops),
343                  "$res = OpImageDrefGather $type $sampledImage $coord $dref">;
344
345def OpImageRead: Op<98, (outs ID:$res),
346                  (ins TYPE:$type, ID:$image, ID:$coord, variable_ops),
347                  "$res = OpImageRead $type $image $coord">;
348def OpImageWrite: Op<99, (outs), (ins ID:$image, ID:$coord, ID:$texel, variable_ops),
349                  "OpImageWrite $image $coord $texel">;
350
351def OpImage: UnOp<"OpImage", 100>;
352def OpImageQueryFormat: UnOp<"OpImageQueryFormat", 101>;
353def OpImageQueryOrder: UnOp<"OpImageQueryOrder", 102>;
354def OpImageQuerySizeLod: BinOp<"OpImageQuerySizeLod", 103>;
355def OpImageQuerySize: UnOp<"OpImageQuerySize", 104>;
356def OpImageQueryLod: BinOp<"OpImageQueryLod", 105>;
357def OpImageQueryLevels: UnOp<"OpImageQueryLevels", 106>;
358def OpImageQuerySamples: UnOp<"OpImageQuerySamples", 107>;
359
360def OpImageSparseSampleImplicitLod: Op<305, (outs ID:$res),
361                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, variable_ops),
362                  "$res = OpImageSparseSampleImplicitLod $type $sampledImage $coord">;
363def OpImageSparseSampleExplicitLod: Op<306, (outs ID:$res),
364                  (ins TYPE:$ty, ID:$sImage, ID:$uv, ImageOperand:$op, ID:$i, variable_ops),
365                  "$res = OpImageSparseSampleExplicitLod $ty $sImage $uv $op $i">;
366
367def OpImageSparseSampleDrefImplicitLod: Op<307, (outs ID:$res),
368                  (ins TYPE:$type, ID:$sampledImg, ID:$coord, ID:$dref, variable_ops),
369                  "$res = OpImageSparseSampleDrefImplicitLod $type $sampledImg $dref $coord">;
370def OpImageSparseSampleDrefExplicitLod: Op<308, (outs ID:$res),
371                  (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops),
372                  "$res = OpImageSparseSampleDrefExplicitLod $ty $im $uv $d $op $i">;
373
374def OpImageSparseSampleProjImplicitLod: Op<309, (outs ID:$res),
375                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, variable_ops),
376                  "$res = OpImageSparseSampleProjImplicitLod $type $sampledImage $coord">;
377def OpImageSparseSampleProjExplicitLod: Op<310, (outs ID:$res),
378                  (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops),
379                  "$res = OpImageSparseSampleProjExplicitLod $ty $im $uv $op $i">;
380
381def OpImageSparseSampleProjDrefImplicitLod: Op<311, (outs ID:$res),
382                  (ins TYPE:$type, ID:$sImage, ID:$coord, ID:$dref, variable_ops),
383                  "$res = OpImageSparseSampleProjDrefImplicitLod $type $sImage $dref $coord">;
384def OpImageSparseSampleProjDrefExplicitLod: Op<312, (outs ID:$res),
385                  (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops),
386                  "$res = OpImageSparseSampleProjDrefExplicitLod $ty $im $uv $d $op $i">;
387
388def OpImageSparseFetch: Op<313, (outs ID:$res),
389                  (ins TYPE:$type, ID:$image, ID:$coord, variable_ops),
390                  "$res = OpImageSparseFetch $type $image $coord">;
391def OpImageSparseGather: Op<314, (outs ID:$res),
392                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$component, variable_ops),
393                  "$res = OpImageSparseGather $type $sampledImage $coord $component">;
394def OpImageSparseDrefGather: Op<315, (outs ID:$res),
395                  (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$dref, variable_ops),
396                  "$res = OpImageSparseDrefGather $type $sampledImage $coord $dref">;
397
398def OpImageSparseTexelsResident: UnOp<"OpImageSparseTexelsResident", 316>;
399
400def OpImageSparseRead: Op<320, (outs ID:$res),
401                  (ins TYPE:$type, ID:$image, ID:$coord, variable_ops),
402                  "$res = OpImageSparseRead $type $image $coord">;
403
404def OpImageSampleFootprintNV: Op<5283, (outs ID:$res),
405                  (ins TYPE:$ty, ID:$sImg, ID:$uv, ID:$granularity, ID:$coarse, variable_ops),
406                  "$res = OpImageSampleFootprintNV $ty $sImg $uv $granularity $coarse">;
407
408// 3.42.11 Conversion instructions
409
410def OpConvertFToU : UnOp<"OpConvertFToU", 109>;
411def OpConvertFToS : UnOp<"OpConvertFToS", 110>;
412def OpConvertSToF : UnOp<"OpConvertSToF", 111>;
413def OpConvertUToF : UnOp<"OpConvertUToF", 112>;
414
415def OpUConvert : UnOp<"OpUConvert", 113>;
416def OpSConvert : UnOp<"OpSConvert", 114>;
417def OpFConvert : UnOp<"OpFConvert", 115>;
418
419def OpQuantizeToF16 : UnOp<"OpQuantizeToF16", 116>;
420
421def OpConvertPtrToU : UnOp<"OpConvertPtrToU", 117>;
422
423def OpSatConvertSToU : UnOp<"OpSatConvertSToU", 118>;
424def OpSatConvertUToS : UnOp<"OpSatConvertUToS", 119>;
425
426def OpConvertUToPtr : UnOp<"OpConvertUToPtr", 120>;
427def OpPtrCastToGeneric : UnOp<"OpPtrCastToGeneric", 121>;
428def OpGenericCastToPtr : UnOp<"OpGenericCastToPtr", 122>;
429def OpGenericCastToPtrExplicit : Op<123, (outs ID:$r), (ins TYPE:$t, ID:$p, StorageClass:$s),
430                              "$r = OpGenericCastToPtrExplicit $t $p $s">;
431def OpBitcast : UnOp<"OpBitcast", 124>;
432
433// 3.42.12 Composite Instructions
434
435def OpVectorExtractDynamic: Op<77, (outs ID:$res), (ins TYPE:$type, vID:$vec, ID:$idx),
436                  "$res = OpVectorExtractDynamic $type $vec $idx", [(set ID:$res, (assigntype (extractelt vID:$vec, ID:$idx), TYPE:$type))]>;
437
438def OpVectorInsertDynamic: Op<78, (outs ID:$res), (ins TYPE:$ty, ID:$vec, ID:$comp, ID:$idx),
439                  "$res = OpVectorInsertDynamic $ty $vec $comp $idx">;
440def OpVectorShuffle: Op<79, (outs ID:$res), (ins TYPE:$ty, ID:$v1, ID:$v2, variable_ops),
441                  "$res = OpVectorShuffle $ty $v1 $v2">;
442def OpCompositeConstruct: Op<80, (outs ID:$res), (ins TYPE:$type, variable_ops),
443                  "$res = OpCompositeConstruct $type">;
444def OpCompositeExtract: Op<81, (outs ID:$res), (ins TYPE:$type, ID:$base, variable_ops),
445                  "$res = OpCompositeExtract $type $base">;
446def OpCompositeInsert: Op<82, (outs ID:$r), (ins TYPE:$ty, ID:$obj, ID:$base, variable_ops),
447                  "$r = OpCompositeInsert $ty $obj $base">;
448def OpCopyObject: UnOp<"OpCopyObject", 83>;
449def OpTranspose: UnOp<"OpTranspose", 84>;
450def OpCopyLogical: UnOp<"OpCopyLogical", 400>;
451
452// 3.42.13 Arithmetic Instructions
453
454def OpSNegate: UnOp<"OpSNegate", 126>;
455def OpFNegate: UnOpTyped<"OpFNegate", 127, fID, fneg>;
456def OpFNegateV: UnOpTyped<"OpFNegate", 127, vfID, fneg>;
457defm OpIAdd: BinOpTypedGen<"OpIAdd", 128, add, 0, 1>;
458defm OpFAdd: BinOpTypedGen<"OpFAdd", 129, fadd, 1, 1>;
459
460defm OpISub: BinOpTypedGen<"OpISub", 130, sub, 0, 1>;
461defm OpFSub: BinOpTypedGen<"OpFSub", 131, fsub, 1, 1>;
462
463defm OpIMul: BinOpTypedGen<"OpIMul", 132, mul, 0, 1>;
464defm OpFMul: BinOpTypedGen<"OpFMul", 133, fmul, 1, 1>;
465
466defm OpUDiv: BinOpTypedGen<"OpUDiv", 134, udiv, 0, 1>;
467defm OpSDiv: BinOpTypedGen<"OpSDiv", 135, sdiv, 0, 1>;
468defm OpFDiv: BinOpTypedGen<"OpFDiv", 136, fdiv, 1, 1>;
469
470defm OpUMod: BinOpTypedGen<"OpUMod", 137, urem, 0, 1>;
471defm OpSRem: BinOpTypedGen<"OpSRem", 138, srem, 0, 1>;
472
473def OpSMod: BinOp<"OpSMod", 139>;
474
475defm OpFRem: BinOpTypedGen<"OpFRem", 140, frem, 1, 1>;
476def OpFMod: BinOp<"OpFMod", 141>;
477
478def OpVectorTimesScalar: BinOp<"OpVectorTimesScalar", 142>;
479def OpMatrixTimesScalar: BinOp<"OpMatrixTimesScalar", 143>;
480def OpVectorTimesMatrix: BinOp<"OpVectorTimesMatrix", 144>;
481def OpMatrixTimesVector: BinOp<"OpMatrixTimesVector", 145>;
482def OpMatrixTimesMatrix: BinOp<"OpMatrixTimesMatrix", 146>;
483
484def OpOuterProduct: BinOp<"OpOuterProduct", 147>;
485def OpDot: BinOp<"OpDot", 148>;
486
487def OpIAddCarry: BinOpTyped<"OpIAddCarry", 149, ID, addc>;
488def OpISubBorrow: BinOpTyped<"OpISubBorrow", 150, ID, subc>;
489def OpUMulExtended: BinOp<"OpUMulExtended", 151>;
490def OpSMulExtended: BinOp<"OpSMulExtended", 152>;
491
492// 3.42.14 Bit Instructions
493
494defm OpShiftRightLogical: BinOpTypedGen<"OpShiftRightLogical", 194, srl, 0, 1>;
495defm OpShiftRightArithmetic: BinOpTypedGen<"OpShiftRightArithmetic", 195, sra, 0, 1>;
496defm OpShiftLeftLogical: BinOpTypedGen<"OpShiftLeftLogical", 196, shl, 0, 1>;
497
498defm OpBitwiseOr: BinOpTypedGen<"OpBitwiseOr", 197, or, 0, 1>;
499defm OpBitwiseXor: BinOpTypedGen<"OpBitwiseXor", 198, xor, 0, 1>;
500defm OpBitwiseAnd: BinOpTypedGen<"OpBitwiseAnd", 199, and, 0, 1>;
501def OpNot: UnOp<"OpNot", 200>;
502
503def OpBitFieldInsert: Op<201, (outs ID:$res),
504                  (ins TYPE:$ty, ID:$base, ID:$insert, ID:$offset, ID:$count),
505                  "$res = OpBitFieldInsert $ty $base $insert $offset $count">;
506def OpBitFieldSExtract: Op<202, (outs ID:$res),
507                  (ins TYPE:$ty, ID:$base, ID:$offset, ID:$count),
508                  "$res = OpBitFieldSExtract $ty $base $offset $count">;
509def OpBitFieldUExtract: Op<203, (outs ID:$res),
510                  (ins TYPE:$ty, ID:$base, ID:$offset, ID:$count),
511                  "$res = OpBitFieldUExtract $ty $base $offset $count">;
512def OpBitReverse: Op<204, (outs ID:$r), (ins TYPE:$ty, ID:$b), "$r = OpBitReverse $ty $b">;
513def OpBitCount: Op<205, (outs ID:$r), (ins TYPE:$ty, ID:$b), "$r = OpBitCount $ty $b">;
514
515// 3.42.15 Relational and Logical Instructions
516
517def OpAny: Op<154, (outs ID:$res), (ins TYPE:$ty, ID:$vec),
518                  "$res = OpAny $ty $vec">;
519def OpAll: Op<155, (outs ID:$res), (ins TYPE:$ty, ID:$vec),
520                  "$res = OpAll $ty $vec">;
521
522def OpIsNan: UnOp<"OpIsNan", 156>;
523def OpIsInf: UnOp<"OpIsInf", 157>;
524def OpIsFinite: UnOp<"OpIsFinite", 158>;
525def OpIsNormal: UnOp<"OpIsNormal", 159>;
526def OpSignBitSet: UnOp<"OpSignBitSet", 160>;
527
528def OpLessOrGreater: BinOp<"OpLessOrGreater", 161>;
529def OpOrdered: BinOp<"OpOrdered", 162>;
530def OpUnordered: BinOp<"OpUnordered", 163>;
531
532def OpLogicalEqual: BinOp<"OpLogicalEqual", 164>;
533def OpLogicalNotEqual: BinOp<"OpLogicalNotEqual", 165>;
534def OpLogicalOr: BinOp<"OpLogicalOr", 166>;
535def OpLogicalAnd: BinOp<"OpLogicalAnd", 167>;
536def OpLogicalNot: UnOp<"OpLogicalNot", 168>;
537
538defm OpSelect: TernOpTypedGen<"OpSelect", 169, select, 1, 1, 1>;
539
540def OpIEqual: BinOp<"OpIEqual", 170>;
541def OpINotEqual: BinOp<"OpINotEqual", 171>;
542
543def OpUGreaterThan: BinOp<"OpUGreaterThan", 172>;
544def OpSGreaterThan: BinOp<"OpSGreaterThan", 173>;
545def OpUGreaterThanEqual: BinOp<"OpUGreaterThanEqual", 174>;
546def OpSGreaterThanEqual: BinOp<"OpSGreaterThanEqual", 175>;
547def OpULessThan: BinOp<"OpULessThan", 176>;
548def OpSLessThan: BinOp<"OpSLessThan", 177>;
549def OpULessThanEqual: BinOp<"OpULessThanEqual", 178>;
550def OpSLessThanEqual: BinOp<"OpSLessThanEqual", 179>;
551
552def OpFOrdEqual: BinOp<"OpFOrdEqual", 180>;
553def OpFUnordEqual: BinOp<"OpFUnordEqual", 181>;
554def OpFOrdNotEqual: BinOp<"OpFOrdNotEqual", 182>;
555def OpFUnordNotEqual: BinOp<"OpFUnordNotEqual", 183>;
556
557def OpFOrdLessThan: BinOp<"OpFOrdLessThan", 184>;
558def OpFUnordLessThan: BinOp<"OpFUnordLessThan", 185>;
559def OpFOrdGreaterThan: BinOp<"OpFOrdGreaterThan", 186>;
560def OpFUnordGreaterThan: BinOp<"OpFUnordGreaterThan", 187>;
561
562def OpFOrdLessThanEqual: BinOp<"OpFOrdLessThanEqual", 188>;
563def OpFUnordLessThanEqual: BinOp<"OpFUnordLessThanEqual", 189>;
564def OpFOrdGreaterThanEqual: BinOp<"OpFOrdGreaterThanEqual", 190>;
565def OpFUnordGreaterThanEqual: BinOp<"OpFUnordGreaterThanEqual", 191>;
566
567// 3.42.16 Derivative Instructions
568
569def OpDPdx: UnOp<"OpDPdx", 207>;
570def OpDPdy: UnOp<"OpDPdy", 208>;
571def OpFwidth: UnOp<"OpFwidth", 209>;
572
573def OpDPdxFine: UnOp<"OpDPdxFine", 210>;
574def OpDPdyFine: UnOp<"OpDPdyFine", 211>;
575def OpFwidthFine: UnOp<"OpFwidthFine", 212>;
576
577def OpDPdxCoarse: UnOp<"OpDPdxCoarse", 213>;
578def OpDPdyCoarse: UnOp<"OpDPdyCoarse", 214>;
579def OpFwidthCoarse: UnOp<"OpFwidthCoarse", 215>;
580
581// 3.42.17 Control-Flow Instructions
582
583def OpPhi: Op<245, (outs ID:$res), (ins TYPE:$type, ID:$var0, ID:$block0, variable_ops),
584                  "$res = OpPhi $type $var0 $block0">;
585def OpLoopMerge: Op<246, (outs), (ins ID:$merge, ID:$continue, LoopControl:$lc, variable_ops),
586                  "OpLoopMerge $merge $merge $continue $lc">;
587def OpSelectionMerge: Op<247, (outs), (ins ID:$merge, SelectionControl:$sc),
588                  "OpSelectionMerge $merge $sc">;
589def OpLabel: Op<248, (outs ID:$label), (ins), "$label = OpLabel">;
590let isTerminator=1 in {
591  def OpBranch: Op<249, (outs), (ins ID:$label), "OpBranch $label">;
592  def OpBranchConditional: Op<250, (outs), (ins ID:$cond, ID:$true, ID:$false, variable_ops),
593                  "OpBranchConditional $cond $true $false">;
594  def OpSwitch: Op<251, (outs), (ins ID:$sel, ID:$dflt, variable_ops), "OpSwitch $sel $dflt">;
595}
596let isReturn = 1, hasDelaySlot=0, isBarrier = 0, isTerminator=1, isNotDuplicable = 1 in {
597  def OpKill: SimpleOp<"OpKill", 252>;
598  def OpReturn: SimpleOp<"OpReturn", 253>;
599  def OpReturnValue: Op<254, (outs), (ins ANYID:$ret), "OpReturnValue $ret">;
600  def OpUnreachable: SimpleOp<"OpUnreachable", 255>;
601}
602def OpLifetimeStart: Op<256, (outs), (ins ID:$ptr, i32imm:$sz), "OpLifetimeStart $ptr, $sz">;
603def OpLifetimeStop: Op<257, (outs), (ins ID:$ptr, i32imm:$sz), "OpLifetimeStop $ptr, $sz">;
604
605// 3.42.18 Atomic Instructions
606
607class AtomicOp<string name, bits<16> opCode>: Op<opCode, (outs ID:$res),
608                  (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$sem),
609                  "$res = "#name#" $ty $ptr $sc $sem">;
610
611class AtomicOpVal<string name, bits<16> opCode>: Op<opCode, (outs ID:$res),
612                  (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$sem, ID:$val),
613                  "$res = "#name#" $ty $ptr $sc $sem $val">;
614
615def OpAtomicLoad: AtomicOp<"OpAtomicLoad", 227>;
616
617def OpAtomicStore: Op<228, (outs), (ins ID:$ptr, ID:$sc, ID:$sem, ID:$val),
618                  "OpAtomicStore $ptr $sc $sem $val">;
619def OpAtomicExchange: Op<229, (outs ID:$res),
620                  (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$sem, ID:$val),
621                  "$res = OpAtomicExchange $ty $ptr $sc $sem $val">;
622def OpAtomicCompareExchange: Op<230, (outs ID:$res),
623                  (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$eq,
624                   ID:$neq, ID:$val, ID:$cmp),
625                  "$res = OpAtomicCompareExchange $ty $ptr $sc $eq $neq $val $cmp">;
626def OpAtomicCompareExchangeWeak: Op<231, (outs ID:$res),
627                   (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$eq,
628                    ID:$neq, ID:$val, ID:$cmp),
629                   "$res = OpAtomicCompareExchangeWeak $ty $ptr $sc $eq $neq $val $cmp">;
630
631def OpAtomicIIncrement: AtomicOp<"OpAtomicIIncrement", 232>;
632def OpAtomicIDecrement: AtomicOp<"OpAtomicIDecrement", 233>;
633
634def OpAtomicIAdd: AtomicOpVal<"OpAtomicIAdd", 234>;
635def OpAtomicISub: AtomicOpVal<"OpAtomicISub", 235>;
636
637def OpAtomicSMin: AtomicOpVal<"OpAtomicSMin", 236>;
638def OpAtomicUMin: AtomicOpVal<"OpAtomicUMin", 237>;
639def OpAtomicSMax: AtomicOpVal<"OpAtomicSMax", 238>;
640def OpAtomicUMax: AtomicOpVal<"OpAtomicUMax", 239>;
641
642def OpAtomicAnd: AtomicOpVal<"OpAtomicAnd", 240>;
643def OpAtomicOr: AtomicOpVal<"OpAtomicOr", 241>;
644def OpAtomicXor: AtomicOpVal<"OpAtomicXor", 242>;
645
646
647def OpAtomicFlagTestAndSet: AtomicOp<"OpAtomicFlagTestAndSet", 318>;
648def OpAtomicFlagClear: Op<319, (outs), (ins ID:$ptr, ID:$sc, ID:$sem),
649                  "OpAtomicFlagClear $ptr $sc $sem">;
650
651// 3.42.19 Primitive Instructions
652
653def OpEmitVertex: SimpleOp<"OpEmitVertex", 218>;
654def OpEndPrimitive: SimpleOp<"OpEndPrimitive", 219>;
655def OpEmitStreamVertex: Op<220, (outs), (ins ID:$stream), "OpEmitStreamVertex $stream">;
656def OpEndStreamPrimitive: Op<221, (outs), (ins ID:$stream), "OpEndStreamPrimitive $stream">;
657
658// 3.42.20 Barrier Instructions
659
660def OpControlBarrier: Op<224, (outs), (ins ID:$exec, ID:$mem, ID:$sem),
661                  "OpControlBarrier $exec $mem $sem">;
662def OpMemoryBarrier: Op<225, (outs), (ins ID:$mem, ID:$sem),
663                  "OpMemoryBarrier $mem $sem">;
664def OpNamedBarrierInitialize: UnOp<"OpNamedBarrierInitialize", 328>;
665def OpMemoryNamedBarrier: Op<329, (outs), (ins ID:$barr, ID:$mem, ID:$sem),
666                  "OpMemoryNamedBarrier $barr $mem $sem">;
667
668// 3.42.21. Group and Subgroup Instructions
669
670def OpGroupAsyncCopy: Op<259, (outs ID:$res), (ins TYPE:$ty, ID:$scope,
671                  ID:$dst, ID:$src, ID:$nelts, ID:$stride, ID:$event),
672                  "$res = OpGroupAsyncCopy $ty $scope $dst $src $nelts $stride $event">;
673def OpGroupWaitEvents: Op<260, (outs), (ins ID:$scope, ID:$nelts, ID:$elist),
674                  "OpGroupWaitEvents $scope $nelts $elist">;
675def OpGroupAll: Op<261, (outs ID:$res), (ins TYPE:$ty, ID:$scope, ID:$pr),
676                  "$res = OpGroupAll $ty $scope $pr">;
677def OpGroupAny: Op<262, (outs ID:$res), (ins TYPE:$ty, ID:$scope, ID:$pr),
678                  "$res = OpGroupAny $ty $scope $pr">;
679def OpGroupBroadcast: Op<263, (outs ID:$res), (ins TYPE:$ty, ID:$scope,
680                               ID:$val, ID:$id),
681                  "$res = OpGroupBroadcast $ty $scope $val $id">;
682class OpGroup<string name, bits<16> opCode>: Op<opCode, (outs ID:$res),
683                  (ins TYPE:$ty, ID:$scope, GroupOperation:$groupOp, ID:$x),
684                  "$res = OpGroup"#name#" $ty $scope $groupOp $x">;
685def OpGroupIAdd: OpGroup<"IAdd", 264>;
686def OpGroupFAdd: OpGroup<"FAdd", 265>;
687def OpGroupFMin: OpGroup<"FMin", 266>;
688def OpGroupUMin: OpGroup<"UMin", 267>;
689def OpGroupSMin: OpGroup<"SMin", 268>;
690def OpGroupFMax: OpGroup<"FMax", 269>;
691def OpGroupUMax: OpGroup<"UMax", 270>;
692def OpGroupSMax: OpGroup<"SMax", 271>;
693
694// TODO: 3.42.22. Device-Side Enqueue Instructions
695def OpEnqueueKernel: Op<292, (outs ID:$res), (ins TYPE:$type, ID:$queue, ID:$flags, ID:$NDR, ID:$nevents, ID:$wevents,
696                                              ID:$revent, ID:$invoke, ID:$param, ID:$psize, ID:$palign, variable_ops),
697                  "$res = OpEnqueueKernel $type $queue $flags $NDR $nevents $wevents $revent $invoke $param $psize $palign">;
698def OpRetainEvent: Op<297, (outs), (ins ID:$event), "OpRetainEvent $event">;
699def OpReleaseEvent: Op<298, (outs), (ins ID:$event), "OpReleaseEvent $event">;
700def OpCreateUserEvent: Op<299, (outs ID:$res), (ins TYPE:$type),
701                  "$res = OpCreateUserEvent $type">;
702def OpIsValidEvent: Op<300, (outs ID:$res), (ins TYPE:$type, ID:$event),
703                  "$res = OpIsValidEvent $type $event ">;
704def OpSetUserEventStatus: Op<301, (outs), (ins ID:$event, ID:$status),
705                  "OpSetUserEventStatus $event $status">;
706def OpCaptureEventProfilingInfo: Op<302, (outs),
707                  (ins ID:$event, ID:$info, ID:$value),
708                  "OpCaptureEventProfilingInfo $event $info $value">;
709def OpGetDefaultQueue: Op<303, (outs ID:$res), (ins TYPE:$type),
710                  "$res = OpGetDefaultQueue $type">;
711def OpBuildNDRange: Op<304, (outs ID:$res), (ins TYPE:$type, ID:$GWS, ID:$LWS, ID:$GWO),
712                  "$res = OpBuildNDRange $type $GWS $LWS $GWO">;
713
714// TODO: 3.42.23. Pipe Instructions
715
716// 3.42.24. Non-Uniform Instructions
717
718def OpGroupNonUniformElect: Op<333, (outs ID:$res), (ins TYPE:$ty, ID:$scope),
719                  "$res = OpGroupNonUniformElect $ty $scope">;
720class OpGroupNU3<string name, bits<16> opCode>: Op<opCode,
721                  (outs ID:$res), (ins TYPE:$ty, ID:$scope, ID:$pred),
722                  "$res = OpGroupNonUniform"#name#" $ty $scope $pred">;
723class OpGroupNU4<string name, bits<16> opCode>: Op<opCode,
724                  (outs ID:$res), (ins TYPE:$ty, ID:$scope, ID:$val, ID:$id),
725                  "$res = OpGroupNonUniform"#name#" $ty $scope $val $id">;
726def OpGroupNonUniformAll: OpGroupNU3<"All", 334>;
727def OpGroupNonUniformAny: OpGroupNU3<"Any", 335>;
728def OpGroupNonUniformAllEqual: OpGroupNU3<"AllEqual", 336>;
729def OpGroupNonUniformBroadcast: OpGroupNU4<"Broadcast", 337>;
730def OpGroupNonUniformBroadcastFirst: OpGroupNU3<"BroadcastFirst", 338>;
731def OpGroupNonUniformBallot: OpGroupNU3<"Ballot", 339>;
732def OpGroupNonUniformInverseBallot: OpGroupNU3<"InverseBallot", 340>;
733def OpGroupNonUniformBallotBitExtract: OpGroupNU4<"BallotBitExtract", 341>;
734def OpGroupNonUniformBallotBitCount: Op<342, (outs ID:$res),
735                  (ins TYPE:$ty, ID:$scope, GroupOperation:$groupOp, ID:$val),
736                  "$res = OpGroupNonUniformBallotBitCount "
737                          "$ty $scope $groupOp $val">;
738def OpGroupNonUniformBallotFindLSB: OpGroupNU3<"BallotFindLSB", 343>;
739def OpGroupNonUniformBallotFindMSB: OpGroupNU3<"BallotFindMSB", 344>;
740def OpGroupNonUniformShuffle: OpGroupNU4<"Shuffle", 345>;
741def OpGroupNonUniformShuffleXor: OpGroupNU4<"ShuffleXor", 346>;
742def OpGroupNonUniformShuffleUp: OpGroupNU4<"ShuffleUp", 347>;
743def OpGroupNonUniformShuffleDown: OpGroupNU4<"ShuffleDown", 348>;
744class OpGroupNUGroup<string name, bits<16> opCode>: Op<opCode, (outs ID:$res),
745                  (ins TYPE:$ty, ID:$scope, GroupOperation:$groupOp,
746                   ID:$val, variable_ops),
747                  "$res = OpGroupNonUniform"#name#" $ty $scope $groupOp $val">;
748def OpGroupNonUniformIAdd: OpGroupNUGroup<"IAdd", 349>;
749def OpGroupNonUniformFAdd: OpGroupNUGroup<"FAdd", 350>;
750def OpGroupNonUniformIMul: OpGroupNUGroup<"IMul", 351>;
751def OpGroupNonUniformFMul: OpGroupNUGroup<"FMul", 352>;
752def OpGroupNonUniformSMin: OpGroupNUGroup<"SMin", 353>;
753def OpGroupNonUniformUMin: OpGroupNUGroup<"UMin", 354>;
754def OpGroupNonUniformFMin: OpGroupNUGroup<"FMin", 355>;
755def OpGroupNonUniformSMax: OpGroupNUGroup<"SMax", 356>;
756def OpGroupNonUniformUMax: OpGroupNUGroup<"UMax", 357>;
757def OpGroupNonUniformFMax: OpGroupNUGroup<"FMax", 358>;
758def OpGroupNonUniformBitwiseAnd: OpGroupNUGroup<"BitwiseAnd", 359>;
759def OpGroupNonUniformBitwiseOr: OpGroupNUGroup<"BitwiseOr", 360>;
760def OpGroupNonUniformBitwiseXor: OpGroupNUGroup<"BitwiseXor", 361>;
761def OpGroupNonUniformLogicalAnd: OpGroupNUGroup<"LogicalAnd", 362>;
762def OpGroupNonUniformLogicalOr: OpGroupNUGroup<"LogicalOr", 363>;
763def OpGroupNonUniformLogicalXor: OpGroupNUGroup<"LogicalXor", 364>;
764