@@ -240,58 +240,63 @@ class DXILOpMappingBase {
240
240
DXILOpClass OpClass = UnknownOpClass;// Class of DXIL Operation.
241
241
Intrinsic LLVMIntrinsic = ?; // LLVM Intrinsic DXIL Operation maps to
242
242
string Doc = ""; // A short description of the operation
243
- list<LLVMType> OpTypes = ?; // Valid types of DXIL Operation in the
244
- // format [returnTy, param1ty, ...]
243
+ // The following fields denote the same semantics as those of Intrinsic class
244
+ // and are initialized with the same values as those of LLVMIntrinsic unless
245
+ // overridden in the definition of a record.
246
+ list<LLVMType> OpRetTypes = ?; // Valid return types of DXIL Operation
247
+ list<LLVMType> OpParamTypes = ?; // Valid parameter types of DXIL Operation
245
248
}
246
249
247
250
class DXILOpMapping<int opCode, DXILOpClass opClass,
248
251
Intrinsic intrinsic, string doc,
249
- list<LLVMType> opTys = []> : DXILOpMappingBase {
252
+ list<LLVMType> retTys = [],
253
+ list<LLVMType> paramTys = []> : DXILOpMappingBase {
250
254
int OpCode = opCode; // Opcode corresponding to DXIL Operation
251
255
DXILOpClass OpClass = opClass; // Class of DXIL Operation.
252
256
Intrinsic LLVMIntrinsic = intrinsic; // LLVM Intrinsic the DXIL Operation maps
253
257
string Doc = doc; // to a short description of the operation
254
- list<LLVMType> OpTypes = !if(!eq(!size(opTys), 0), LLVMIntrinsic.Types, opTys);
258
+ list<LLVMType> OpRetTypes = !if(!eq(!size(retTys), 0), LLVMIntrinsic.RetTypes, retTys);
259
+ list<LLVMType> OpParamTypes = !if(!eq(!size(paramTys), 0), LLVMIntrinsic.ParamTypes, paramTys);
255
260
}
256
261
257
262
// Concrete definition of DXIL Operation mapping to corresponding LLVM intrinsic
258
263
def Abs : DXILOpMapping<6, unary, int_fabs,
259
264
"Returns the absolute value of the input.">;
260
265
def IsInf : DXILOpMapping<9, isSpecialFloat, int_dx_isinf,
261
266
"Determines if the specified value is infinite.",
262
- [llvm_i1_ty, llvm_halforfloat_ty]>;
267
+ [llvm_i1_ty], [ llvm_halforfloat_ty]>;
263
268
def Cos : DXILOpMapping<12, unary, int_cos,
264
269
"Returns cosine(theta) for theta in radians.",
265
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
270
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
266
271
def Sin : DXILOpMapping<13, unary, int_sin,
267
272
"Returns sine(theta) for theta in radians.",
268
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
273
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
269
274
def Exp2 : DXILOpMapping<21, unary, int_exp2,
270
275
"Returns the base 2 exponential, or 2**x, of the specified value."
271
276
"exp2(x) = 2**x.",
272
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
277
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
273
278
def Frac : DXILOpMapping<22, unary, int_dx_frac,
274
279
"Returns a fraction from 0 to 1 that represents the "
275
280
"decimal part of the input.",
276
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
281
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
277
282
def Log2 : DXILOpMapping<23, unary, int_log2,
278
283
"Returns the base-2 logarithm of the specified value.",
279
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
284
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
280
285
def Sqrt : DXILOpMapping<24, unary, int_sqrt,
281
286
"Returns the square root of the specified floating-point"
282
287
"value, per component.",
283
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
288
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
284
289
def RSqrt : DXILOpMapping<25, unary, int_dx_rsqrt,
285
290
"Returns the reciprocal of the square root of the specified value."
286
291
"rsqrt(x) = 1 / sqrt(x).",
287
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
292
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
288
293
def Round : DXILOpMapping<26, unary, int_round,
289
294
"Returns the input rounded to the nearest integer"
290
295
"within a floating-point type.",
291
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
296
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
292
297
def Floor : DXILOpMapping<27, unary, int_floor,
293
298
"Returns the largest integer that is less than or equal to the input.",
294
- [llvm_halforfloat_ty, LLVMMatchType<0>]>;
299
+ [llvm_halforfloat_ty], [ LLVMMatchType<0>]>;
295
300
def FMax : DXILOpMapping<35, binary, int_maxnum,
296
301
"Float maximum. FMax(a,b) = a > b ? a : b">;
297
302
def FMin : DXILOpMapping<36, binary, int_minnum,
@@ -305,20 +310,28 @@ def UMax : DXILOpMapping<39, binary, int_umax,
305
310
def UMin : DXILOpMapping<40, binary, int_umin,
306
311
"Unsigned integer minimum. UMin(a,b) = a < b ? a : b">;
307
312
def FMad : DXILOpMapping<46, tertiary, int_fmuladd,
308
- "Floating point arithmetic multiply/add operation. fmad(m,a,b) = m * a + b.">;
313
+ "Floating point arithmetic multiply/add operation. "
314
+ "fmad(m,a,b) = m * a + b.">;
309
315
def IMad : DXILOpMapping<48, tertiary, int_dx_imad,
310
- "Signed integer arithmetic multiply/add operation. imad(m,a,b) = m * a + b.">;
316
+ "Signed integer arithmetic multiply/add operation. "
317
+ "imad(m,a,b) = m * a + b.">;
311
318
def UMad : DXILOpMapping<49, tertiary, int_dx_umad,
312
- "Unsigned integer arithmetic multiply/add operation. umad(m,a,b) = m * a + b.">;
313
- let OpTypes = !listconcat([llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 4)) in
314
- def Dot2 : DXILOpMapping<54, dot2, int_dx_dot2,
315
- "dot product of two float vectors Dot(a,b) = a[0]*b[0] + ... + a[n]*b[n] where n is between 0 and 1">;
316
- let OpTypes = !listconcat([llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 6)) in
317
- def Dot3 : DXILOpMapping<55, dot3, int_dx_dot3,
318
- "dot product of two float vectors Dot(a,b) = a[0]*b[0] + ... + a[n]*b[n] where n is between 0 and 2">;
319
- let OpTypes = !listconcat([llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 8)) in
320
- def Dot4 : DXILOpMapping<56, dot4, int_dx_dot4,
321
- "dot product of two float vectors Dot(a,b) = a[0]*b[0] + ... + a[n]*b[n] where n is between 0 and 3">;
319
+ "Unsigned integer arithmetic multiply/add operation. "
320
+ "umad(m,a,b) = m * a + b.">;
321
+ def Dot2 : DXILOpMapping<54, dot2, int_dx_dot2,
322
+ "dot product of two float vectors Dot(a,b) = a[0]*b[0]"
323
+ " + ... + a[n]*b[n] where n is between 0 and 1",
324
+ [llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 4)>;
325
+ def Dot3 : DXILOpMapping<55, dot3, int_dx_dot3,
326
+ "dot product of two float vectors Dot(a,b) = a[0]*b[0]"
327
+ " + ... + a[n]*b[n] where n is between 0 and 2",
328
+ [llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 6)>;
329
+ def Dot4 : DXILOpMapping<56, dot4, int_dx_dot4,
330
+ "dot product of two float vectors Dot(a,b) = a[0]*b[0]"
331
+ " + ... + a[n]*b[n] where n is between 0 and 3",
332
+ [llvm_halforfloat_ty], !listsplat(llvm_halforfloat_ty, 8)>;
333
+ def Barrier : DXILOpMapping<80, barrier, int_dx_barrier,
334
+ "Inserts a memory barrier in the shader">;
322
335
def ThreadId : DXILOpMapping<93, threadId, int_dx_thread_id,
323
336
"Reads the thread ID">;
324
337
def GroupId : DXILOpMapping<94, groupId, int_dx_group_id,
0 commit comments