blob: 8ae655d143553c24434cba2ceff6449af8d1c94a [file] [log] [blame]
Sheri Zhang79cb9452021-09-07 14:51:49 +01001/*******************************************************************************
2 * Copyright (c) 2008-2020 The Khronos Group Inc.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
Sheri Zhang79cb9452021-09-07 14:51:49 +01004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Anthony Barbier6ff3b192017-09-04 18:44:23 +01007 *
Sheri Zhang79cb9452021-09-07 14:51:49 +01008 * http://www.apache.org/licenses/LICENSE-2.0
Anthony Barbier6ff3b192017-09-04 18:44:23 +01009 *
Sheri Zhang79cb9452021-09-07 14:51:49 +010010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 ******************************************************************************/
Anthony Barbier6ff3b192017-09-04 18:44:23 +010016
Anthony Barbier6ff3b192017-09-04 18:44:23 +010017#ifndef __CL_PLATFORM_H
18#define __CL_PLATFORM_H
19
Sheri Zhang67354e02021-06-30 16:08:29 +010020#include <CL/cl_version.h>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010021
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#if defined(_WIN32)
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000027 #if !defined(CL_API_ENTRY)
28 #define CL_API_ENTRY
29 #endif
30 #if !defined(CL_API_CALL)
31 #define CL_API_CALL __stdcall
32 #endif
33 #if !defined(CL_CALLBACK)
34 #define CL_CALLBACK __stdcall
35 #endif
Anthony Barbier6ff3b192017-09-04 18:44:23 +010036#else
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000037 #if !defined(CL_API_ENTRY)
38 #define CL_API_ENTRY
39 #endif
40 #if !defined(CL_API_CALL)
41 #define CL_API_CALL
42 #endif
43 #if !defined(CL_CALLBACK)
44 #define CL_CALLBACK
45 #endif
Anthony Barbier6ff3b192017-09-04 18:44:23 +010046#endif
47
Pablo Telloe86a09f2018-01-11 15:44:48 +000048/*
49 * Deprecation flags refer to the last version of the header in which the
50 * feature was not deprecated.
51 *
52 * E.g. VERSION_1_1_DEPRECATED means the feature is present in 1.1 without
53 * deprecation but is deprecated in versions later than 1.1.
54 */
55
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000056#ifndef CL_API_SUFFIX_USER
57#define CL_API_SUFFIX_USER
58#endif
59
60#ifndef CL_API_PREFIX_USER
61#define CL_API_PREFIX_USER
62#endif
63
64#define CL_API_SUFFIX_COMMON CL_API_SUFFIX_USER
65#define CL_API_PREFIX_COMMON CL_API_PREFIX_USER
66
67#define CL_API_SUFFIX__VERSION_1_0 CL_API_SUFFIX_COMMON
68#define CL_API_SUFFIX__VERSION_1_1 CL_API_SUFFIX_COMMON
69#define CL_API_SUFFIX__VERSION_1_2 CL_API_SUFFIX_COMMON
70#define CL_API_SUFFIX__VERSION_2_0 CL_API_SUFFIX_COMMON
71#define CL_API_SUFFIX__VERSION_2_1 CL_API_SUFFIX_COMMON
72#define CL_API_SUFFIX__VERSION_2_2 CL_API_SUFFIX_COMMON
73#define CL_API_SUFFIX__VERSION_3_0 CL_API_SUFFIX_COMMON
74#define CL_API_SUFFIX__EXPERIMENTAL CL_API_SUFFIX_COMMON
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010075
Sheri Zhang67354e02021-06-30 16:08:29 +010076
77#ifdef __GNUC__
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000078 #define CL_API_SUFFIX_DEPRECATED __attribute__((deprecated))
79 #define CL_API_PREFIX_DEPRECATED
Sheri Zhang67354e02021-06-30 16:08:29 +010080#elif defined(_WIN32)
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000081 #define CL_API_SUFFIX_DEPRECATED
82 #define CL_API_PREFIX_DEPRECATED __declspec(deprecated)
Anthony Barbier6ff3b192017-09-04 18:44:23 +010083#else
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000084 #define CL_API_SUFFIX_DEPRECATED
85 #define CL_API_PREFIX_DEPRECATED
Sheri Zhang67354e02021-06-30 16:08:29 +010086#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010087
Sheri Zhang67354e02021-06-30 16:08:29 +010088#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000089 #define CL_API_SUFFIX__VERSION_1_0_DEPRECATED CL_API_SUFFIX_COMMON
90 #define CL_API_PREFIX__VERSION_1_0_DEPRECATED CL_API_PREFIX_COMMON
Sheri Zhang67354e02021-06-30 16:08:29 +010091#else
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000092 #define CL_API_SUFFIX__VERSION_1_0_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
93 #define CL_API_PREFIX__VERSION_1_0_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
Sheri Zhang67354e02021-06-30 16:08:29 +010094#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +010095
Sheri Zhang67354e02021-06-30 16:08:29 +010096#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +000097 #define CL_API_SUFFIX__VERSION_1_1_DEPRECATED CL_API_SUFFIX_COMMON
98 #define CL_API_PREFIX__VERSION_1_1_DEPRECATED CL_API_PREFIX_COMMON
Sheri Zhang67354e02021-06-30 16:08:29 +010099#else
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000100 #define CL_API_SUFFIX__VERSION_1_1_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
101 #define CL_API_PREFIX__VERSION_1_1_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
Sheri Zhang67354e02021-06-30 16:08:29 +0100102#endif
Pablo Telloe86a09f2018-01-11 15:44:48 +0000103
Sheri Zhang67354e02021-06-30 16:08:29 +0100104#ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000105 #define CL_API_SUFFIX__VERSION_1_2_DEPRECATED CL_API_SUFFIX_COMMON
106 #define CL_API_PREFIX__VERSION_1_2_DEPRECATED CL_API_PREFIX_COMMON
Sheri Zhang67354e02021-06-30 16:08:29 +0100107#else
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000108 #define CL_API_SUFFIX__VERSION_1_2_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
109 #define CL_API_PREFIX__VERSION_1_2_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
Sheri Zhang67354e02021-06-30 16:08:29 +0100110 #endif
Pablo Telloe86a09f2018-01-11 15:44:48 +0000111
Sheri Zhang67354e02021-06-30 16:08:29 +0100112#ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000113 #define CL_API_SUFFIX__VERSION_2_0_DEPRECATED CL_API_SUFFIX_COMMON
114 #define CL_API_PREFIX__VERSION_2_0_DEPRECATED CL_API_PREFIX_COMMON
Sheri Zhang67354e02021-06-30 16:08:29 +0100115#else
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000116 #define CL_API_SUFFIX__VERSION_2_0_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
117 #define CL_API_PREFIX__VERSION_2_0_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
Sheri Zhang67354e02021-06-30 16:08:29 +0100118#endif
Pablo Telloe86a09f2018-01-11 15:44:48 +0000119
Sheri Zhang67354e02021-06-30 16:08:29 +0100120#ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000121 #define CL_API_SUFFIX__VERSION_2_1_DEPRECATED CL_API_SUFFIX_COMMON
122 #define CL_API_PREFIX__VERSION_2_1_DEPRECATED CL_API_PREFIX_COMMON
Sheri Zhang67354e02021-06-30 16:08:29 +0100123#else
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000124 #define CL_API_SUFFIX__VERSION_2_1_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
125 #define CL_API_PREFIX__VERSION_2_1_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100126#endif
127
Sheri Zhang79cb9452021-09-07 14:51:49 +0100128#ifdef CL_USE_DEPRECATED_OPENCL_2_2_APIS
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000129 #define CL_API_SUFFIX__VERSION_2_2_DEPRECATED CL_API_SUFFIX_COMMON
130 #define CL_API_PREFIX__VERSION_2_2_DEPRECATED CL_API_PREFIX_COMMON
Sheri Zhang79cb9452021-09-07 14:51:49 +0100131#else
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000132 #define CL_API_SUFFIX__VERSION_2_2_DEPRECATED CL_API_SUFFIX_COMMON CL_API_SUFFIX_DEPRECATED
133 #define CL_API_PREFIX__VERSION_2_2_DEPRECATED CL_API_PREFIX_COMMON CL_API_PREFIX_DEPRECATED
Sheri Zhang79cb9452021-09-07 14:51:49 +0100134#endif
135
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100136#if (defined (_WIN32) && defined(_MSC_VER))
137
Pablo Marquez Tellodc2282f2021-11-23 15:16:00 +0000138/* intptr_t is used in cl.h and provided by stddef.h in Visual C++, but not in clang */
139/* stdint.h was missing before Visual Studio 2010, include it for later versions and for clang */
140#if defined(__clang__) || _MSC_VER >= 1600
141 #include <stdint.h>
142#endif
143
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100144/* scalar types */
145typedef signed __int8 cl_char;
146typedef unsigned __int8 cl_uchar;
147typedef signed __int16 cl_short;
148typedef unsigned __int16 cl_ushort;
149typedef signed __int32 cl_int;
150typedef unsigned __int32 cl_uint;
151typedef signed __int64 cl_long;
152typedef unsigned __int64 cl_ulong;
153
154typedef unsigned __int16 cl_half;
155typedef float cl_float;
156typedef double cl_double;
157
158/* Macro names and corresponding values defined by OpenCL */
159#define CL_CHAR_BIT 8
160#define CL_SCHAR_MAX 127
161#define CL_SCHAR_MIN (-127-1)
162#define CL_CHAR_MAX CL_SCHAR_MAX
163#define CL_CHAR_MIN CL_SCHAR_MIN
164#define CL_UCHAR_MAX 255
165#define CL_SHRT_MAX 32767
166#define CL_SHRT_MIN (-32767-1)
167#define CL_USHRT_MAX 65535
168#define CL_INT_MAX 2147483647
169#define CL_INT_MIN (-2147483647-1)
170#define CL_UINT_MAX 0xffffffffU
171#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
172#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
173#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
174
175#define CL_FLT_DIG 6
176#define CL_FLT_MANT_DIG 24
177#define CL_FLT_MAX_10_EXP +38
178#define CL_FLT_MAX_EXP +128
179#define CL_FLT_MIN_10_EXP -37
180#define CL_FLT_MIN_EXP -125
181#define CL_FLT_RADIX 2
182#define CL_FLT_MAX 340282346638528859811704183484516925440.0f
183#define CL_FLT_MIN 1.175494350822287507969e-38f
Pablo Telloe86a09f2018-01-11 15:44:48 +0000184#define CL_FLT_EPSILON 1.1920928955078125e-7f
185
186#define CL_HALF_DIG 3
187#define CL_HALF_MANT_DIG 11
188#define CL_HALF_MAX_10_EXP +4
189#define CL_HALF_MAX_EXP +16
190#define CL_HALF_MIN_10_EXP -4
191#define CL_HALF_MIN_EXP -13
192#define CL_HALF_RADIX 2
193#define CL_HALF_MAX 65504.0f
194#define CL_HALF_MIN 6.103515625e-05f
195#define CL_HALF_EPSILON 9.765625e-04f
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100196
197#define CL_DBL_DIG 15
198#define CL_DBL_MANT_DIG 53
199#define CL_DBL_MAX_10_EXP +308
200#define CL_DBL_MAX_EXP +1024
201#define CL_DBL_MIN_10_EXP -307
202#define CL_DBL_MIN_EXP -1021
203#define CL_DBL_RADIX 2
Pablo Telloe86a09f2018-01-11 15:44:48 +0000204#define CL_DBL_MAX 1.7976931348623158e+308
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100205#define CL_DBL_MIN 2.225073858507201383090e-308
206#define CL_DBL_EPSILON 2.220446049250313080847e-16
207
Pablo Telloe86a09f2018-01-11 15:44:48 +0000208#define CL_M_E 2.7182818284590452354
209#define CL_M_LOG2E 1.4426950408889634074
210#define CL_M_LOG10E 0.43429448190325182765
211#define CL_M_LN2 0.69314718055994530942
212#define CL_M_LN10 2.30258509299404568402
213#define CL_M_PI 3.14159265358979323846
214#define CL_M_PI_2 1.57079632679489661923
215#define CL_M_PI_4 0.78539816339744830962
216#define CL_M_1_PI 0.31830988618379067154
217#define CL_M_2_PI 0.63661977236758134308
218#define CL_M_2_SQRTPI 1.12837916709551257390
219#define CL_M_SQRT2 1.41421356237309504880
220#define CL_M_SQRT1_2 0.70710678118654752440
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100221
Pablo Telloe86a09f2018-01-11 15:44:48 +0000222#define CL_M_E_F 2.718281828f
223#define CL_M_LOG2E_F 1.442695041f
224#define CL_M_LOG10E_F 0.434294482f
225#define CL_M_LN2_F 0.693147181f
226#define CL_M_LN10_F 2.302585093f
227#define CL_M_PI_F 3.141592654f
228#define CL_M_PI_2_F 1.570796327f
229#define CL_M_PI_4_F 0.785398163f
230#define CL_M_1_PI_F 0.318309886f
231#define CL_M_2_PI_F 0.636619772f
232#define CL_M_2_SQRTPI_F 1.128379167f
233#define CL_M_SQRT2_F 1.414213562f
234#define CL_M_SQRT1_2_F 0.707106781f
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100235
236#define CL_NAN (CL_INFINITY - CL_INFINITY)
237#define CL_HUGE_VALF ((cl_float) 1e50)
238#define CL_HUGE_VAL ((cl_double) 1e500)
239#define CL_MAXFLOAT CL_FLT_MAX
240#define CL_INFINITY CL_HUGE_VALF
241
242#else
243
244#include <stdint.h>
245
246/* scalar types */
247typedef int8_t cl_char;
248typedef uint8_t cl_uchar;
Sheri Zhang67354e02021-06-30 16:08:29 +0100249typedef int16_t cl_short;
250typedef uint16_t cl_ushort;
251typedef int32_t cl_int;
252typedef uint32_t cl_uint;
253typedef int64_t cl_long;
254typedef uint64_t cl_ulong;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100255
Sheri Zhang67354e02021-06-30 16:08:29 +0100256typedef uint16_t cl_half;
257typedef float cl_float;
258typedef double cl_double;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100259
260/* Macro names and corresponding values defined by OpenCL */
261#define CL_CHAR_BIT 8
262#define CL_SCHAR_MAX 127
263#define CL_SCHAR_MIN (-127-1)
264#define CL_CHAR_MAX CL_SCHAR_MAX
265#define CL_CHAR_MIN CL_SCHAR_MIN
266#define CL_UCHAR_MAX 255
267#define CL_SHRT_MAX 32767
268#define CL_SHRT_MIN (-32767-1)
269#define CL_USHRT_MAX 65535
270#define CL_INT_MAX 2147483647
271#define CL_INT_MIN (-2147483647-1)
272#define CL_UINT_MAX 0xffffffffU
273#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
274#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
275#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
276
277#define CL_FLT_DIG 6
278#define CL_FLT_MANT_DIG 24
279#define CL_FLT_MAX_10_EXP +38
280#define CL_FLT_MAX_EXP +128
281#define CL_FLT_MIN_10_EXP -37
282#define CL_FLT_MIN_EXP -125
283#define CL_FLT_RADIX 2
Pablo Telloe86a09f2018-01-11 15:44:48 +0000284#define CL_FLT_MAX 340282346638528859811704183484516925440.0f
285#define CL_FLT_MIN 1.175494350822287507969e-38f
286#define CL_FLT_EPSILON 1.1920928955078125e-7f
287
288#define CL_HALF_DIG 3
289#define CL_HALF_MANT_DIG 11
290#define CL_HALF_MAX_10_EXP +4
291#define CL_HALF_MAX_EXP +16
292#define CL_HALF_MIN_10_EXP -4
293#define CL_HALF_MIN_EXP -13
294#define CL_HALF_RADIX 2
295#define CL_HALF_MAX 65504.0f
296#define CL_HALF_MIN 6.103515625e-05f
297#define CL_HALF_EPSILON 9.765625e-04f
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100298
299#define CL_DBL_DIG 15
300#define CL_DBL_MANT_DIG 53
301#define CL_DBL_MAX_10_EXP +308
302#define CL_DBL_MAX_EXP +1024
303#define CL_DBL_MIN_10_EXP -307
304#define CL_DBL_MIN_EXP -1021
305#define CL_DBL_RADIX 2
Pablo Telloe86a09f2018-01-11 15:44:48 +0000306#define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
307#define CL_DBL_MIN 2.225073858507201383090e-308
308#define CL_DBL_EPSILON 2.220446049250313080847e-16
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100309
Pablo Telloe86a09f2018-01-11 15:44:48 +0000310#define CL_M_E 2.7182818284590452354
311#define CL_M_LOG2E 1.4426950408889634074
312#define CL_M_LOG10E 0.43429448190325182765
313#define CL_M_LN2 0.69314718055994530942
314#define CL_M_LN10 2.30258509299404568402
315#define CL_M_PI 3.14159265358979323846
316#define CL_M_PI_2 1.57079632679489661923
317#define CL_M_PI_4 0.78539816339744830962
318#define CL_M_1_PI 0.31830988618379067154
319#define CL_M_2_PI 0.63661977236758134308
320#define CL_M_2_SQRTPI 1.12837916709551257390
321#define CL_M_SQRT2 1.41421356237309504880
322#define CL_M_SQRT1_2 0.70710678118654752440
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100323
Pablo Telloe86a09f2018-01-11 15:44:48 +0000324#define CL_M_E_F 2.718281828f
325#define CL_M_LOG2E_F 1.442695041f
326#define CL_M_LOG10E_F 0.434294482f
327#define CL_M_LN2_F 0.693147181f
328#define CL_M_LN10_F 2.302585093f
329#define CL_M_PI_F 3.141592654f
330#define CL_M_PI_2_F 1.570796327f
331#define CL_M_PI_4_F 0.785398163f
332#define CL_M_1_PI_F 0.318309886f
333#define CL_M_2_PI_F 0.636619772f
334#define CL_M_2_SQRTPI_F 1.128379167f
335#define CL_M_SQRT2_F 1.414213562f
336#define CL_M_SQRT1_2_F 0.707106781f
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100337
338#if defined( __GNUC__ )
339 #define CL_HUGE_VALF __builtin_huge_valf()
340 #define CL_HUGE_VAL __builtin_huge_val()
341 #define CL_NAN __builtin_nanf( "" )
342#else
343 #define CL_HUGE_VALF ((cl_float) 1e50)
344 #define CL_HUGE_VAL ((cl_double) 1e500)
345 float nanf( const char * );
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100346 #define CL_NAN nanf( "" )
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100347#endif
348#define CL_MAXFLOAT CL_FLT_MAX
349#define CL_INFINITY CL_HUGE_VALF
350
351#endif
352
353#include <stddef.h>
354
355/* Mirror types to GL types. Mirror types allow us to avoid deciding which 87s to load based on whether we are using GL or GLES here. */
356typedef unsigned int cl_GLuint;
357typedef int cl_GLint;
358typedef unsigned int cl_GLenum;
359
360/*
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100361 * Vector types
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100362 *
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100363 * Note: OpenCL requires that all types be naturally aligned.
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100364 * This means that vector types must be naturally aligned.
365 * For example, a vector of four floats must be aligned to
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100366 * a 16 byte boundary (calculated as 4 * the natural 4-byte
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100367 * alignment of the float). The alignment qualifiers here
368 * will only function properly if your compiler supports them
369 * and if you don't actively work to defeat them. For example,
370 * in order for a cl_float4 to be 16 byte aligned in a struct,
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100371 * the start of the struct must itself be 16-byte aligned.
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100372 *
373 * Maintaining proper alignment is the user's responsibility.
374 */
375
376/* Define basic vector types */
377#if defined( __VEC__ )
Sheri Zhang79cb9452021-09-07 14:51:49 +0100378 #if !defined(__clang__)
379 #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
380 #endif
Sheri Zhang67354e02021-06-30 16:08:29 +0100381 typedef __vector unsigned char __cl_uchar16;
382 typedef __vector signed char __cl_char16;
383 typedef __vector unsigned short __cl_ushort8;
384 typedef __vector signed short __cl_short8;
385 typedef __vector unsigned int __cl_uint4;
386 typedef __vector signed int __cl_int4;
387 typedef __vector float __cl_float4;
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100388 #define __CL_UCHAR16__ 1
389 #define __CL_CHAR16__ 1
390 #define __CL_USHORT8__ 1
391 #define __CL_SHORT8__ 1
392 #define __CL_UINT4__ 1
393 #define __CL_INT4__ 1
394 #define __CL_FLOAT4__ 1
395#endif
396
397#if defined( __SSE__ )
398 #if defined( __MINGW64__ )
399 #include <intrin.h>
400 #else
401 #include <xmmintrin.h>
402 #endif
403 #if defined( __GNUC__ )
404 typedef float __cl_float4 __attribute__((vector_size(16)));
405 #else
406 typedef __m128 __cl_float4;
407 #endif
408 #define __CL_FLOAT4__ 1
409#endif
410
411#if defined( __SSE2__ )
412 #if defined( __MINGW64__ )
413 #include <intrin.h>
414 #else
415 #include <emmintrin.h>
416 #endif
417 #if defined( __GNUC__ )
418 typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16)));
419 typedef cl_char __cl_char16 __attribute__((vector_size(16)));
420 typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16)));
421 typedef cl_short __cl_short8 __attribute__((vector_size(16)));
422 typedef cl_uint __cl_uint4 __attribute__((vector_size(16)));
423 typedef cl_int __cl_int4 __attribute__((vector_size(16)));
424 typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16)));
425 typedef cl_long __cl_long2 __attribute__((vector_size(16)));
426 typedef cl_double __cl_double2 __attribute__((vector_size(16)));
427 #else
428 typedef __m128i __cl_uchar16;
429 typedef __m128i __cl_char16;
430 typedef __m128i __cl_ushort8;
431 typedef __m128i __cl_short8;
432 typedef __m128i __cl_uint4;
433 typedef __m128i __cl_int4;
434 typedef __m128i __cl_ulong2;
435 typedef __m128i __cl_long2;
436 typedef __m128d __cl_double2;
437 #endif
438 #define __CL_UCHAR16__ 1
439 #define __CL_CHAR16__ 1
440 #define __CL_USHORT8__ 1
441 #define __CL_SHORT8__ 1
442 #define __CL_INT4__ 1
443 #define __CL_UINT4__ 1
444 #define __CL_ULONG2__ 1
445 #define __CL_LONG2__ 1
446 #define __CL_DOUBLE2__ 1
447#endif
448
449#if defined( __MMX__ )
450 #include <mmintrin.h>
451 #if defined( __GNUC__ )
452 typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8)));
453 typedef cl_char __cl_char8 __attribute__((vector_size(8)));
454 typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8)));
455 typedef cl_short __cl_short4 __attribute__((vector_size(8)));
456 typedef cl_uint __cl_uint2 __attribute__((vector_size(8)));
457 typedef cl_int __cl_int2 __attribute__((vector_size(8)));
458 typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8)));
459 typedef cl_long __cl_long1 __attribute__((vector_size(8)));
460 typedef cl_float __cl_float2 __attribute__((vector_size(8)));
461 #else
462 typedef __m64 __cl_uchar8;
463 typedef __m64 __cl_char8;
464 typedef __m64 __cl_ushort4;
465 typedef __m64 __cl_short4;
466 typedef __m64 __cl_uint2;
467 typedef __m64 __cl_int2;
468 typedef __m64 __cl_ulong1;
469 typedef __m64 __cl_long1;
470 typedef __m64 __cl_float2;
471 #endif
472 #define __CL_UCHAR8__ 1
473 #define __CL_CHAR8__ 1
474 #define __CL_USHORT4__ 1
475 #define __CL_SHORT4__ 1
476 #define __CL_INT2__ 1
477 #define __CL_UINT2__ 1
478 #define __CL_ULONG1__ 1
479 #define __CL_LONG1__ 1
480 #define __CL_FLOAT2__ 1
481#endif
482
483#if defined( __AVX__ )
484 #if defined( __MINGW64__ )
485 #include <intrin.h>
486 #else
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100487 #include <immintrin.h>
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100488 #endif
489 #if defined( __GNUC__ )
490 typedef cl_float __cl_float8 __attribute__((vector_size(32)));
491 typedef cl_double __cl_double4 __attribute__((vector_size(32)));
492 #else
493 typedef __m256 __cl_float8;
494 typedef __m256d __cl_double4;
495 #endif
496 #define __CL_FLOAT8__ 1
497 #define __CL_DOUBLE4__ 1
498#endif
499
Pablo Telloe86a09f2018-01-11 15:44:48 +0000500/* Define capabilities for anonymous struct members. */
501#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
502#define __CL_HAS_ANON_STRUCT__ 1
503#define __CL_ANON_STRUCT__
504#elif defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
505#define __CL_HAS_ANON_STRUCT__ 1
506#define __CL_ANON_STRUCT__ __extension__
Sheri Zhang79cb9452021-09-07 14:51:49 +0100507#elif defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000508 #if _MSC_VER >= 1500
509 /* Microsoft Developer Studio 2008 supports anonymous structs, but
510 * complains by default. */
511 #define __CL_HAS_ANON_STRUCT__ 1
512 #define __CL_ANON_STRUCT__
513 /* Disable warning C4201: nonstandard extension used : nameless
514 * struct/union */
515 #pragma warning( push )
516 #pragma warning( disable : 4201 )
517 #endif
518#else
519#define __CL_HAS_ANON_STRUCT__ 0
520#define __CL_ANON_STRUCT__
521#endif
522
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100523/* Define alignment keys */
Sheri Zhang79cb9452021-09-07 14:51:49 +0100524#if defined( __GNUC__ ) || defined(__INTEGRITY)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100525 #define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
526#elif defined( _WIN32) && (_MSC_VER)
527 /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
528 /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */
529 /* #include <crtdefs.h> */
530 /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */
531 #define CL_ALIGNED(_x)
532#else
533 #warning Need to implement some method to align data here
534 #define CL_ALIGNED(_x)
535#endif
536
537/* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
Pablo Telloe86a09f2018-01-11 15:44:48 +0000538#if __CL_HAS_ANON_STRUCT__
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100539 /* .xyzw and .s0123...{f|F} are supported */
540 #define CL_HAS_NAMED_VECTOR_FIELDS 1
541 /* .hi and .lo are supported */
542 #define CL_HAS_HI_LO_VECTOR_FIELDS 1
543#endif
544
545/* Define cl_vector types */
546
547/* ---- cl_charn ---- */
548typedef union
549{
550 cl_char CL_ALIGNED(2) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000551#if __CL_HAS_ANON_STRUCT__
552 __CL_ANON_STRUCT__ struct{ cl_char x, y; };
553 __CL_ANON_STRUCT__ struct{ cl_char s0, s1; };
554 __CL_ANON_STRUCT__ struct{ cl_char lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100555#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100556#if defined( __CL_CHAR2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100557 __cl_char2 v2;
558#endif
559}cl_char2;
560
561typedef union
562{
563 cl_char CL_ALIGNED(4) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000564#if __CL_HAS_ANON_STRUCT__
565 __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; };
566 __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3; };
567 __CL_ANON_STRUCT__ struct{ cl_char2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100568#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100569#if defined( __CL_CHAR2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100570 __cl_char2 v2[2];
571#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100572#if defined( __CL_CHAR4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100573 __cl_char4 v4;
574#endif
575}cl_char4;
576
577/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
578typedef cl_char4 cl_char3;
579
580typedef union
581{
582 cl_char CL_ALIGNED(8) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000583#if __CL_HAS_ANON_STRUCT__
584 __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; };
585 __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
586 __CL_ANON_STRUCT__ struct{ cl_char4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100587#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100588#if defined( __CL_CHAR2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100589 __cl_char2 v2[4];
590#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100591#if defined( __CL_CHAR4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100592 __cl_char4 v4[2];
593#endif
594#if defined( __CL_CHAR8__ )
595 __cl_char8 v8;
596#endif
597}cl_char8;
598
599typedef union
600{
601 cl_char CL_ALIGNED(16) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000602#if __CL_HAS_ANON_STRUCT__
603 __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
604 __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
605 __CL_ANON_STRUCT__ struct{ cl_char8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100606#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100607#if defined( __CL_CHAR2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100608 __cl_char2 v2[8];
609#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100610#if defined( __CL_CHAR4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100611 __cl_char4 v4[4];
612#endif
613#if defined( __CL_CHAR8__ )
614 __cl_char8 v8[2];
615#endif
616#if defined( __CL_CHAR16__ )
617 __cl_char16 v16;
618#endif
619}cl_char16;
620
621
622/* ---- cl_ucharn ---- */
623typedef union
624{
625 cl_uchar CL_ALIGNED(2) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000626#if __CL_HAS_ANON_STRUCT__
627 __CL_ANON_STRUCT__ struct{ cl_uchar x, y; };
628 __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1; };
629 __CL_ANON_STRUCT__ struct{ cl_uchar lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100630#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100631#if defined( __cl_uchar2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100632 __cl_uchar2 v2;
633#endif
634}cl_uchar2;
635
636typedef union
637{
638 cl_uchar CL_ALIGNED(4) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000639#if __CL_HAS_ANON_STRUCT__
640 __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; };
641 __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3; };
642 __CL_ANON_STRUCT__ struct{ cl_uchar2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100643#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100644#if defined( __CL_UCHAR2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100645 __cl_uchar2 v2[2];
646#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100647#if defined( __CL_UCHAR4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100648 __cl_uchar4 v4;
649#endif
650}cl_uchar4;
651
652/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
653typedef cl_uchar4 cl_uchar3;
654
655typedef union
656{
657 cl_uchar CL_ALIGNED(8) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000658#if __CL_HAS_ANON_STRUCT__
659 __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; };
660 __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
661 __CL_ANON_STRUCT__ struct{ cl_uchar4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100662#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100663#if defined( __CL_UCHAR2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100664 __cl_uchar2 v2[4];
665#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100666#if defined( __CL_UCHAR4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100667 __cl_uchar4 v4[2];
668#endif
669#if defined( __CL_UCHAR8__ )
670 __cl_uchar8 v8;
671#endif
672}cl_uchar8;
673
674typedef union
675{
676 cl_uchar CL_ALIGNED(16) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000677#if __CL_HAS_ANON_STRUCT__
678 __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
679 __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
680 __CL_ANON_STRUCT__ struct{ cl_uchar8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100681#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100682#if defined( __CL_UCHAR2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100683 __cl_uchar2 v2[8];
684#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100685#if defined( __CL_UCHAR4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100686 __cl_uchar4 v4[4];
687#endif
688#if defined( __CL_UCHAR8__ )
689 __cl_uchar8 v8[2];
690#endif
691#if defined( __CL_UCHAR16__ )
692 __cl_uchar16 v16;
693#endif
694}cl_uchar16;
695
696
697/* ---- cl_shortn ---- */
698typedef union
699{
700 cl_short CL_ALIGNED(4) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000701#if __CL_HAS_ANON_STRUCT__
702 __CL_ANON_STRUCT__ struct{ cl_short x, y; };
703 __CL_ANON_STRUCT__ struct{ cl_short s0, s1; };
704 __CL_ANON_STRUCT__ struct{ cl_short lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100705#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100706#if defined( __CL_SHORT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100707 __cl_short2 v2;
708#endif
709}cl_short2;
710
711typedef union
712{
713 cl_short CL_ALIGNED(8) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000714#if __CL_HAS_ANON_STRUCT__
715 __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; };
716 __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3; };
717 __CL_ANON_STRUCT__ struct{ cl_short2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100718#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100719#if defined( __CL_SHORT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100720 __cl_short2 v2[2];
721#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100722#if defined( __CL_SHORT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100723 __cl_short4 v4;
724#endif
725}cl_short4;
726
727/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
728typedef cl_short4 cl_short3;
729
730typedef union
731{
732 cl_short CL_ALIGNED(16) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000733#if __CL_HAS_ANON_STRUCT__
734 __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; };
735 __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
736 __CL_ANON_STRUCT__ struct{ cl_short4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100737#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100738#if defined( __CL_SHORT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100739 __cl_short2 v2[4];
740#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100741#if defined( __CL_SHORT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100742 __cl_short4 v4[2];
743#endif
744#if defined( __CL_SHORT8__ )
745 __cl_short8 v8;
746#endif
747}cl_short8;
748
749typedef union
750{
751 cl_short CL_ALIGNED(32) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000752#if __CL_HAS_ANON_STRUCT__
753 __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
754 __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
755 __CL_ANON_STRUCT__ struct{ cl_short8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100756#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100757#if defined( __CL_SHORT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100758 __cl_short2 v2[8];
759#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100760#if defined( __CL_SHORT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100761 __cl_short4 v4[4];
762#endif
763#if defined( __CL_SHORT8__ )
764 __cl_short8 v8[2];
765#endif
766#if defined( __CL_SHORT16__ )
767 __cl_short16 v16;
768#endif
769}cl_short16;
770
771
772/* ---- cl_ushortn ---- */
773typedef union
774{
775 cl_ushort CL_ALIGNED(4) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000776#if __CL_HAS_ANON_STRUCT__
777 __CL_ANON_STRUCT__ struct{ cl_ushort x, y; };
778 __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1; };
779 __CL_ANON_STRUCT__ struct{ cl_ushort lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100780#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100781#if defined( __CL_USHORT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100782 __cl_ushort2 v2;
783#endif
784}cl_ushort2;
785
786typedef union
787{
788 cl_ushort CL_ALIGNED(8) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000789#if __CL_HAS_ANON_STRUCT__
790 __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; };
791 __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3; };
792 __CL_ANON_STRUCT__ struct{ cl_ushort2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100793#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100794#if defined( __CL_USHORT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100795 __cl_ushort2 v2[2];
796#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100797#if defined( __CL_USHORT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100798 __cl_ushort4 v4;
799#endif
800}cl_ushort4;
801
802/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
803typedef cl_ushort4 cl_ushort3;
804
805typedef union
806{
807 cl_ushort CL_ALIGNED(16) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000808#if __CL_HAS_ANON_STRUCT__
809 __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; };
810 __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
811 __CL_ANON_STRUCT__ struct{ cl_ushort4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100812#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100813#if defined( __CL_USHORT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100814 __cl_ushort2 v2[4];
815#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100816#if defined( __CL_USHORT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100817 __cl_ushort4 v4[2];
818#endif
819#if defined( __CL_USHORT8__ )
820 __cl_ushort8 v8;
821#endif
822}cl_ushort8;
823
824typedef union
825{
826 cl_ushort CL_ALIGNED(32) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000827#if __CL_HAS_ANON_STRUCT__
828 __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
829 __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
830 __CL_ANON_STRUCT__ struct{ cl_ushort8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100831#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100832#if defined( __CL_USHORT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100833 __cl_ushort2 v2[8];
834#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100835#if defined( __CL_USHORT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100836 __cl_ushort4 v4[4];
837#endif
838#if defined( __CL_USHORT8__ )
839 __cl_ushort8 v8[2];
840#endif
841#if defined( __CL_USHORT16__ )
842 __cl_ushort16 v16;
843#endif
844}cl_ushort16;
845
Pablo Telloe86a09f2018-01-11 15:44:48 +0000846
847/* ---- cl_halfn ---- */
848typedef union
849{
850 cl_half CL_ALIGNED(4) s[2];
851#if __CL_HAS_ANON_STRUCT__
852 __CL_ANON_STRUCT__ struct{ cl_half x, y; };
853 __CL_ANON_STRUCT__ struct{ cl_half s0, s1; };
854 __CL_ANON_STRUCT__ struct{ cl_half lo, hi; };
855#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100856#if defined( __CL_HALF2__)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000857 __cl_half2 v2;
858#endif
859}cl_half2;
860
861typedef union
862{
863 cl_half CL_ALIGNED(8) s[4];
864#if __CL_HAS_ANON_STRUCT__
865 __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; };
866 __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3; };
867 __CL_ANON_STRUCT__ struct{ cl_half2 lo, hi; };
868#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100869#if defined( __CL_HALF2__)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000870 __cl_half2 v2[2];
871#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100872#if defined( __CL_HALF4__)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000873 __cl_half4 v4;
874#endif
875}cl_half4;
876
877/* cl_half3 is identical in size, alignment and behavior to cl_half4. See section 6.1.5. */
878typedef cl_half4 cl_half3;
879
880typedef union
881{
882 cl_half CL_ALIGNED(16) s[8];
883#if __CL_HAS_ANON_STRUCT__
884 __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; };
885 __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7; };
886 __CL_ANON_STRUCT__ struct{ cl_half4 lo, hi; };
887#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100888#if defined( __CL_HALF2__)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000889 __cl_half2 v2[4];
890#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100891#if defined( __CL_HALF4__)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000892 __cl_half4 v4[2];
893#endif
894#if defined( __CL_HALF8__ )
895 __cl_half8 v8;
896#endif
897}cl_half8;
898
899typedef union
900{
901 cl_half CL_ALIGNED(32) s[16];
902#if __CL_HAS_ANON_STRUCT__
903 __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
904 __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
905 __CL_ANON_STRUCT__ struct{ cl_half8 lo, hi; };
906#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100907#if defined( __CL_HALF2__)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000908 __cl_half2 v2[8];
909#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100910#if defined( __CL_HALF4__)
Pablo Telloe86a09f2018-01-11 15:44:48 +0000911 __cl_half4 v4[4];
912#endif
913#if defined( __CL_HALF8__ )
914 __cl_half8 v8[2];
915#endif
916#if defined( __CL_HALF16__ )
917 __cl_half16 v16;
918#endif
919}cl_half16;
920
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100921/* ---- cl_intn ---- */
922typedef union
923{
924 cl_int CL_ALIGNED(8) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000925#if __CL_HAS_ANON_STRUCT__
926 __CL_ANON_STRUCT__ struct{ cl_int x, y; };
927 __CL_ANON_STRUCT__ struct{ cl_int s0, s1; };
928 __CL_ANON_STRUCT__ struct{ cl_int lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100929#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100930#if defined( __CL_INT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100931 __cl_int2 v2;
932#endif
933}cl_int2;
934
935typedef union
936{
937 cl_int CL_ALIGNED(16) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000938#if __CL_HAS_ANON_STRUCT__
939 __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; };
940 __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3; };
941 __CL_ANON_STRUCT__ struct{ cl_int2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100942#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100943#if defined( __CL_INT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100944 __cl_int2 v2[2];
945#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100946#if defined( __CL_INT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100947 __cl_int4 v4;
948#endif
949}cl_int4;
950
951/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
952typedef cl_int4 cl_int3;
953
954typedef union
955{
956 cl_int CL_ALIGNED(32) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000957#if __CL_HAS_ANON_STRUCT__
958 __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; };
959 __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
960 __CL_ANON_STRUCT__ struct{ cl_int4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100961#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100962#if defined( __CL_INT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100963 __cl_int2 v2[4];
964#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100965#if defined( __CL_INT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100966 __cl_int4 v4[2];
967#endif
968#if defined( __CL_INT8__ )
969 __cl_int8 v8;
970#endif
971}cl_int8;
972
973typedef union
974{
975 cl_int CL_ALIGNED(64) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +0000976#if __CL_HAS_ANON_STRUCT__
977 __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
978 __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
979 __CL_ANON_STRUCT__ struct{ cl_int8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100980#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100981#if defined( __CL_INT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100982 __cl_int2 v2[8];
983#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +0100984#if defined( __CL_INT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100985 __cl_int4 v4[4];
986#endif
987#if defined( __CL_INT8__ )
988 __cl_int8 v8[2];
989#endif
990#if defined( __CL_INT16__ )
991 __cl_int16 v16;
992#endif
993}cl_int16;
994
995
996/* ---- cl_uintn ---- */
997typedef union
998{
999 cl_uint CL_ALIGNED(8) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001000#if __CL_HAS_ANON_STRUCT__
1001 __CL_ANON_STRUCT__ struct{ cl_uint x, y; };
1002 __CL_ANON_STRUCT__ struct{ cl_uint s0, s1; };
1003 __CL_ANON_STRUCT__ struct{ cl_uint lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001004#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001005#if defined( __CL_UINT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001006 __cl_uint2 v2;
1007#endif
1008}cl_uint2;
1009
1010typedef union
1011{
1012 cl_uint CL_ALIGNED(16) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001013#if __CL_HAS_ANON_STRUCT__
1014 __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; };
1015 __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3; };
1016 __CL_ANON_STRUCT__ struct{ cl_uint2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001017#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001018#if defined( __CL_UINT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001019 __cl_uint2 v2[2];
1020#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001021#if defined( __CL_UINT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001022 __cl_uint4 v4;
1023#endif
1024}cl_uint4;
1025
1026/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
1027typedef cl_uint4 cl_uint3;
1028
1029typedef union
1030{
1031 cl_uint CL_ALIGNED(32) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001032#if __CL_HAS_ANON_STRUCT__
1033 __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; };
1034 __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
1035 __CL_ANON_STRUCT__ struct{ cl_uint4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001036#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001037#if defined( __CL_UINT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001038 __cl_uint2 v2[4];
1039#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001040#if defined( __CL_UINT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001041 __cl_uint4 v4[2];
1042#endif
1043#if defined( __CL_UINT8__ )
1044 __cl_uint8 v8;
1045#endif
1046}cl_uint8;
1047
1048typedef union
1049{
1050 cl_uint CL_ALIGNED(64) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001051#if __CL_HAS_ANON_STRUCT__
1052 __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1053 __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1054 __CL_ANON_STRUCT__ struct{ cl_uint8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001055#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001056#if defined( __CL_UINT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001057 __cl_uint2 v2[8];
1058#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001059#if defined( __CL_UINT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001060 __cl_uint4 v4[4];
1061#endif
1062#if defined( __CL_UINT8__ )
1063 __cl_uint8 v8[2];
1064#endif
1065#if defined( __CL_UINT16__ )
1066 __cl_uint16 v16;
1067#endif
1068}cl_uint16;
1069
1070/* ---- cl_longn ---- */
1071typedef union
1072{
1073 cl_long CL_ALIGNED(16) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001074#if __CL_HAS_ANON_STRUCT__
1075 __CL_ANON_STRUCT__ struct{ cl_long x, y; };
1076 __CL_ANON_STRUCT__ struct{ cl_long s0, s1; };
1077 __CL_ANON_STRUCT__ struct{ cl_long lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001078#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001079#if defined( __CL_LONG2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001080 __cl_long2 v2;
1081#endif
1082}cl_long2;
1083
1084typedef union
1085{
1086 cl_long CL_ALIGNED(32) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001087#if __CL_HAS_ANON_STRUCT__
1088 __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; };
1089 __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3; };
1090 __CL_ANON_STRUCT__ struct{ cl_long2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001091#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001092#if defined( __CL_LONG2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001093 __cl_long2 v2[2];
1094#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001095#if defined( __CL_LONG4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001096 __cl_long4 v4;
1097#endif
1098}cl_long4;
1099
1100/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
1101typedef cl_long4 cl_long3;
1102
1103typedef union
1104{
1105 cl_long CL_ALIGNED(64) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001106#if __CL_HAS_ANON_STRUCT__
1107 __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; };
1108 __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
1109 __CL_ANON_STRUCT__ struct{ cl_long4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001110#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001111#if defined( __CL_LONG2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001112 __cl_long2 v2[4];
1113#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001114#if defined( __CL_LONG4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001115 __cl_long4 v4[2];
1116#endif
1117#if defined( __CL_LONG8__ )
1118 __cl_long8 v8;
1119#endif
1120}cl_long8;
1121
1122typedef union
1123{
1124 cl_long CL_ALIGNED(128) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001125#if __CL_HAS_ANON_STRUCT__
1126 __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1127 __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1128 __CL_ANON_STRUCT__ struct{ cl_long8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001129#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001130#if defined( __CL_LONG2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001131 __cl_long2 v2[8];
1132#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001133#if defined( __CL_LONG4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001134 __cl_long4 v4[4];
1135#endif
1136#if defined( __CL_LONG8__ )
1137 __cl_long8 v8[2];
1138#endif
1139#if defined( __CL_LONG16__ )
1140 __cl_long16 v16;
1141#endif
1142}cl_long16;
1143
1144
1145/* ---- cl_ulongn ---- */
1146typedef union
1147{
1148 cl_ulong CL_ALIGNED(16) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001149#if __CL_HAS_ANON_STRUCT__
1150 __CL_ANON_STRUCT__ struct{ cl_ulong x, y; };
1151 __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1; };
1152 __CL_ANON_STRUCT__ struct{ cl_ulong lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001153#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001154#if defined( __CL_ULONG2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001155 __cl_ulong2 v2;
1156#endif
1157}cl_ulong2;
1158
1159typedef union
1160{
1161 cl_ulong CL_ALIGNED(32) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001162#if __CL_HAS_ANON_STRUCT__
1163 __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; };
1164 __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3; };
1165 __CL_ANON_STRUCT__ struct{ cl_ulong2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001166#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001167#if defined( __CL_ULONG2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001168 __cl_ulong2 v2[2];
1169#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001170#if defined( __CL_ULONG4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001171 __cl_ulong4 v4;
1172#endif
1173}cl_ulong4;
1174
1175/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
1176typedef cl_ulong4 cl_ulong3;
1177
1178typedef union
1179{
1180 cl_ulong CL_ALIGNED(64) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001181#if __CL_HAS_ANON_STRUCT__
1182 __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; };
1183 __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
1184 __CL_ANON_STRUCT__ struct{ cl_ulong4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001185#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001186#if defined( __CL_ULONG2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001187 __cl_ulong2 v2[4];
1188#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001189#if defined( __CL_ULONG4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001190 __cl_ulong4 v4[2];
1191#endif
1192#if defined( __CL_ULONG8__ )
1193 __cl_ulong8 v8;
1194#endif
1195}cl_ulong8;
1196
1197typedef union
1198{
1199 cl_ulong CL_ALIGNED(128) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001200#if __CL_HAS_ANON_STRUCT__
1201 __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1202 __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1203 __CL_ANON_STRUCT__ struct{ cl_ulong8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001204#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001205#if defined( __CL_ULONG2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001206 __cl_ulong2 v2[8];
1207#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001208#if defined( __CL_ULONG4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001209 __cl_ulong4 v4[4];
1210#endif
1211#if defined( __CL_ULONG8__ )
1212 __cl_ulong8 v8[2];
1213#endif
1214#if defined( __CL_ULONG16__ )
1215 __cl_ulong16 v16;
1216#endif
1217}cl_ulong16;
1218
1219
1220/* --- cl_floatn ---- */
1221
1222typedef union
1223{
1224 cl_float CL_ALIGNED(8) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001225#if __CL_HAS_ANON_STRUCT__
1226 __CL_ANON_STRUCT__ struct{ cl_float x, y; };
1227 __CL_ANON_STRUCT__ struct{ cl_float s0, s1; };
1228 __CL_ANON_STRUCT__ struct{ cl_float lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001229#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001230#if defined( __CL_FLOAT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001231 __cl_float2 v2;
1232#endif
1233}cl_float2;
1234
1235typedef union
1236{
1237 cl_float CL_ALIGNED(16) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001238#if __CL_HAS_ANON_STRUCT__
1239 __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; };
1240 __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3; };
1241 __CL_ANON_STRUCT__ struct{ cl_float2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001242#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001243#if defined( __CL_FLOAT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001244 __cl_float2 v2[2];
1245#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001246#if defined( __CL_FLOAT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001247 __cl_float4 v4;
1248#endif
1249}cl_float4;
1250
1251/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1252typedef cl_float4 cl_float3;
1253
1254typedef union
1255{
1256 cl_float CL_ALIGNED(32) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001257#if __CL_HAS_ANON_STRUCT__
1258 __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; };
1259 __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
1260 __CL_ANON_STRUCT__ struct{ cl_float4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001261#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001262#if defined( __CL_FLOAT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001263 __cl_float2 v2[4];
1264#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001265#if defined( __CL_FLOAT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001266 __cl_float4 v4[2];
1267#endif
1268#if defined( __CL_FLOAT8__ )
1269 __cl_float8 v8;
1270#endif
1271}cl_float8;
1272
1273typedef union
1274{
1275 cl_float CL_ALIGNED(64) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001276#if __CL_HAS_ANON_STRUCT__
1277 __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1278 __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1279 __CL_ANON_STRUCT__ struct{ cl_float8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001280#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001281#if defined( __CL_FLOAT2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001282 __cl_float2 v2[8];
1283#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001284#if defined( __CL_FLOAT4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001285 __cl_float4 v4[4];
1286#endif
1287#if defined( __CL_FLOAT8__ )
1288 __cl_float8 v8[2];
1289#endif
1290#if defined( __CL_FLOAT16__ )
1291 __cl_float16 v16;
1292#endif
1293}cl_float16;
1294
1295/* --- cl_doublen ---- */
1296
1297typedef union
1298{
1299 cl_double CL_ALIGNED(16) s[2];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001300#if __CL_HAS_ANON_STRUCT__
1301 __CL_ANON_STRUCT__ struct{ cl_double x, y; };
1302 __CL_ANON_STRUCT__ struct{ cl_double s0, s1; };
1303 __CL_ANON_STRUCT__ struct{ cl_double lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001304#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001305#if defined( __CL_DOUBLE2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001306 __cl_double2 v2;
1307#endif
1308}cl_double2;
1309
1310typedef union
1311{
1312 cl_double CL_ALIGNED(32) s[4];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001313#if __CL_HAS_ANON_STRUCT__
1314 __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; };
1315 __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3; };
1316 __CL_ANON_STRUCT__ struct{ cl_double2 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001317#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001318#if defined( __CL_DOUBLE2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001319 __cl_double2 v2[2];
1320#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001321#if defined( __CL_DOUBLE4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001322 __cl_double4 v4;
1323#endif
1324}cl_double4;
1325
1326/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1327typedef cl_double4 cl_double3;
1328
1329typedef union
1330{
1331 cl_double CL_ALIGNED(64) s[8];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001332#if __CL_HAS_ANON_STRUCT__
1333 __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; };
1334 __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
1335 __CL_ANON_STRUCT__ struct{ cl_double4 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001336#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001337#if defined( __CL_DOUBLE2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001338 __cl_double2 v2[4];
1339#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001340#if defined( __CL_DOUBLE4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001341 __cl_double4 v4[2];
1342#endif
1343#if defined( __CL_DOUBLE8__ )
1344 __cl_double8 v8;
1345#endif
1346}cl_double8;
1347
1348typedef union
1349{
1350 cl_double CL_ALIGNED(128) s[16];
Pablo Telloe86a09f2018-01-11 15:44:48 +00001351#if __CL_HAS_ANON_STRUCT__
1352 __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1353 __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1354 __CL_ANON_STRUCT__ struct{ cl_double8 lo, hi; };
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001355#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001356#if defined( __CL_DOUBLE2__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001357 __cl_double2 v2[8];
1358#endif
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001359#if defined( __CL_DOUBLE4__)
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001360 __cl_double4 v4[4];
1361#endif
1362#if defined( __CL_DOUBLE8__ )
1363 __cl_double8 v8[2];
1364#endif
1365#if defined( __CL_DOUBLE16__ )
1366 __cl_double16 v16;
1367#endif
1368}cl_double16;
1369
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001370/* Macro to facilitate debugging
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001371 * Usage:
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001372 * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001373 * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \"
1374 * Each line thereafter of OpenCL C source must end with: \n\
1375 * The last line ends in ";
1376 *
1377 * Example:
1378 *
1379 * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
1380 * kernel void foo( int a, float * b ) \n\
1381 * { \n\
1382 * // my comment \n\
1383 * *b[ get_global_id(0)] = a; \n\
1384 * } \n\
1385 * ";
1386 *
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001387 * This should correctly set up the line, (column) and file information for your source
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001388 * string so you can do source level debugging.
1389 */
1390#define __CL_STRINGIFY( _x ) # _x
1391#define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x )
Anthony Barbier8b2fdc92018-08-09 11:42:38 +01001392#define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
1393
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001394#ifdef __cplusplus
1395}
1396#endif
1397
Sheri Zhang79cb9452021-09-07 14:51:49 +01001398#if defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__)
Pablo Telloe86a09f2018-01-11 15:44:48 +00001399 #if _MSC_VER >=1500
1400 #pragma warning( pop )
1401 #endif
1402#endif
1403
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001404#endif /* __CL_PLATFORM_H */