181ad6265SDimitry Andric//- DXIL.td - Describe DXIL operation -------------------------*- tablegen -*-// 281ad6265SDimitry Andric// 381ad6265SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 481ad6265SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 581ad6265SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 681ad6265SDimitry Andric// 781ad6265SDimitry Andric//===----------------------------------------------------------------------===// 881ad6265SDimitry Andric/// 981ad6265SDimitry Andric/// \file 10*0fca6ea1SDimitry Andric/// This is a target description file for DXIL operations. 1181ad6265SDimitry Andric/// 1281ad6265SDimitry Andric//===----------------------------------------------------------------------===// 1381ad6265SDimitry Andric 1481ad6265SDimitry Andricinclude "llvm/IR/Intrinsics.td" 1581ad6265SDimitry Andric 16*0fca6ea1SDimitry Andricclass DXILOpClass; 17*0fca6ea1SDimitry Andric 18*0fca6ea1SDimitry Andric// Following is a set of DXIL Operation classes whose names appear to be 19*0fca6ea1SDimitry Andric// arbitrary, yet need to be a substring of the function name used during 20*0fca6ea1SDimitry Andric// lowering to DXIL Operation calls. These class name strings are specified 21*0fca6ea1SDimitry Andric// as the third argument of add_dixil_op in utils/hct/hctdb.py and case converted 22*0fca6ea1SDimitry Andric// in utils/hct/hctdb_instrhelp.py of DirectXShaderCompiler repo. The function 23*0fca6ea1SDimitry Andric// name has the format "dx.op.<class-name>.<return-type>". 24*0fca6ea1SDimitry Andric 25*0fca6ea1SDimitry Andricdefset list<DXILOpClass> OpClasses = { 26*0fca6ea1SDimitry Andric def acceptHitAndEndSearch : DXILOpClass; 27*0fca6ea1SDimitry Andric def allocateNodeOutputRecords : DXILOpClass; 28*0fca6ea1SDimitry Andric def allocateRayQuery : DXILOpClass; 29*0fca6ea1SDimitry Andric def annotateHandle : DXILOpClass; 30*0fca6ea1SDimitry Andric def annotateNodeHandle : DXILOpClass; 31*0fca6ea1SDimitry Andric def annotateNodeRecordHandle : DXILOpClass; 32*0fca6ea1SDimitry Andric def atomicBinOp : DXILOpClass; 33*0fca6ea1SDimitry Andric def atomicCompareExchange : DXILOpClass; 34*0fca6ea1SDimitry Andric def attributeAtVertex : DXILOpClass; 35*0fca6ea1SDimitry Andric def barrier : DXILOpClass; 36*0fca6ea1SDimitry Andric def barrierByMemoryHandle : DXILOpClass; 37*0fca6ea1SDimitry Andric def barrierByMemoryType : DXILOpClass; 38*0fca6ea1SDimitry Andric def barrierByNodeRecordHandle : DXILOpClass; 39*0fca6ea1SDimitry Andric def binary : DXILOpClass; 40*0fca6ea1SDimitry Andric def binaryWithCarryOrBorrow : DXILOpClass; 41*0fca6ea1SDimitry Andric def binaryWithTwoOuts : DXILOpClass; 42*0fca6ea1SDimitry Andric def bitcastF16toI16 : DXILOpClass; 43*0fca6ea1SDimitry Andric def bitcastF32toI32 : DXILOpClass; 44*0fca6ea1SDimitry Andric def bitcastF64toI64 : DXILOpClass; 45*0fca6ea1SDimitry Andric def bitcastI16toF16 : DXILOpClass; 46*0fca6ea1SDimitry Andric def bitcastI32toF32 : DXILOpClass; 47*0fca6ea1SDimitry Andric def bitcastI64toF64 : DXILOpClass; 48*0fca6ea1SDimitry Andric def bufferLoad : DXILOpClass; 49*0fca6ea1SDimitry Andric def bufferStore : DXILOpClass; 50*0fca6ea1SDimitry Andric def bufferUpdateCounter : DXILOpClass; 51*0fca6ea1SDimitry Andric def calculateLOD : DXILOpClass; 52*0fca6ea1SDimitry Andric def callShader : DXILOpClass; 53*0fca6ea1SDimitry Andric def cbufferLoad : DXILOpClass; 54*0fca6ea1SDimitry Andric def cbufferLoadLegacy : DXILOpClass; 55*0fca6ea1SDimitry Andric def checkAccessFullyMapped : DXILOpClass; 56*0fca6ea1SDimitry Andric def coverage : DXILOpClass; 57*0fca6ea1SDimitry Andric def createHandle : DXILOpClass; 58*0fca6ea1SDimitry Andric def createHandleForLib : DXILOpClass; 59*0fca6ea1SDimitry Andric def createHandleFromBinding : DXILOpClass; 60*0fca6ea1SDimitry Andric def createHandleFromHeap : DXILOpClass; 61*0fca6ea1SDimitry Andric def createNodeInputRecordHandle : DXILOpClass; 62*0fca6ea1SDimitry Andric def createNodeOutputHandle : DXILOpClass; 63*0fca6ea1SDimitry Andric def cutStream : DXILOpClass; 64*0fca6ea1SDimitry Andric def cycleCounterLegacy : DXILOpClass; 65*0fca6ea1SDimitry Andric def discard : DXILOpClass; 66*0fca6ea1SDimitry Andric def dispatchMesh : DXILOpClass; 67*0fca6ea1SDimitry Andric def dispatchRaysDimensions : DXILOpClass; 68*0fca6ea1SDimitry Andric def dispatchRaysIndex : DXILOpClass; 69*0fca6ea1SDimitry Andric def domainLocation : DXILOpClass; 70*0fca6ea1SDimitry Andric def dot2 : DXILOpClass; 71*0fca6ea1SDimitry Andric def dot2AddHalf : DXILOpClass; 72*0fca6ea1SDimitry Andric def dot3 : DXILOpClass; 73*0fca6ea1SDimitry Andric def dot4 : DXILOpClass; 74*0fca6ea1SDimitry Andric def dot4AddPacked : DXILOpClass; 75*0fca6ea1SDimitry Andric def emitIndices : DXILOpClass; 76*0fca6ea1SDimitry Andric def emitStream : DXILOpClass; 77*0fca6ea1SDimitry Andric def emitThenCutStream : DXILOpClass; 78*0fca6ea1SDimitry Andric def evalCentroid : DXILOpClass; 79*0fca6ea1SDimitry Andric def evalSampleIndex : DXILOpClass; 80*0fca6ea1SDimitry Andric def evalSnapped : DXILOpClass; 81*0fca6ea1SDimitry Andric def finishedCrossGroupSharing : DXILOpClass; 82*0fca6ea1SDimitry Andric def flattenedThreadIdInGroup : DXILOpClass; 83*0fca6ea1SDimitry Andric def geometryIndex : DXILOpClass; 84*0fca6ea1SDimitry Andric def getDimensions : DXILOpClass; 85*0fca6ea1SDimitry Andric def getInputRecordCount : DXILOpClass; 86*0fca6ea1SDimitry Andric def getMeshPayload : DXILOpClass; 87*0fca6ea1SDimitry Andric def getNodeRecordPtr : DXILOpClass; 88*0fca6ea1SDimitry Andric def getRemainingRecursionLevels : DXILOpClass; 89*0fca6ea1SDimitry Andric def groupId : DXILOpClass; 90*0fca6ea1SDimitry Andric def gsInstanceID : DXILOpClass; 91*0fca6ea1SDimitry Andric def hitKind : DXILOpClass; 92*0fca6ea1SDimitry Andric def ignoreHit : DXILOpClass; 93*0fca6ea1SDimitry Andric def incrementOutputCount : DXILOpClass; 94*0fca6ea1SDimitry Andric def indexNodeHandle : DXILOpClass; 95*0fca6ea1SDimitry Andric def innerCoverage : DXILOpClass; 96*0fca6ea1SDimitry Andric def instanceID : DXILOpClass; 97*0fca6ea1SDimitry Andric def instanceIndex : DXILOpClass; 98*0fca6ea1SDimitry Andric def isHelperLane : DXILOpClass; 99*0fca6ea1SDimitry Andric def isSpecialFloat : DXILOpClass; 100*0fca6ea1SDimitry Andric def legacyDoubleToFloat : DXILOpClass; 101*0fca6ea1SDimitry Andric def legacyDoubleToSInt32 : DXILOpClass; 102*0fca6ea1SDimitry Andric def legacyDoubleToUInt32 : DXILOpClass; 103*0fca6ea1SDimitry Andric def legacyF16ToF32 : DXILOpClass; 104*0fca6ea1SDimitry Andric def legacyF32ToF16 : DXILOpClass; 105*0fca6ea1SDimitry Andric def loadInput : DXILOpClass; 106*0fca6ea1SDimitry Andric def loadOutputControlPoint : DXILOpClass; 107*0fca6ea1SDimitry Andric def loadPatchConstant : DXILOpClass; 108*0fca6ea1SDimitry Andric def makeDouble : DXILOpClass; 109*0fca6ea1SDimitry Andric def minPrecXRegLoad : DXILOpClass; 110*0fca6ea1SDimitry Andric def minPrecXRegStore : DXILOpClass; 111*0fca6ea1SDimitry Andric def nodeOutputIsValid : DXILOpClass; 112*0fca6ea1SDimitry Andric def objectRayDirection : DXILOpClass; 113*0fca6ea1SDimitry Andric def objectRayOrigin : DXILOpClass; 114*0fca6ea1SDimitry Andric def objectToWorld : DXILOpClass; 115*0fca6ea1SDimitry Andric def outputComplete : DXILOpClass; 116*0fca6ea1SDimitry Andric def outputControlPointID : DXILOpClass; 117*0fca6ea1SDimitry Andric def pack4x8 : DXILOpClass; 118*0fca6ea1SDimitry Andric def primitiveID : DXILOpClass; 119*0fca6ea1SDimitry Andric def primitiveIndex : DXILOpClass; 120*0fca6ea1SDimitry Andric def quadOp : DXILOpClass; 121*0fca6ea1SDimitry Andric def quadReadLaneAt : DXILOpClass; 122*0fca6ea1SDimitry Andric def quadVote : DXILOpClass; 123*0fca6ea1SDimitry Andric def quaternary : DXILOpClass; 124*0fca6ea1SDimitry Andric def rawBufferLoad : DXILOpClass; 125*0fca6ea1SDimitry Andric def rawBufferStore : DXILOpClass; 126*0fca6ea1SDimitry Andric def rayFlags : DXILOpClass; 127*0fca6ea1SDimitry Andric def rayQuery_Abort : DXILOpClass; 128*0fca6ea1SDimitry Andric def rayQuery_CommitNonOpaqueTriangleHit : DXILOpClass; 129*0fca6ea1SDimitry Andric def rayQuery_CommitProceduralPrimitiveHit : DXILOpClass; 130*0fca6ea1SDimitry Andric def rayQuery_Proceed : DXILOpClass; 131*0fca6ea1SDimitry Andric def rayQuery_StateMatrix : DXILOpClass; 132*0fca6ea1SDimitry Andric def rayQuery_StateScalar : DXILOpClass; 133*0fca6ea1SDimitry Andric def rayQuery_StateVector : DXILOpClass; 134*0fca6ea1SDimitry Andric def rayQuery_TraceRayInline : DXILOpClass; 135*0fca6ea1SDimitry Andric def rayTCurrent : DXILOpClass; 136*0fca6ea1SDimitry Andric def rayTMin : DXILOpClass; 137*0fca6ea1SDimitry Andric def renderTargetGetSampleCount : DXILOpClass; 138*0fca6ea1SDimitry Andric def renderTargetGetSamplePosition : DXILOpClass; 139*0fca6ea1SDimitry Andric def reportHit : DXILOpClass; 140*0fca6ea1SDimitry Andric def sample : DXILOpClass; 141*0fca6ea1SDimitry Andric def sampleBias : DXILOpClass; 142*0fca6ea1SDimitry Andric def sampleCmp : DXILOpClass; 143*0fca6ea1SDimitry Andric def sampleCmpBias : DXILOpClass; 144*0fca6ea1SDimitry Andric def sampleCmpGrad : DXILOpClass; 145*0fca6ea1SDimitry Andric def sampleCmpLevel : DXILOpClass; 146*0fca6ea1SDimitry Andric def sampleCmpLevelZero : DXILOpClass; 147*0fca6ea1SDimitry Andric def sampleGrad : DXILOpClass; 148*0fca6ea1SDimitry Andric def sampleIndex : DXILOpClass; 149*0fca6ea1SDimitry Andric def sampleLevel : DXILOpClass; 150*0fca6ea1SDimitry Andric def setMeshOutputCounts : DXILOpClass; 151*0fca6ea1SDimitry Andric def splitDouble : DXILOpClass; 152*0fca6ea1SDimitry Andric def startInstanceLocation : DXILOpClass; 153*0fca6ea1SDimitry Andric def startVertexLocation : DXILOpClass; 154*0fca6ea1SDimitry Andric def storeOutput : DXILOpClass; 155*0fca6ea1SDimitry Andric def storePatchConstant : DXILOpClass; 156*0fca6ea1SDimitry Andric def storePrimitiveOutput : DXILOpClass; 157*0fca6ea1SDimitry Andric def storeVertexOutput : DXILOpClass; 158*0fca6ea1SDimitry Andric def tempRegLoad : DXILOpClass; 159*0fca6ea1SDimitry Andric def tempRegStore : DXILOpClass; 160*0fca6ea1SDimitry Andric def tertiary : DXILOpClass; 161*0fca6ea1SDimitry Andric def texture2DMSGetSamplePosition : DXILOpClass; 162*0fca6ea1SDimitry Andric def textureGather : DXILOpClass; 163*0fca6ea1SDimitry Andric def textureGatherCmp : DXILOpClass; 164*0fca6ea1SDimitry Andric def textureGatherRaw : DXILOpClass; 165*0fca6ea1SDimitry Andric def textureLoad : DXILOpClass; 166*0fca6ea1SDimitry Andric def textureStore : DXILOpClass; 167*0fca6ea1SDimitry Andric def textureStoreSample : DXILOpClass; 168*0fca6ea1SDimitry Andric def threadId : DXILOpClass; 169*0fca6ea1SDimitry Andric def threadIdInGroup : DXILOpClass; 170*0fca6ea1SDimitry Andric def traceRay : DXILOpClass; 171*0fca6ea1SDimitry Andric def unary : DXILOpClass; 172*0fca6ea1SDimitry Andric def unaryBits : DXILOpClass; 173*0fca6ea1SDimitry Andric def unpack4x8 : DXILOpClass; 174*0fca6ea1SDimitry Andric def viewID : DXILOpClass; 175*0fca6ea1SDimitry Andric def waveActiveAllEqual : DXILOpClass; 176*0fca6ea1SDimitry Andric def waveActiveBallot : DXILOpClass; 177*0fca6ea1SDimitry Andric def waveActiveBit : DXILOpClass; 178*0fca6ea1SDimitry Andric def waveActiveOp : DXILOpClass; 179*0fca6ea1SDimitry Andric def waveAllOp : DXILOpClass; 180*0fca6ea1SDimitry Andric def waveAllTrue : DXILOpClass; 181*0fca6ea1SDimitry Andric def waveAnyTrue : DXILOpClass; 182*0fca6ea1SDimitry Andric def waveGetLaneCount : DXILOpClass; 183*0fca6ea1SDimitry Andric def waveGetLaneIndex : DXILOpClass; 184*0fca6ea1SDimitry Andric def waveIsFirstLane : DXILOpClass; 185*0fca6ea1SDimitry Andric def waveMatch : DXILOpClass; 186*0fca6ea1SDimitry Andric def waveMatrix_Accumulate : DXILOpClass; 187*0fca6ea1SDimitry Andric def waveMatrix_Annotate : DXILOpClass; 188*0fca6ea1SDimitry Andric def waveMatrix_Depth : DXILOpClass; 189*0fca6ea1SDimitry Andric def waveMatrix_Fill : DXILOpClass; 190*0fca6ea1SDimitry Andric def waveMatrix_LoadGroupShared : DXILOpClass; 191*0fca6ea1SDimitry Andric def waveMatrix_LoadRawBuf : DXILOpClass; 192*0fca6ea1SDimitry Andric def waveMatrix_Multiply : DXILOpClass; 193*0fca6ea1SDimitry Andric def waveMatrix_ScalarOp : DXILOpClass; 194*0fca6ea1SDimitry Andric def waveMatrix_StoreGroupShared : DXILOpClass; 195*0fca6ea1SDimitry Andric def waveMatrix_StoreRawBuf : DXILOpClass; 196*0fca6ea1SDimitry Andric def waveMultiPrefixBitCount : DXILOpClass; 197*0fca6ea1SDimitry Andric def waveMultiPrefixOp : DXILOpClass; 198*0fca6ea1SDimitry Andric def wavePrefixOp : DXILOpClass; 199*0fca6ea1SDimitry Andric def waveReadLaneAt : DXILOpClass; 200*0fca6ea1SDimitry Andric def waveReadLaneFirst : DXILOpClass; 201*0fca6ea1SDimitry Andric def worldRayDirection : DXILOpClass; 202*0fca6ea1SDimitry Andric def worldRayOrigin : DXILOpClass; 203*0fca6ea1SDimitry Andric def worldToObject : DXILOpClass; 204*0fca6ea1SDimitry Andric def writeSamplerFeedback : DXILOpClass; 205*0fca6ea1SDimitry Andric def writeSamplerFeedbackBias : DXILOpClass; 206*0fca6ea1SDimitry Andric def writeSamplerFeedbackGrad : DXILOpClass; 207*0fca6ea1SDimitry Andric def writeSamplerFeedbackLevel: DXILOpClass; 208*0fca6ea1SDimitry Andric 209*0fca6ea1SDimitry Andric // This is a sentinel definition. Hence placed at the end of the list 210*0fca6ea1SDimitry Andric // and not as part of the above alphabetically sorted valid definitions. 211*0fca6ea1SDimitry Andric // Additionally it is capitalized unlike all the others. 212*0fca6ea1SDimitry Andric def UnknownOpClass: DXILOpClass; 21381ad6265SDimitry Andric} 21481ad6265SDimitry Andric 215*0fca6ea1SDimitry Andric// Several of the overloaded DXIL Operations support for data types 216*0fca6ea1SDimitry Andric// that are a subset of the overloaded LLVM intrinsics that they map to. 217*0fca6ea1SDimitry Andric// For e.g., llvm.sin.* intrinsic operates on any floating-point type and 218*0fca6ea1SDimitry Andric// maps for lowering to DXIL Op Sin. However, valid overloads of DXIL Sin 219*0fca6ea1SDimitry Andric// operation overloads are half (f16) and float (f32) only. 220*0fca6ea1SDimitry Andric// 221*0fca6ea1SDimitry Andric// The following abstracts overload types specific to DXIL operations. 22281ad6265SDimitry Andric 223*0fca6ea1SDimitry Andricclass DXILType : LLVMType<OtherVT> { 224*0fca6ea1SDimitry Andric let isAny = 1; 225*0fca6ea1SDimitry Andric int isI16OrI32 = 0; 226*0fca6ea1SDimitry Andric int isHalfOrFloat = 0; 22781ad6265SDimitry Andric} 22881ad6265SDimitry Andric 229*0fca6ea1SDimitry Andric// Concrete records for various overload types supported specifically by 230*0fca6ea1SDimitry Andric// DXIL Operations. 231*0fca6ea1SDimitry Andriclet isI16OrI32 = 1 in 232*0fca6ea1SDimitry Andric def llvm_i16ori32_ty : DXILType; 23381ad6265SDimitry Andric 234*0fca6ea1SDimitry Andriclet isHalfOrFloat = 1 in 235*0fca6ea1SDimitry Andric def llvm_halforfloat_ty : DXILType; 236*0fca6ea1SDimitry Andric 237*0fca6ea1SDimitry Andric// Abstraction DXIL Operation to LLVM intrinsic 238*0fca6ea1SDimitry Andricclass DXILOpMappingBase { 239*0fca6ea1SDimitry Andric int OpCode = 0; // Opcode of DXIL Operation 240*0fca6ea1SDimitry Andric DXILOpClass OpClass = UnknownOpClass;// Class of DXIL Operation. 241*0fca6ea1SDimitry Andric Intrinsic LLVMIntrinsic = ?; // LLVM Intrinsic DXIL Operation maps to 242*0fca6ea1SDimitry Andric string Doc = ""; // A short description of the operation 243*0fca6ea1SDimitry Andric list<LLVMType> OpTypes = ?; // Valid types of DXIL Operation in the 244*0fca6ea1SDimitry Andric // format [returnTy, param1ty, ...] 24581ad6265SDimitry Andric} 24681ad6265SDimitry Andric 247*0fca6ea1SDimitry Andricclass DXILOpMapping<int opCode, DXILOpClass opClass, 248*0fca6ea1SDimitry Andric Intrinsic intrinsic, string doc, 249*0fca6ea1SDimitry Andric list<LLVMType> opTys = []> : DXILOpMappingBase { 250*0fca6ea1SDimitry Andric int OpCode = opCode; // Opcode corresponding to DXIL Operation 251*0fca6ea1SDimitry Andric DXILOpClass OpClass = opClass; // Class of DXIL Operation. 252*0fca6ea1SDimitry Andric Intrinsic LLVMIntrinsic = intrinsic; // LLVM Intrinsic the DXIL Operation maps 253*0fca6ea1SDimitry Andric string Doc = doc; // to a short description of the operation 254*0fca6ea1SDimitry Andric list<LLVMType> OpTypes = !if(!eq(!size(opTys), 0), LLVMIntrinsic.Types, opTys); 25581ad6265SDimitry Andric} 25681ad6265SDimitry Andric 257*0fca6ea1SDimitry Andric// Concrete definition of DXIL Operation mapping to corresponding LLVM intrinsic 258*0fca6ea1SDimitry Andricdef Abs : DXILOpMapping<6, unary, int_fabs, 259*0fca6ea1SDimitry Andric "Returns the absolute value of the input.">; 260*0fca6ea1SDimitry Andricdef IsInf : DXILOpMapping<9, isSpecialFloat, int_dx_isinf, 261*0fca6ea1SDimitry Andric "Determines if the specified value is infinite.", 262*0fca6ea1SDimitry Andric [llvm_i1_ty, llvm_halforfloat_ty]>; 263*0fca6ea1SDimitry Andricdef Cos : DXILOpMapping<12, unary, int_cos, 264*0fca6ea1SDimitry Andric "Returns cosine(theta) for theta in radians.", 265*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 266*0fca6ea1SDimitry Andricdef Sin : DXILOpMapping<13, unary, int_sin, 267*0fca6ea1SDimitry Andric "Returns sine(theta) for theta in radians.", 268*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 269*0fca6ea1SDimitry Andricdef Tan : DXILOpMapping<14, unary, int_tan, 270*0fca6ea1SDimitry Andric "Returns tangent(theta) for theta in radians.", 271*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 272*0fca6ea1SDimitry Andricdef ACos : DXILOpMapping<15, unary, int_acos, 273*0fca6ea1SDimitry Andric "Returns the arccosine of each component of input.", 274*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 275*0fca6ea1SDimitry Andricdef ASin : DXILOpMapping<16, unary, int_asin, 276*0fca6ea1SDimitry Andric "Returns the arcsine of each component of input.", 277*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 278*0fca6ea1SDimitry Andricdef ATan : DXILOpMapping<17, unary, int_atan, 279*0fca6ea1SDimitry Andric "Returns the arctangent of each component of input.", 280*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 281*0fca6ea1SDimitry Andricdef HCos : DXILOpMapping<18, unary, int_cosh, 282*0fca6ea1SDimitry Andric "Returns the hyperbolic cosine of the specified value.", 283*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 284*0fca6ea1SDimitry Andricdef HSin : DXILOpMapping<19, unary, int_sinh, 285*0fca6ea1SDimitry Andric "Returns the hyperbolic sine of the specified value.", 286*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 287*0fca6ea1SDimitry Andricdef HTan : DXILOpMapping<20, unary, int_tanh, 288*0fca6ea1SDimitry Andric "Returns the hyperbolic tan of the specified value.", 289*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 29081ad6265SDimitry Andric 291*0fca6ea1SDimitry Andricdef Exp2 : DXILOpMapping<21, unary, int_exp2, 292*0fca6ea1SDimitry Andric "Returns the base 2 exponential, or 2**x, of the specified value." 293*0fca6ea1SDimitry Andric "exp2(x) = 2**x.", 294*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 295*0fca6ea1SDimitry Andricdef Frac : DXILOpMapping<22, unary, int_dx_frac, 296*0fca6ea1SDimitry Andric "Returns a fraction from 0 to 1 that represents the " 297*0fca6ea1SDimitry Andric "decimal part of the input.", 298*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 299*0fca6ea1SDimitry Andricdef Log2 : DXILOpMapping<23, unary, int_log2, 300*0fca6ea1SDimitry Andric "Returns the base-2 logarithm of the specified value.", 301*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 302*0fca6ea1SDimitry Andricdef Sqrt : DXILOpMapping<24, unary, int_sqrt, 303*0fca6ea1SDimitry Andric "Returns the square root of the specified floating-point" 304*0fca6ea1SDimitry Andric "value, per component.", 305*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 306*0fca6ea1SDimitry Andricdef RSqrt : DXILOpMapping<25, unary, int_dx_rsqrt, 307*0fca6ea1SDimitry Andric "Returns the reciprocal of the square root of the specified value." 308*0fca6ea1SDimitry Andric "rsqrt(x) = 1 / sqrt(x).", 309*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 310*0fca6ea1SDimitry Andricdef Round : DXILOpMapping<26, unary, int_roundeven, 311*0fca6ea1SDimitry Andric "Returns the input rounded to the nearest integer" 312*0fca6ea1SDimitry Andric "within a floating-point type.", 313*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 314*0fca6ea1SDimitry Andricdef Floor : DXILOpMapping<27, unary, int_floor, 315*0fca6ea1SDimitry Andric "Returns the largest integer that is less than or equal to the input.", 316*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 317*0fca6ea1SDimitry Andricdef Ceil : DXILOpMapping<28, unary, int_ceil, 318*0fca6ea1SDimitry Andric "Returns the smallest integer that is greater than or equal to the input.", 319*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 320*0fca6ea1SDimitry Andricdef Trunc : DXILOpMapping<29, unary, int_trunc, 321*0fca6ea1SDimitry Andric "Returns the specified value truncated to the integer component.", 322*0fca6ea1SDimitry Andric [llvm_halforfloat_ty, LLVMMatchType<0>]>; 323*0fca6ea1SDimitry Andricdef Rbits : DXILOpMapping<30, unary, int_bitreverse, 324*0fca6ea1SDimitry Andric "Returns the specified value with its bits reversed.", 325*0fca6ea1SDimitry Andric [llvm_anyint_ty, LLVMMatchType<0>]>; 326*0fca6ea1SDimitry Andricdef FMax : DXILOpMapping<35, binary, int_maxnum, 327*0fca6ea1SDimitry Andric "Float maximum. FMax(a,b) = a > b ? a : b">; 328*0fca6ea1SDimitry Andricdef FMin : DXILOpMapping<36, binary, int_minnum, 329*0fca6ea1SDimitry Andric "Float minimum. FMin(a,b) = a < b ? a : b">; 330*0fca6ea1SDimitry Andricdef SMax : DXILOpMapping<37, binary, int_smax, 331*0fca6ea1SDimitry Andric "Signed integer maximum. SMax(a,b) = a > b ? a : b">; 332*0fca6ea1SDimitry Andricdef SMin : DXILOpMapping<38, binary, int_smin, 333*0fca6ea1SDimitry Andric "Signed integer minimum. SMin(a,b) = a < b ? a : b">; 334*0fca6ea1SDimitry Andricdef UMax : DXILOpMapping<39, binary, int_umax, 335*0fca6ea1SDimitry Andric "Unsigned integer maximum. UMax(a,b) = a > b ? a : b">; 336*0fca6ea1SDimitry Andricdef UMin : DXILOpMapping<40, binary, int_umin, 337*0fca6ea1SDimitry Andric "Unsigned integer minimum. UMin(a,b) = a < b ? a : b">; 338*0fca6ea1SDimitry Andricdef FMad : DXILOpMapping<46, tertiary, int_fmuladd, 339*0fca6ea1SDimitry Andric "Floating point arithmetic multiply/add operation. fmad(m,a,b) = m * a + b.">; 340*0fca6ea1SDimitry Andricdef IMad : DXILOpMapping<48, tertiary, int_dx_imad, 341*0fca6ea1SDimitry Andric "Signed integer arithmetic multiply/add operation. imad(m,a,b) = m * a + b.">; 342*0fca6ea1SDimitry Andricdef UMad : DXILOpMapping<49, tertiary, int_dx_umad, 343*0fca6ea1SDimitry Andric "Unsigned integer arithmetic multiply/add operation. umad(m,a,b) = m * a + b.">; 344*0fca6ea1SDimitry Andriclet OpTypes = !listconcat([llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 4)) in 345*0fca6ea1SDimitry Andric def Dot2 : DXILOpMapping<54, dot2, int_dx_dot2, 346*0fca6ea1SDimitry Andric "dot product of two float vectors Dot(a,b) = a[0]*b[0] + ... + a[n]*b[n] where n is between 0 and 1">; 347*0fca6ea1SDimitry Andriclet OpTypes = !listconcat([llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 6)) in 348*0fca6ea1SDimitry Andric def Dot3 : DXILOpMapping<55, dot3, int_dx_dot3, 349*0fca6ea1SDimitry Andric "dot product of two float vectors Dot(a,b) = a[0]*b[0] + ... + a[n]*b[n] where n is between 0 and 2">; 350*0fca6ea1SDimitry Andriclet OpTypes = !listconcat([llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 8)) in 351*0fca6ea1SDimitry Andric def Dot4 : DXILOpMapping<56, dot4, int_dx_dot4, 352*0fca6ea1SDimitry Andric "dot product of two float vectors Dot(a,b) = a[0]*b[0] + ... + a[n]*b[n] where n is between 0 and 3">; 353*0fca6ea1SDimitry Andricdef ThreadId : DXILOpMapping<93, threadId, int_dx_thread_id, 354*0fca6ea1SDimitry Andric "Reads the thread ID">; 355*0fca6ea1SDimitry Andricdef GroupId : DXILOpMapping<94, groupId, int_dx_group_id, 356*0fca6ea1SDimitry Andric "Reads the group ID (SV_GroupID)">; 357*0fca6ea1SDimitry Andricdef ThreadIdInGroup : DXILOpMapping<95, threadIdInGroup, 358*0fca6ea1SDimitry Andric int_dx_thread_id_in_group, 359*0fca6ea1SDimitry Andric "Reads the thread ID within the group " 360*0fca6ea1SDimitry Andric "(SV_GroupThreadID)">; 361*0fca6ea1SDimitry Andricdef FlattenedThreadIdInGroup : DXILOpMapping<96, flattenedThreadIdInGroup, 362*0fca6ea1SDimitry Andric int_dx_flattened_thread_id_in_group, 363*0fca6ea1SDimitry Andric "Provides a flattened index for a " 364*0fca6ea1SDimitry Andric "given thread within a given " 365*0fca6ea1SDimitry Andric "group (SV_GroupIndex)">; 366