1/*******************************************************************************
2 * Copyright (c) 2008-2020 The Khronos Group Inc.
3 *
4 * 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
7 *
8 *    http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * 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 ******************************************************************************/
16
17#ifndef __CL_PLATFORM_H
18#define __CL_PLATFORM_H
19
20#include <CL/cl_version.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#if defined(_WIN32)
27    #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
36#else
37    #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
46#endif
47
48/*
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
56#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
75
76
77#ifdef __GNUC__
78  #define CL_API_SUFFIX_DEPRECATED __attribute__((deprecated))
79  #define CL_API_PREFIX_DEPRECATED
80#elif defined(_WIN32)
81  #define CL_API_SUFFIX_DEPRECATED
82  #define CL_API_PREFIX_DEPRECATED __declspec(deprecated)
83#else
84  #define CL_API_SUFFIX_DEPRECATED
85  #define CL_API_PREFIX_DEPRECATED
86#endif
87
88#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
89    #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
91#else
92    #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
94#endif
95
96#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
97    #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
99#else
100    #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
102#endif
103
104#ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS
105    #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
107#else
108    #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
110 #endif
111
112#ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS
113    #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
115#else
116    #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
118#endif
119
120#ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS
121    #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
123#else
124    #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
126#endif
127
128#ifdef CL_USE_DEPRECATED_OPENCL_2_2_APIS
129    #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
131#else
132    #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
134#endif
135
136#if (defined (_WIN32) && defined(_MSC_VER))
137
138#if defined(__clang__)
139#pragma clang diagnostic push
140#pragma clang diagnostic ignored "-Wlanguage-extension-token"
141#endif
142
143/* intptr_t is used in cl.h and provided by stddef.h in Visual C++, but not in clang */
144/* stdint.h was missing before Visual Studio 2010, include it for later versions and for clang */
145#if defined(__clang__) || _MSC_VER >= 1600
146    #include <stdint.h>
147#endif
148
149/* scalar types  */
150typedef signed   __int8         cl_char;
151typedef unsigned __int8         cl_uchar;
152typedef signed   __int16        cl_short;
153typedef unsigned __int16        cl_ushort;
154typedef signed   __int32        cl_int;
155typedef unsigned __int32        cl_uint;
156typedef signed   __int64        cl_long;
157typedef unsigned __int64        cl_ulong;
158
159typedef unsigned __int16        cl_half;
160typedef float                   cl_float;
161typedef double                  cl_double;
162
163#if defined(__clang__)
164#pragma clang diagnostic pop
165#endif
166
167/* Macro names and corresponding values defined by OpenCL */
168#define CL_CHAR_BIT         8
169#define CL_SCHAR_MAX        127
170#define CL_SCHAR_MIN        (-127-1)
171#define CL_CHAR_MAX         CL_SCHAR_MAX
172#define CL_CHAR_MIN         CL_SCHAR_MIN
173#define CL_UCHAR_MAX        255
174#define CL_SHRT_MAX         32767
175#define CL_SHRT_MIN         (-32767-1)
176#define CL_USHRT_MAX        65535
177#define CL_INT_MAX          2147483647
178#define CL_INT_MIN          (-2147483647-1)
179#define CL_UINT_MAX         0xffffffffU
180#define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
181#define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
182#define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
183
184#define CL_FLT_DIG          6
185#define CL_FLT_MANT_DIG     24
186#define CL_FLT_MAX_10_EXP   +38
187#define CL_FLT_MAX_EXP      +128
188#define CL_FLT_MIN_10_EXP   -37
189#define CL_FLT_MIN_EXP      -125
190#define CL_FLT_RADIX        2
191#define CL_FLT_MAX          340282346638528859811704183484516925440.0f
192#define CL_FLT_MIN          1.175494350822287507969e-38f
193#define CL_FLT_EPSILON      1.1920928955078125e-7f
194
195#define CL_HALF_DIG          3
196#define CL_HALF_MANT_DIG     11
197#define CL_HALF_MAX_10_EXP   +4
198#define CL_HALF_MAX_EXP      +16
199#define CL_HALF_MIN_10_EXP   -4
200#define CL_HALF_MIN_EXP      -13
201#define CL_HALF_RADIX        2
202#define CL_HALF_MAX          65504.0f
203#define CL_HALF_MIN          6.103515625e-05f
204#define CL_HALF_EPSILON      9.765625e-04f
205
206#define CL_DBL_DIG          15
207#define CL_DBL_MANT_DIG     53
208#define CL_DBL_MAX_10_EXP   +308
209#define CL_DBL_MAX_EXP      +1024
210#define CL_DBL_MIN_10_EXP   -307
211#define CL_DBL_MIN_EXP      -1021
212#define CL_DBL_RADIX        2
213#define CL_DBL_MAX          1.7976931348623158e+308
214#define CL_DBL_MIN          2.225073858507201383090e-308
215#define CL_DBL_EPSILON      2.220446049250313080847e-16
216
217#define CL_M_E              2.7182818284590452354
218#define CL_M_LOG2E          1.4426950408889634074
219#define CL_M_LOG10E         0.43429448190325182765
220#define CL_M_LN2            0.69314718055994530942
221#define CL_M_LN10           2.30258509299404568402
222#define CL_M_PI             3.14159265358979323846
223#define CL_M_PI_2           1.57079632679489661923
224#define CL_M_PI_4           0.78539816339744830962
225#define CL_M_1_PI           0.31830988618379067154
226#define CL_M_2_PI           0.63661977236758134308
227#define CL_M_2_SQRTPI       1.12837916709551257390
228#define CL_M_SQRT2          1.41421356237309504880
229#define CL_M_SQRT1_2        0.70710678118654752440
230
231#define CL_M_E_F            2.718281828f
232#define CL_M_LOG2E_F        1.442695041f
233#define CL_M_LOG10E_F       0.434294482f
234#define CL_M_LN2_F          0.693147181f
235#define CL_M_LN10_F         2.302585093f
236#define CL_M_PI_F           3.141592654f
237#define CL_M_PI_2_F         1.570796327f
238#define CL_M_PI_4_F         0.785398163f
239#define CL_M_1_PI_F         0.318309886f
240#define CL_M_2_PI_F         0.636619772f
241#define CL_M_2_SQRTPI_F     1.128379167f
242#define CL_M_SQRT2_F        1.414213562f
243#define CL_M_SQRT1_2_F      0.707106781f
244
245#define CL_NAN              (CL_INFINITY - CL_INFINITY)
246#define CL_HUGE_VALF        ((cl_float) 1e50)
247#define CL_HUGE_VAL         ((cl_double) 1e500)
248#define CL_MAXFLOAT         CL_FLT_MAX
249#define CL_INFINITY         CL_HUGE_VALF
250
251#else
252
253#include <stdint.h>
254
255/* scalar types  */
256typedef int8_t          cl_char;
257typedef uint8_t         cl_uchar;
258typedef int16_t         cl_short;
259typedef uint16_t        cl_ushort;
260typedef int32_t         cl_int;
261typedef uint32_t        cl_uint;
262typedef int64_t         cl_long;
263typedef uint64_t        cl_ulong;
264
265typedef uint16_t        cl_half;
266typedef float           cl_float;
267typedef double          cl_double;
268
269/* Macro names and corresponding values defined by OpenCL */
270#define CL_CHAR_BIT         8
271#define CL_SCHAR_MAX        127
272#define CL_SCHAR_MIN        (-127-1)
273#define CL_CHAR_MAX         CL_SCHAR_MAX
274#define CL_CHAR_MIN         CL_SCHAR_MIN
275#define CL_UCHAR_MAX        255
276#define CL_SHRT_MAX         32767
277#define CL_SHRT_MIN         (-32767-1)
278#define CL_USHRT_MAX        65535
279#define CL_INT_MAX          2147483647
280#define CL_INT_MIN          (-2147483647-1)
281#define CL_UINT_MAX         0xffffffffU
282#define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
283#define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
284#define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
285
286#define CL_FLT_DIG          6
287#define CL_FLT_MANT_DIG     24
288#define CL_FLT_MAX_10_EXP   +38
289#define CL_FLT_MAX_EXP      +128
290#define CL_FLT_MIN_10_EXP   -37
291#define CL_FLT_MIN_EXP      -125
292#define CL_FLT_RADIX        2
293#define CL_FLT_MAX          340282346638528859811704183484516925440.0f
294#define CL_FLT_MIN          1.175494350822287507969e-38f
295#define CL_FLT_EPSILON      1.1920928955078125e-7f
296
297#define CL_HALF_DIG          3
298#define CL_HALF_MANT_DIG     11
299#define CL_HALF_MAX_10_EXP   +4
300#define CL_HALF_MAX_EXP      +16
301#define CL_HALF_MIN_10_EXP   -4
302#define CL_HALF_MIN_EXP      -13
303#define CL_HALF_RADIX        2
304#define CL_HALF_MAX          65504.0f
305#define CL_HALF_MIN          6.103515625e-05f
306#define CL_HALF_EPSILON      9.765625e-04f
307
308#define CL_DBL_DIG          15
309#define CL_DBL_MANT_DIG     53
310#define CL_DBL_MAX_10_EXP   +308
311#define CL_DBL_MAX_EXP      +1024
312#define CL_DBL_MIN_10_EXP   -307
313#define CL_DBL_MIN_EXP      -1021
314#define CL_DBL_RADIX        2
315#define CL_DBL_MAX          179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
316#define CL_DBL_MIN          2.225073858507201383090e-308
317#define CL_DBL_EPSILON      2.220446049250313080847e-16
318
319#define CL_M_E              2.7182818284590452354
320#define CL_M_LOG2E          1.4426950408889634074
321#define CL_M_LOG10E         0.43429448190325182765
322#define CL_M_LN2            0.69314718055994530942
323#define CL_M_LN10           2.30258509299404568402
324#define CL_M_PI             3.14159265358979323846
325#define CL_M_PI_2           1.57079632679489661923
326#define CL_M_PI_4           0.78539816339744830962
327#define CL_M_1_PI           0.31830988618379067154
328#define CL_M_2_PI           0.63661977236758134308
329#define CL_M_2_SQRTPI       1.12837916709551257390
330#define CL_M_SQRT2          1.41421356237309504880
331#define CL_M_SQRT1_2        0.70710678118654752440
332
333#define CL_M_E_F            2.718281828f
334#define CL_M_LOG2E_F        1.442695041f
335#define CL_M_LOG10E_F       0.434294482f
336#define CL_M_LN2_F          0.693147181f
337#define CL_M_LN10_F         2.302585093f
338#define CL_M_PI_F           3.141592654f
339#define CL_M_PI_2_F         1.570796327f
340#define CL_M_PI_4_F         0.785398163f
341#define CL_M_1_PI_F         0.318309886f
342#define CL_M_2_PI_F         0.636619772f
343#define CL_M_2_SQRTPI_F     1.128379167f
344#define CL_M_SQRT2_F        1.414213562f
345#define CL_M_SQRT1_2_F      0.707106781f
346
347#if defined( __GNUC__ )
348   #define CL_HUGE_VALF     __builtin_huge_valf()
349   #define CL_HUGE_VAL      __builtin_huge_val()
350   #define CL_NAN           __builtin_nanf( "" )
351#else
352   #define CL_HUGE_VALF     ((cl_float) 1e50)
353   #define CL_HUGE_VAL      ((cl_double) 1e500)
354   float nanf( const char * );
355   #define CL_NAN           nanf( "" )
356#endif
357#define CL_MAXFLOAT         CL_FLT_MAX
358#define CL_INFINITY         CL_HUGE_VALF
359
360#endif
361
362#include <stddef.h>
363
364/* 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. */
365typedef unsigned int cl_GLuint;
366typedef int          cl_GLint;
367typedef unsigned int cl_GLenum;
368
369/*
370 * Vector types
371 *
372 *  Note:   OpenCL requires that all types be naturally aligned.
373 *          This means that vector types must be naturally aligned.
374 *          For example, a vector of four floats must be aligned to
375 *          a 16 byte boundary (calculated as 4 * the natural 4-byte
376 *          alignment of the float).  The alignment qualifiers here
377 *          will only function properly if your compiler supports them
378 *          and if you don't actively work to defeat them.  For example,
379 *          in order for a cl_float4 to be 16 byte aligned in a struct,
380 *          the start of the struct must itself be 16-byte aligned.
381 *
382 *          Maintaining proper alignment is the user's responsibility.
383 */
384
385/* Define basic vector types */
386#if defined( __VEC__ )
387  #if !defined(__clang__)
388     #include <altivec.h>   /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
389  #endif
390   typedef __vector unsigned char     __cl_uchar16;
391   typedef __vector signed char       __cl_char16;
392   typedef __vector unsigned short    __cl_ushort8;
393   typedef __vector signed short      __cl_short8;
394   typedef __vector unsigned int      __cl_uint4;
395   typedef __vector signed int        __cl_int4;
396   typedef __vector float             __cl_float4;
397   #define  __CL_UCHAR16__  1
398   #define  __CL_CHAR16__   1
399   #define  __CL_USHORT8__  1
400   #define  __CL_SHORT8__   1
401   #define  __CL_UINT4__    1
402   #define  __CL_INT4__     1
403   #define  __CL_FLOAT4__   1
404#endif
405
406#if defined( __SSE__ )
407    #if defined( __MINGW64__ )
408        #include <intrin.h>
409    #else
410        #include <xmmintrin.h>
411    #endif
412    #if defined( __GNUC__ )
413        typedef float __cl_float4   __attribute__((vector_size(16)));
414    #else
415        typedef __m128 __cl_float4;
416    #endif
417    #define __CL_FLOAT4__   1
418#endif
419
420#if defined( __SSE2__ )
421    #if defined( __MINGW64__ )
422        #include <intrin.h>
423    #else
424        #include <emmintrin.h>
425    #endif
426    #if defined( __GNUC__ )
427        typedef cl_uchar    __cl_uchar16    __attribute__((vector_size(16)));
428        typedef cl_char     __cl_char16     __attribute__((vector_size(16)));
429        typedef cl_ushort   __cl_ushort8    __attribute__((vector_size(16)));
430        typedef cl_short    __cl_short8     __attribute__((vector_size(16)));
431        typedef cl_uint     __cl_uint4      __attribute__((vector_size(16)));
432        typedef cl_int      __cl_int4       __attribute__((vector_size(16)));
433        typedef cl_ulong    __cl_ulong2     __attribute__((vector_size(16)));
434        typedef cl_long     __cl_long2      __attribute__((vector_size(16)));
435        typedef cl_double   __cl_double2    __attribute__((vector_size(16)));
436    #else
437        typedef __m128i __cl_uchar16;
438        typedef __m128i __cl_char16;
439        typedef __m128i __cl_ushort8;
440        typedef __m128i __cl_short8;
441        typedef __m128i __cl_uint4;
442        typedef __m128i __cl_int4;
443        typedef __m128i __cl_ulong2;
444        typedef __m128i __cl_long2;
445        typedef __m128d __cl_double2;
446    #endif
447    #define __CL_UCHAR16__  1
448    #define __CL_CHAR16__   1
449    #define __CL_USHORT8__  1
450    #define __CL_SHORT8__   1
451    #define __CL_INT4__     1
452    #define __CL_UINT4__    1
453    #define __CL_ULONG2__   1
454    #define __CL_LONG2__    1
455    #define __CL_DOUBLE2__  1
456#endif
457
458#if defined( __MMX__ )
459    #include <mmintrin.h>
460    #if defined( __GNUC__ )
461        typedef cl_uchar    __cl_uchar8     __attribute__((vector_size(8)));
462        typedef cl_char     __cl_char8      __attribute__((vector_size(8)));
463        typedef cl_ushort   __cl_ushort4    __attribute__((vector_size(8)));
464        typedef cl_short    __cl_short4     __attribute__((vector_size(8)));
465        typedef cl_uint     __cl_uint2      __attribute__((vector_size(8)));
466        typedef cl_int      __cl_int2       __attribute__((vector_size(8)));
467        typedef cl_ulong    __cl_ulong1     __attribute__((vector_size(8)));
468        typedef cl_long     __cl_long1      __attribute__((vector_size(8)));
469        typedef cl_float    __cl_float2     __attribute__((vector_size(8)));
470    #else
471        typedef __m64       __cl_uchar8;
472        typedef __m64       __cl_char8;
473        typedef __m64       __cl_ushort4;
474        typedef __m64       __cl_short4;
475        typedef __m64       __cl_uint2;
476        typedef __m64       __cl_int2;
477        typedef __m64       __cl_ulong1;
478        typedef __m64       __cl_long1;
479        typedef __m64       __cl_float2;
480    #endif
481    #define __CL_UCHAR8__   1
482    #define __CL_CHAR8__    1
483    #define __CL_USHORT4__  1
484    #define __CL_SHORT4__   1
485    #define __CL_INT2__     1
486    #define __CL_UINT2__    1
487    #define __CL_ULONG1__   1
488    #define __CL_LONG1__    1
489    #define __CL_FLOAT2__   1
490#endif
491
492#if defined( __AVX__ )
493    #if defined( __MINGW64__ )
494        #include <intrin.h>
495    #else
496        #include <immintrin.h>
497    #endif
498    #if defined( __GNUC__ )
499        typedef cl_float    __cl_float8     __attribute__((vector_size(32)));
500        typedef cl_double   __cl_double4    __attribute__((vector_size(32)));
501    #else
502        typedef __m256      __cl_float8;
503        typedef __m256d     __cl_double4;
504    #endif
505    #define __CL_FLOAT8__   1
506    #define __CL_DOUBLE4__  1
507#endif
508
509/* Define capabilities for anonymous struct members. */
510#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
511#define  __CL_HAS_ANON_STRUCT__ 1
512#define  __CL_ANON_STRUCT__
513#elif defined(_WIN32) && defined(_MSC_VER) && !defined(__STDC__)
514#define  __CL_HAS_ANON_STRUCT__ 1
515#define  __CL_ANON_STRUCT__
516#elif defined(__GNUC__) && ! defined(__STRICT_ANSI__)
517#define  __CL_HAS_ANON_STRUCT__ 1
518#define  __CL_ANON_STRUCT__ __extension__
519#else
520#define  __CL_HAS_ANON_STRUCT__ 0
521#define  __CL_ANON_STRUCT__
522#endif
523
524#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
525   /* Disable warning C4201: nonstandard extension used : nameless struct/union */
526    #pragma warning( push )
527    #pragma warning( disable : 4201 )
528#endif
529
530/* Define alignment keys */
531#if defined( __GNUC__ ) || defined(__INTEGRITY)
532    #define CL_ALIGNED(_x)          __attribute__ ((aligned(_x)))
533#elif defined( _WIN32) && (_MSC_VER)
534    /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements     */
535    /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx                                                 */
536    /* #include <crtdefs.h>                                                                                             */
537    /* #define CL_ALIGNED(_x)          _CRT_ALIGN(_x)                                                                   */
538    #define CL_ALIGNED(_x)
539#else
540   #warning  Need to implement some method to align data here
541   #define  CL_ALIGNED(_x)
542#endif
543
544/* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
545#if __CL_HAS_ANON_STRUCT__
546    /* .xyzw and .s0123...{f|F} are supported */
547    #define CL_HAS_NAMED_VECTOR_FIELDS 1
548    /* .hi and .lo are supported */
549    #define CL_HAS_HI_LO_VECTOR_FIELDS 1
550#endif
551
552/* Define cl_vector types */
553
554/* ---- cl_charn ---- */
555typedef union
556{
557    cl_char  CL_ALIGNED(2) s[2];
558#if __CL_HAS_ANON_STRUCT__
559   __CL_ANON_STRUCT__ struct{ cl_char  x, y; };
560   __CL_ANON_STRUCT__ struct{ cl_char  s0, s1; };
561   __CL_ANON_STRUCT__ struct{ cl_char  lo, hi; };
562#endif
563#if defined( __CL_CHAR2__)
564    __cl_char2     v2;
565#endif
566}cl_char2;
567
568typedef union
569{
570    cl_char  CL_ALIGNED(4) s[4];
571#if __CL_HAS_ANON_STRUCT__
572   __CL_ANON_STRUCT__ struct{ cl_char  x, y, z, w; };
573   __CL_ANON_STRUCT__ struct{ cl_char  s0, s1, s2, s3; };
574   __CL_ANON_STRUCT__ struct{ cl_char2 lo, hi; };
575#endif
576#if defined( __CL_CHAR2__)
577    __cl_char2     v2[2];
578#endif
579#if defined( __CL_CHAR4__)
580    __cl_char4     v4;
581#endif
582}cl_char4;
583
584/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
585typedef  cl_char4  cl_char3;
586
587typedef union
588{
589    cl_char   CL_ALIGNED(8) s[8];
590#if __CL_HAS_ANON_STRUCT__
591   __CL_ANON_STRUCT__ struct{ cl_char  x, y, z, w; };
592   __CL_ANON_STRUCT__ struct{ cl_char  s0, s1, s2, s3, s4, s5, s6, s7; };
593   __CL_ANON_STRUCT__ struct{ cl_char4 lo, hi; };
594#endif
595#if defined( __CL_CHAR2__)
596    __cl_char2     v2[4];
597#endif
598#if defined( __CL_CHAR4__)
599    __cl_char4     v4[2];
600#endif
601#if defined( __CL_CHAR8__ )
602    __cl_char8     v8;
603#endif
604}cl_char8;
605
606typedef union
607{
608    cl_char  CL_ALIGNED(16) s[16];
609#if __CL_HAS_ANON_STRUCT__
610   __CL_ANON_STRUCT__ struct{ cl_char  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
611   __CL_ANON_STRUCT__ struct{ cl_char  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
612   __CL_ANON_STRUCT__ struct{ cl_char8 lo, hi; };
613#endif
614#if defined( __CL_CHAR2__)
615    __cl_char2     v2[8];
616#endif
617#if defined( __CL_CHAR4__)
618    __cl_char4     v4[4];
619#endif
620#if defined( __CL_CHAR8__ )
621    __cl_char8     v8[2];
622#endif
623#if defined( __CL_CHAR16__ )
624    __cl_char16    v16;
625#endif
626}cl_char16;
627
628
629/* ---- cl_ucharn ---- */
630typedef union
631{
632    cl_uchar  CL_ALIGNED(2) s[2];
633#if __CL_HAS_ANON_STRUCT__
634   __CL_ANON_STRUCT__ struct{ cl_uchar  x, y; };
635   __CL_ANON_STRUCT__ struct{ cl_uchar  s0, s1; };
636   __CL_ANON_STRUCT__ struct{ cl_uchar  lo, hi; };
637#endif
638#if defined( __cl_uchar2__)
639    __cl_uchar2     v2;
640#endif
641}cl_uchar2;
642
643typedef union
644{
645    cl_uchar  CL_ALIGNED(4) s[4];
646#if __CL_HAS_ANON_STRUCT__
647   __CL_ANON_STRUCT__ struct{ cl_uchar  x, y, z, w; };
648   __CL_ANON_STRUCT__ struct{ cl_uchar  s0, s1, s2, s3; };
649   __CL_ANON_STRUCT__ struct{ cl_uchar2 lo, hi; };
650#endif
651#if defined( __CL_UCHAR2__)
652    __cl_uchar2     v2[2];
653#endif
654#if defined( __CL_UCHAR4__)
655    __cl_uchar4     v4;
656#endif
657}cl_uchar4;
658
659/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
660typedef  cl_uchar4  cl_uchar3;
661
662typedef union
663{
664    cl_uchar   CL_ALIGNED(8) s[8];
665#if __CL_HAS_ANON_STRUCT__
666   __CL_ANON_STRUCT__ struct{ cl_uchar  x, y, z, w; };
667   __CL_ANON_STRUCT__ struct{ cl_uchar  s0, s1, s2, s3, s4, s5, s6, s7; };
668   __CL_ANON_STRUCT__ struct{ cl_uchar4 lo, hi; };
669#endif
670#if defined( __CL_UCHAR2__)
671    __cl_uchar2     v2[4];
672#endif
673#if defined( __CL_UCHAR4__)
674    __cl_uchar4     v4[2];
675#endif
676#if defined( __CL_UCHAR8__ )
677    __cl_uchar8     v8;
678#endif
679}cl_uchar8;
680
681typedef union
682{
683    cl_uchar  CL_ALIGNED(16) s[16];
684#if __CL_HAS_ANON_STRUCT__
685   __CL_ANON_STRUCT__ struct{ cl_uchar  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
686   __CL_ANON_STRUCT__ struct{ cl_uchar  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
687   __CL_ANON_STRUCT__ struct{ cl_uchar8 lo, hi; };
688#endif
689#if defined( __CL_UCHAR2__)
690    __cl_uchar2     v2[8];
691#endif
692#if defined( __CL_UCHAR4__)
693    __cl_uchar4     v4[4];
694#endif
695#if defined( __CL_UCHAR8__ )
696    __cl_uchar8     v8[2];
697#endif
698#if defined( __CL_UCHAR16__ )
699    __cl_uchar16    v16;
700#endif
701}cl_uchar16;
702
703
704/* ---- cl_shortn ---- */
705typedef union
706{
707    cl_short  CL_ALIGNED(4) s[2];
708#if __CL_HAS_ANON_STRUCT__
709   __CL_ANON_STRUCT__ struct{ cl_short  x, y; };
710   __CL_ANON_STRUCT__ struct{ cl_short  s0, s1; };
711   __CL_ANON_STRUCT__ struct{ cl_short  lo, hi; };
712#endif
713#if defined( __CL_SHORT2__)
714    __cl_short2     v2;
715#endif
716}cl_short2;
717
718typedef union
719{
720    cl_short  CL_ALIGNED(8) s[4];
721#if __CL_HAS_ANON_STRUCT__
722   __CL_ANON_STRUCT__ struct{ cl_short  x, y, z, w; };
723   __CL_ANON_STRUCT__ struct{ cl_short  s0, s1, s2, s3; };
724   __CL_ANON_STRUCT__ struct{ cl_short2 lo, hi; };
725#endif
726#if defined( __CL_SHORT2__)
727    __cl_short2     v2[2];
728#endif
729#if defined( __CL_SHORT4__)
730    __cl_short4     v4;
731#endif
732}cl_short4;
733
734/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
735typedef  cl_short4  cl_short3;
736
737typedef union
738{
739    cl_short   CL_ALIGNED(16) s[8];
740#if __CL_HAS_ANON_STRUCT__
741   __CL_ANON_STRUCT__ struct{ cl_short  x, y, z, w; };
742   __CL_ANON_STRUCT__ struct{ cl_short  s0, s1, s2, s3, s4, s5, s6, s7; };
743   __CL_ANON_STRUCT__ struct{ cl_short4 lo, hi; };
744#endif
745#if defined( __CL_SHORT2__)
746    __cl_short2     v2[4];
747#endif
748#if defined( __CL_SHORT4__)
749    __cl_short4     v4[2];
750#endif
751#if defined( __CL_SHORT8__ )
752    __cl_short8     v8;
753#endif
754}cl_short8;
755
756typedef union
757{
758    cl_short  CL_ALIGNED(32) s[16];
759#if __CL_HAS_ANON_STRUCT__
760   __CL_ANON_STRUCT__ struct{ cl_short  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
761   __CL_ANON_STRUCT__ struct{ cl_short  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
762   __CL_ANON_STRUCT__ struct{ cl_short8 lo, hi; };
763#endif
764#if defined( __CL_SHORT2__)
765    __cl_short2     v2[8];
766#endif
767#if defined( __CL_SHORT4__)
768    __cl_short4     v4[4];
769#endif
770#if defined( __CL_SHORT8__ )
771    __cl_short8     v8[2];
772#endif
773#if defined( __CL_SHORT16__ )
774    __cl_short16    v16;
775#endif
776}cl_short16;
777
778
779/* ---- cl_ushortn ---- */
780typedef union
781{
782    cl_ushort  CL_ALIGNED(4) s[2];
783#if __CL_HAS_ANON_STRUCT__
784   __CL_ANON_STRUCT__ struct{ cl_ushort  x, y; };
785   __CL_ANON_STRUCT__ struct{ cl_ushort  s0, s1; };
786   __CL_ANON_STRUCT__ struct{ cl_ushort  lo, hi; };
787#endif
788#if defined( __CL_USHORT2__)
789    __cl_ushort2     v2;
790#endif
791}cl_ushort2;
792
793typedef union
794{
795    cl_ushort  CL_ALIGNED(8) s[4];
796#if __CL_HAS_ANON_STRUCT__
797   __CL_ANON_STRUCT__ struct{ cl_ushort  x, y, z, w; };
798   __CL_ANON_STRUCT__ struct{ cl_ushort  s0, s1, s2, s3; };
799   __CL_ANON_STRUCT__ struct{ cl_ushort2 lo, hi; };
800#endif
801#if defined( __CL_USHORT2__)
802    __cl_ushort2     v2[2];
803#endif
804#if defined( __CL_USHORT4__)
805    __cl_ushort4     v4;
806#endif
807}cl_ushort4;
808
809/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
810typedef  cl_ushort4  cl_ushort3;
811
812typedef union
813{
814    cl_ushort   CL_ALIGNED(16) s[8];
815#if __CL_HAS_ANON_STRUCT__
816   __CL_ANON_STRUCT__ struct{ cl_ushort  x, y, z, w; };
817   __CL_ANON_STRUCT__ struct{ cl_ushort  s0, s1, s2, s3, s4, s5, s6, s7; };
818   __CL_ANON_STRUCT__ struct{ cl_ushort4 lo, hi; };
819#endif
820#if defined( __CL_USHORT2__)
821    __cl_ushort2     v2[4];
822#endif
823#if defined( __CL_USHORT4__)
824    __cl_ushort4     v4[2];
825#endif
826#if defined( __CL_USHORT8__ )
827    __cl_ushort8     v8;
828#endif
829}cl_ushort8;
830
831typedef union
832{
833    cl_ushort  CL_ALIGNED(32) s[16];
834#if __CL_HAS_ANON_STRUCT__
835   __CL_ANON_STRUCT__ struct{ cl_ushort  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
836   __CL_ANON_STRUCT__ struct{ cl_ushort  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
837   __CL_ANON_STRUCT__ struct{ cl_ushort8 lo, hi; };
838#endif
839#if defined( __CL_USHORT2__)
840    __cl_ushort2     v2[8];
841#endif
842#if defined( __CL_USHORT4__)
843    __cl_ushort4     v4[4];
844#endif
845#if defined( __CL_USHORT8__ )
846    __cl_ushort8     v8[2];
847#endif
848#if defined( __CL_USHORT16__ )
849    __cl_ushort16    v16;
850#endif
851}cl_ushort16;
852
853
854/* ---- cl_halfn ---- */
855typedef union
856{
857    cl_half  CL_ALIGNED(4) s[2];
858#if __CL_HAS_ANON_STRUCT__
859    __CL_ANON_STRUCT__ struct{ cl_half  x, y; };
860    __CL_ANON_STRUCT__ struct{ cl_half  s0, s1; };
861    __CL_ANON_STRUCT__ struct{ cl_half  lo, hi; };
862#endif
863#if defined( __CL_HALF2__)
864    __cl_half2     v2;
865#endif
866}cl_half2;
867
868typedef union
869{
870    cl_half  CL_ALIGNED(8) s[4];
871#if __CL_HAS_ANON_STRUCT__
872    __CL_ANON_STRUCT__ struct{ cl_half  x, y, z, w; };
873    __CL_ANON_STRUCT__ struct{ cl_half  s0, s1, s2, s3; };
874    __CL_ANON_STRUCT__ struct{ cl_half2 lo, hi; };
875#endif
876#if defined( __CL_HALF2__)
877    __cl_half2     v2[2];
878#endif
879#if defined( __CL_HALF4__)
880    __cl_half4     v4;
881#endif
882}cl_half4;
883
884/* cl_half3 is identical in size, alignment and behavior to cl_half4. See section 6.1.5. */
885typedef  cl_half4  cl_half3;
886
887typedef union
888{
889    cl_half   CL_ALIGNED(16) s[8];
890#if __CL_HAS_ANON_STRUCT__
891    __CL_ANON_STRUCT__ struct{ cl_half  x, y, z, w; };
892    __CL_ANON_STRUCT__ struct{ cl_half  s0, s1, s2, s3, s4, s5, s6, s7; };
893    __CL_ANON_STRUCT__ struct{ cl_half4 lo, hi; };
894#endif
895#if defined( __CL_HALF2__)
896    __cl_half2     v2[4];
897#endif
898#if defined( __CL_HALF4__)
899    __cl_half4     v4[2];
900#endif
901#if defined( __CL_HALF8__ )
902    __cl_half8     v8;
903#endif
904}cl_half8;
905
906typedef union
907{
908    cl_half  CL_ALIGNED(32) s[16];
909#if __CL_HAS_ANON_STRUCT__
910    __CL_ANON_STRUCT__ struct{ cl_half  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
911    __CL_ANON_STRUCT__ struct{ cl_half  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
912    __CL_ANON_STRUCT__ struct{ cl_half8 lo, hi; };
913#endif
914#if defined( __CL_HALF2__)
915    __cl_half2     v2[8];
916#endif
917#if defined( __CL_HALF4__)
918    __cl_half4     v4[4];
919#endif
920#if defined( __CL_HALF8__ )
921    __cl_half8     v8[2];
922#endif
923#if defined( __CL_HALF16__ )
924    __cl_half16    v16;
925#endif
926}cl_half16;
927
928/* ---- cl_intn ---- */
929typedef union
930{
931    cl_int  CL_ALIGNED(8) s[2];
932#if __CL_HAS_ANON_STRUCT__
933   __CL_ANON_STRUCT__ struct{ cl_int  x, y; };
934   __CL_ANON_STRUCT__ struct{ cl_int  s0, s1; };
935   __CL_ANON_STRUCT__ struct{ cl_int  lo, hi; };
936#endif
937#if defined( __CL_INT2__)
938    __cl_int2     v2;
939#endif
940}cl_int2;
941
942typedef union
943{
944    cl_int  CL_ALIGNED(16) s[4];
945#if __CL_HAS_ANON_STRUCT__
946   __CL_ANON_STRUCT__ struct{ cl_int  x, y, z, w; };
947   __CL_ANON_STRUCT__ struct{ cl_int  s0, s1, s2, s3; };
948   __CL_ANON_STRUCT__ struct{ cl_int2 lo, hi; };
949#endif
950#if defined( __CL_INT2__)
951    __cl_int2     v2[2];
952#endif
953#if defined( __CL_INT4__)
954    __cl_int4     v4;
955#endif
956}cl_int4;
957
958/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
959typedef  cl_int4  cl_int3;
960
961typedef union
962{
963    cl_int   CL_ALIGNED(32) s[8];
964#if __CL_HAS_ANON_STRUCT__
965   __CL_ANON_STRUCT__ struct{ cl_int  x, y, z, w; };
966   __CL_ANON_STRUCT__ struct{ cl_int  s0, s1, s2, s3, s4, s5, s6, s7; };
967   __CL_ANON_STRUCT__ struct{ cl_int4 lo, hi; };
968#endif
969#if defined( __CL_INT2__)
970    __cl_int2     v2[4];
971#endif
972#if defined( __CL_INT4__)
973    __cl_int4     v4[2];
974#endif
975#if defined( __CL_INT8__ )
976    __cl_int8     v8;
977#endif
978}cl_int8;
979
980typedef union
981{
982    cl_int  CL_ALIGNED(64) s[16];
983#if __CL_HAS_ANON_STRUCT__
984   __CL_ANON_STRUCT__ struct{ cl_int  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
985   __CL_ANON_STRUCT__ struct{ cl_int  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
986   __CL_ANON_STRUCT__ struct{ cl_int8 lo, hi; };
987#endif
988#if defined( __CL_INT2__)
989    __cl_int2     v2[8];
990#endif
991#if defined( __CL_INT4__)
992    __cl_int4     v4[4];
993#endif
994#if defined( __CL_INT8__ )
995    __cl_int8     v8[2];
996#endif
997#if defined( __CL_INT16__ )
998    __cl_int16    v16;
999#endif
1000}cl_int16;
1001
1002
1003/* ---- cl_uintn ---- */
1004typedef union
1005{
1006    cl_uint  CL_ALIGNED(8) s[2];
1007#if __CL_HAS_ANON_STRUCT__
1008   __CL_ANON_STRUCT__ struct{ cl_uint  x, y; };
1009   __CL_ANON_STRUCT__ struct{ cl_uint  s0, s1; };
1010   __CL_ANON_STRUCT__ struct{ cl_uint  lo, hi; };
1011#endif
1012#if defined( __CL_UINT2__)
1013    __cl_uint2     v2;
1014#endif
1015}cl_uint2;
1016
1017typedef union
1018{
1019    cl_uint  CL_ALIGNED(16) s[4];
1020#if __CL_HAS_ANON_STRUCT__
1021   __CL_ANON_STRUCT__ struct{ cl_uint  x, y, z, w; };
1022   __CL_ANON_STRUCT__ struct{ cl_uint  s0, s1, s2, s3; };
1023   __CL_ANON_STRUCT__ struct{ cl_uint2 lo, hi; };
1024#endif
1025#if defined( __CL_UINT2__)
1026    __cl_uint2     v2[2];
1027#endif
1028#if defined( __CL_UINT4__)
1029    __cl_uint4     v4;
1030#endif
1031}cl_uint4;
1032
1033/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
1034typedef  cl_uint4  cl_uint3;
1035
1036typedef union
1037{
1038    cl_uint   CL_ALIGNED(32) s[8];
1039#if __CL_HAS_ANON_STRUCT__
1040   __CL_ANON_STRUCT__ struct{ cl_uint  x, y, z, w; };
1041   __CL_ANON_STRUCT__ struct{ cl_uint  s0, s1, s2, s3, s4, s5, s6, s7; };
1042   __CL_ANON_STRUCT__ struct{ cl_uint4 lo, hi; };
1043#endif
1044#if defined( __CL_UINT2__)
1045    __cl_uint2     v2[4];
1046#endif
1047#if defined( __CL_UINT4__)
1048    __cl_uint4     v4[2];
1049#endif
1050#if defined( __CL_UINT8__ )
1051    __cl_uint8     v8;
1052#endif
1053}cl_uint8;
1054
1055typedef union
1056{
1057    cl_uint  CL_ALIGNED(64) s[16];
1058#if __CL_HAS_ANON_STRUCT__
1059   __CL_ANON_STRUCT__ struct{ cl_uint  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1060   __CL_ANON_STRUCT__ struct{ cl_uint  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1061   __CL_ANON_STRUCT__ struct{ cl_uint8 lo, hi; };
1062#endif
1063#if defined( __CL_UINT2__)
1064    __cl_uint2     v2[8];
1065#endif
1066#if defined( __CL_UINT4__)
1067    __cl_uint4     v4[4];
1068#endif
1069#if defined( __CL_UINT8__ )
1070    __cl_uint8     v8[2];
1071#endif
1072#if defined( __CL_UINT16__ )
1073    __cl_uint16    v16;
1074#endif
1075}cl_uint16;
1076
1077/* ---- cl_longn ---- */
1078typedef union
1079{
1080    cl_long  CL_ALIGNED(16) s[2];
1081#if __CL_HAS_ANON_STRUCT__
1082   __CL_ANON_STRUCT__ struct{ cl_long  x, y; };
1083   __CL_ANON_STRUCT__ struct{ cl_long  s0, s1; };
1084   __CL_ANON_STRUCT__ struct{ cl_long  lo, hi; };
1085#endif
1086#if defined( __CL_LONG2__)
1087    __cl_long2     v2;
1088#endif
1089}cl_long2;
1090
1091typedef union
1092{
1093    cl_long  CL_ALIGNED(32) s[4];
1094#if __CL_HAS_ANON_STRUCT__
1095   __CL_ANON_STRUCT__ struct{ cl_long  x, y, z, w; };
1096   __CL_ANON_STRUCT__ struct{ cl_long  s0, s1, s2, s3; };
1097   __CL_ANON_STRUCT__ struct{ cl_long2 lo, hi; };
1098#endif
1099#if defined( __CL_LONG2__)
1100    __cl_long2     v2[2];
1101#endif
1102#if defined( __CL_LONG4__)
1103    __cl_long4     v4;
1104#endif
1105}cl_long4;
1106
1107/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
1108typedef  cl_long4  cl_long3;
1109
1110typedef union
1111{
1112    cl_long   CL_ALIGNED(64) s[8];
1113#if __CL_HAS_ANON_STRUCT__
1114   __CL_ANON_STRUCT__ struct{ cl_long  x, y, z, w; };
1115   __CL_ANON_STRUCT__ struct{ cl_long  s0, s1, s2, s3, s4, s5, s6, s7; };
1116   __CL_ANON_STRUCT__ struct{ cl_long4 lo, hi; };
1117#endif
1118#if defined( __CL_LONG2__)
1119    __cl_long2     v2[4];
1120#endif
1121#if defined( __CL_LONG4__)
1122    __cl_long4     v4[2];
1123#endif
1124#if defined( __CL_LONG8__ )
1125    __cl_long8     v8;
1126#endif
1127}cl_long8;
1128
1129typedef union
1130{
1131    cl_long  CL_ALIGNED(128) s[16];
1132#if __CL_HAS_ANON_STRUCT__
1133   __CL_ANON_STRUCT__ struct{ cl_long  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1134   __CL_ANON_STRUCT__ struct{ cl_long  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1135   __CL_ANON_STRUCT__ struct{ cl_long8 lo, hi; };
1136#endif
1137#if defined( __CL_LONG2__)
1138    __cl_long2     v2[8];
1139#endif
1140#if defined( __CL_LONG4__)
1141    __cl_long4     v4[4];
1142#endif
1143#if defined( __CL_LONG8__ )
1144    __cl_long8     v8[2];
1145#endif
1146#if defined( __CL_LONG16__ )
1147    __cl_long16    v16;
1148#endif
1149}cl_long16;
1150
1151
1152/* ---- cl_ulongn ---- */
1153typedef union
1154{
1155    cl_ulong  CL_ALIGNED(16) s[2];
1156#if __CL_HAS_ANON_STRUCT__
1157   __CL_ANON_STRUCT__ struct{ cl_ulong  x, y; };
1158   __CL_ANON_STRUCT__ struct{ cl_ulong  s0, s1; };
1159   __CL_ANON_STRUCT__ struct{ cl_ulong  lo, hi; };
1160#endif
1161#if defined( __CL_ULONG2__)
1162    __cl_ulong2     v2;
1163#endif
1164}cl_ulong2;
1165
1166typedef union
1167{
1168    cl_ulong  CL_ALIGNED(32) s[4];
1169#if __CL_HAS_ANON_STRUCT__
1170   __CL_ANON_STRUCT__ struct{ cl_ulong  x, y, z, w; };
1171   __CL_ANON_STRUCT__ struct{ cl_ulong  s0, s1, s2, s3; };
1172   __CL_ANON_STRUCT__ struct{ cl_ulong2 lo, hi; };
1173#endif
1174#if defined( __CL_ULONG2__)
1175    __cl_ulong2     v2[2];
1176#endif
1177#if defined( __CL_ULONG4__)
1178    __cl_ulong4     v4;
1179#endif
1180}cl_ulong4;
1181
1182/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
1183typedef  cl_ulong4  cl_ulong3;
1184
1185typedef union
1186{
1187    cl_ulong   CL_ALIGNED(64) s[8];
1188#if __CL_HAS_ANON_STRUCT__
1189   __CL_ANON_STRUCT__ struct{ cl_ulong  x, y, z, w; };
1190   __CL_ANON_STRUCT__ struct{ cl_ulong  s0, s1, s2, s3, s4, s5, s6, s7; };
1191   __CL_ANON_STRUCT__ struct{ cl_ulong4 lo, hi; };
1192#endif
1193#if defined( __CL_ULONG2__)
1194    __cl_ulong2     v2[4];
1195#endif
1196#if defined( __CL_ULONG4__)
1197    __cl_ulong4     v4[2];
1198#endif
1199#if defined( __CL_ULONG8__ )
1200    __cl_ulong8     v8;
1201#endif
1202}cl_ulong8;
1203
1204typedef union
1205{
1206    cl_ulong  CL_ALIGNED(128) s[16];
1207#if __CL_HAS_ANON_STRUCT__
1208   __CL_ANON_STRUCT__ struct{ cl_ulong  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1209   __CL_ANON_STRUCT__ struct{ cl_ulong  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1210   __CL_ANON_STRUCT__ struct{ cl_ulong8 lo, hi; };
1211#endif
1212#if defined( __CL_ULONG2__)
1213    __cl_ulong2     v2[8];
1214#endif
1215#if defined( __CL_ULONG4__)
1216    __cl_ulong4     v4[4];
1217#endif
1218#if defined( __CL_ULONG8__ )
1219    __cl_ulong8     v8[2];
1220#endif
1221#if defined( __CL_ULONG16__ )
1222    __cl_ulong16    v16;
1223#endif
1224}cl_ulong16;
1225
1226
1227/* --- cl_floatn ---- */
1228
1229typedef union
1230{
1231    cl_float  CL_ALIGNED(8) s[2];
1232#if __CL_HAS_ANON_STRUCT__
1233   __CL_ANON_STRUCT__ struct{ cl_float  x, y; };
1234   __CL_ANON_STRUCT__ struct{ cl_float  s0, s1; };
1235   __CL_ANON_STRUCT__ struct{ cl_float  lo, hi; };
1236#endif
1237#if defined( __CL_FLOAT2__)
1238    __cl_float2     v2;
1239#endif
1240}cl_float2;
1241
1242typedef union
1243{
1244    cl_float  CL_ALIGNED(16) s[4];
1245#if __CL_HAS_ANON_STRUCT__
1246   __CL_ANON_STRUCT__ struct{ cl_float   x, y, z, w; };
1247   __CL_ANON_STRUCT__ struct{ cl_float   s0, s1, s2, s3; };
1248   __CL_ANON_STRUCT__ struct{ cl_float2  lo, hi; };
1249#endif
1250#if defined( __CL_FLOAT2__)
1251    __cl_float2     v2[2];
1252#endif
1253#if defined( __CL_FLOAT4__)
1254    __cl_float4     v4;
1255#endif
1256}cl_float4;
1257
1258/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1259typedef  cl_float4  cl_float3;
1260
1261typedef union
1262{
1263    cl_float   CL_ALIGNED(32) s[8];
1264#if __CL_HAS_ANON_STRUCT__
1265   __CL_ANON_STRUCT__ struct{ cl_float   x, y, z, w; };
1266   __CL_ANON_STRUCT__ struct{ cl_float   s0, s1, s2, s3, s4, s5, s6, s7; };
1267   __CL_ANON_STRUCT__ struct{ cl_float4  lo, hi; };
1268#endif
1269#if defined( __CL_FLOAT2__)
1270    __cl_float2     v2[4];
1271#endif
1272#if defined( __CL_FLOAT4__)
1273    __cl_float4     v4[2];
1274#endif
1275#if defined( __CL_FLOAT8__ )
1276    __cl_float8     v8;
1277#endif
1278}cl_float8;
1279
1280typedef union
1281{
1282    cl_float  CL_ALIGNED(64) s[16];
1283#if __CL_HAS_ANON_STRUCT__
1284   __CL_ANON_STRUCT__ struct{ cl_float  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1285   __CL_ANON_STRUCT__ struct{ cl_float  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1286   __CL_ANON_STRUCT__ struct{ cl_float8 lo, hi; };
1287#endif
1288#if defined( __CL_FLOAT2__)
1289    __cl_float2     v2[8];
1290#endif
1291#if defined( __CL_FLOAT4__)
1292    __cl_float4     v4[4];
1293#endif
1294#if defined( __CL_FLOAT8__ )
1295    __cl_float8     v8[2];
1296#endif
1297#if defined( __CL_FLOAT16__ )
1298    __cl_float16    v16;
1299#endif
1300}cl_float16;
1301
1302/* --- cl_doublen ---- */
1303
1304typedef union
1305{
1306    cl_double  CL_ALIGNED(16) s[2];
1307#if __CL_HAS_ANON_STRUCT__
1308   __CL_ANON_STRUCT__ struct{ cl_double  x, y; };
1309   __CL_ANON_STRUCT__ struct{ cl_double s0, s1; };
1310   __CL_ANON_STRUCT__ struct{ cl_double lo, hi; };
1311#endif
1312#if defined( __CL_DOUBLE2__)
1313    __cl_double2     v2;
1314#endif
1315}cl_double2;
1316
1317typedef union
1318{
1319    cl_double  CL_ALIGNED(32) s[4];
1320#if __CL_HAS_ANON_STRUCT__
1321   __CL_ANON_STRUCT__ struct{ cl_double  x, y, z, w; };
1322   __CL_ANON_STRUCT__ struct{ cl_double  s0, s1, s2, s3; };
1323   __CL_ANON_STRUCT__ struct{ cl_double2 lo, hi; };
1324#endif
1325#if defined( __CL_DOUBLE2__)
1326    __cl_double2     v2[2];
1327#endif
1328#if defined( __CL_DOUBLE4__)
1329    __cl_double4     v4;
1330#endif
1331}cl_double4;
1332
1333/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1334typedef  cl_double4  cl_double3;
1335
1336typedef union
1337{
1338    cl_double   CL_ALIGNED(64) s[8];
1339#if __CL_HAS_ANON_STRUCT__
1340   __CL_ANON_STRUCT__ struct{ cl_double  x, y, z, w; };
1341   __CL_ANON_STRUCT__ struct{ cl_double  s0, s1, s2, s3, s4, s5, s6, s7; };
1342   __CL_ANON_STRUCT__ struct{ cl_double4 lo, hi; };
1343#endif
1344#if defined( __CL_DOUBLE2__)
1345    __cl_double2     v2[4];
1346#endif
1347#if defined( __CL_DOUBLE4__)
1348    __cl_double4     v4[2];
1349#endif
1350#if defined( __CL_DOUBLE8__ )
1351    __cl_double8     v8;
1352#endif
1353}cl_double8;
1354
1355typedef union
1356{
1357    cl_double  CL_ALIGNED(128) s[16];
1358#if __CL_HAS_ANON_STRUCT__
1359   __CL_ANON_STRUCT__ struct{ cl_double  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1360   __CL_ANON_STRUCT__ struct{ cl_double  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1361   __CL_ANON_STRUCT__ struct{ cl_double8 lo, hi; };
1362#endif
1363#if defined( __CL_DOUBLE2__)
1364    __cl_double2     v2[8];
1365#endif
1366#if defined( __CL_DOUBLE4__)
1367    __cl_double4     v4[4];
1368#endif
1369#if defined( __CL_DOUBLE8__ )
1370    __cl_double8     v8[2];
1371#endif
1372#if defined( __CL_DOUBLE16__ )
1373    __cl_double16    v16;
1374#endif
1375}cl_double16;
1376
1377/* Macro to facilitate debugging
1378 * Usage:
1379 *   Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
1380 *   The first line ends with:   CL_PROGRAM_STRING_DEBUG_INFO \"
1381 *   Each line thereafter of OpenCL C source must end with: \n\
1382 *   The last line ends in ";
1383 *
1384 *   Example:
1385 *
1386 *   const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
1387 *   kernel void foo( int a, float * b )             \n\
1388 *   {                                               \n\
1389 *      // my comment                                \n\
1390 *      *b[ get_global_id(0)] = a;                   \n\
1391 *   }                                               \n\
1392 *   ";
1393 *
1394 * This should correctly set up the line, (column) and file information for your source
1395 * string so you can do source level debugging.
1396 */
1397#define  __CL_STRINGIFY( _x )               # _x
1398#define  _CL_STRINGIFY( _x )                __CL_STRINGIFY( _x )
1399#define  CL_PROGRAM_STRING_DEBUG_INFO       "#line "  _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
1400
1401#ifdef __cplusplus
1402}
1403#endif
1404
1405#if defined(_WIN32) && defined(_MSC_VER) && __CL_HAS_ANON_STRUCT__
1406    #pragma warning( pop )
1407#endif
1408
1409#endif  /* __CL_PLATFORM_H  */
1410