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