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