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