summaryrefslogtreecommitdiff
path: root/lib/Sema/OpenCLBuiltins.td
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:52:09 +0000
commit519fc96c475680de2cc49e7811dbbfadb912cbcc (patch)
tree310ca684459b7e9ae13c9a3b9abf308b3a634afe /lib/Sema/OpenCLBuiltins.td
parent2298981669bf3bd63335a4be179bc0f96823a8f4 (diff)
Notes
Diffstat (limited to 'lib/Sema/OpenCLBuiltins.td')
-rw-r--r--lib/Sema/OpenCLBuiltins.td744
1 files changed, 561 insertions, 183 deletions
diff --git a/lib/Sema/OpenCLBuiltins.td b/lib/Sema/OpenCLBuiltins.td
index 7e37e55dbafab..2986140594675 100644
--- a/lib/Sema/OpenCLBuiltins.td
+++ b/lib/Sema/OpenCLBuiltins.td
@@ -20,75 +20,164 @@
//===----------------------------------------------------------------------===//
// Versions of OpenCL
class Version<int _Version> {
- int Version = _Version;
+ int ID = _Version;
}
-def CL10: Version<100>;
-def CL11: Version<110>;
-def CL12: Version<120>;
-def CL20: Version<200>;
+def CLAll : Version< 0>;
+def CL10 : Version<100>;
+def CL11 : Version<110>;
+def CL12 : Version<120>;
+def CL20 : Version<200>;
// Address spaces
// Pointer types need to be assigned an address space.
class AddressSpace<string _AS> {
- string AddrSpace = _AS;
+ string Name = _AS;
}
-def default_as : AddressSpace<"clang::LangAS::Default">;
-def private_as : AddressSpace<"clang::LangAS::opencl_private">;
-def global_as : AddressSpace<"clang::LangAS::opencl_global">;
-def constant_as : AddressSpace<"clang::LangAS::opencl_constant">;
-def local_as : AddressSpace<"clang::LangAS::opencl_local">;
-def generic_as : AddressSpace<"clang::LangAS::opencl_generic">;
+def DefaultAS : AddressSpace<"clang::LangAS::Default">;
+def PrivateAS : AddressSpace<"clang::LangAS::opencl_private">;
+def GlobalAS : AddressSpace<"clang::LangAS::opencl_global">;
+def ConstantAS : AddressSpace<"clang::LangAS::opencl_constant">;
+def LocalAS : AddressSpace<"clang::LangAS::opencl_local">;
+def GenericAS : AddressSpace<"clang::LangAS::opencl_generic">;
-// Qualified Type. Allow to retrieve one ASTContext QualType.
-class QualType<string _Name> {
+// Qualified Type. These map to ASTContext::QualType.
+class QualType<string _Name, bit _IsAbstract=0> {
// Name of the field or function in a clang::ASTContext
// E.g. Name="IntTy" for the int type, and "getIntPtrType()" for an intptr_t
string Name = _Name;
+ // Some QualTypes in this file represent an abstract type for which there is
+ // no corresponding AST QualType, e.g. a GenType or an `image2d_t` type
+ // without access qualifiers.
+ bit IsAbstract = _IsAbstract;
}
-// Helper class to store type access qualifiers (volatile, const, ...).
-class Qualifier<string _QualName> {
- string QualName = _QualName;
+// List of integers.
+class IntList<string _Name, list<int> _List> {
+ string Name = _Name;
+ list<int> List = _List;
}
//===----------------------------------------------------------------------===//
// OpenCL C classes for types
//===----------------------------------------------------------------------===//
-// OpenCL types (int, float, ...)
+// OpenCL C basic data types (int, float, image2d_t, ...).
+// Its child classes can represent concrete types (e.g. VectorType) or
+// abstract types (e.g. GenType).
class Type<string _Name, QualType _QTName> {
- // Name of the Type
+ // Name of the Type.
string Name = _Name;
- // QualType associated with this type
+ // QualType associated with this type.
QualType QTName = _QTName;
- // Size of the vector (if applicable)
- int VecWidth = 0;
- // Is pointer
+ // Size of the vector (if applicable).
+ int VecWidth = 1;
+ // Is a pointer.
bit IsPointer = 0;
- // List of qualifiers associated with the type (volatile, ...)
- list<Qualifier> QualList = [];
- // Address space
- string AddrSpace = "clang::LangAS::Default";
+ // "const" qualifier.
+ bit IsConst = 0;
+ // "volatile" qualifier.
+ bit IsVolatile = 0;
// Access qualifier. Must be one of ("RO", "WO", "RW").
string AccessQualifier = "";
+ // Address space.
+ string AddrSpace = DefaultAS.Name;
}
-// OpenCL vector types (e.g. int2, int3, int16, float8, ...)
+// OpenCL vector types (e.g. int2, int3, int16, float8, ...).
class VectorType<Type _Ty, int _VecWidth> : Type<_Ty.Name, _Ty.QTName> {
- int VecWidth = _VecWidth;
+ let VecWidth = _VecWidth;
+ let AccessQualifier = "";
+ // Inherited fields
+ let IsPointer = _Ty.IsPointer;
+ let IsConst = _Ty.IsConst;
+ let IsVolatile = _Ty.IsVolatile;
+ let AddrSpace = _Ty.AddrSpace;
}
-// OpenCL pointer types (e.g. int*, float*, ...)
-class PointerType<Type _Ty, AddressSpace _AS = global_as> :
+// OpenCL pointer types (e.g. int*, float*, ...).
+class PointerType<Type _Ty, AddressSpace _AS = DefaultAS> :
Type<_Ty.Name, _Ty.QTName> {
- bit IsPointer = 1;
- string AddrSpace = _AS.AddrSpace;
+ let AddrSpace = _AS.Name;
+ // Inherited fields
+ let VecWidth = _Ty.VecWidth;
+ let IsPointer = 1;
+ let IsConst = _Ty.IsConst;
+ let IsVolatile = _Ty.IsVolatile;
+ let AccessQualifier = _Ty.AccessQualifier;
+}
+
+// OpenCL const types (e.g. const int).
+class ConstType<Type _Ty> : Type<_Ty.Name, _Ty.QTName> {
+ let IsConst = 1;
+ // Inherited fields
+ let VecWidth = _Ty.VecWidth;
+ let IsPointer = _Ty.IsPointer;
+ let IsVolatile = _Ty.IsVolatile;
+ let AccessQualifier = _Ty.AccessQualifier;
+ let AddrSpace = _Ty.AddrSpace;
+}
+
+// OpenCL volatile types (e.g. volatile int).
+class VolatileType<Type _Ty> : Type<_Ty.Name, _Ty.QTName> {
+ let IsVolatile = 1;
+ // Inherited fields
+ let VecWidth = _Ty.VecWidth;
+ let IsPointer = _Ty.IsPointer;
+ let IsConst = _Ty.IsConst;
+ let AccessQualifier = _Ty.AccessQualifier;
+ let AddrSpace = _Ty.AddrSpace;
}
-// OpenCL image types (e.g. image2d_t, ...)
-class ImageType<Type _Ty, QualType _QTName, string _AccessQualifier> :
- Type<_Ty.Name, _QTName> {
+// OpenCL image types (e.g. image2d).
+class ImageType<Type _Ty, string _AccessQualifier> :
+ Type<_Ty.Name, QualType<_Ty.QTName.Name#_AccessQualifier#"Ty", 0>> {
+ let VecWidth = 0;
let AccessQualifier = _AccessQualifier;
+ // Inherited fields
+ let IsPointer = _Ty.IsPointer;
+ let IsConst = _Ty.IsConst;
+ let IsVolatile = _Ty.IsVolatile;
+ let AddrSpace = _Ty.AddrSpace;
+}
+
+// List of Types.
+class TypeList<string _Name, list<Type> _Type> {
+ string Name = _Name;
+ list<Type> List = _Type;
+}
+
+// A GenericType is an abstract type that defines a set of types as a
+// combination of Types and vector sizes.
+//
+// For example, if TypeList = <int, float> and VectorList = <1, 2, 4>, then it
+// represents <int, int2, int4, float, float2, float4>.
+//
+// Some rules apply when using multiple GenericType arguments in a declaration:
+// 1. The number of vector sizes must be equal or 1 for all gentypes in a
+// declaration.
+// 2. The number of Types must be equal or 1 for all gentypes in a
+// declaration.
+// 3. Generic types are combined by iterating over all generic types at once.
+// For example, for the following GenericTypes
+// GenT1 = GenericType<half, [1, 2]> and
+// GenT2 = GenericType<float, int, [1, 2]>
+// A declaration f(GenT1, GenT2) results in the combinations
+// f(half, float), f(half2, float2), f(half, int), f(half2, int2) .
+// 4. "sgentype" from the OpenCL specification is supported by specifying
+// a single vector size.
+// For example, for the following GenericTypes
+// GenT = GenericType<half, int, [1, 2]> and
+// SGenT = GenericType<half, int, [1]>
+// A declaration f(GenT, SGenT) results in the combinations
+// f(half, half), f(half2, half), f(int, int), f(int2, int) .
+class GenericType<string _Ty, TypeList _TypeList, IntList _VectorList> :
+ Type<_Ty, QualType<"null", 1>> {
+ // Possible element types of the generic type.
+ TypeList TypeList = _TypeList;
+ // Possible vector sizes of the types in the TypeList.
+ IntList VectorList = _VectorList;
+ // The VecWidth field is ignored for GenericTypes. Use VectorList instead.
+ let VecWidth = 0;
}
//===----------------------------------------------------------------------===//
@@ -103,141 +192,124 @@ class Builtin<string _Name, list<Type> _Signature> {
list<Type> Signature = _Signature;
// OpenCL Extension to which the function belongs (cl_khr_subgroups, ...)
string Extension = "";
- // OpenCL Version to which the function belongs (CL10, ...)
- Version Version = CL10;
+ // Version of OpenCL from which the function is available (e.g.: CL10).
+ // MinVersion is inclusive.
+ Version MinVersion = CL10;
+ // Version of OpenCL from which the function is not supported anymore.
+ // MaxVersion is exclusive.
+ // CLAll makes the function available for all versions.
+ Version MaxVersion = CLAll;
}
//===----------------------------------------------------------------------===//
-// Multiclass definitions
+// Definitions of OpenCL C types
//===----------------------------------------------------------------------===//
-// multiclass BifN: Creates Builtin class instances for OpenCL builtin
-// functions with N arguments.
-// _Name : Name of the function
-// _Signature : Signature of the function (list of the Type used by the
-// function, the first one being the return type).
-// _IsVector : List of bit indicating if the type in the _Signature at the
-// same index is to be a vector in the multiple overloads. The
-// list must have at least one non-zero value.
-multiclass Bif0<string _Name, list<Type> _Signature, list<bit> _IsVector> {
- def : Builtin<_Name, _Signature>;
- foreach v = [2, 3, 4, 8, 16] in {
- def : Builtin<_Name,
- [!if(_IsVector[0], VectorType<_Signature[0], v>, _Signature[0])]>;
- }
-}
-multiclass Bif1<string _Name, list<Type> _Signature, list<bit> _IsVector> {
- def : Builtin<_Name, _Signature>;
- foreach v = [2, 3, 4, 8, 16] in {
- def : Builtin<_Name,
- [!if(_IsVector[0], VectorType<_Signature[0], v>, _Signature[0]),
- !if(_IsVector[1], VectorType<_Signature[1], v>, _Signature[1])]>;
- }
-}
-multiclass Bif2<string _Name, list<Type> _Signature, list<bit> _IsVector> {
- def : Builtin<_Name, _Signature>;
- foreach v = [2, 3, 4, 8, 16] in {
- def : Builtin<_Name,
- [!if(_IsVector[0], VectorType<_Signature[0], v>, _Signature[0]),
- !if(_IsVector[1], VectorType<_Signature[1], v>, _Signature[1]),
- !if(_IsVector[2], VectorType<_Signature[2], v>, _Signature[2])]>;
- }
-}
-multiclass Bif3<string _Name, list<Type> _Signature, list<bit> _IsVector> {
- def : Builtin<_Name, _Signature>;
- foreach v = [2, 3, 4, 8, 16] in {
- def : Builtin<_Name,
- [!if(_IsVector[0], VectorType<_Signature[0], v>, _Signature[0]),
- !if(_IsVector[1], VectorType<_Signature[1], v>, _Signature[1]),
- !if(_IsVector[2], VectorType<_Signature[2], v>, _Signature[2]),
- !if(_IsVector[3], VectorType<_Signature[3], v>, _Signature[3])]>;
- }
-}
+
+// OpenCL v1.0/1.2/2.0 s6.1.1: Built-in Scalar Data Types.
+def Bool : Type<"bool", QualType<"BoolTy">>;
+def Char : Type<"char", QualType<"CharTy">>;
+def UChar : Type<"uchar", QualType<"UnsignedCharTy">>;
+def Short : Type<"short", QualType<"ShortTy">>;
+def UShort : Type<"ushort", QualType<"UnsignedShortTy">>;
+def Int : Type<"int", QualType<"IntTy">>;
+def UInt : Type<"uint", QualType<"UnsignedIntTy">>;
+def Long : Type<"long", QualType<"LongTy">>;
+def ULong : Type<"ulong", QualType<"UnsignedLongTy">>;
+def Float : Type<"float", QualType<"FloatTy">>;
+def Double : Type<"double", QualType<"DoubleTy">>;
+def Half : Type<"half", QualType<"HalfTy">>;
+def Size : Type<"size_t", QualType<"getSizeType()">>;
+def PtrDiff : Type<"ptrdiff_t", QualType<"getPointerDiffType()">>;
+def IntPtr : Type<"intptr_t", QualType<"getIntPtrType()">>;
+def UIntPtr : Type<"uintPtr_t", QualType<"getUIntPtrType()">>;
+def Void : Type<"void_t", QualType<"VoidTy">>;
+
+// OpenCL v1.0/1.2/2.0 s6.1.2: Built-in Vector Data Types.
+// Built-in vector data types are created by TableGen's OpenCLBuiltinEmitter.
+
+// OpenCL v1.0/1.2/2.0 s6.1.3: Other Built-in Data Types.
+// The image definitions are "abstract". They should not be used without
+// specifying an access qualifier (RO/WO/RW).
+def Image1d : Type<"Image1d", QualType<"OCLImage1d", 1>>;
+def Image2d : Type<"Image2d", QualType<"OCLImage2d", 1>>;
+def Image3d : Type<"Image3d", QualType<"OCLImage3d", 1>>;
+def Image1dArray : Type<"Image1dArray", QualType<"OCLImage1dArray", 1>>;
+def Image1dBuffer : Type<"Image1dBuffer", QualType<"OCLImage1dBuffer", 1>>;
+def Image2dArray : Type<"Image2dArray", QualType<"OCLImage2dArray", 1>>;
+def Image2dDepth : Type<"Image2dDepth", QualType<"OCLImage2dDepth", 1>>;
+def Image2dArrayDepth : Type<"Image2dArrayDepth", QualType<"OCLImage2dArrayDepth", 1>>;
+def Image2dMsaa : Type<"Image2dMsaa", QualType<"OCLImage2dMSAA", 1>>;
+def Image2dArrayMsaa : Type<"Image2dArrayMsaa", QualType<"OCLImage2dArrayMSAA", 1>>;
+def Image2dMsaaDepth : Type<"Image2dMsaaDepth", QualType<"OCLImage2dMSAADepth", 1>>;
+def Image2dArrayMsaaDepth : Type<"Image2dArrayMsaaDepth", QualType<"OCLImage2dArrayMSAADepth", 1>>;
+
+def Sampler : Type<"Sampler", QualType<"OCLSamplerTy">>;
+def Event : Type<"Event", QualType<"OCLEventTy">>;
+
//===----------------------------------------------------------------------===//
-// Definitions of OpenCL C types
+// Definitions of OpenCL gentype variants
//===----------------------------------------------------------------------===//
-// OpenCL v1.2 s6.1.1: Built-in Scalar Data Types
-def bool_t : Type<"bool", QualType<"BoolTy">>;
-def char_t : Type<"char", QualType<"CharTy">>;
-def uchar_t : Type<"uchar", QualType<"UnsignedCharTy">>;
-def short_t : Type<"short", QualType<"ShortTy">>;
-def ushort_t : Type<"ushort", QualType<"UnsignedShortTy">>;
-def int_t : Type<"int", QualType<"IntTy">>;
-def uint_t : Type<"uint", QualType<"UnsignedIntTy">>;
-def long_t : Type<"long", QualType<"LongTy">>;
-def ulong_t : Type<"ulong", QualType<"UnsignedLongTy">>;
-def float_t : Type<"float", QualType<"FloatTy">>;
-def double_t : Type<"double", QualType<"DoubleTy">>;
-def half_t : Type<"half", QualType<"HalfTy">>;
-def size_t : Type<"size_t", QualType<"getSizeType()">>;
-def ptrdiff_t : Type<"ptrdiff_t", QualType<"getPointerDiffType()">>;
-def intptr_t : Type<"intptr_t", QualType<"getIntPtrType()">>;
-def uintptr_t : Type<"uintptr_t", QualType<"getUIntPtrType()">>;
-def void_t : Type<"void", QualType<"VoidTy">>;
-
-// OpenCL v1.2 s6.1.2: Built-in Vector Data Types
-foreach v = [2, 3, 4, 8, 16] in {
- def char#v#_t : VectorType<char_t, v>;
- def uchar#v#_t : VectorType<uchar_t, v>;
- def short#v#_t : VectorType<short_t, v>;
- def ushort#v#_t : VectorType<ushort_t, v>;
- def "int"#v#_t : VectorType<int_t, v>;
- def uint#v#_t : VectorType<uint_t, v>;
- def long#v#_t : VectorType<long_t, v>;
- def ulong#v#_t : VectorType<ulong_t, v>;
- def float#v#_t : VectorType<float_t, v>;
- def double#v#_t : VectorType<double_t, v>;
- def half#v#_t : VectorType<half_t, v>;
-}
-
-// OpenCL v1.2 s6.1.3: Other Built-in Data Types
-// These definitions with a "null" name are "abstract". They should not
-// be used in definitions of Builtin functions.
-def image2d_t : Type<"image2d_t", QualType<"null">>;
-def image3d_t : Type<"image3d_t", QualType<"null">>;
-def image2d_array_t : Type<"image2d_array_t", QualType<"null">>;
-def image1d_t : Type<"image1d_t", QualType<"null">>;
-def image1d_buffer_t : Type<"image1d_buffer_t", QualType<"null">>;
-def image1d_array_t : Type<"image1d_array_t", QualType<"null">>;
-// Unlike the few functions above, the following definitions can be used
-// in definitions of Builtin functions (they have a QualType with a name).
-foreach v = ["RO", "WO", "RW"] in {
- def image2d_#v#_t : ImageType<image2d_t,
- QualType<"OCLImage2d"#v#"Ty">,
- v>;
- def image3d_#v#_t : ImageType<image3d_t,
- QualType<"OCLImage3d"#v#"Ty">,
- v>;
- def image2d_array#v#_t : ImageType<image2d_array_t,
- QualType<"OCLImage2dArray"#v#"Ty">,
- v>;
- def image1d_#v#_t : ImageType<image1d_t,
- QualType<"OCLImage1d"#v#"Ty">,
- v>;
- def image1d_buffer#v#_t : ImageType<image1d_buffer_t,
- QualType<"OCLImage1dBuffer"#v#"Ty">,
- v>;
- def image1d_array#v#_t : ImageType<image1d_array_t,
- QualType<"OCLImage1dArray"#v#"Ty">,
- v>;
-}
-
-def sampler_t : Type<"sampler_t", QualType<"OCLSamplerTy">>;
-def event_t : Type<"event_t", QualType<"OCLEventTy">>;
+// The OpenCL specification often uses "gentype" in builtin function
+// declarations to indicate that a builtin function is available with various
+// argument and return types. The types represented by "gentype" vary between
+// different parts of the specification. The following definitions capture
+// the different type lists for gentypes in different parts of the
+// specification.
+
+// Vector width lists.
+def VecAndScalar: IntList<"VecAndScalar", [1, 2, 3, 4, 8, 16]>;
+def VecNoScalar : IntList<"VecNoScalar", [2, 3, 4, 8, 16]>;
+def Vec1 : IntList<"Vec1", [1]>;
+
+// Type lists.
+def TLAll : TypeList<"TLAll", [Char, UChar, Short, UShort, Int, UInt, Long, ULong, Float, Double, Half]>;
+def TLFloat : TypeList<"TLFloat", [Float, Double, Half]>;
+
+def TLAllInts : TypeList<"TLAllInts", [Char, UChar, Short, UShort, Int, UInt, Long, ULong]>;
+
+// GenType definitions for multiple base types (e.g. all floating point types,
+// or all integer types).
+// All types
+def AGenTypeN : GenericType<"AGenTypeN", TLAll, VecAndScalar>;
+def AGenTypeNNoScalar : GenericType<"AGenTypeNNoScalar", TLAll, VecNoScalar>;
+// All integer
+def AIGenType1 : GenericType<"AIGenType1", TLAllInts, Vec1>;
+def AIGenTypeN : GenericType<"AIGenTypeN", TLAllInts, VecAndScalar>;
+def AIGenTypeNNoScalar : GenericType<"AIGenTypeNNoScalar", TLAllInts, VecNoScalar>;
+// Float
+def FGenTypeN : GenericType<"FGenTypeN", TLFloat, VecAndScalar>;
+
+// GenType definitions for every single base type (e.g. fp32 only).
+// Names are like: GenTypeFloatVecAndScalar.
+foreach Type = [Char, UChar, Short, UShort,
+ Int, UInt, Long, ULong,
+ Float, Double, Half] in {
+ foreach VecSizes = [VecAndScalar, VecNoScalar] in {
+ def "GenType" # Type # VecSizes :
+ GenericType<"GenType" # Type # VecSizes,
+ TypeList<"GL" # Type.Name, [Type]>,
+ VecSizes>;
+ }
+}
+
//===----------------------------------------------------------------------===//
// Definitions of OpenCL builtin functions
//===----------------------------------------------------------------------===//
-// OpenCL v1.2 s6.2.3: Explicit Conversions
-// Generate the convert_ builtins.
-foreach RType = [float_t, double_t, char_t, uchar_t, short_t, ushort_t,
- int_t, uint_t, long_t, ulong_t] in {
- foreach IType = [float_t, double_t, char_t, uchar_t, short_t, ushort_t,
- int_t, uint_t, long_t, ulong_t] in {
+//--------------------------------------------------------------------
+// OpenCL v1.1/1.2/2.0 s6.2.3 - Explicit conversions.
+// OpenCL v2.0 Extensions s5.1.1 and s6.1.1 - Conversions.
+
+// Generate the convert_* builtins functions.
+foreach RType = [Float, Double, Half, Char, UChar, Short,
+ UShort, Int, UInt, Long, ULong] in {
+ foreach IType = [Float, Double, Half, Char, UChar, Short,
+ UShort, Int, UInt, Long, ULong] in {
foreach sat = ["", "_sat"] in {
- foreach rte = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
- def : Builtin<"convert_" # RType.Name # sat # rte, [RType, IType]>;
+ foreach rnd = ["", "_rte", "_rtn", "_rtp", "_rtz"] in {
+ def : Builtin<"convert_" # RType.Name # sat # rnd, [RType, IType]>;
foreach v = [2, 3, 4, 8, 16] in {
- def : Builtin<"convert_" # RType.Name # v # sat # rte,
+ def : Builtin<"convert_" # RType.Name # v # sat # rnd,
[VectorType<RType, v>,
VectorType<IType, v>]>;
}
@@ -246,51 +318,357 @@ foreach RType = [float_t, double_t, char_t, uchar_t, short_t, ushort_t,
}
}
-// OpenCL v1.2 s6.12.1: Work-Item Functions
-def get_work_dim : Builtin<"get_work_dim", [uint_t]>;
+//--------------------------------------------------------------------
+// OpenCL v1.1 s6.11.1, v1.2 s6.12.1, v2.0 s6.13.1 - Work-item Functions
+// --- Table 7 ---
+def : Builtin<"get_work_dim", [UInt]>;
foreach name = ["get_global_size", "get_global_id", "get_local_size",
"get_local_id", "get_num_groups", "get_group_id",
"get_global_offset"] in {
- def : Builtin<name, [size_t, uint_t]>;
+ def : Builtin<name, [Size, UInt]>;
+}
+
+let MinVersion = CL20 in {
+ def : Builtin<"get_enqueued_local_size", [Size, UInt]>;
+ foreach name = ["get_global_linear_id", "get_local_linear_id"] in {
+ def : Builtin<name, [Size]>;
+ }
+}
+
+//--------------------------------------------------------------------
+// OpenCL v1.1 s6.11.7, v1.2 s6.12.7, v2.0 s6.13.7 - Vector Data Load and Store Functions
+// OpenCL Extension v1.1 s9.3.6 and s9.6.6, v1.2 s9.5.6, v2.0 s9.4.6, v2.0 s5.1.6 and 6.1.6 - Vector Data Load and Store Functions
+// --- Table 15 ---
+// Variants for OpenCL versions below 2.0, using pointers to the global, local
+// and private address spaces.
+let MaxVersion = CL20 in {
+ foreach AS = [GlobalAS, LocalAS, PrivateAS] in {
+ foreach VSize = [2, 3, 4, 8, 16] in {
+ foreach name = ["vload" # VSize] in {
+ def : Builtin<name, [VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, AS>]>;
+ def : Builtin<name, [VectorType<UChar, VSize>, Size, PointerType<ConstType<UChar>, AS>]>;
+ def : Builtin<name, [VectorType<Short, VSize>, Size, PointerType<ConstType<Short>, AS>]>;
+ def : Builtin<name, [VectorType<UShort, VSize>, Size, PointerType<ConstType<UShort>, AS>]>;
+ def : Builtin<name, [VectorType<Int, VSize>, Size, PointerType<ConstType<Int>, AS>]>;
+ def : Builtin<name, [VectorType<UInt, VSize>, Size, PointerType<ConstType<UInt>, AS>]>;
+ def : Builtin<name, [VectorType<Long, VSize>, Size, PointerType<ConstType<Long>, AS>]>;
+ def : Builtin<name, [VectorType<ULong, VSize>, Size, PointerType<ConstType<ULong>, AS>]>;
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Float>, AS>]>;
+ def : Builtin<name, [VectorType<Double, VSize>, Size, PointerType<ConstType<Double>, AS>]>;
+ def : Builtin<name, [VectorType<Half, VSize>, Size, PointerType<ConstType<Half>, AS>]>;
+ }
+ foreach name = ["vstore" # VSize] in {
+ def : Builtin<name, [Void, VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, AS>]>;
+ def : Builtin<name, [Void, VectorType<UChar, VSize>, Size, PointerType<ConstType<UChar>, AS>]>;
+ def : Builtin<name, [Void, VectorType<Short, VSize>, Size, PointerType<ConstType<Short>, AS>]>;
+ def : Builtin<name, [Void, VectorType<UShort, VSize>, Size, PointerType<ConstType<UShort>, AS>]>;
+ def : Builtin<name, [Void, VectorType<Int, VSize>, Size, PointerType<ConstType<Int>, AS>]>;
+ def : Builtin<name, [Void, VectorType<UInt, VSize>, Size, PointerType<ConstType<UInt>, AS>]>;
+ def : Builtin<name, [Void, VectorType<Long, VSize>, Size, PointerType<ConstType<Long>, AS>]>;
+ def : Builtin<name, [Void, VectorType<ULong, VSize>, Size, PointerType<ConstType<ULong>, AS>]>;
+ def : Builtin<name, [Void, VectorType<Float, VSize>, Size, PointerType<ConstType<Float>, AS>]>;
+ def : Builtin<name, [Void, VectorType<Double, VSize>, Size, PointerType<ConstType<Double>, AS>]>;
+ def : Builtin<name, [Void, VectorType<Half, VSize>, Size, PointerType<ConstType<Half>, AS>]>;
+ }
+ foreach name = ["vloada_half" # VSize] in {
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, AS>]>;
+ }
+ foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
+ foreach name = ["vstorea_half" # VSize # rnd] in {
+ def : Builtin<name, [Void, VectorType<Float, VSize>, Size, PointerType<Half, AS>]>;
+ def : Builtin<name, [Void, VectorType<Double, VSize>, Size, PointerType<Half, AS>]>;
+ }
+ }
+ }
+ }
+}
+// Variants for OpenCL versions above 2.0, using pointers to the generic
+// address space.
+let MinVersion = CL20 in {
+ foreach VSize = [2, 3, 4, 8, 16] in {
+ foreach name = ["vload" # VSize] in {
+ def : Builtin<name, [VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, GenericAS>]>;
+ def : Builtin<name, [VectorType<UChar, VSize>, Size, PointerType<ConstType<UChar>, GenericAS>]>;
+ def : Builtin<name, [VectorType<Short, VSize>, Size, PointerType<ConstType<Short>, GenericAS>]>;
+ def : Builtin<name, [VectorType<UShort, VSize>, Size, PointerType<ConstType<UShort>, GenericAS>]>;
+ def : Builtin<name, [VectorType<Int, VSize>, Size, PointerType<ConstType<Int>, GenericAS>]>;
+ def : Builtin<name, [VectorType<UInt, VSize>, Size, PointerType<ConstType<UInt>, GenericAS>]>;
+ def : Builtin<name, [VectorType<Long, VSize>, Size, PointerType<ConstType<Long>, GenericAS>]>;
+ def : Builtin<name, [VectorType<ULong, VSize>, Size, PointerType<ConstType<ULong>, GenericAS>]>;
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Float>, GenericAS>]>;
+ def : Builtin<name, [VectorType<Double, VSize>, Size, PointerType<ConstType<Double>, GenericAS>]>;
+ def : Builtin<name, [VectorType<Half, VSize>, Size, PointerType<ConstType<Half>, GenericAS>]>;
+ }
+ foreach name = ["vstore" # VSize] in {
+ def : Builtin<name, [Void, VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<UChar, VSize>, Size, PointerType<ConstType<UChar>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<Short, VSize>, Size, PointerType<ConstType<Short>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<UShort, VSize>, Size, PointerType<ConstType<UShort>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<Int, VSize>, Size, PointerType<ConstType<Int>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<UInt, VSize>, Size, PointerType<ConstType<UInt>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<Long, VSize>, Size, PointerType<ConstType<Long>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<ULong, VSize>, Size, PointerType<ConstType<ULong>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<Float, VSize>, Size, PointerType<ConstType<Float>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<Double, VSize>, Size, PointerType<ConstType<Double>, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<Half, VSize>, Size, PointerType<ConstType<Half>, GenericAS>]>;
+ }
+ foreach name = ["vloada_half" # VSize] in {
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, GenericAS>]>;
+ }
+ foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
+ foreach name = ["vstorea_half" # VSize # rnd] in {
+ def : Builtin<name, [Void, VectorType<Float, VSize>, Size, PointerType<Half, GenericAS>]>;
+ def : Builtin<name, [Void, VectorType<Double, VSize>, Size, PointerType<Half, GenericAS>]>;
+ }
+ }
+ }
+}
+// Variants using pointers to the constant address space.
+foreach VSize = [2, 3, 4, 8, 16] in {
+ foreach name = ["vload" # VSize] in {
+ def : Builtin<name, [VectorType<Char, VSize>, Size, PointerType<ConstType<Char>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<UChar, VSize>, Size, PointerType<ConstType<UChar>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<Short, VSize>, Size, PointerType<ConstType<Short>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<UShort, VSize>, Size, PointerType<ConstType<UShort>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<Int, VSize>, Size, PointerType<ConstType<Int>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<UInt, VSize>, Size, PointerType<ConstType<UInt>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<Long, VSize>, Size, PointerType<ConstType<Long>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<ULong, VSize>, Size, PointerType<ConstType<ULong>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Float>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<Double, VSize>, Size, PointerType<ConstType<Double>, ConstantAS>]>;
+ def : Builtin<name, [VectorType<Half, VSize>, Size, PointerType<ConstType<Half>, ConstantAS>]>;
+ }
+ foreach name = ["vloada_half" # VSize] in {
+ def : Builtin<name, [VectorType<Float, VSize>, Size, PointerType<ConstType<Half>, ConstantAS>]>;
+ }
+ foreach rnd = ["", "_rte", "_rtz", "_rtp", "_rtn"] in {
+ foreach name = ["vstorea_half" # VSize # rnd] in {
+ def : Builtin<name, [Void, VectorType<Float, VSize>, Size, PointerType<Half, ConstantAS>]>;
+ def : Builtin<name, [Void, VectorType<Double, VSize>, Size, PointerType<Half, ConstantAS>]>;
+ }
+ }
+}
+
+//--------------------------------------------------------------------
+// OpenCL v1.1 s6.11.10, v1.2 s6.12.10, v2.0 s6.13.10: Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch
+// OpenCL Extension v2.0 s5.1.7 and s6.1.7: Async Copies from Global to Local Memory, Local to Global Memory, and Prefetch
+// --- Table 18 ---
+foreach name = ["async_work_group_copy"] in {
+ def : Builtin<name, [Event, PointerType<AGenTypeN, LocalAS>, PointerType<ConstType<AGenTypeN>, GlobalAS>, Size, Event]>;
+ def : Builtin<name, [Event, PointerType<AGenTypeN, GlobalAS>, PointerType<ConstType<AGenTypeN>, LocalAS>, Size, Event]>;
+}
+foreach name = ["async_work_group_strided_copy"] in {
+ def : Builtin<name, [Event, PointerType<AGenTypeN, LocalAS>, PointerType<ConstType<AGenTypeN>, GlobalAS>, Size, Size, Event]>;
+ def : Builtin<name, [Event, PointerType<AGenTypeN, GlobalAS>, PointerType<ConstType<AGenTypeN>, LocalAS>, Size, Size, Event]>;
+}
+foreach name = ["wait_group_events"] in {
+ def : Builtin<name, [Void, Int, PointerType<Event, GenericAS>]>;
+}
+foreach name = ["prefetch"] in {
+ def : Builtin<name, [Void, PointerType<ConstType<AGenTypeN>, GlobalAS>, Size]>;
+}
+
+//--------------------------------------------------------------------
+// OpenCL v2.0 s6.13.11 - Atomics Functions.
+// Functions that use memory_order and cl_mem_fence_flags enums are not
+// declared here as the TableGen backend does not handle enums.
+
+// OpenCL v1.0 s9.5, s9.6, s9.7 - Atomic Functions for 32-bit integers.
+// --- Table 9.1 ---
+foreach Type = [Int, UInt] in {
+ foreach name = ["atom_add", "atom_sub", "atom_xchg"] in {
+ def : Builtin<name, [Type, PointerType<VolatileType<Type>, GlobalAS>, Type]>;
+ }
+ foreach name = ["atom_inc", "atom_dec"] in {
+ def : Builtin<name, [Type, PointerType<VolatileType<Type>, GlobalAS>]>;
+ }
+ foreach name = ["atom_cmpxchg"] in {
+ def : Builtin<name, [Type, PointerType<VolatileType<Type>, GlobalAS>, Type, Type]>;
+ }
}
// OpenCL v1.2 s6.12.2: Math Functions
foreach name = ["acos", "acosh", "acospi",
"asin", "asinh", "asinpi",
"atan", "atanh", "atanpi"] in {
- foreach type = [float_t, double_t, half_t] in {
- defm : Bif1<name, [type, type], [1, 1]>;
- }
+ def : Builtin<name, [FGenTypeN, FGenTypeN]>;
}
foreach name = ["atan2", "atan2pi"] in {
- foreach type = [float_t, double_t, half_t] in {
- defm : Bif2<name, [type, type, type], [1, 1, 1]>;
- }
+ def : Builtin<name, [FGenTypeN, FGenTypeN, FGenTypeN]>;
}
foreach name = ["fmax", "fmin"] in {
- foreach type = [float_t, double_t, half_t] in {
- defm : Bif2<name, [type, type, type], [1, 1, 1]>;
- defm : Bif2<name, [type, type, type], [1, 1, 0]>;
+ def : Builtin<name, [FGenTypeN, FGenTypeN, FGenTypeN]>;
+ def : Builtin<name, [GenTypeFloatVecNoScalar, GenTypeFloatVecNoScalar, Float]>;
+ def : Builtin<name, [GenTypeDoubleVecNoScalar, GenTypeDoubleVecNoScalar, Double]>;
+ def : Builtin<name, [GenTypeHalfVecNoScalar, GenTypeHalfVecNoScalar, Half]>;
+}
+
+// OpenCL v1.1 s6.11.3, v1.2 s6.12.3, v2.0 s6.13.3 - Integer Functions
+foreach name = ["max", "min"] in {
+ def : Builtin<name, [AIGenTypeN, AIGenTypeN, AIGenTypeN]>;
+ def : Builtin<name, [AIGenTypeNNoScalar, AIGenTypeNNoScalar, AIGenType1]>;
+}
+
+//--------------------------------------------------------------------
+// OpenCL v1.1 s6.11.3, v1.2 s6.12.14, v2.0 s6.13.14: Image Read and Write Functions
+// OpenCL Extension v2.0 s5.1.8 and s6.1.8: Image Read and Write Functions
+// --- Table 22: Image Read Functions with Samplers ---
+foreach imgTy = [Image1d] in {
+ foreach coordTy = [Int, Float] in {
+ def : Builtin<"read_imagef", [VectorType<Float, 4>, ImageType<imgTy, "RO">, Sampler, coordTy]>;
+ def : Builtin<"read_imagei", [VectorType<Int, 4>, ImageType<imgTy, "RO">, Sampler, coordTy]>;
+ def : Builtin<"read_imageui", [VectorType<UInt, 4>, ImageType<imgTy, "RO">, Sampler, coordTy]>;
+ }
+}
+foreach imgTy = [Image2d, Image1dArray] in {
+ foreach coordTy = [Int, Float] in {
+ def : Builtin<"read_imagef", [VectorType<Float, 4>, ImageType<imgTy, "RO">, Sampler, VectorType<coordTy, 2>]>;
+ def : Builtin<"read_imagei", [VectorType<Int, 4>, ImageType<imgTy, "RO">, Sampler, VectorType<coordTy, 2>]>;
+ def : Builtin<"read_imageui", [VectorType<UInt, 4>, ImageType<imgTy, "RO">, Sampler, VectorType<coordTy, 2>]>;
}
}
+foreach imgTy = [Image3d, Image2dArray] in {
+ foreach coordTy = [Int, Float] in {
+ def : Builtin<"read_imagef", [VectorType<Float, 4>, ImageType<imgTy, "RO">, Sampler, VectorType<coordTy, 4>]>;
+ def : Builtin<"read_imagei", [VectorType<Int, 4>, ImageType<imgTy, "RO">, Sampler, VectorType<coordTy, 4>]>;
+ def : Builtin<"read_imageui", [VectorType<UInt, 4>, ImageType<imgTy, "RO">, Sampler, VectorType<coordTy, 4>]>;
+ }
+}
+foreach coordTy = [Int, Float] in {
+ def : Builtin<"read_imagef", [Float, ImageType<Image2dDepth, "RO">, Sampler, VectorType<coordTy, 2>]>;
+ def : Builtin<"read_imagef", [Float, ImageType<Image2dArrayDepth, "RO">, Sampler, VectorType<coordTy, 4>]>;
+}
-// OpenCL v1.2 s6.12.14: Built-in Image Read Functions
-def read_imagef : Builtin<"read_imagef",
- [float4_t, image2d_RO_t, VectorType<int_t, 2>]>;
-def write_imagef : Builtin<"write_imagef",
- [void_t,
- image2d_WO_t,
- VectorType<int_t, 2>,
- VectorType<float_t, 4>]>;
+// --- Table 23: Sampler-less Read Functions ---
+foreach aQual = ["RO", "RW"] in {
+ foreach imgTy = [Image2d, Image1dArray] in {
+ def : Builtin<"read_imagef", [VectorType<Float, 4>, ImageType<imgTy, aQual>, VectorType<Int, 2>]>;
+ def : Builtin<"read_imagei", [VectorType<Int, 4>, ImageType<imgTy, aQual>, VectorType<Int, 2>]>;
+ def : Builtin<"read_imageui", [VectorType<UInt, 4>, ImageType<imgTy, aQual>, VectorType<Int, 2>]>;
+ }
+ foreach imgTy = [Image3d, Image2dArray] in {
+ def : Builtin<"read_imagef", [VectorType<Float, 4>, ImageType<imgTy, aQual>, VectorType<Int, 4>]>;
+ def : Builtin<"read_imagei", [VectorType<Int, 4>, ImageType<imgTy, aQual>, VectorType<Int, 4>]>;
+ def : Builtin<"read_imageui", [VectorType<UInt, 4>, ImageType<imgTy, aQual>, VectorType<Int, 4>]>;
+ }
+ foreach imgTy = [Image1d, Image1dBuffer] in {
+ def : Builtin<"read_imagef", [VectorType<Float, 4>, ImageType<imgTy, aQual>, Int]>;
+ def : Builtin<"read_imagei", [VectorType<Int, 4>, ImageType<imgTy, aQual>, Int]>;
+ def : Builtin<"read_imageui", [VectorType<UInt, 4>, ImageType<imgTy, aQual>, Int]>;
+ }
+ def : Builtin<"read_imagef", [Float, ImageType<Image2dDepth, aQual>, VectorType<Int, 2>]>;
+ def : Builtin<"read_imagef", [Float, ImageType<Image2dArrayDepth, aQual>, VectorType<Int, 4>]>;
+}
+
+// --- Table 24: Image Write Functions ---
+foreach aQual = ["WO", "RW"] in {
+ foreach imgTy = [Image2d] in {
+ def : Builtin<"write_imagef", [Void, ImageType<imgTy, aQual>, VectorType<Int, 2>, VectorType<Float, 4>]>;
+ def : Builtin<"write_imagei", [Void, ImageType<imgTy, aQual>, VectorType<Int, 2>, VectorType<Int, 4>]>;
+ def : Builtin<"write_imageui", [Void, ImageType<imgTy, aQual>, VectorType<Int, 2>, VectorType<UInt, 4>]>;
+ }
+ foreach imgTy = [Image2dArray] in {
+ def : Builtin<"write_imagef", [Void, ImageType<imgTy, aQual>, VectorType<Int, 4>, VectorType<Float, 4>]>;
+ def : Builtin<"write_imagei", [Void, ImageType<imgTy, aQual>, VectorType<Int, 4>, VectorType<Int, 4>]>;
+ def : Builtin<"write_imageui", [Void, ImageType<imgTy, aQual>, VectorType<Int, 4>, VectorType<UInt, 4>]>;
+ }
+ foreach imgTy = [Image1d, Image1dBuffer] in {
+ def : Builtin<"write_imagef", [Void, ImageType<imgTy, aQual>, Int, VectorType<Float, 4>]>;
+ def : Builtin<"write_imagei", [Void, ImageType<imgTy, aQual>, Int, VectorType<Int, 4>]>;
+ def : Builtin<"write_imageui", [Void, ImageType<imgTy, aQual>, Int, VectorType<UInt, 4>]>;
+ }
+ foreach imgTy = [Image1dArray] in {
+ def : Builtin<"write_imagef", [Void, ImageType<imgTy, aQual>, VectorType<Int, 2>, VectorType<Float, 4>]>;
+ def : Builtin<"write_imagei", [Void, ImageType<imgTy, aQual>, VectorType<Int, 2>, VectorType<Int, 4>]>;
+ def : Builtin<"write_imageui", [Void, ImageType<imgTy, aQual>, VectorType<Int, 2>, VectorType<UInt, 4>]>;
+ }
+ foreach imgTy = [Image3d] in {
+ def : Builtin<"write_imagef", [Void, ImageType<imgTy, aQual>, VectorType<Int, 4>, VectorType<Float, 4>]>;
+ def : Builtin<"write_imagei", [Void, ImageType<imgTy, aQual>, VectorType<Int, 4>, VectorType<Int, 4>]>;
+ def : Builtin<"write_imageui", [Void, ImageType<imgTy, aQual>, VectorType<Int, 4>, VectorType<UInt, 4>]>;
+ }
+ def : Builtin<"write_imagef", [Void, ImageType<Image2dDepth, aQual>, VectorType<Int, 2>, Float]>;
+ def : Builtin<"write_imagef", [Void, ImageType<Image2dArrayDepth, aQual>, VectorType<Int, 4>, Float]>;
+}
+
+// --- Table 25: Image Query Functions ---
+foreach aQual = ["RO", "WO", "RW"] in {
+ foreach imgTy = [Image1d, Image1dBuffer, Image2d, Image3d,
+ Image1dArray, Image2dArray, Image2dDepth,
+ Image2dArrayDepth] in {
+ foreach name = ["get_image_width", "get_image_channel_data_type",
+ "get_image_channel_order"] in {
+ def : Builtin<name, [Int, ImageType<imgTy, aQual>]>;
+ }
+ }
+ foreach imgTy = [Image2d, Image3d, Image2dArray, Image2dDepth,
+ Image2dArrayDepth] in {
+ def : Builtin<"get_image_height", [Int, ImageType<imgTy, aQual>]>;
+ }
+ def : Builtin<"get_image_depth", [Int, ImageType<Image3d, aQual>]>;
+ foreach imgTy = [Image2d, Image2dArray, Image2dDepth,
+ Image2dArrayDepth] in {
+ def : Builtin<"get_image_dim", [VectorType<Int, 2>, ImageType<imgTy, aQual>]>;
+ }
+ def : Builtin<"get_image_dim", [VectorType<Int, 4>, ImageType<Image3d, aQual>]>;
+ foreach imgTy = [Image1dArray, Image2dArray, Image2dArrayDepth] in {
+ def : Builtin<"get_image_array_size", [Size, ImageType<imgTy, aQual>]>;
+ }
+}
+
+// OpenCL extension v2.0 s5.1.9: Built-in Image Read Functions
+// --- Table 8 ---
+foreach aQual = ["RO"] in {
+ foreach name = ["read_imageh"] in {
+ foreach coordTy = [Int, Float] in {
+ foreach imgTy = [Image2d, Image1dArray] in {
+ def : Builtin<name, [VectorType<Half, 4>, ImageType<imgTy, aQual>, Sampler, VectorType<coordTy, 2>]>;
+ }
+ foreach imgTy = [Image3d, Image2dArray] in {
+ def : Builtin<name, [VectorType<Half, 4>, ImageType<imgTy, aQual>, Sampler, VectorType<coordTy, 4>]>;
+ }
+ foreach imgTy = [Image1d] in {
+ def : Builtin<name, [VectorType<Half, 4>, ImageType<imgTy, aQual>, Sampler, coordTy]>;
+ }
+ }
+ }
+}
+// OpenCL extension v2.0 s5.1.10: Built-in Image Sampler-less Read Functions
+// --- Table 9 ---
+foreach aQual = ["RO", "RW"] in {
+ foreach name = ["read_imageh"] in {
+ foreach imgTy = [Image2d, Image1dArray] in {
+ def : Builtin<name, [VectorType<Half, 4>, ImageType<imgTy, aQual>, VectorType<Int, 2>]>;
+ }
+ foreach imgTy = [Image3d, Image2dArray] in {
+ def : Builtin<name, [VectorType<Half, 4>, ImageType<imgTy, aQual>, VectorType<Int, 4>]>;
+ }
+ foreach imgTy = [Image1d, Image1dBuffer] in {
+ def : Builtin<name, [VectorType<Half, 4>, ImageType<imgTy, aQual>, Int]>;
+ }
+ }
+}
+// OpenCL extension v2.0 s5.1.11: Built-in Image Write Functions
+// --- Table 10 ---
+foreach aQual = ["WO", "RW"] in {
+ foreach name = ["write_imageh"] in {
+ def : Builtin<name, [Void, ImageType<Image2d, aQual>, VectorType<Int, 2>, VectorType<Half, 4>]>;
+ def : Builtin<name, [Void, ImageType<Image2dArray, aQual>, VectorType<Int, 4>, VectorType<Half, 4>]>;
+ def : Builtin<name, [Void, ImageType<Image1d, aQual>, Int, VectorType<Half, 4>]>;
+ def : Builtin<name, [Void, ImageType<Image1dBuffer, aQual>, Int, VectorType<Half, 4>]>;
+ def : Builtin<name, [Void, ImageType<Image1dArray, aQual>, VectorType<Int, 2>, VectorType<Half, 4>]>;
+ def : Builtin<name, [Void, ImageType<Image3d, aQual>, VectorType<Int, 4>, VectorType<Half, 4>]>;
+ }
+}
// OpenCL v2.0 s9.17.3: Additions to section 6.13.1: Work-Item Functions
-let Version = CL20 in {
+let MinVersion = CL20 in {
let Extension = "cl_khr_subgroups" in {
- def get_sub_group_size : Builtin<"get_sub_group_size", [uint_t]>;
- def get_max_sub_group_size : Builtin<"get_max_sub_group_size", [uint_t]>;
- def get_num_sub_groups : Builtin<"get_num_sub_groups", [uint_t]>;
+ def get_sub_group_size : Builtin<"get_sub_group_size", [UInt]>;
+ def get_max_sub_group_size : Builtin<"get_max_sub_group_size", [UInt]>;
+ def get_num_sub_groups : Builtin<"get_num_sub_groups", [UInt]>;
}
}