@@ -321,8 +321,7 @@ class ConstOCLSPVBuiltin<string _Name, list<Type> _Signature> :
321
321
322
322
// OpenCL v1.0/1.2/2.0 s6.1.1: Built-in Scalar Data Types.
323
323
def Bool : IntType<"bool", QualType<"Context.BoolTy">, 1>;
324
- def TrueChar : IntType<"_char", QualType<"Context.CharTy", 0, 1>, 8>;
325
- def Char : IntType<"char", QualType<"Context.SignedCharTy", 0, 1>, 8>;
324
+ def Char : IntType<"char", QualType<"Context.CharTy", 0, 1>, 8>;
326
325
def SChar : IntType<"schar", QualType<"Context.SignedCharTy", 0, 1>, 8>;
327
326
def UChar : UIntType<"uchar", QualType<"Context.UnsignedCharTy">, 8>;
328
327
def Short : IntType<"short", QualType<"Context.ShortTy", 0, 1>, 16>;
@@ -356,19 +355,20 @@ def Vec16 : IntList<"Vec16", [16]>;
356
355
def Vec1234 : IntList<"Vec1234", [1, 2, 3, 4]>;
357
356
358
357
// Type lists.
359
- def TLAll : TypeList<[Char, UChar, Short, UShort, Int, UInt, Long, ULong, Float, Double, Half]>;
360
- def TLAllUnsigned : TypeList<[UChar, UChar, UShort, UShort, UInt, UInt, ULong, ULong, UInt, ULong, UShort]>;
361
- def TLAllWithBool : TypeList<[Bool, Char, UChar, Short, UShort, Int, UInt, Long,
358
+ def TLAll : TypeList<[Char, SChar, UChar, Short, UShort, Int, UInt, Long, ULong, Float, Double, Half]>;
359
+ def TLAllUnsigned : TypeList<[UChar, UChar, UChar, UShort, UShort, UInt, UInt, ULong, ULong, UInt, ULong, UShort]>;
360
+ def TLAllWithBool : TypeList<[Bool, Char, SChar, UChar, Short, UShort, Int, UInt, Long,
362
361
ULong, Float, Double, Half]>;
363
362
def TLFloat : TypeList<[Float, Double, Half]>;
364
363
// FIXME: handle properly char (signed or unsigned depending on host)
365
- def TLSignedInts : TypeList<[Char, Short, Int, Long]>;
366
- def TLUnsignedInts : TypeList<[UChar, UShort, UInt, ULong]>;
364
+ def TLSignedInts : TypeList<[Char, SChar, Short, Int, Long]>;
365
+ def TLUIToSIInts : TypeList<[UChar, UChar, UShort, UInt, ULong]>;
366
+ def TLUnsignedInts : TypeList<[UChar, UShort, UInt, ULong]>;
367
367
368
368
// Signed to Unsigned conversion
369
369
// FIXME: handle properly char (signed or unsigned depending on host)
370
- def TLSToUSignedInts : TypeList<[Char, Short, Int, Long]>;
371
- def TLSToUUnsignedInts : TypeList<[UChar, UShort, UInt, ULong]>;
370
+ def TLSToUSignedInts : TypeList<[Char, SChar, Short, Int, Long]>;
371
+ def TLSToUUnsignedInts : TypeList<[UChar, UChar, UShort, UInt, ULong]>;
372
372
373
373
def TLIntLongFloats : TypeList<[Int, UInt, Long, ULong, Float, Double, Half]>;
374
374
@@ -377,7 +377,7 @@ def TLIntLongFloats : TypeList<[Int, UInt, Long, ULong, Float, Double, Half]>;
377
377
// uchar abs(uchar).
378
378
def TLAllUIntsTwice : TypeList<[UChar, UChar, UChar, UShort, UShort, UInt, UInt, ULong, ULong]>;
379
379
380
- def TLAllInts : TypeList<[Char, UChar, Short, UShort, Int, UInt, Long, ULong]>;
380
+ def TLAllInts : TypeList<[Char, SChar, UChar, Short, UShort, Int, UInt, Long, ULong]>;
381
381
382
382
// GenType definitions for multiple base types (e.g. all floating point types,
383
383
// or all integer types).
@@ -394,6 +394,8 @@ def AIGenType1 : GenericType<"AIGenType1", TLAllInts, Vec1>;
394
394
def AIGenTypeN : GenericType<"AIGenTypeN", TLAllInts, VecAndScalar>;
395
395
def AUIGenTypeN : GenericType<"AUIGenTypeN", TLUnsignedInts, VecAndScalar>;
396
396
def ASIGenTypeN : GenericType<"ASIGenTypeN", TLSignedInts, VecAndScalar>;
397
+ // unsigned integers matching 1:1 with signed ints
398
+ def AUIToSIGenTypeN : GenericType<"AUIToSIGenTypeN", TLUIToSIInts, VecAndScalar>;
397
399
def AIGenTypeNNoScalar : GenericType<"AIGenTypeNNoScalar", TLAllInts, VecNoScalar>;
398
400
// All integer to unsigned
399
401
def AI2UGenTypeN : GenericType<"AI2UGenTypeN", TLAllUIntsTwice, VecAndScalar>;
@@ -403,6 +405,7 @@ def SGenTypeN : GenericType<"SGenTypeN", TLSignedInts, VecAndScalar
403
405
// Unsigned integer
404
406
def UGenType1 : GenericType<"UGenType1", TLUnsignedInts, Vec1>;
405
407
def UGenTypeN : GenericType<"UGenTypeN", TLUnsignedInts, VecAndScalar>;
408
+ def UToSGenTypeN : GenericType<"UToSGenTypeN", TLUIToSIInts, VecAndScalar>;
406
409
def UInt4 : GenericType<"UInt4", TypeList<[UInt]>, Vec4>;
407
410
// Float
408
411
def FGenType1 : GenericType<"FGenType1", TLFloat, Vec1>;
@@ -412,7 +415,7 @@ def IntLongFloatGenType1 : GenericType<"IntLongFloatGenType1", TLIntLongFloats
412
415
413
416
// GenType definitions for every single base type (e.g. fp32 only).
414
417
// Names are like: GenTypeFloatVecAndScalar.
415
- foreach Type = [Char, UChar, SChar , Short, UShort,
418
+ foreach Type = [Char, SChar, UChar , Short, UShort,
416
419
Int, UInt, Long, ULong,
417
420
Float, Double, Half] in {
418
421
foreach VecSizes = [VecAndScalar, VecNoScalar] in {
@@ -550,9 +553,9 @@ foreach name = ["clz", "ctz", "popcount"] in {
550
553
551
554
def : ConstOCLSPVBuiltin<"rotate", [AIGenTypeN, AIGenTypeN, AIGenTypeN]>;
552
555
553
- def : ConstOCLSPVBuiltin<"s_abs", [AUIGenTypeN , ASIGenTypeN]>;
556
+ def : ConstOCLSPVBuiltin<"s_abs", [AUIToSIGenTypeN , ASIGenTypeN]>;
554
557
555
- def : ConstOCLSPVBuiltin<"s_abs_diff", [AUIGenTypeN , ASIGenTypeN, ASIGenTypeN]>;
558
+ def : ConstOCLSPVBuiltin<"s_abs_diff", [AUIToSIGenTypeN , ASIGenTypeN, ASIGenTypeN]>;
556
559
557
560
foreach name = ["s_add_sat",
558
561
"s_hadd", "s_rhadd",
@@ -652,9 +655,9 @@ def : ConstOCLSPVBuiltin<"bitselect", [AGenTypeN, AGenTypeN, AGenTypeN, AGenType
652
655
653
656
foreach name = ["select"] in {
654
657
def : ConstOCLSPVBuiltin<name, [SGenTypeN, SGenTypeN, SGenTypeN, SGenTypeN]>;
655
- def : ConstOCLSPVBuiltin<name, [SGenTypeN, SGenTypeN, SGenTypeN, UGenTypeN ]>;
658
+ def : ConstOCLSPVBuiltin<name, [SGenTypeN, SGenTypeN, SGenTypeN, UToSGenTypeN ]>;
656
659
def : ConstOCLSPVBuiltin<name, [UGenTypeN, UGenTypeN, UGenTypeN, UGenTypeN]>;
657
- def : ConstOCLSPVBuiltin<name, [UGenTypeN, UGenTypeN, UGenTypeN , SGenTypeN]>;
660
+ def : ConstOCLSPVBuiltin<name, [UToSGenTypeN, UToSGenTypeN, UToSGenTypeN , SGenTypeN]>;
658
661
def : ConstOCLSPVBuiltin<name, [GenTypeFloatVecAndScalar, GenTypeFloatVecAndScalar, GenTypeFloatVecAndScalar, GenTypeUIntVecAndScalar]>;
659
662
def : ConstOCLSPVBuiltin<name, [GenTypeDoubleVecAndScalar, GenTypeDoubleVecAndScalar, GenTypeDoubleVecAndScalar, GenTypeULongVecAndScalar]>;
660
663
def : ConstOCLSPVBuiltin<name, [GenTypeHalfVecAndScalar, GenTypeHalfVecAndScalar, GenTypeHalfVecAndScalar, GenTypeUShortVecAndScalar]>;
@@ -872,16 +875,16 @@ foreach name = ["Dot"] in {
872
875
}
873
876
874
877
foreach name = ["Any", "All"] in {
875
- def : SPVBuiltin<name, [Bool, GenTypeSCharVecNoScalar ], Attr.Const>;
878
+ def : SPVBuiltin<name, [Bool, GenTypeCharVecNoScalar ], Attr.Const>;
876
879
}
877
880
878
881
foreach name = ["IsNan", "IsInf", "IsFinite", "IsNormal", "SignBitSet"] in {
879
882
def : SPVBuiltin<name, [Bool, Float], Attr.Const>;
880
883
def : SPVBuiltin<name, [Bool, Double], Attr.Const>;
881
884
def : SPVBuiltin<name, [Bool, Half], Attr.Const>;
882
- def : SPVBuiltin<name, [GenTypeSCharVecNoScalar , GenTypeFloatVecNoScalar], Attr.Const>;
883
- def : SPVBuiltin<name, [GenTypeSCharVecNoScalar , GenTypeDoubleVecNoScalar], Attr.Const>;
884
- def : SPVBuiltin<name, [GenTypeSCharVecNoScalar , GenTypeHalfVecNoScalar], Attr.Const>;
885
+ def : SPVBuiltin<name, [GenTypeCharVecNoScalar , GenTypeFloatVecNoScalar], Attr.Const>;
886
+ def : SPVBuiltin<name, [GenTypeCharVecNoScalar , GenTypeDoubleVecNoScalar], Attr.Const>;
887
+ def : SPVBuiltin<name, [GenTypeCharVecNoScalar , GenTypeHalfVecNoScalar], Attr.Const>;
885
888
}
886
889
887
890
foreach name = ["LessOrGreater",
@@ -895,9 +898,9 @@ foreach name = ["LessOrGreater",
895
898
def : SPVBuiltin<name, [Bool, Float, Float], Attr.Const>;
896
899
def : SPVBuiltin<name, [Bool, Double, Double], Attr.Const>;
897
900
def : SPVBuiltin<name, [Bool, Half, Half], Attr.Const>;
898
- def : SPVBuiltin<name, [GenTypeSCharVecNoScalar , GenTypeFloatVecNoScalar, GenTypeFloatVecNoScalar], Attr.Const>;
899
- def : SPVBuiltin<name, [GenTypeSCharVecNoScalar , GenTypeDoubleVecNoScalar, GenTypeDoubleVecNoScalar], Attr.Const>;
900
- def : SPVBuiltin<name, [GenTypeSCharVecNoScalar , GenTypeHalfVecNoScalar, GenTypeHalfVecNoScalar], Attr.Const>;
901
+ def : SPVBuiltin<name, [GenTypeCharVecNoScalar , GenTypeFloatVecNoScalar, GenTypeFloatVecNoScalar], Attr.Const>;
902
+ def : SPVBuiltin<name, [GenTypeCharVecNoScalar , GenTypeDoubleVecNoScalar, GenTypeDoubleVecNoScalar], Attr.Const>;
903
+ def : SPVBuiltin<name, [GenTypeCharVecNoScalar , GenTypeHalfVecNoScalar, GenTypeHalfVecNoScalar], Attr.Const>;
901
904
}
902
905
903
906
foreach name = ["BitCount"] in {
@@ -989,7 +992,7 @@ foreach name = ["GroupLogicalAndKHR", "GroupLogicalOrKHR"] in {
989
992
990
993
def SubgroupShuffleINTELVecType
991
994
: GenericType<"SubgroupShuffleINTELVecType",
992
- TypeList<[Char, UChar, Short, UShort, Int, UInt, Float]>,
995
+ TypeList<[Char, SChar, UChar, Short, UShort, Int, UInt, Float]>,
993
996
VecNoScalar>;
994
997
995
998
foreach name = ["SubgroupShuffleINTEL", "SubgroupShuffleXorINTEL"] in {
0 commit comments