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 ID:$dst_id), (ins ID:$src_id, TYPE:$src_ty)>; 19 def DECL_TYPE: Pseudo<(outs ID:$dst_id), (ins ID:$src_id, TYPE:$src_ty)>; 20 def GET_ID: Pseudo<(outs iID:$dst_id), (ins iID:$src)>; 21 def GET_fID: Pseudo<(outs fID:$dst_id), (ins fID:$src)>; 22 def GET_pID: Pseudo<(outs pID:$dst_id), (ins pID:$src)>; 23 def GET_vID: Pseudo<(outs vID:$dst_id), (ins vID:$src)>; 24 def GET_vfID: Pseudo<(outs vfID:$dst_id), (ins vfID:$src)>; 25 def GET_vpID: Pseudo<(outs vpID:$dst_id), (ins vpID:$src)>; 26} 27 28def SPVTypeBin : SDTypeProfile<1, 2, []>; 29 30def assigntype : SDNode<"SPIRVISD::AssignType", SPVTypeBin>; 31 32def : GINodeEquiv<ASSIGN_TYPE, assigntype>; 33 34class BinOp<string name, bits<16> opCode, list<dag> pattern=[]> 35 : Op<opCode, (outs ID:$dst), (ins TYPE:$src_ty, ID:$src, ID:$src2), 36 "$dst = "#name#" $src_ty $src $src2", pattern>; 37 38class BinOpTyped<string name, bits<16> opCode, RegisterClass CID, SDNode node> 39 : Op<opCode, (outs CID:$dst), (ins TYPE:$src_ty, CID:$src, CID:$src2), 40 "$dst = "#name#" $src_ty $src $src2", 41 [(set CID:$dst, (assigntype (node CID:$src, CID:$src2), TYPE:$src_ty))]>; 42 43class TernOpTyped<string name, bits<16> opCode, RegisterClass CCond, RegisterClass CID, SDNode node> 44 : Op<opCode, (outs CID:$dst), (ins TYPE:$src_ty, CCond:$cond, CID:$src1, CID:$src2), 45 "$dst = "#name#" $src_ty $cond $src1 $src2", 46 [(set CID:$dst, (assigntype (node CCond:$cond, CID:$src1, CID:$src2), TYPE:$src_ty))]>; 47 48multiclass BinOpTypedGen<string name, bits<16> opCode, SDNode node, bit genF = 0, bit genV = 0> { 49 if genF then 50 def S: BinOpTyped<name, opCode, fID, node>; 51 else 52 def S: BinOpTyped<name, opCode, iID, node>; 53 if genV then { 54 if genF then 55 def V: BinOpTyped<name, opCode, vfID, node>; 56 else 57 def V: BinOpTyped<name, opCode, vID, node>; 58 } 59} 60 61multiclass TernOpTypedGen<string name, bits<16> opCode, SDNode node, bit genP = 1, bit genI = 1, bit genF = 0, bit genV = 0> { 62 if genP then { 63 def SPSCond: TernOpTyped<name, opCode, iID, pID, node>; 64 def SPVCond: TernOpTyped<name, opCode, vID, pID, node>; 65 } 66 if genI then { 67 def SISCond: TernOpTyped<name, opCode, iID, iID, node>; 68 def SIVCond: TernOpTyped<name, opCode, vID, iID, node>; 69 } 70 if genF then { 71 def SFSCond: TernOpTyped<name, opCode, iID, fID, node>; 72 def SFVCond: TernOpTyped<name, opCode, vID, fID, node>; 73 } 74 if genV then { 75 if genP then { 76 def VPSCond: TernOpTyped<name, opCode, iID, vpID, node>; 77 def VPVCond: TernOpTyped<name, opCode, vID, vpID, node>; 78 } 79 if genI then { 80 def VISCond: TernOpTyped<name, opCode, iID, vID, node>; 81 def VIVCond: TernOpTyped<name, opCode, vID, vID, node>; 82 } 83 if genF then { 84 def VFSCond: TernOpTyped<name, opCode, iID, vfID, node>; 85 def VFVCond: TernOpTyped<name, opCode, vID, vfID, node>; 86 } 87 } 88} 89 90class UnOp<string name, bits<16> opCode, list<dag> pattern=[]> 91 : Op<opCode, (outs ID:$dst), (ins TYPE:$type, ID:$src), 92 "$dst = "#name#" $type $src", pattern>; 93class UnOpTyped<string name, bits<16> opCode, RegisterClass CID, SDNode node> 94 : Op<opCode, (outs CID:$dst), (ins TYPE:$src_ty, CID:$src), 95 "$dst = "#name#" $src_ty $src", [(set CID:$dst, (assigntype (node CID:$src), TYPE:$src_ty))]>; 96 97class SimpleOp<string name, bits<16> opCode>: Op<opCode, (outs), (ins), name>; 98 99// 3.42.1 Miscellaneous Instructions 100 101def OpNop: SimpleOp<"OpNop", 0>; 102def OpUndef: Op<1, (outs ID:$res), (ins TYPE:$type), "$res = OpUndef $type">; 103def OpSizeOf: Op<321, (outs ID:$res), (ins TYPE:$ty, ID:$ptr), "$res = OpSizeOf $ty $ptr">; 104 105// - SPV_KHR_expect_assume : Expect assume instructions 106def OpAssumeTrueKHR: Op<5630, (outs), (ins ID:$cond), "OpAssumeTrueKHR $cond">; 107def OpExpectKHR: Op<5631, (outs ID:$res), (ins TYPE:$ty, ID:$val, ID:$expected), "$res = OpExpectKHR $ty $val $expected">; 108 109// 3.42.2 Debug Instructions 110 111def OpSourceContinued: Op<2, (outs), (ins StringImm:$str, variable_ops), 112 "OpSourceContinued $str">; 113def OpSource: Op<3, (outs), (ins SourceLanguage:$lang, i32imm:$version, variable_ops), 114 "OpSource $lang $version">; 115def OpSourceExtension: Op<4, (outs), (ins StringImm:$extension, variable_ops), 116 "OpSourceExtension $extension">; 117def OpName: Op<5, (outs), (ins ANY:$tar, StringImm:$name, variable_ops), "OpName $tar $name">; 118def OpMemberName: Op<6, (outs), (ins TYPE:$ty, i32imm:$mem, StringImm:$name, variable_ops), 119 "OpMemberName $ty $mem $name">; 120def OpString: Op<7, (outs ID:$r), (ins StringImm:$s, variable_ops), "$r = OpString $s">; 121def OpLine: Op<8, (outs), (ins ID:$file, i32imm:$ln, i32imm:$col), "OpLine $file $ln $col">; 122def OpNoLine: Op<317, (outs), (ins), "OpNoLine">; 123def OpModuleProcessed: Op<330, (outs), (ins StringImm:$process, variable_ops), 124 "OpModuleProcessed $process">; 125 126// 3.42.3 Annotation Instructions 127 128def OpDecorate: Op<71, (outs), (ins ANY:$target, Decoration:$dec, variable_ops), 129 "OpDecorate $target $dec">; 130def OpMemberDecorate: Op<72, (outs), (ins TYPE:$t, i32imm:$m, Decoration:$d, variable_ops), 131 "OpMemberDecorate $t $m $d">; 132 133// TODO Currently some deprecated opcodes are missing: OpDecorationGroup, 134// OpGroupDecorate and OpGroupMemberDecorate 135 136def OpDecorateId: Op<332, (outs), (ins ANY:$target, Decoration:$dec, variable_ops), 137 "OpDecorateId $target $dec">; 138def OpDecorateString: Op<5632, (outs), (ins ANY:$t, Decoration:$d, StringImm:$s, variable_ops), 139 "OpDecorateString $t $d $s">; 140def OpMemberDecorateString: Op<5633, (outs), 141 (ins TYPE:$ty, i32imm:$mem, Decoration:$dec, StringImm:$str, variable_ops), 142 "OpMemberDecorateString $ty $mem $dec $str">; 143 144// 3.42.4 Extension Instructions 145 146def OpExtension: Op<10, (outs), (ins StringImm:$name, variable_ops), "OpExtension $name">; 147def OpExtInstImport: Op<11, (outs ID:$res), (ins StringImm:$extInstsName, variable_ops), 148 "$res = OpExtInstImport $extInstsName">; 149// $set should have been a register by the SPIR-V specification, 150// however, OpExtInst and OpExtInstImport get its own special case treatment 151// after instruction selection, so `i32imm` is the correct definition from the 152// perspective of the instruction selection pass 153def OpExtInst: Op<12, (outs ID:$res), (ins TYPE:$ty, i32imm:$set, Extension:$inst, variable_ops), 154 "$res = OpExtInst $ty $set $inst">; 155// 3.42.5 Mode-Setting Instructions 156 157def OpMemoryModel: Op<14, (outs), (ins AddressingModel:$addr, MemoryModel:$mem), 158 "OpMemoryModel $addr $mem">; 159def OpEntryPoint: Op<15, (outs), 160 (ins ExecutionModel:$model, ID:$entry, StringImm:$name, variable_ops), 161 "OpEntryPoint $model $entry $name">; 162def OpExecutionMode: Op<16, (outs), (ins ID:$entry, ExecutionMode:$mode, variable_ops), 163 "OpExecutionMode $entry $mode">; 164def OpCapability: Op<17, (outs), (ins Capability:$cap), "OpCapability $cap">; 165def OpExecutionModeId: Op<331, (outs), (ins ID:$entry, ExecutionMode:$mode, variable_ops), 166 "OpExecutionModeId $entry $mode">; 167 168// 3.42.6 Type-Declaration Instructions 169 170def OpTypeVoid: Op<19, (outs TYPE:$type), (ins), "$type = OpTypeVoid">; 171def OpTypeBool: Op<20, (outs TYPE:$type), (ins), "$type = OpTypeBool">; 172def OpTypeInt: Op<21, (outs TYPE:$type), (ins i32imm:$width, i32imm:$signedness), 173 "$type = OpTypeInt $width $signedness">; 174def OpTypeFloat: Op<22, (outs TYPE:$type), (ins i32imm:$width), 175 "$type = OpTypeFloat $width">; 176def OpTypeVector: Op<23, (outs TYPE:$type), (ins TYPE:$compType, i32imm:$compCount), 177 "$type = OpTypeVector $compType $compCount">; 178def OpTypeMatrix: Op<24, (outs TYPE:$type), (ins TYPE:$colType, i32imm:$colCount), 179 "$type = OpTypeMatrix $colType $colCount">; 180def OpTypeImage: Op<25, (outs TYPE:$res), (ins TYPE:$sampTy, Dim:$dim, i32imm:$depth, 181 i32imm:$arrayed, i32imm:$MS, i32imm:$sampled, ImageFormat:$imFormat, variable_ops), 182 "$res = OpTypeImage $sampTy $dim $depth $arrayed $MS $sampled $imFormat">; 183def OpTypeSampler: Op<26, (outs TYPE:$res), (ins), "$res = OpTypeSampler">; 184def OpTypeSampledImage: Op<27, (outs TYPE:$res), (ins TYPE:$imageType), 185 "$res = OpTypeSampledImage $imageType">; 186def OpTypeArray: Op<28, (outs TYPE:$type), (ins TYPE:$elementType, ID:$length), 187 "$type = OpTypeArray $elementType $length">; 188def OpTypeRuntimeArray: Op<29, (outs TYPE:$type), (ins TYPE:$elementType), 189 "$type = OpTypeRuntimeArray $elementType">; 190def OpTypeStruct: Op<30, (outs TYPE:$res), (ins variable_ops), "$res = OpTypeStruct">; 191def OpTypeOpaque: Op<31, (outs TYPE:$res), (ins StringImm:$name, variable_ops), 192 "$res = OpTypeOpaque $name">; 193def OpTypePointer: Op<32, (outs TYPE:$res), (ins StorageClass:$storage, TYPE:$type), 194 "$res = OpTypePointer $storage $type">; 195def OpTypeFunction: Op<33, (outs TYPE:$funcType), (ins TYPE:$returnType, variable_ops), 196 "$funcType = OpTypeFunction $returnType">; 197def OpTypeEvent: Op<34, (outs TYPE:$res), (ins), "$res = OpTypeEvent">; 198def OpTypeDeviceEvent: Op<35, (outs TYPE:$res), (ins), "$res = OpTypeDeviceEvent">; 199def OpTypeReserveId: Op<36, (outs TYPE:$res), (ins), "$res = OpTypeReserveId">; 200def OpTypeQueue: Op<37, (outs TYPE:$res), (ins), "$res = OpTypeQueue">; 201def OpTypePipe: Op<38, (outs TYPE:$res), (ins AccessQualifier:$a), "$res = OpTypePipe $a">; 202def OpTypeForwardPointer: Op<39, (outs), (ins TYPE:$ptrType, StorageClass:$storageClass), 203 "OpTypeForwardPointer $ptrType $storageClass">; 204def OpTypePipeStorage: Op<322, (outs TYPE:$res), (ins), "$res = OpTypePipeStorage">; 205def OpTypeNamedBarrier: Op<327, (outs TYPE:$res), (ins), "$res = OpTypeNamedBarrier">; 206def OpTypeAccelerationStructureNV: Op<5341, (outs TYPE:$res), (ins), 207 "$res = OpTypeAccelerationStructureNV">; 208def OpTypeCooperativeMatrixNV: Op<5358, (outs TYPE:$res), 209 (ins TYPE:$compType, ID:$scope, ID:$rows, ID:$cols), 210 "$res = OpTypeCooperativeMatrixNV $compType $scope $rows $cols">; 211def OpTypeCooperativeMatrixKHR: Op<4456, (outs TYPE:$res), 212 (ins TYPE:$compType, ID:$scope, ID:$rows, ID:$cols, ID:$use), 213 "$res = OpTypeCooperativeMatrixKHR $compType $scope $rows $cols $use">; 214 215// 3.42.7 Constant-Creation Instructions 216 217def imm_to_i32 : SDNodeXForm<imm, [{ 218return CurDAG->getTargetConstant( 219 N->getValueAP().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i32); 220}]>; 221 222def fimm_to_i64 : SDNodeXForm<imm, [{ 223return CurDAG->getTargetConstant( 224 N->getValueAPF().bitcastToAPInt().getZExtValue(), SDLoc(N), MVT::i64); 225}]>; 226 227def gi_bitcast_fimm_to_i64 : GICustomOperandRenderer<"renderFImm64">, 228 GISDNodeXFormEquiv<fimm_to_i64>; 229 230def gi_bitcast_imm_to_i32 : GICustomOperandRenderer<"renderImm32">, 231 GISDNodeXFormEquiv<imm_to_i32>; 232 233def PseudoConstI: IntImmLeaf<i64, [{ return Imm.getBitWidth() <= 32; }], imm_to_i32>; 234def PseudoConstF: FPImmLeaf<f64, [{ return true; }], fimm_to_i64>; 235def ConstPseudoTrue: IntImmLeaf<i64, [{ return Imm.getBitWidth() == 1 && Imm.getZExtValue() == 1; }]>; 236def ConstPseudoFalse: IntImmLeaf<i64, [{ return Imm.getBitWidth() == 1 && Imm.getZExtValue() == 0; }]>; 237def ConstPseudoNull: IntImmLeaf<i64, [{ return Imm.isZero(); }]>; 238 239multiclass IntFPImm<bits<16> opCode, string name> { 240 def I: Op<opCode, (outs iID:$dst), (ins TYPE:$type, iID:$src, variable_ops), 241 "$dst = "#name#" $type", [(set iID:$dst, (assigntype PseudoConstI:$src, TYPE:$type))]>; 242 def F: Op<opCode, (outs fID:$dst), (ins TYPE:$type, fID:$src, variable_ops), 243 "$dst = "#name#" $type", [(set fID:$dst, (assigntype PseudoConstF:$src, TYPE:$type))]>; 244} 245 246def OpConstantTrue: Op<41, (outs iID:$dst), (ins TYPE:$src_ty), "$dst = OpConstantTrue $src_ty", 247 [(set iID:$dst, (assigntype ConstPseudoTrue, TYPE:$src_ty))]>; 248def OpConstantFalse: Op<42, (outs iID:$dst), (ins TYPE:$src_ty), "$dst = OpConstantFalse $src_ty", 249 [(set iID:$dst, (assigntype ConstPseudoFalse, TYPE:$src_ty))]>; 250 251defm OpConstant: IntFPImm<43, "OpConstant">; 252 253def OpConstantComposite: Op<44, (outs ID:$res), (ins TYPE:$type, variable_ops), 254 "$res = OpConstantComposite $type">; 255def OpConstantSampler: Op<45, (outs ID:$res), 256 (ins TYPE:$t, SamplerAddressingMode:$s, i32imm:$p, SamplerFilterMode:$f), 257 "$res = OpConstantSampler $t $s $p $f">; 258def OpConstantNull: Op<46, (outs ID:$dst), (ins TYPE:$src_ty), "$dst = OpConstantNull $src_ty">; 259 260def OpSpecConstantTrue: Op<48, (outs ID:$r), (ins TYPE:$t), "$r = OpSpecConstantTrue $t">; 261def OpSpecConstantFalse: Op<49, (outs ID:$r), (ins TYPE:$t), "$r = OpSpecConstantFalse $t">; 262def OpSpecConstant: Op<50, (outs ID:$res), (ins TYPE:$type, i32imm:$imm, variable_ops), 263 "$res = OpSpecConstant $type $imm">; 264def OpSpecConstantComposite: Op<51, (outs ID:$res), (ins TYPE:$type, variable_ops), 265 "$res = OpSpecConstantComposite $type">; 266def OpSpecConstantOp: Op<52, (outs ID:$res), (ins TYPE:$t, i32imm:$c, ID:$o, variable_ops), 267 "$res = OpSpecConstantOp $t $c $o">; 268 269// 3.42.8 Memory Instructions 270 271def OpVariable: Op<59, (outs ID:$res), (ins TYPE:$type, StorageClass:$sc, variable_ops), 272 "$res = OpVariable $type $sc">; 273def OpImageTexelPointer: Op<60, (outs ID:$res), 274 (ins TYPE:$resType, ID:$image, ID:$coord, ID:$sample), 275 "$res = OpImageTexelPointer $resType $image $coord $sample">; 276def OpLoad: Op<61, (outs ID:$res), (ins TYPE:$resType, ID:$pointer, variable_ops), 277 "$res = OpLoad $resType $pointer">; 278def OpStore: Op<62, (outs), (ins ID:$pointer, ID:$objectToStore, variable_ops), 279 "OpStore $pointer $objectToStore">; 280def OpCopyMemory: Op<63, (outs), (ins ID:$dest, ID:$src, variable_ops), 281 "OpCopyMemory $dest $src">; 282def OpCopyMemorySized: Op<64, (outs), (ins ID:$dest, ID:$src, ID:$size, variable_ops), 283 "OpCopyMemorySized $dest $src $size">; 284def OpAccessChain: Op<65, (outs ID:$res), (ins TYPE:$type, ID:$base, variable_ops), 285 "$res = OpAccessChain $type $base">; 286def OpInBoundsAccessChain: Op<66, (outs ID:$res), 287 (ins TYPE:$type, ID:$base, variable_ops), 288 "$res = OpInBoundsAccessChain $type $base">; 289def OpPtrAccessChain: Op<67, (outs ID:$res), 290 (ins TYPE:$type, ID:$base, ID:$element, variable_ops), 291 "$res = OpPtrAccessChain $type $base $element">; 292def OpArrayLength: Op<68, (outs ID:$res), (ins TYPE:$resTy, ID:$struct, i32imm:$arrayMember), 293 "$res = OpArrayLength $resTy $struct $arrayMember">; 294def OpGenericPtrMemSemantics: Op<69, (outs ID:$res), (ins TYPE:$resType, ID:$pointer), 295 "$res = OpGenericPtrMemSemantics $resType $pointer">; 296def OpInBoundsPtrAccessChain: Op<70, (outs ID:$res), 297 (ins TYPE:$type, ID:$base, ID:$element, variable_ops), 298 "$res = OpInBoundsPtrAccessChain $type $base $element">; 299def OpPtrEqual: Op<401, (outs ID:$res), (ins TYPE:$resType, ID:$a, ID:$b), 300 "$res = OpPtrEqual $resType $a $b">; 301def OpPtrNotEqual: Op<402, (outs ID:$res), (ins TYPE:$resType, ID:$a, ID:$b), 302 "$res = OpPtrNotEqual $resType $a $b">; 303def OpPtrDiff: Op<403, (outs ID:$res), (ins TYPE:$resType, ID:$a, ID:$b), 304 "$res = OpPtrDiff $resType $a $b">; 305 306// - SPV_INTEL_variable_length_array 307 308def OpVariableLengthArrayINTEL: Op<5818, (outs ID:$res), (ins TYPE:$type, ID:$length), 309 "$res = OpVariableLengthArrayINTEL $type $length">; 310def OpSaveMemoryINTEL: Op<5819, (outs ID:$res), (ins TYPE:$type), 311 "$res = OpSaveMemoryINTEL $type">; 312def OpRestoreMemoryINTEL: Op<5820, (outs), (ins ID:$ptr), 313 "OpRestoreMemoryINTEL $ptr">; 314 315// 3.42.9 Function Instructions 316 317def OpFunction: Op<54, (outs ID:$func), 318 (ins TYPE:$resType, FunctionControl:$funcControl, TYPE:$funcType), 319 "$func = OpFunction $resType $funcControl $funcType">; 320def OpFunctionParameter: Op<55, (outs ID:$arg), (ins TYPE:$type), 321 "$arg = OpFunctionParameter $type">; 322def OpFunctionEnd: Op<56, (outs), (ins), "OpFunctionEnd"> { 323 let isTerminator=1; 324} 325def OpFunctionCall: Op<57, (outs ID:$res), (ins TYPE:$resType, ID:$function, variable_ops), 326 "$res = OpFunctionCall $resType $function">; 327 328// 3.42.10 Image Instructions 329 330def OpSampledImage: BinOp<"OpSampledImage", 86>; 331 332def OpImageSampleImplicitLod: Op<87, (outs ID:$res), 333 (ins TYPE:$type, ID:$sampledImage, ID:$coord, variable_ops), 334 "$res = OpImageSampleImplicitLod $type $sampledImage $coord">; 335def OpImageSampleExplicitLod: Op<88, (outs ID:$res), 336 (ins TYPE:$ty, ID:$sImage, ID:$uv, ImageOperand:$op, ID:$i, variable_ops), 337 "$res = OpImageSampleExplicitLod $ty $sImage $uv $op $i">; 338 339def OpImageSampleDrefImplicitLod: Op<89, (outs ID:$res), 340 (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$dref, variable_ops), 341 "$res = OpImageSampleDrefImplicitLod $type $sampledImage $dref $coord">; 342def OpImageSampleDrefExplicitLod: Op<90, (outs ID:$res), 343 (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops), 344 "$res = OpImageSampleDrefExplicitLod $ty $im $uv $d $op $i">; 345 346def OpImageSampleProjImplicitLod: Op<91, (outs ID:$res), 347 (ins TYPE:$type, ID:$sampledImage, ID:$coord, variable_ops), 348 "$res = OpImageSampleProjImplicitLod $type $sampledImage $coord">; 349def OpImageSampleProjExplicitLod: Op<92, (outs ID:$res), 350 (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops), 351 "$res = OpImageSampleProjExplicitLod $ty $im $uv $op $i">; 352 353def OpImageSampleProjDrefImplicitLod: Op<93, (outs ID:$res), 354 (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$dref, variable_ops), 355 "$res = OpImageSampleProjDrefImplicitLod $type $sampledImage $dref $coord">; 356def OpImageSampleProjDrefExplicitLod: Op<94, (outs ID:$res), 357 (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops), 358 "$res = OpImageSampleProjDrefExplicitLod $ty $im $uv $d $op $i">; 359 360def OpImageFetch: Op<95, (outs ID:$res), 361 (ins TYPE:$type, ID:$image, ID:$coord, variable_ops), 362 "$res = OpImageFetch $type $image $coord">; 363def OpImageGather: Op<96, (outs ID:$res), 364 (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$component, variable_ops), 365 "$res = OpImageGather $type $sampledImage $coord $component">; 366def OpImageDrefGather: Op<97, (outs ID:$res), 367 (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$dref, variable_ops), 368 "$res = OpImageDrefGather $type $sampledImage $coord $dref">; 369 370def OpImageRead: Op<98, (outs ID:$res), 371 (ins TYPE:$type, ID:$image, ID:$coord, variable_ops), 372 "$res = OpImageRead $type $image $coord">; 373def OpImageWrite: Op<99, (outs), (ins ID:$image, ID:$coord, ID:$texel, variable_ops), 374 "OpImageWrite $image $coord $texel">; 375 376def OpImage: UnOp<"OpImage", 100>; 377def OpImageQueryFormat: UnOp<"OpImageQueryFormat", 101>; 378def OpImageQueryOrder: UnOp<"OpImageQueryOrder", 102>; 379def OpImageQuerySizeLod: BinOp<"OpImageQuerySizeLod", 103>; 380def OpImageQuerySize: UnOp<"OpImageQuerySize", 104>; 381def OpImageQueryLod: BinOp<"OpImageQueryLod", 105>; 382def OpImageQueryLevels: UnOp<"OpImageQueryLevels", 106>; 383def OpImageQuerySamples: UnOp<"OpImageQuerySamples", 107>; 384 385def OpImageSparseSampleImplicitLod: Op<305, (outs ID:$res), 386 (ins TYPE:$type, ID:$sampledImage, ID:$coord, variable_ops), 387 "$res = OpImageSparseSampleImplicitLod $type $sampledImage $coord">; 388def OpImageSparseSampleExplicitLod: Op<306, (outs ID:$res), 389 (ins TYPE:$ty, ID:$sImage, ID:$uv, ImageOperand:$op, ID:$i, variable_ops), 390 "$res = OpImageSparseSampleExplicitLod $ty $sImage $uv $op $i">; 391 392def OpImageSparseSampleDrefImplicitLod: Op<307, (outs ID:$res), 393 (ins TYPE:$type, ID:$sampledImg, ID:$coord, ID:$dref, variable_ops), 394 "$res = OpImageSparseSampleDrefImplicitLod $type $sampledImg $dref $coord">; 395def OpImageSparseSampleDrefExplicitLod: Op<308, (outs ID:$res), 396 (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops), 397 "$res = OpImageSparseSampleDrefExplicitLod $ty $im $uv $d $op $i">; 398 399def OpImageSparseSampleProjImplicitLod: Op<309, (outs ID:$res), 400 (ins TYPE:$type, ID:$sampledImage, ID:$coord, variable_ops), 401 "$res = OpImageSparseSampleProjImplicitLod $type $sampledImage $coord">; 402def OpImageSparseSampleProjExplicitLod: Op<310, (outs ID:$res), 403 (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops), 404 "$res = OpImageSparseSampleProjExplicitLod $ty $im $uv $op $i">; 405 406def OpImageSparseSampleProjDrefImplicitLod: Op<311, (outs ID:$res), 407 (ins TYPE:$type, ID:$sImage, ID:$coord, ID:$dref, variable_ops), 408 "$res = OpImageSparseSampleProjDrefImplicitLod $type $sImage $dref $coord">; 409def OpImageSparseSampleProjDrefExplicitLod: Op<312, (outs ID:$res), 410 (ins TYPE:$ty, ID:$im, ID:$uv, ID:$d, ImageOperand:$op, ID:$i, variable_ops), 411 "$res = OpImageSparseSampleProjDrefExplicitLod $ty $im $uv $d $op $i">; 412 413def OpImageSparseFetch: Op<313, (outs ID:$res), 414 (ins TYPE:$type, ID:$image, ID:$coord, variable_ops), 415 "$res = OpImageSparseFetch $type $image $coord">; 416def OpImageSparseGather: Op<314, (outs ID:$res), 417 (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$component, variable_ops), 418 "$res = OpImageSparseGather $type $sampledImage $coord $component">; 419def OpImageSparseDrefGather: Op<315, (outs ID:$res), 420 (ins TYPE:$type, ID:$sampledImage, ID:$coord, ID:$dref, variable_ops), 421 "$res = OpImageSparseDrefGather $type $sampledImage $coord $dref">; 422 423def OpImageSparseTexelsResident: UnOp<"OpImageSparseTexelsResident", 316>; 424 425def OpImageSparseRead: Op<320, (outs ID:$res), 426 (ins TYPE:$type, ID:$image, ID:$coord, variable_ops), 427 "$res = OpImageSparseRead $type $image $coord">; 428 429def OpImageSampleFootprintNV: Op<5283, (outs ID:$res), 430 (ins TYPE:$ty, ID:$sImg, ID:$uv, ID:$granularity, ID:$coarse, variable_ops), 431 "$res = OpImageSampleFootprintNV $ty $sImg $uv $granularity $coarse">; 432 433// 3.42.11 Conversion instructions 434 435def OpConvertFToU : UnOp<"OpConvertFToU", 109>; 436def OpConvertFToS : UnOp<"OpConvertFToS", 110>; 437def OpConvertSToF : UnOp<"OpConvertSToF", 111>; 438def OpConvertUToF : UnOp<"OpConvertUToF", 112>; 439 440def OpUConvert : UnOp<"OpUConvert", 113>; 441def OpSConvert : UnOp<"OpSConvert", 114>; 442def OpFConvert : UnOp<"OpFConvert", 115>; 443 444def OpQuantizeToF16 : UnOp<"OpQuantizeToF16", 116>; 445 446def OpConvertPtrToU : UnOp<"OpConvertPtrToU", 117>; 447 448def OpSatConvertSToU : UnOp<"OpSatConvertSToU", 118>; 449def OpSatConvertUToS : UnOp<"OpSatConvertUToS", 119>; 450 451def OpConvertUToPtr : UnOp<"OpConvertUToPtr", 120>; 452def OpPtrCastToGeneric : UnOp<"OpPtrCastToGeneric", 121>; 453def OpGenericCastToPtr : UnOp<"OpGenericCastToPtr", 122>; 454def OpGenericCastToPtrExplicit : Op<123, (outs ID:$r), (ins TYPE:$t, ID:$p, StorageClass:$s), 455 "$r = OpGenericCastToPtrExplicit $t $p $s">; 456def OpBitcast : UnOp<"OpBitcast", 124>; 457 458// SPV_INTEL_usm_storage_classes 459def OpPtrCastToCrossWorkgroupINTEL : UnOp<"OpPtrCastToCrossWorkgroupINTEL", 5934>; 460def OpCrossWorkgroupCastToPtrINTEL : UnOp<"OpCrossWorkgroupCastToPtrINTEL", 5938>; 461 462// SPV_INTEL_bfloat16_conversion 463def OpConvertFToBF16INTEL : UnOp<"OpConvertFToBF16INTEL", 6116>; 464def OpConvertBF16ToFINTEL : UnOp<"OpConvertBF16ToFINTEL", 6117>; 465 466// 3.42.12 Composite Instructions 467 468//def OpVectorExtractDynamic: Op<77, (outs ID:$res), (ins TYPE:$type, vID:$vec, ID:$idx), 469// "$res = OpVectorExtractDynamic $type $vec $idx", [(set ID:$res, (assigntype (extractelt vID:$vec, ID:$idx), TYPE:$type))]>; 470def OpVectorExtractDynamic: Op<77, (outs ID:$res), (ins TYPE:$type, vID:$vec, ID:$idx), 471 "$res = OpVectorExtractDynamic $type $vec $idx">; 472 473def OpVectorInsertDynamic: Op<78, (outs ID:$res), (ins TYPE:$ty, ID:$vec, ID:$comp, ID:$idx), 474 "$res = OpVectorInsertDynamic $ty $vec $comp $idx">; 475def OpVectorShuffle: Op<79, (outs ID:$res), (ins TYPE:$ty, ID:$v1, ID:$v2, variable_ops), 476 "$res = OpVectorShuffle $ty $v1 $v2">; 477def OpCompositeConstruct: Op<80, (outs ID:$res), (ins TYPE:$type, variable_ops), 478 "$res = OpCompositeConstruct $type">; 479def OpCompositeExtract: Op<81, (outs ID:$res), (ins TYPE:$type, ID:$base, variable_ops), 480 "$res = OpCompositeExtract $type $base">; 481def OpCompositeInsert: Op<82, (outs ID:$r), (ins TYPE:$ty, ID:$obj, ID:$base, variable_ops), 482 "$r = OpCompositeInsert $ty $obj $base">; 483def OpCopyObject: UnOp<"OpCopyObject", 83>; 484def OpTranspose: UnOp<"OpTranspose", 84>; 485def OpCopyLogical: UnOp<"OpCopyLogical", 400>; 486 487// 3.42.13 Arithmetic Instructions 488 489def OpSNegate: UnOp<"OpSNegate", 126>; 490def OpFNegate: UnOpTyped<"OpFNegate", 127, fID, fneg>; 491def OpFNegateV: UnOpTyped<"OpFNegate", 127, vfID, fneg>; 492defm OpIAdd: BinOpTypedGen<"OpIAdd", 128, add, 0, 1>; 493defm OpFAdd: BinOpTypedGen<"OpFAdd", 129, fadd, 1, 1>; 494defm OpStrictFAdd: BinOpTypedGen<"OpFAdd", 129, strict_fadd, 1, 1>; 495 496defm OpISub: BinOpTypedGen<"OpISub", 130, sub, 0, 1>; 497defm OpFSub: BinOpTypedGen<"OpFSub", 131, fsub, 1, 1>; 498defm OpStrictFSub: BinOpTypedGen<"OpFSub", 131, strict_fsub, 1, 1>; 499 500defm OpIMul: BinOpTypedGen<"OpIMul", 132, mul, 0, 1>; 501defm OpFMul: BinOpTypedGen<"OpFMul", 133, fmul, 1, 1>; 502defm OpStrictFMul: BinOpTypedGen<"OpFMul", 133, strict_fmul, 1, 1>; 503 504defm OpUDiv: BinOpTypedGen<"OpUDiv", 134, udiv, 0, 1>; 505defm OpSDiv: BinOpTypedGen<"OpSDiv", 135, sdiv, 0, 1>; 506defm OpFDiv: BinOpTypedGen<"OpFDiv", 136, fdiv, 1, 1>; 507defm OpStrictFDiv: BinOpTypedGen<"OpFDiv", 136, strict_fdiv, 1, 1>; 508 509defm OpUMod: BinOpTypedGen<"OpUMod", 137, urem, 0, 1>; 510defm OpSRem: BinOpTypedGen<"OpSRem", 138, srem, 0, 1>; 511 512def OpSMod: BinOp<"OpSMod", 139>; 513 514defm OpFRem: BinOpTypedGen<"OpFRem", 140, frem, 1, 1>; 515defm OpStrictFRem: BinOpTypedGen<"OpFRem", 140, strict_frem, 1, 1>; 516 517def OpFMod: BinOp<"OpFMod", 141>; 518 519def OpVectorTimesScalar: BinOp<"OpVectorTimesScalar", 142>; 520def OpMatrixTimesScalar: BinOp<"OpMatrixTimesScalar", 143>; 521def OpVectorTimesMatrix: BinOp<"OpVectorTimesMatrix", 144>; 522def OpMatrixTimesVector: BinOp<"OpMatrixTimesVector", 145>; 523def OpMatrixTimesMatrix: BinOp<"OpMatrixTimesMatrix", 146>; 524 525def OpOuterProduct: BinOp<"OpOuterProduct", 147>; 526def OpDot: BinOp<"OpDot", 148>; 527 528defm OpIAddCarry: BinOpTypedGen<"OpIAddCarry", 149, addc, 0, 1>; 529defm OpISubBorrow: BinOpTypedGen<"OpISubBorrow", 150, subc, 0, 1>; 530def OpUMulExtended: BinOp<"OpUMulExtended", 151>; 531def OpSMulExtended: BinOp<"OpSMulExtended", 152>; 532 533def OpSDot: BinOp<"OpSDot", 4450>; 534def OpUDot: BinOp<"OpUDot", 4451>; 535 536// 3.42.14 Bit Instructions 537 538defm OpShiftRightLogical: BinOpTypedGen<"OpShiftRightLogical", 194, srl, 0, 1>; 539defm OpShiftRightArithmetic: BinOpTypedGen<"OpShiftRightArithmetic", 195, sra, 0, 1>; 540defm OpShiftLeftLogical: BinOpTypedGen<"OpShiftLeftLogical", 196, shl, 0, 1>; 541 542defm OpBitwiseOr: BinOpTypedGen<"OpBitwiseOr", 197, or, 0, 1>; 543defm OpBitwiseXor: BinOpTypedGen<"OpBitwiseXor", 198, xor, 0, 1>; 544defm OpBitwiseAnd: BinOpTypedGen<"OpBitwiseAnd", 199, and, 0, 1>; 545def OpNot: UnOp<"OpNot", 200>; 546 547def OpBitFieldInsert: Op<201, (outs ID:$res), 548 (ins TYPE:$ty, ID:$base, ID:$insert, ID:$offset, ID:$count), 549 "$res = OpBitFieldInsert $ty $base $insert $offset $count">; 550def OpBitFieldSExtract: Op<202, (outs ID:$res), 551 (ins TYPE:$ty, ID:$base, ID:$offset, ID:$count), 552 "$res = OpBitFieldSExtract $ty $base $offset $count">; 553def OpBitFieldUExtract: Op<203, (outs ID:$res), 554 (ins TYPE:$ty, ID:$base, ID:$offset, ID:$count), 555 "$res = OpBitFieldUExtract $ty $base $offset $count">; 556def OpBitReverse: Op<204, (outs ID:$r), (ins TYPE:$ty, ID:$b), "$r = OpBitReverse $ty $b">; 557def OpBitCount: Op<205, (outs ID:$r), (ins TYPE:$ty, ID:$b), "$r = OpBitCount $ty $b">; 558 559// 3.42.15 Relational and Logical Instructions 560 561def OpAny: Op<154, (outs ID:$res), (ins TYPE:$ty, ID:$vec), 562 "$res = OpAny $ty $vec">; 563def OpAll: Op<155, (outs ID:$res), (ins TYPE:$ty, ID:$vec), 564 "$res = OpAll $ty $vec">; 565 566def OpIsNan: UnOp<"OpIsNan", 156>; 567def OpIsInf: UnOp<"OpIsInf", 157>; 568def OpIsFinite: UnOp<"OpIsFinite", 158>; 569def OpIsNormal: UnOp<"OpIsNormal", 159>; 570def OpSignBitSet: UnOp<"OpSignBitSet", 160>; 571 572def OpLessOrGreater: BinOp<"OpLessOrGreater", 161>; 573def OpOrdered: BinOp<"OpOrdered", 162>; 574def OpUnordered: BinOp<"OpUnordered", 163>; 575 576def OpLogicalEqual: BinOp<"OpLogicalEqual", 164>; 577def OpLogicalNotEqual: BinOp<"OpLogicalNotEqual", 165>; 578def OpLogicalOr: BinOp<"OpLogicalOr", 166>; 579def OpLogicalAnd: BinOp<"OpLogicalAnd", 167>; 580def OpLogicalNot: UnOp<"OpLogicalNot", 168>; 581 582defm OpSelect: TernOpTypedGen<"OpSelect", 169, select, 1, 1, 1, 1>; 583 584def OpIEqual: BinOp<"OpIEqual", 170>; 585def OpINotEqual: BinOp<"OpINotEqual", 171>; 586 587def OpUGreaterThan: BinOp<"OpUGreaterThan", 172>; 588def OpSGreaterThan: BinOp<"OpSGreaterThan", 173>; 589def OpUGreaterThanEqual: BinOp<"OpUGreaterThanEqual", 174>; 590def OpSGreaterThanEqual: BinOp<"OpSGreaterThanEqual", 175>; 591def OpULessThan: BinOp<"OpULessThan", 176>; 592def OpSLessThan: BinOp<"OpSLessThan", 177>; 593def OpULessThanEqual: BinOp<"OpULessThanEqual", 178>; 594def OpSLessThanEqual: BinOp<"OpSLessThanEqual", 179>; 595 596def OpFOrdEqual: BinOp<"OpFOrdEqual", 180>; 597def OpFUnordEqual: BinOp<"OpFUnordEqual", 181>; 598def OpFOrdNotEqual: BinOp<"OpFOrdNotEqual", 182>; 599def OpFUnordNotEqual: BinOp<"OpFUnordNotEqual", 183>; 600 601def OpFOrdLessThan: BinOp<"OpFOrdLessThan", 184>; 602def OpFUnordLessThan: BinOp<"OpFUnordLessThan", 185>; 603def OpFOrdGreaterThan: BinOp<"OpFOrdGreaterThan", 186>; 604def OpFUnordGreaterThan: BinOp<"OpFUnordGreaterThan", 187>; 605 606def OpFOrdLessThanEqual: BinOp<"OpFOrdLessThanEqual", 188>; 607def OpFUnordLessThanEqual: BinOp<"OpFUnordLessThanEqual", 189>; 608def OpFOrdGreaterThanEqual: BinOp<"OpFOrdGreaterThanEqual", 190>; 609def OpFUnordGreaterThanEqual: BinOp<"OpFUnordGreaterThanEqual", 191>; 610 611// 3.42.16 Derivative Instructions 612 613def OpDPdx: UnOp<"OpDPdx", 207>; 614def OpDPdy: UnOp<"OpDPdy", 208>; 615def OpFwidth: UnOp<"OpFwidth", 209>; 616 617def OpDPdxFine: UnOp<"OpDPdxFine", 210>; 618def OpDPdyFine: UnOp<"OpDPdyFine", 211>; 619def OpFwidthFine: UnOp<"OpFwidthFine", 212>; 620 621def OpDPdxCoarse: UnOp<"OpDPdxCoarse", 213>; 622def OpDPdyCoarse: UnOp<"OpDPdyCoarse", 214>; 623def OpFwidthCoarse: UnOp<"OpFwidthCoarse", 215>; 624 625// 3.42.17 Control-Flow Instructions 626 627def OpPhi: Op<245, (outs ID:$res), (ins TYPE:$type, ID:$var0, ID:$block0, variable_ops), 628 "$res = OpPhi $type $var0 $block0">; 629def OpLoopMerge: Op<246, (outs), (ins unknown:$merge, unknown:$continue, LoopControl:$lc, variable_ops), 630 "OpLoopMerge $merge $continue $lc">; 631def OpSelectionMerge: Op<247, (outs), (ins unknown:$merge, SelectionControl:$sc), 632 "OpSelectionMerge $merge $sc">; 633def OpLabel: Op<248, (outs ID:$label), (ins), "$label = OpLabel">; 634let isBarrier = 1, isTerminator = 1, isBranch = 1 in { 635 def OpBranch: Op<249, (outs), (ins unknown:$label), "OpBranch $label">; 636 def OpBranchConditional: Op<250, (outs), (ins ID:$cond, unknown:$true, unknown:$false, variable_ops), 637 "OpBranchConditional $cond $true $false">; 638 def OpSwitch: Op<251, (outs), (ins ID:$sel, ID:$dflt, variable_ops), "OpSwitch $sel $dflt">; 639} 640let isReturn = 1, hasDelaySlot = 0, isBarrier = 0, isTerminator = 1, isNotDuplicable = 1 in { 641 def OpKill: SimpleOp<"OpKill", 252>; 642 def OpReturn: SimpleOp<"OpReturn", 253>; 643 def OpReturnValue: Op<254, (outs), (ins ID:$ret), "OpReturnValue $ret">; 644 def OpUnreachable: SimpleOp<"OpUnreachable", 255>; 645} 646def OpLifetimeStart: Op<256, (outs), (ins ID:$ptr, i32imm:$sz), "OpLifetimeStart $ptr, $sz">; 647def OpLifetimeStop: Op<257, (outs), (ins ID:$ptr, i32imm:$sz), "OpLifetimeStop $ptr, $sz">; 648def OpDemoteToHelperInvocation: SimpleOp<"OpDemoteToHelperInvocation", 5380>; 649 650// 3.42.18 Atomic Instructions 651 652class AtomicOp<string name, bits<16> opCode>: Op<opCode, (outs ID:$res), 653 (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$sem), 654 "$res = "#name#" $ty $ptr $sc $sem">; 655 656class AtomicOpVal<string name, bits<16> opCode>: Op<opCode, (outs ID:$res), 657 (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$sem, ID:$val), 658 "$res = "#name#" $ty $ptr $sc $sem $val">; 659 660def OpAtomicLoad: AtomicOp<"OpAtomicLoad", 227>; 661 662def OpAtomicStore: Op<228, (outs), (ins ID:$ptr, ID:$sc, ID:$sem, ID:$val), 663 "OpAtomicStore $ptr $sc $sem $val">; 664def OpAtomicExchange: Op<229, (outs ID:$res), 665 (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$sem, ID:$val), 666 "$res = OpAtomicExchange $ty $ptr $sc $sem $val">; 667def OpAtomicCompareExchange: Op<230, (outs ID:$res), 668 (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$eq, 669 ID:$neq, ID:$val, ID:$cmp), 670 "$res = OpAtomicCompareExchange $ty $ptr $sc $eq $neq $val $cmp">; 671def OpAtomicCompareExchangeWeak: Op<231, (outs ID:$res), 672 (ins TYPE:$ty, ID:$ptr, ID:$sc, ID:$eq, 673 ID:$neq, ID:$val, ID:$cmp), 674 "$res = OpAtomicCompareExchangeWeak $ty $ptr $sc $eq $neq $val $cmp">; 675 676def OpAtomicIIncrement: AtomicOp<"OpAtomicIIncrement", 232>; 677def OpAtomicIDecrement: AtomicOp<"OpAtomicIDecrement", 233>; 678 679def OpAtomicIAdd: AtomicOpVal<"OpAtomicIAdd", 234>; 680def OpAtomicISub: AtomicOpVal<"OpAtomicISub", 235>; 681 682def OpAtomicSMin: AtomicOpVal<"OpAtomicSMin", 236>; 683def OpAtomicUMin: AtomicOpVal<"OpAtomicUMin", 237>; 684def OpAtomicSMax: AtomicOpVal<"OpAtomicSMax", 238>; 685def OpAtomicUMax: AtomicOpVal<"OpAtomicUMax", 239>; 686 687def OpAtomicAnd: AtomicOpVal<"OpAtomicAnd", 240>; 688def OpAtomicOr: AtomicOpVal<"OpAtomicOr", 241>; 689def OpAtomicXor: AtomicOpVal<"OpAtomicXor", 242>; 690 691def OpAtomicFAddEXT: AtomicOpVal<"OpAtomicFAddEXT", 6035>; 692def OpAtomicFMinEXT: AtomicOpVal<"OpAtomicFMinEXT", 5614>; 693def OpAtomicFMaxEXT: AtomicOpVal<"OpAtomicFMaxEXT", 5615>; 694 695def OpAtomicFlagTestAndSet: AtomicOp<"OpAtomicFlagTestAndSet", 318>; 696def OpAtomicFlagClear: Op<319, (outs), (ins ID:$ptr, ID:$sc, ID:$sem), 697 "OpAtomicFlagClear $ptr $sc $sem">; 698 699// 3.42.19 Primitive Instructions 700 701def OpEmitVertex: SimpleOp<"OpEmitVertex", 218>; 702def OpEndPrimitive: SimpleOp<"OpEndPrimitive", 219>; 703def OpEmitStreamVertex: Op<220, (outs), (ins ID:$stream), "OpEmitStreamVertex $stream">; 704def OpEndStreamPrimitive: Op<221, (outs), (ins ID:$stream), "OpEndStreamPrimitive $stream">; 705 706// 3.42.20 Barrier Instructions 707 708def OpControlBarrier: Op<224, (outs), (ins ID:$exec, ID:$mem, ID:$sem), 709 "OpControlBarrier $exec $mem $sem">; 710def OpMemoryBarrier: Op<225, (outs), (ins ID:$mem, ID:$sem), 711 "OpMemoryBarrier $mem $sem">; 712def OpNamedBarrierInitialize: UnOp<"OpNamedBarrierInitialize", 328>; 713def OpMemoryNamedBarrier: Op<329, (outs), (ins ID:$barr, ID:$mem, ID:$sem), 714 "OpMemoryNamedBarrier $barr $mem $sem">; 715 716// SPV_INTEL_split_barrier 717def OpControlBarrierArriveINTEL: Op<6142, (outs), (ins ID:$exec, ID:$mem, ID:$sem), 718 "OpControlBarrierArriveINTEL $exec $mem $sem">; 719def OpControlBarrierWaitINTEL: Op<6143, (outs), (ins ID:$exec, ID:$mem, ID:$sem), 720 "OpControlBarrierWaitINTEL $exec $mem $sem">; 721 722// 3.42.21. Group and Subgroup Instructions 723 724def OpGroupAsyncCopy: Op<259, (outs ID:$res), (ins TYPE:$ty, ID:$scope, 725 ID:$dst, ID:$src, ID:$nelts, ID:$stride, ID:$event), 726 "$res = OpGroupAsyncCopy $ty $scope $dst $src $nelts $stride $event">; 727def OpGroupWaitEvents: Op<260, (outs), (ins ID:$scope, ID:$nelts, ID:$elist), 728 "OpGroupWaitEvents $scope $nelts $elist">; 729def OpGroupAll: Op<261, (outs ID:$res), (ins TYPE:$ty, ID:$scope, ID:$pr), 730 "$res = OpGroupAll $ty $scope $pr">; 731def OpGroupAny: Op<262, (outs ID:$res), (ins TYPE:$ty, ID:$scope, ID:$pr), 732 "$res = OpGroupAny $ty $scope $pr">; 733def OpGroupBroadcast: Op<263, (outs ID:$res), (ins TYPE:$ty, ID:$scope, 734 ID:$val, ID:$id), 735 "$res = OpGroupBroadcast $ty $scope $val $id">; 736class OpGroup<string name, bits<16> opCode>: Op<opCode, (outs ID:$res), 737 (ins TYPE:$ty, ID:$scope, GroupOperation:$groupOp, ID:$x), 738 "$res = OpGroup"#name#" $ty $scope $groupOp $x">; 739def OpGroupIAdd: OpGroup<"IAdd", 264>; 740def OpGroupFAdd: OpGroup<"FAdd", 265>; 741def OpGroupFMin: OpGroup<"FMin", 266>; 742def OpGroupUMin: OpGroup<"UMin", 267>; 743def OpGroupSMin: OpGroup<"SMin", 268>; 744def OpGroupFMax: OpGroup<"FMax", 269>; 745def OpGroupUMax: OpGroup<"UMax", 270>; 746def OpGroupSMax: OpGroup<"SMax", 271>; 747 748// TODO: 3.42.22. Device-Side Enqueue Instructions 749def OpEnqueueKernel: Op<292, (outs ID:$res), (ins TYPE:$type, ID:$queue, ID:$flags, ID:$NDR, ID:$nevents, ID:$wevents, 750 ID:$revent, ID:$invoke, ID:$param, ID:$psize, ID:$palign, variable_ops), 751 "$res = OpEnqueueKernel $type $queue $flags $NDR $nevents $wevents $revent $invoke $param $psize $palign">; 752def OpRetainEvent: Op<297, (outs), (ins ID:$event), "OpRetainEvent $event">; 753def OpReleaseEvent: Op<298, (outs), (ins ID:$event), "OpReleaseEvent $event">; 754def OpCreateUserEvent: Op<299, (outs ID:$res), (ins TYPE:$type), 755 "$res = OpCreateUserEvent $type">; 756def OpIsValidEvent: Op<300, (outs ID:$res), (ins TYPE:$type, ID:$event), 757 "$res = OpIsValidEvent $type $event ">; 758def OpSetUserEventStatus: Op<301, (outs), (ins ID:$event, ID:$status), 759 "OpSetUserEventStatus $event $status">; 760def OpCaptureEventProfilingInfo: Op<302, (outs), 761 (ins ID:$event, ID:$info, ID:$value), 762 "OpCaptureEventProfilingInfo $event $info $value">; 763def OpGetDefaultQueue: Op<303, (outs ID:$res), (ins TYPE:$type), 764 "$res = OpGetDefaultQueue $type">; 765def OpBuildNDRange: Op<304, (outs ID:$res), (ins TYPE:$type, ID:$GWS, ID:$LWS, ID:$GWO), 766 "$res = OpBuildNDRange $type $GWS $LWS $GWO">; 767 768// TODO: 3.42.23. Pipe Instructions 769 770// 3.42.24. Non-Uniform Instructions 771 772def OpGroupNonUniformElect: Op<333, (outs ID:$res), (ins TYPE:$ty, ID:$scope), 773 "$res = OpGroupNonUniformElect $ty $scope">; 774class OpGroupNU3<string name, bits<16> opCode>: Op<opCode, 775 (outs ID:$res), (ins TYPE:$ty, ID:$scope, ID:$pred), 776 "$res = OpGroupNonUniform"#name#" $ty $scope $pred">; 777class OpGroupNU4<string name, bits<16> opCode>: Op<opCode, 778 (outs ID:$res), (ins TYPE:$ty, ID:$scope, ID:$val, ID:$id), 779 "$res = OpGroupNonUniform"#name#" $ty $scope $val $id">; 780def OpGroupNonUniformAll: OpGroupNU3<"All", 334>; 781def OpGroupNonUniformAny: OpGroupNU3<"Any", 335>; 782def OpGroupNonUniformAllEqual: OpGroupNU3<"AllEqual", 336>; 783def OpGroupNonUniformBroadcast: OpGroupNU4<"Broadcast", 337>; 784def OpGroupNonUniformBroadcastFirst: OpGroupNU3<"BroadcastFirst", 338>; 785def OpGroupNonUniformBallot: OpGroupNU3<"Ballot", 339>; 786def OpGroupNonUniformInverseBallot: OpGroupNU3<"InverseBallot", 340>; 787def OpGroupNonUniformBallotBitExtract: OpGroupNU4<"BallotBitExtract", 341>; 788def OpGroupNonUniformBallotBitCount: Op<342, (outs ID:$res), 789 (ins TYPE:$ty, ID:$scope, GroupOperation:$groupOp, ID:$val), 790 "$res = OpGroupNonUniformBallotBitCount " 791 "$ty $scope $groupOp $val">; 792def OpGroupNonUniformBallotFindLSB: OpGroupNU3<"BallotFindLSB", 343>; 793def OpGroupNonUniformBallotFindMSB: OpGroupNU3<"BallotFindMSB", 344>; 794def OpGroupNonUniformShuffle: OpGroupNU4<"Shuffle", 345>; 795def OpGroupNonUniformShuffleXor: OpGroupNU4<"ShuffleXor", 346>; 796def OpGroupNonUniformShuffleUp: OpGroupNU4<"ShuffleUp", 347>; 797def OpGroupNonUniformShuffleDown: OpGroupNU4<"ShuffleDown", 348>; 798class OpGroupNUGroup<string name, bits<16> opCode>: Op<opCode, (outs ID:$res), 799 (ins TYPE:$ty, ID:$scope, GroupOperation:$groupOp, 800 ID:$val, variable_ops), 801 "$res = OpGroupNonUniform"#name#" $ty $scope $groupOp $val">; 802def OpGroupNonUniformIAdd: OpGroupNUGroup<"IAdd", 349>; 803def OpGroupNonUniformFAdd: OpGroupNUGroup<"FAdd", 350>; 804def OpGroupNonUniformIMul: OpGroupNUGroup<"IMul", 351>; 805def OpGroupNonUniformFMul: OpGroupNUGroup<"FMul", 352>; 806def OpGroupNonUniformSMin: OpGroupNUGroup<"SMin", 353>; 807def OpGroupNonUniformUMin: OpGroupNUGroup<"UMin", 354>; 808def OpGroupNonUniformFMin: OpGroupNUGroup<"FMin", 355>; 809def OpGroupNonUniformSMax: OpGroupNUGroup<"SMax", 356>; 810def OpGroupNonUniformUMax: OpGroupNUGroup<"UMax", 357>; 811def OpGroupNonUniformFMax: OpGroupNUGroup<"FMax", 358>; 812def OpGroupNonUniformBitwiseAnd: OpGroupNUGroup<"BitwiseAnd", 359>; 813def OpGroupNonUniformBitwiseOr: OpGroupNUGroup<"BitwiseOr", 360>; 814def OpGroupNonUniformBitwiseXor: OpGroupNUGroup<"BitwiseXor", 361>; 815def OpGroupNonUniformLogicalAnd: OpGroupNUGroup<"LogicalAnd", 362>; 816def OpGroupNonUniformLogicalOr: OpGroupNUGroup<"LogicalOr", 363>; 817def OpGroupNonUniformLogicalXor: OpGroupNUGroup<"LogicalXor", 364>; 818 819// SPV_KHR_subgroup_rotate 820def OpGroupNonUniformRotateKHR: Op<4431, (outs ID:$res), 821 (ins TYPE:$type, ID:$scope, ID:$value, ID:$delta, variable_ops), 822 "$res = OpGroupNonUniformRotateKHR $type $scope $value $delta">; 823 824// SPV_KHR_shader_clock 825def OpReadClockKHR: Op<5056, (outs ID:$res), 826 (ins TYPE:$type, ID:$scope), 827 "$res = OpReadClockKHR $type $scope">; 828 829// 3.49.7, Constant-Creation Instructions 830 831// - SPV_INTEL_function_pointers 832def OpConstantFunctionPointerINTEL: Op<5600, (outs ID:$res), (ins TYPE:$ty, ID:$fun), "$res = OpConstantFunctionPointerINTEL $ty $fun">; 833 834// 3.49.9. Function Instructions 835 836// - SPV_INTEL_function_pointers 837def OpFunctionPointerCallINTEL: Op<5601, (outs ID:$res), (ins TYPE:$ty, ID:$funPtr, variable_ops), "$res = OpFunctionPointerCallINTEL $ty $funPtr">; 838 839// 3.49.21. Group and Subgroup Instructions 840 841// - SPV_INTEL_subgroups 842def OpSubgroupShuffleINTEL: Op<5571, (outs ID:$res), (ins TYPE:$type, ID:$data, ID:$invocationId), 843 "$res = OpSubgroupShuffleINTEL $type $data $invocationId">; 844def OpSubgroupShuffleDownINTEL: Op<5572, (outs ID:$res), (ins TYPE:$type, ID:$current, ID:$next, ID:$delta), 845 "$res = OpSubgroupShuffleDownINTEL $type $current $next $delta">; 846def OpSubgroupShuffleUpINTEL: Op<5573, (outs ID:$res), (ins TYPE:$type, ID:$previous, ID:$current, ID:$delta), 847 "$res = OpSubgroupShuffleUpINTEL $type $previous $current $delta">; 848def OpSubgroupShuffleXorINTEL: Op<5574, (outs ID:$res), (ins TYPE:$type, ID:$data, ID:$value), 849 "$res = OpSubgroupShuffleXorINTEL $type $data $value">; 850def OpSubgroupBlockReadINTEL: Op<5575, (outs ID:$res), (ins TYPE:$type, ID:$ptr), 851 "$res = OpSubgroupBlockReadINTEL $type $ptr">; 852def OpSubgroupBlockWriteINTEL: Op<5576, (outs), (ins ID:$ptr, ID:$data), 853 "OpSubgroupBlockWriteINTEL $ptr $data">; 854def OpSubgroupImageBlockReadINTEL: Op<5577, (outs ID:$res), (ins TYPE:$type, ID:$image, ID:$coordinate), 855 "$res = OpSubgroupImageBlockReadINTEL $type $image $coordinate">; 856def OpSubgroupImageBlockWriteINTEL: Op<5578, (outs), (ins ID:$image, ID:$coordinate, ID:$data), 857 "OpSubgroupImageBlockWriteINTEL $image $coordinate $data">; 858 859// SPV_INTEL_media_block_io 860def OpSubgroupImageMediaBlockReadINTEL: Op<5580, (outs ID:$res), (ins TYPE:$type, ID:$image, ID:$coordinate, ID:$width, ID:$height), 861 "$res = OpSubgroupImageMediaBlockReadINTEL $type $image $coordinate $width $height">; 862def OpSubgroupImageMediaBlockWriteINTEL: Op<5581, (outs), (ins ID:$image, ID:$coordinate, ID:$width, ID:$height, ID:$data), 863 "OpSubgroupImageMediaBlockWriteINTEL $image $coordinate $width $height $data">; 864 865// - SPV_KHR_uniform_group_instructions 866def OpGroupIMulKHR: Op<6401, (outs ID:$res), (ins TYPE:$type, ID:$scope, i32imm:$groupOp, ID:$value), 867 "$res = OpGroupIMulKHR $type $scope $groupOp $value">; 868def OpGroupFMulKHR: Op<6402, (outs ID:$res), (ins TYPE:$type, ID:$scope, i32imm:$groupOp, ID:$value), 869 "$res = OpGroupFMulKHR $type $scope $groupOp $value">; 870def OpGroupBitwiseAndKHR: Op<6403, (outs ID:$res), (ins TYPE:$type, ID:$scope, i32imm:$groupOp, ID:$value), 871 "$res = OpGroupBitwiseAndKHR $type $scope $groupOp $value">; 872def OpGroupBitwiseOrKHR: Op<6404, (outs ID:$res), (ins TYPE:$type, ID:$scope, i32imm:$groupOp, ID:$value), 873 "$res = OpGroupBitwiseOrKHR $type $scope $groupOp $value">; 874def OpGroupBitwiseXorKHR: Op<6405, (outs ID:$res), (ins TYPE:$type, ID:$scope, i32imm:$groupOp, ID:$value), 875 "$res = OpGroupBitwiseXorKHR $type $scope $groupOp $value">; 876def OpGroupLogicalAndKHR: Op<6406, (outs ID:$res), (ins TYPE:$type, ID:$scope, i32imm:$groupOp, ID:$value), 877 "$res = OpGroupLogicalAndKHR $type $scope $groupOp $value">; 878def OpGroupLogicalOrKHR: Op<6407, (outs ID:$res), (ins TYPE:$type, ID:$scope, i32imm:$groupOp, ID:$value), 879 "$res = OpGroupLogicalOrKHR $type $scope $groupOp $value">; 880def OpGroupLogicalXorKHR: Op<6408, (outs ID:$res), (ins TYPE:$type, ID:$scope, i32imm:$groupOp, ID:$value), 881 "$res = OpGroupLogicalXorKHR $type $scope $groupOp $value">; 882 883// Inline Assembly Instructions 884def OpAsmTargetINTEL: Op<5609, (outs ID:$res), (ins StringImm:$str, variable_ops), "$res = OpAsmTargetINTEL $str">; 885def OpAsmINTEL: Op<5610, (outs ID:$res), (ins TYPE:$type, TYPE:$asm_type, ID:$target, 886 StringImm:$asm, StringImm:$constraints, variable_ops), 887 "$res = OpAsmINTEL $type $asm_type $target $asm">; 888def OpAsmCallINTEL: Op<5611, (outs ID:$res), (ins TYPE:$type, ID:$asm, variable_ops), 889 "$res = OpAsmCallINTEL $type $asm">; 890 891// SPV_KHR_cooperative_matrix 892def OpCooperativeMatrixLoadKHR: Op<4457, (outs ID:$res), 893 (ins TYPE:$resType, ID:$pointer, ID:$memory_layout, variable_ops), 894 "$res = OpCooperativeMatrixLoadKHR $resType $pointer $memory_layout">; 895def OpCooperativeMatrixStoreKHR: Op<4458, (outs), 896 (ins ID:$pointer, ID:$objectToStore, ID:$memory_layout, variable_ops), 897 "OpCooperativeMatrixStoreKHR $pointer $objectToStore $memory_layout">; 898def OpCooperativeMatrixMulAddKHR: Op<4459, (outs ID:$res), 899 (ins TYPE:$type, ID:$A, ID:$B, ID:$C, variable_ops), 900 "$res = OpCooperativeMatrixMulAddKHR $type $A $B $C">; 901def OpCooperativeMatrixLengthKHR: Op<4460, (outs ID:$res), (ins TYPE:$type, ID:$coop_matr_type), 902 "$res = OpCooperativeMatrixLengthKHR $type $coop_matr_type">; 903 904// SPV_INTEL_joint_matrix 905def OpCooperativeMatrixLoadCheckedINTEL: Op<6193, (outs ID:$res), 906 (ins TYPE:$resType, ID:$pointer, ID:$xOffset, ID:$yOffset, ID:$memory_layout, ID:$height, ID:$width, variable_ops), 907 "$res = OpCooperativeMatrixLoadCheckedINTEL $resType $pointer $xOffset $yOffset $memory_layout $height $width">; 908def OpCooperativeMatrixStoreCheckedINTEL: Op<6194, (outs), 909 (ins ID:$pointer, ID:$xOffset, ID:$yOffset, ID:$objectToStore, ID:$memory_layout, ID:$height, ID:$width, variable_ops), 910 "OpCooperativeMatrixStoreCheckedINTEL $pointer $xOffset $yOffset $objectToStore $memory_layout $height $width">; 911def OpCooperativeMatrixConstructCheckedINTEL: Op<6195, (outs ID:$res), 912 (ins TYPE:$resType, ID:$xOffset, ID:$yOffset, ID:$height, ID:$width, ID:$value), 913 "$res = OpCooperativeMatrixConstructCheckedINTEL $resType $xOffset $yOffset $height $width $value">; 914def OpCooperativeMatrixGetElementCoordINTEL: Op<6440, (outs ID:$res), 915 (ins TYPE:$resType, ID:$matrix, ID:$index), 916 "$res = OpCooperativeMatrixGetElementCoordINTEL $resType $matrix $index">; 917def OpCooperativeMatrixPrefetchINTEL: Op<6449, (outs), 918 (ins ID:$pointer, ID:$rows, ID:$columns, i32imm:$cacheLevel, ID:$memory_layout, variable_ops), 919 "OpCooperativeMatrixPrefetchINTEL $pointer $rows $columns $cacheLevel $memory_layout">; 920 921// SPV_EXT_arithmetic_fence 922def OpArithmeticFenceEXT: Op<6145, (outs ID:$res), (ins TYPE:$type, ID:$target), 923 "$res = OpArithmeticFenceEXT $type $target">; 924