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