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