17ec681f3Smrg/*******************************************************************************
27ec681f3Smrg * Copyright (c) 2008-2020 The Khronos Group Inc.
3af69d88dSmrg *
47ec681f3Smrg * Licensed under the Apache License, Version 2.0 (the "License");
57ec681f3Smrg * you may not use this file except in compliance with the License.
67ec681f3Smrg * You may obtain a copy of the License at
7af69d88dSmrg *
87ec681f3Smrg *    http://www.apache.org/licenses/LICENSE-2.0
9af69d88dSmrg *
107ec681f3Smrg * Unless required by applicable law or agreed to in writing, software
117ec681f3Smrg * distributed under the License is distributed on an "AS IS" BASIS,
127ec681f3Smrg * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137ec681f3Smrg * See the License for the specific language governing permissions and
147ec681f3Smrg * limitations under the License.
157ec681f3Smrg ******************************************************************************/
16af69d88dSmrg
17af69d88dSmrg#ifndef __CL_PLATFORM_H
18af69d88dSmrg#define __CL_PLATFORM_H
19af69d88dSmrg
2053c12917Smaya#include <CL/cl_version.h>
21af69d88dSmrg
22af69d88dSmrg#ifdef __cplusplus
23af69d88dSmrgextern "C" {
24af69d88dSmrg#endif
25af69d88dSmrg
26af69d88dSmrg#if defined(_WIN32)
27af69d88dSmrg    #define CL_API_ENTRY
28af69d88dSmrg    #define CL_API_CALL     __stdcall
29af69d88dSmrg    #define CL_CALLBACK     __stdcall
30af69d88dSmrg#else
31af69d88dSmrg    #define CL_API_ENTRY
32af69d88dSmrg    #define CL_API_CALL
33af69d88dSmrg    #define CL_CALLBACK
34af69d88dSmrg#endif
35af69d88dSmrg
3653c12917Smaya/*
3753c12917Smaya * Deprecation flags refer to the last version of the header in which the
3853c12917Smaya * feature was not deprecated.
3953c12917Smaya *
4053c12917Smaya * E.g. VERSION_1_1_DEPRECATED means the feature is present in 1.1 without
4153c12917Smaya * deprecation but is deprecated in versions later than 1.1.
4253c12917Smaya */
4353c12917Smaya
4453c12917Smaya#define CL_EXTENSION_WEAK_LINK
4553c12917Smaya#define CL_API_SUFFIX__VERSION_1_0
4653c12917Smaya#define CL_EXT_SUFFIX__VERSION_1_0
4753c12917Smaya#define CL_API_SUFFIX__VERSION_1_1
4853c12917Smaya#define CL_EXT_SUFFIX__VERSION_1_1
4953c12917Smaya#define CL_API_SUFFIX__VERSION_1_2
5053c12917Smaya#define CL_EXT_SUFFIX__VERSION_1_2
5153c12917Smaya#define CL_API_SUFFIX__VERSION_2_0
5253c12917Smaya#define CL_EXT_SUFFIX__VERSION_2_0
5353c12917Smaya#define CL_API_SUFFIX__VERSION_2_1
5453c12917Smaya#define CL_EXT_SUFFIX__VERSION_2_1
5553c12917Smaya#define CL_API_SUFFIX__VERSION_2_2
5653c12917Smaya#define CL_EXT_SUFFIX__VERSION_2_2
577ec681f3Smrg#define CL_API_SUFFIX__VERSION_3_0
587ec681f3Smrg#define CL_EXT_SUFFIX__VERSION_3_0
597ec681f3Smrg#define CL_API_SUFFIX__EXPERIMENTAL
607ec681f3Smrg#define CL_EXT_SUFFIX__EXPERIMENTAL
6153c12917Smaya
6253c12917Smaya
637ec681f3Smrg#ifdef __GNUC__
647ec681f3Smrg  #define CL_EXT_SUFFIX_DEPRECATED __attribute__((deprecated))
657ec681f3Smrg  #define CL_EXT_PREFIX_DEPRECATED
6653c12917Smaya#elif defined(_WIN32)
677ec681f3Smrg  #define CL_EXT_SUFFIX_DEPRECATED
687ec681f3Smrg  #define CL_EXT_PREFIX_DEPRECATED __declspec(deprecated)
6953c12917Smaya#else
707ec681f3Smrg  #define CL_EXT_SUFFIX_DEPRECATED
717ec681f3Smrg  #define CL_EXT_PREFIX_DEPRECATED
727ec681f3Smrg#endif
737ec681f3Smrg
747ec681f3Smrg#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
7553c12917Smaya    #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED
7653c12917Smaya    #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED
777ec681f3Smrg#else
787ec681f3Smrg    #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXT_SUFFIX_DEPRECATED
797ec681f3Smrg    #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED CL_EXT_PREFIX_DEPRECATED
807ec681f3Smrg#endif
8153c12917Smaya
827ec681f3Smrg#ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS
8353c12917Smaya    #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
8453c12917Smaya    #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
857ec681f3Smrg#else
867ec681f3Smrg    #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXT_SUFFIX_DEPRECATED
877ec681f3Smrg    #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED CL_EXT_PREFIX_DEPRECATED
887ec681f3Smrg#endif
8953c12917Smaya
907ec681f3Smrg#ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS
9153c12917Smaya    #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED
9253c12917Smaya    #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED
937ec681f3Smrg#else
947ec681f3Smrg    #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED CL_EXT_SUFFIX_DEPRECATED
957ec681f3Smrg    #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED CL_EXT_PREFIX_DEPRECATED
967ec681f3Smrg #endif
9753c12917Smaya
987ec681f3Smrg#ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS
9953c12917Smaya    #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED
10053c12917Smaya    #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED
1017ec681f3Smrg#else
1027ec681f3Smrg    #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED CL_EXT_SUFFIX_DEPRECATED
1037ec681f3Smrg    #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED CL_EXT_PREFIX_DEPRECATED
1047ec681f3Smrg#endif
10553c12917Smaya
1067ec681f3Smrg#ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS
10753c12917Smaya    #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED
10853c12917Smaya    #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED
1097ec681f3Smrg#else
1107ec681f3Smrg    #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED CL_EXT_SUFFIX_DEPRECATED
1117ec681f3Smrg    #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED CL_EXT_PREFIX_DEPRECATED
1127ec681f3Smrg#endif
1137ec681f3Smrg
1147ec681f3Smrg#ifdef CL_USE_DEPRECATED_OPENCL_2_2_APIS
1157ec681f3Smrg    #define CL_EXT_SUFFIX__VERSION_2_2_DEPRECATED
1167ec681f3Smrg    #define CL_EXT_PREFIX__VERSION_2_2_DEPRECATED
1177ec681f3Smrg#else
1187ec681f3Smrg    #define CL_EXT_SUFFIX__VERSION_2_2_DEPRECATED CL_EXT_SUFFIX_DEPRECATED
1197ec681f3Smrg    #define CL_EXT_PREFIX__VERSION_2_2_DEPRECATED CL_EXT_PREFIX_DEPRECATED
120af69d88dSmrg#endif
121af69d88dSmrg
122af69d88dSmrg#if (defined (_WIN32) && defined(_MSC_VER))
123af69d88dSmrg
124af69d88dSmrg/* scalar types  */
125af69d88dSmrgtypedef signed   __int8         cl_char;
126af69d88dSmrgtypedef unsigned __int8         cl_uchar;
127af69d88dSmrgtypedef signed   __int16        cl_short;
128af69d88dSmrgtypedef unsigned __int16        cl_ushort;
129af69d88dSmrgtypedef signed   __int32        cl_int;
130af69d88dSmrgtypedef unsigned __int32        cl_uint;
131af69d88dSmrgtypedef signed   __int64        cl_long;
132af69d88dSmrgtypedef unsigned __int64        cl_ulong;
133af69d88dSmrg
134af69d88dSmrgtypedef unsigned __int16        cl_half;
135af69d88dSmrgtypedef float                   cl_float;
136af69d88dSmrgtypedef double                  cl_double;
137af69d88dSmrg
138af69d88dSmrg/* Macro names and corresponding values defined by OpenCL */
139af69d88dSmrg#define CL_CHAR_BIT         8
140af69d88dSmrg#define CL_SCHAR_MAX        127
141af69d88dSmrg#define CL_SCHAR_MIN        (-127-1)
142af69d88dSmrg#define CL_CHAR_MAX         CL_SCHAR_MAX
143af69d88dSmrg#define CL_CHAR_MIN         CL_SCHAR_MIN
144af69d88dSmrg#define CL_UCHAR_MAX        255
145af69d88dSmrg#define CL_SHRT_MAX         32767
146af69d88dSmrg#define CL_SHRT_MIN         (-32767-1)
147af69d88dSmrg#define CL_USHRT_MAX        65535
148af69d88dSmrg#define CL_INT_MAX          2147483647
149af69d88dSmrg#define CL_INT_MIN          (-2147483647-1)
150af69d88dSmrg#define CL_UINT_MAX         0xffffffffU
151af69d88dSmrg#define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
152af69d88dSmrg#define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
153af69d88dSmrg#define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
154af69d88dSmrg
155af69d88dSmrg#define CL_FLT_DIG          6
156af69d88dSmrg#define CL_FLT_MANT_DIG     24
157af69d88dSmrg#define CL_FLT_MAX_10_EXP   +38
158af69d88dSmrg#define CL_FLT_MAX_EXP      +128
159af69d88dSmrg#define CL_FLT_MIN_10_EXP   -37
160af69d88dSmrg#define CL_FLT_MIN_EXP      -125
161af69d88dSmrg#define CL_FLT_RADIX        2
162af69d88dSmrg#define CL_FLT_MAX          340282346638528859811704183484516925440.0f
163af69d88dSmrg#define CL_FLT_MIN          1.175494350822287507969e-38f
16453c12917Smaya#define CL_FLT_EPSILON      1.1920928955078125e-7f
16553c12917Smaya
16653c12917Smaya#define CL_HALF_DIG          3
16753c12917Smaya#define CL_HALF_MANT_DIG     11
16853c12917Smaya#define CL_HALF_MAX_10_EXP   +4
16953c12917Smaya#define CL_HALF_MAX_EXP      +16
17053c12917Smaya#define CL_HALF_MIN_10_EXP   -4
17153c12917Smaya#define CL_HALF_MIN_EXP      -13
17253c12917Smaya#define CL_HALF_RADIX        2
17353c12917Smaya#define CL_HALF_MAX          65504.0f
17453c12917Smaya#define CL_HALF_MIN          6.103515625e-05f
17553c12917Smaya#define CL_HALF_EPSILON      9.765625e-04f
176af69d88dSmrg
177af69d88dSmrg#define CL_DBL_DIG          15
178af69d88dSmrg#define CL_DBL_MANT_DIG     53
179af69d88dSmrg#define CL_DBL_MAX_10_EXP   +308
180af69d88dSmrg#define CL_DBL_MAX_EXP      +1024
181af69d88dSmrg#define CL_DBL_MIN_10_EXP   -307
182af69d88dSmrg#define CL_DBL_MIN_EXP      -1021
183af69d88dSmrg#define CL_DBL_RADIX        2
18453c12917Smaya#define CL_DBL_MAX          1.7976931348623158e+308
185af69d88dSmrg#define CL_DBL_MIN          2.225073858507201383090e-308
186af69d88dSmrg#define CL_DBL_EPSILON      2.220446049250313080847e-16
187af69d88dSmrg
18853c12917Smaya#define CL_M_E              2.7182818284590452354
18953c12917Smaya#define CL_M_LOG2E          1.4426950408889634074
19053c12917Smaya#define CL_M_LOG10E         0.43429448190325182765
19153c12917Smaya#define CL_M_LN2            0.69314718055994530942
19253c12917Smaya#define CL_M_LN10           2.30258509299404568402
19353c12917Smaya#define CL_M_PI             3.14159265358979323846
19453c12917Smaya#define CL_M_PI_2           1.57079632679489661923
19553c12917Smaya#define CL_M_PI_4           0.78539816339744830962
19653c12917Smaya#define CL_M_1_PI           0.31830988618379067154
19753c12917Smaya#define CL_M_2_PI           0.63661977236758134308
19853c12917Smaya#define CL_M_2_SQRTPI       1.12837916709551257390
19953c12917Smaya#define CL_M_SQRT2          1.41421356237309504880
20053c12917Smaya#define CL_M_SQRT1_2        0.70710678118654752440
20153c12917Smaya
20253c12917Smaya#define CL_M_E_F            2.718281828f
20353c12917Smaya#define CL_M_LOG2E_F        1.442695041f
20453c12917Smaya#define CL_M_LOG10E_F       0.434294482f
20553c12917Smaya#define CL_M_LN2_F          0.693147181f
20653c12917Smaya#define CL_M_LN10_F         2.302585093f
20753c12917Smaya#define CL_M_PI_F           3.141592654f
20853c12917Smaya#define CL_M_PI_2_F         1.570796327f
20953c12917Smaya#define CL_M_PI_4_F         0.785398163f
21053c12917Smaya#define CL_M_1_PI_F         0.318309886f
21153c12917Smaya#define CL_M_2_PI_F         0.636619772f
21253c12917Smaya#define CL_M_2_SQRTPI_F     1.128379167f
21353c12917Smaya#define CL_M_SQRT2_F        1.414213562f
21453c12917Smaya#define CL_M_SQRT1_2_F      0.707106781f
215af69d88dSmrg
216af69d88dSmrg#define CL_NAN              (CL_INFINITY - CL_INFINITY)
217af69d88dSmrg#define CL_HUGE_VALF        ((cl_float) 1e50)
218af69d88dSmrg#define CL_HUGE_VAL         ((cl_double) 1e500)
219af69d88dSmrg#define CL_MAXFLOAT         CL_FLT_MAX
220af69d88dSmrg#define CL_INFINITY         CL_HUGE_VALF
221af69d88dSmrg
222af69d88dSmrg#else
223af69d88dSmrg
224af69d88dSmrg#include <stdint.h>
225af69d88dSmrg
226af69d88dSmrg/* scalar types  */
227af69d88dSmrgtypedef int8_t          cl_char;
228af69d88dSmrgtypedef uint8_t         cl_uchar;
2297ec681f3Smrgtypedef int16_t         cl_short;
2307ec681f3Smrgtypedef uint16_t        cl_ushort;
2317ec681f3Smrgtypedef int32_t         cl_int;
2327ec681f3Smrgtypedef uint32_t        cl_uint;
2337ec681f3Smrgtypedef int64_t         cl_long;
2347ec681f3Smrgtypedef uint64_t        cl_ulong;
235af69d88dSmrg
2367ec681f3Smrgtypedef uint16_t        cl_half;
2377ec681f3Smrgtypedef float           cl_float;
2387ec681f3Smrgtypedef double          cl_double;
239af69d88dSmrg
240af69d88dSmrg/* Macro names and corresponding values defined by OpenCL */
241af69d88dSmrg#define CL_CHAR_BIT         8
242af69d88dSmrg#define CL_SCHAR_MAX        127
243af69d88dSmrg#define CL_SCHAR_MIN        (-127-1)
244af69d88dSmrg#define CL_CHAR_MAX         CL_SCHAR_MAX
245af69d88dSmrg#define CL_CHAR_MIN         CL_SCHAR_MIN
246af69d88dSmrg#define CL_UCHAR_MAX        255
247af69d88dSmrg#define CL_SHRT_MAX         32767
248af69d88dSmrg#define CL_SHRT_MIN         (-32767-1)
249af69d88dSmrg#define CL_USHRT_MAX        65535
250af69d88dSmrg#define CL_INT_MAX          2147483647
251af69d88dSmrg#define CL_INT_MIN          (-2147483647-1)
252af69d88dSmrg#define CL_UINT_MAX         0xffffffffU
253af69d88dSmrg#define CL_LONG_MAX         ((cl_long) 0x7FFFFFFFFFFFFFFFLL)
254af69d88dSmrg#define CL_LONG_MIN         ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL)
255af69d88dSmrg#define CL_ULONG_MAX        ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL)
256af69d88dSmrg
257af69d88dSmrg#define CL_FLT_DIG          6
258af69d88dSmrg#define CL_FLT_MANT_DIG     24
259af69d88dSmrg#define CL_FLT_MAX_10_EXP   +38
260af69d88dSmrg#define CL_FLT_MAX_EXP      +128
261af69d88dSmrg#define CL_FLT_MIN_10_EXP   -37
262af69d88dSmrg#define CL_FLT_MIN_EXP      -125
263af69d88dSmrg#define CL_FLT_RADIX        2
26453c12917Smaya#define CL_FLT_MAX          340282346638528859811704183484516925440.0f
26553c12917Smaya#define CL_FLT_MIN          1.175494350822287507969e-38f
26653c12917Smaya#define CL_FLT_EPSILON      1.1920928955078125e-7f
26753c12917Smaya
26853c12917Smaya#define CL_HALF_DIG          3
26953c12917Smaya#define CL_HALF_MANT_DIG     11
27053c12917Smaya#define CL_HALF_MAX_10_EXP   +4
27153c12917Smaya#define CL_HALF_MAX_EXP      +16
27253c12917Smaya#define CL_HALF_MIN_10_EXP   -4
27353c12917Smaya#define CL_HALF_MIN_EXP      -13
27453c12917Smaya#define CL_HALF_RADIX        2
27553c12917Smaya#define CL_HALF_MAX          65504.0f
27653c12917Smaya#define CL_HALF_MIN          6.103515625e-05f
27753c12917Smaya#define CL_HALF_EPSILON      9.765625e-04f
278af69d88dSmrg
279af69d88dSmrg#define CL_DBL_DIG          15
280af69d88dSmrg#define CL_DBL_MANT_DIG     53
281af69d88dSmrg#define CL_DBL_MAX_10_EXP   +308
282af69d88dSmrg#define CL_DBL_MAX_EXP      +1024
283af69d88dSmrg#define CL_DBL_MIN_10_EXP   -307
284af69d88dSmrg#define CL_DBL_MIN_EXP      -1021
285af69d88dSmrg#define CL_DBL_RADIX        2
28653c12917Smaya#define CL_DBL_MAX          179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0
28753c12917Smaya#define CL_DBL_MIN          2.225073858507201383090e-308
28853c12917Smaya#define CL_DBL_EPSILON      2.220446049250313080847e-16
28953c12917Smaya
29053c12917Smaya#define CL_M_E              2.7182818284590452354
29153c12917Smaya#define CL_M_LOG2E          1.4426950408889634074
29253c12917Smaya#define CL_M_LOG10E         0.43429448190325182765
29353c12917Smaya#define CL_M_LN2            0.69314718055994530942
29453c12917Smaya#define CL_M_LN10           2.30258509299404568402
29553c12917Smaya#define CL_M_PI             3.14159265358979323846
29653c12917Smaya#define CL_M_PI_2           1.57079632679489661923
29753c12917Smaya#define CL_M_PI_4           0.78539816339744830962
29853c12917Smaya#define CL_M_1_PI           0.31830988618379067154
29953c12917Smaya#define CL_M_2_PI           0.63661977236758134308
30053c12917Smaya#define CL_M_2_SQRTPI       1.12837916709551257390
30153c12917Smaya#define CL_M_SQRT2          1.41421356237309504880
30253c12917Smaya#define CL_M_SQRT1_2        0.70710678118654752440
30353c12917Smaya
30453c12917Smaya#define CL_M_E_F            2.718281828f
30553c12917Smaya#define CL_M_LOG2E_F        1.442695041f
30653c12917Smaya#define CL_M_LOG10E_F       0.434294482f
30753c12917Smaya#define CL_M_LN2_F          0.693147181f
30853c12917Smaya#define CL_M_LN10_F         2.302585093f
30953c12917Smaya#define CL_M_PI_F           3.141592654f
31053c12917Smaya#define CL_M_PI_2_F         1.570796327f
31153c12917Smaya#define CL_M_PI_4_F         0.785398163f
31253c12917Smaya#define CL_M_1_PI_F         0.318309886f
31353c12917Smaya#define CL_M_2_PI_F         0.636619772f
31453c12917Smaya#define CL_M_2_SQRTPI_F     1.128379167f
31553c12917Smaya#define CL_M_SQRT2_F        1.414213562f
31653c12917Smaya#define CL_M_SQRT1_2_F      0.707106781f
317af69d88dSmrg
318af69d88dSmrg#if defined( __GNUC__ )
319af69d88dSmrg   #define CL_HUGE_VALF     __builtin_huge_valf()
320af69d88dSmrg   #define CL_HUGE_VAL      __builtin_huge_val()
321af69d88dSmrg   #define CL_NAN           __builtin_nanf( "" )
322af69d88dSmrg#else
323af69d88dSmrg   #define CL_HUGE_VALF     ((cl_float) 1e50)
324af69d88dSmrg   #define CL_HUGE_VAL      ((cl_double) 1e500)
325af69d88dSmrg   float nanf( const char * );
32653c12917Smaya   #define CL_NAN           nanf( "" )
327af69d88dSmrg#endif
328af69d88dSmrg#define CL_MAXFLOAT         CL_FLT_MAX
329af69d88dSmrg#define CL_INFINITY         CL_HUGE_VALF
330af69d88dSmrg
331af69d88dSmrg#endif
332af69d88dSmrg
333af69d88dSmrg#include <stddef.h>
334af69d88dSmrg
335af69d88dSmrg/* 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. */
336af69d88dSmrgtypedef unsigned int cl_GLuint;
337af69d88dSmrgtypedef int          cl_GLint;
338af69d88dSmrgtypedef unsigned int cl_GLenum;
339af69d88dSmrg
340af69d88dSmrg/*
34153c12917Smaya * Vector types
342af69d88dSmrg *
34353c12917Smaya *  Note:   OpenCL requires that all types be naturally aligned.
344af69d88dSmrg *          This means that vector types must be naturally aligned.
345af69d88dSmrg *          For example, a vector of four floats must be aligned to
34653c12917Smaya *          a 16 byte boundary (calculated as 4 * the natural 4-byte
347af69d88dSmrg *          alignment of the float).  The alignment qualifiers here
348af69d88dSmrg *          will only function properly if your compiler supports them
349af69d88dSmrg *          and if you don't actively work to defeat them.  For example,
350af69d88dSmrg *          in order for a cl_float4 to be 16 byte aligned in a struct,
35153c12917Smaya *          the start of the struct must itself be 16-byte aligned.
352af69d88dSmrg *
353af69d88dSmrg *          Maintaining proper alignment is the user's responsibility.
354af69d88dSmrg */
355af69d88dSmrg
356af69d88dSmrg/* Define basic vector types */
357af69d88dSmrg#if defined( __VEC__ )
3587ec681f3Smrg  #if !defined(__clang__)
3597ec681f3Smrg     #include <altivec.h>   /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */
3607ec681f3Smrg  #endif
36153c12917Smaya   typedef __vector unsigned char     __cl_uchar16;
36253c12917Smaya   typedef __vector signed char       __cl_char16;
36353c12917Smaya   typedef __vector unsigned short    __cl_ushort8;
36453c12917Smaya   typedef __vector signed short      __cl_short8;
36553c12917Smaya   typedef __vector unsigned int      __cl_uint4;
36653c12917Smaya   typedef __vector signed int        __cl_int4;
36753c12917Smaya   typedef __vector float             __cl_float4;
368af69d88dSmrg   #define  __CL_UCHAR16__  1
369af69d88dSmrg   #define  __CL_CHAR16__   1
370af69d88dSmrg   #define  __CL_USHORT8__  1
371af69d88dSmrg   #define  __CL_SHORT8__   1
372af69d88dSmrg   #define  __CL_UINT4__    1
373af69d88dSmrg   #define  __CL_INT4__     1
374af69d88dSmrg   #define  __CL_FLOAT4__   1
375af69d88dSmrg#endif
376af69d88dSmrg
377af69d88dSmrg#if defined( __SSE__ )
378af69d88dSmrg    #if defined( __MINGW64__ )
379af69d88dSmrg        #include <intrin.h>
380af69d88dSmrg    #else
381af69d88dSmrg        #include <xmmintrin.h>
382af69d88dSmrg    #endif
383af69d88dSmrg    #if defined( __GNUC__ )
384af69d88dSmrg        typedef float __cl_float4   __attribute__((vector_size(16)));
385af69d88dSmrg    #else
386af69d88dSmrg        typedef __m128 __cl_float4;
387af69d88dSmrg    #endif
388af69d88dSmrg    #define __CL_FLOAT4__   1
389af69d88dSmrg#endif
390af69d88dSmrg
391af69d88dSmrg#if defined( __SSE2__ )
392af69d88dSmrg    #if defined( __MINGW64__ )
393af69d88dSmrg        #include <intrin.h>
394af69d88dSmrg    #else
395af69d88dSmrg        #include <emmintrin.h>
396af69d88dSmrg    #endif
397af69d88dSmrg    #if defined( __GNUC__ )
398af69d88dSmrg        typedef cl_uchar    __cl_uchar16    __attribute__((vector_size(16)));
399af69d88dSmrg        typedef cl_char     __cl_char16     __attribute__((vector_size(16)));
400af69d88dSmrg        typedef cl_ushort   __cl_ushort8    __attribute__((vector_size(16)));
401af69d88dSmrg        typedef cl_short    __cl_short8     __attribute__((vector_size(16)));
402af69d88dSmrg        typedef cl_uint     __cl_uint4      __attribute__((vector_size(16)));
403af69d88dSmrg        typedef cl_int      __cl_int4       __attribute__((vector_size(16)));
404af69d88dSmrg        typedef cl_ulong    __cl_ulong2     __attribute__((vector_size(16)));
405af69d88dSmrg        typedef cl_long     __cl_long2      __attribute__((vector_size(16)));
406af69d88dSmrg        typedef cl_double   __cl_double2    __attribute__((vector_size(16)));
407af69d88dSmrg    #else
408af69d88dSmrg        typedef __m128i __cl_uchar16;
409af69d88dSmrg        typedef __m128i __cl_char16;
410af69d88dSmrg        typedef __m128i __cl_ushort8;
411af69d88dSmrg        typedef __m128i __cl_short8;
412af69d88dSmrg        typedef __m128i __cl_uint4;
413af69d88dSmrg        typedef __m128i __cl_int4;
414af69d88dSmrg        typedef __m128i __cl_ulong2;
415af69d88dSmrg        typedef __m128i __cl_long2;
416af69d88dSmrg        typedef __m128d __cl_double2;
417af69d88dSmrg    #endif
418af69d88dSmrg    #define __CL_UCHAR16__  1
419af69d88dSmrg    #define __CL_CHAR16__   1
420af69d88dSmrg    #define __CL_USHORT8__  1
421af69d88dSmrg    #define __CL_SHORT8__   1
422af69d88dSmrg    #define __CL_INT4__     1
423af69d88dSmrg    #define __CL_UINT4__    1
424af69d88dSmrg    #define __CL_ULONG2__   1
425af69d88dSmrg    #define __CL_LONG2__    1
426af69d88dSmrg    #define __CL_DOUBLE2__  1
427af69d88dSmrg#endif
428af69d88dSmrg
429af69d88dSmrg#if defined( __MMX__ )
430af69d88dSmrg    #include <mmintrin.h>
431af69d88dSmrg    #if defined( __GNUC__ )
432af69d88dSmrg        typedef cl_uchar    __cl_uchar8     __attribute__((vector_size(8)));
433af69d88dSmrg        typedef cl_char     __cl_char8      __attribute__((vector_size(8)));
434af69d88dSmrg        typedef cl_ushort   __cl_ushort4    __attribute__((vector_size(8)));
435af69d88dSmrg        typedef cl_short    __cl_short4     __attribute__((vector_size(8)));
436af69d88dSmrg        typedef cl_uint     __cl_uint2      __attribute__((vector_size(8)));
437af69d88dSmrg        typedef cl_int      __cl_int2       __attribute__((vector_size(8)));
438af69d88dSmrg        typedef cl_ulong    __cl_ulong1     __attribute__((vector_size(8)));
439af69d88dSmrg        typedef cl_long     __cl_long1      __attribute__((vector_size(8)));
440af69d88dSmrg        typedef cl_float    __cl_float2     __attribute__((vector_size(8)));
441af69d88dSmrg    #else
442af69d88dSmrg        typedef __m64       __cl_uchar8;
443af69d88dSmrg        typedef __m64       __cl_char8;
444af69d88dSmrg        typedef __m64       __cl_ushort4;
445af69d88dSmrg        typedef __m64       __cl_short4;
446af69d88dSmrg        typedef __m64       __cl_uint2;
447af69d88dSmrg        typedef __m64       __cl_int2;
448af69d88dSmrg        typedef __m64       __cl_ulong1;
449af69d88dSmrg        typedef __m64       __cl_long1;
450af69d88dSmrg        typedef __m64       __cl_float2;
451af69d88dSmrg    #endif
452af69d88dSmrg    #define __CL_UCHAR8__   1
453af69d88dSmrg    #define __CL_CHAR8__    1
454af69d88dSmrg    #define __CL_USHORT4__  1
455af69d88dSmrg    #define __CL_SHORT4__   1
456af69d88dSmrg    #define __CL_INT2__     1
457af69d88dSmrg    #define __CL_UINT2__    1
458af69d88dSmrg    #define __CL_ULONG1__   1
459af69d88dSmrg    #define __CL_LONG1__    1
460af69d88dSmrg    #define __CL_FLOAT2__   1
461af69d88dSmrg#endif
462af69d88dSmrg
463af69d88dSmrg#if defined( __AVX__ )
464af69d88dSmrg    #if defined( __MINGW64__ )
465af69d88dSmrg        #include <intrin.h>
466af69d88dSmrg    #else
46753c12917Smaya        #include <immintrin.h>
468af69d88dSmrg    #endif
469af69d88dSmrg    #if defined( __GNUC__ )
470af69d88dSmrg        typedef cl_float    __cl_float8     __attribute__((vector_size(32)));
471af69d88dSmrg        typedef cl_double   __cl_double4    __attribute__((vector_size(32)));
472af69d88dSmrg    #else
473af69d88dSmrg        typedef __m256      __cl_float8;
474af69d88dSmrg        typedef __m256d     __cl_double4;
475af69d88dSmrg    #endif
476af69d88dSmrg    #define __CL_FLOAT8__   1
477af69d88dSmrg    #define __CL_DOUBLE4__  1
478af69d88dSmrg#endif
479af69d88dSmrg
480af69d88dSmrg/* Define capabilities for anonymous struct members. */
48153c12917Smaya#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
48253c12917Smaya#define  __CL_HAS_ANON_STRUCT__ 1
48353c12917Smaya#define  __CL_ANON_STRUCT__
48453c12917Smaya#elif defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
485af69d88dSmrg#define  __CL_HAS_ANON_STRUCT__ 1
486af69d88dSmrg#define  __CL_ANON_STRUCT__ __extension__
4877ec681f3Smrg#elif defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__)
48853c12917Smaya    #if _MSC_VER >= 1500
489af69d88dSmrg   /* Microsoft Developer Studio 2008 supports anonymous structs, but
490af69d88dSmrg    * complains by default. */
49153c12917Smaya    #define  __CL_HAS_ANON_STRUCT__ 1
49253c12917Smaya    #define  __CL_ANON_STRUCT__
493af69d88dSmrg   /* Disable warning C4201: nonstandard extension used : nameless
494af69d88dSmrg    * struct/union */
49553c12917Smaya    #pragma warning( push )
49653c12917Smaya    #pragma warning( disable : 4201 )
49753c12917Smaya    #endif
498af69d88dSmrg#else
499af69d88dSmrg#define  __CL_HAS_ANON_STRUCT__ 0
500af69d88dSmrg#define  __CL_ANON_STRUCT__
501af69d88dSmrg#endif
502af69d88dSmrg
503af69d88dSmrg/* Define alignment keys */
504af69d88dSmrg#if defined( __GNUC__ )
505af69d88dSmrg    #define CL_ALIGNED(_x)          __attribute__ ((aligned(_x)))
506af69d88dSmrg#elif defined( _WIN32) && (_MSC_VER)
507af69d88dSmrg    /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements     */
508af69d88dSmrg    /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx                                                 */
509af69d88dSmrg    /* #include <crtdefs.h>                                                                                             */
510af69d88dSmrg    /* #define CL_ALIGNED(_x)          _CRT_ALIGN(_x)                                                                   */
511af69d88dSmrg    #define CL_ALIGNED(_x)
512af69d88dSmrg#else
513af69d88dSmrg   #warning  Need to implement some method to align data here
514af69d88dSmrg   #define  CL_ALIGNED(_x)
515af69d88dSmrg#endif
516af69d88dSmrg
517af69d88dSmrg/* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
518af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
519af69d88dSmrg    /* .xyzw and .s0123...{f|F} are supported */
520af69d88dSmrg    #define CL_HAS_NAMED_VECTOR_FIELDS 1
521af69d88dSmrg    /* .hi and .lo are supported */
522af69d88dSmrg    #define CL_HAS_HI_LO_VECTOR_FIELDS 1
523af69d88dSmrg#endif
524af69d88dSmrg
525af69d88dSmrg/* Define cl_vector types */
526af69d88dSmrg
527af69d88dSmrg/* ---- cl_charn ---- */
528af69d88dSmrgtypedef union
529af69d88dSmrg{
530af69d88dSmrg    cl_char  CL_ALIGNED(2) s[2];
531af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
532af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  x, y; };
533af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  s0, s1; };
534af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  lo, hi; };
535af69d88dSmrg#endif
53653c12917Smaya#if defined( __CL_CHAR2__)
537af69d88dSmrg    __cl_char2     v2;
538af69d88dSmrg#endif
539af69d88dSmrg}cl_char2;
540af69d88dSmrg
541af69d88dSmrgtypedef union
542af69d88dSmrg{
543af69d88dSmrg    cl_char  CL_ALIGNED(4) s[4];
544af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
545af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  x, y, z, w; };
546af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  s0, s1, s2, s3; };
547af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char2 lo, hi; };
548af69d88dSmrg#endif
54953c12917Smaya#if defined( __CL_CHAR2__)
550af69d88dSmrg    __cl_char2     v2[2];
551af69d88dSmrg#endif
55253c12917Smaya#if defined( __CL_CHAR4__)
553af69d88dSmrg    __cl_char4     v4;
554af69d88dSmrg#endif
555af69d88dSmrg}cl_char4;
556af69d88dSmrg
557af69d88dSmrg/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */
558af69d88dSmrgtypedef  cl_char4  cl_char3;
559af69d88dSmrg
560af69d88dSmrgtypedef union
561af69d88dSmrg{
562af69d88dSmrg    cl_char   CL_ALIGNED(8) s[8];
563af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
564af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  x, y, z, w; };
565af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  s0, s1, s2, s3, s4, s5, s6, s7; };
566af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char4 lo, hi; };
567af69d88dSmrg#endif
56853c12917Smaya#if defined( __CL_CHAR2__)
569af69d88dSmrg    __cl_char2     v2[4];
570af69d88dSmrg#endif
57153c12917Smaya#if defined( __CL_CHAR4__)
572af69d88dSmrg    __cl_char4     v4[2];
573af69d88dSmrg#endif
574af69d88dSmrg#if defined( __CL_CHAR8__ )
575af69d88dSmrg    __cl_char8     v8;
576af69d88dSmrg#endif
577af69d88dSmrg}cl_char8;
578af69d88dSmrg
579af69d88dSmrgtypedef union
580af69d88dSmrg{
581af69d88dSmrg    cl_char  CL_ALIGNED(16) s[16];
582af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
583af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
584af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
585af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_char8 lo, hi; };
586af69d88dSmrg#endif
58753c12917Smaya#if defined( __CL_CHAR2__)
588af69d88dSmrg    __cl_char2     v2[8];
589af69d88dSmrg#endif
59053c12917Smaya#if defined( __CL_CHAR4__)
591af69d88dSmrg    __cl_char4     v4[4];
592af69d88dSmrg#endif
593af69d88dSmrg#if defined( __CL_CHAR8__ )
594af69d88dSmrg    __cl_char8     v8[2];
595af69d88dSmrg#endif
596af69d88dSmrg#if defined( __CL_CHAR16__ )
597af69d88dSmrg    __cl_char16    v16;
598af69d88dSmrg#endif
599af69d88dSmrg}cl_char16;
600af69d88dSmrg
601af69d88dSmrg
602af69d88dSmrg/* ---- cl_ucharn ---- */
603af69d88dSmrgtypedef union
604af69d88dSmrg{
605af69d88dSmrg    cl_uchar  CL_ALIGNED(2) s[2];
606af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
607af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  x, y; };
608af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  s0, s1; };
609af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  lo, hi; };
610af69d88dSmrg#endif
61153c12917Smaya#if defined( __cl_uchar2__)
612af69d88dSmrg    __cl_uchar2     v2;
613af69d88dSmrg#endif
614af69d88dSmrg}cl_uchar2;
615af69d88dSmrg
616af69d88dSmrgtypedef union
617af69d88dSmrg{
618af69d88dSmrg    cl_uchar  CL_ALIGNED(4) s[4];
619af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
620af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  x, y, z, w; };
621af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  s0, s1, s2, s3; };
622af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar2 lo, hi; };
623af69d88dSmrg#endif
62453c12917Smaya#if defined( __CL_UCHAR2__)
625af69d88dSmrg    __cl_uchar2     v2[2];
626af69d88dSmrg#endif
62753c12917Smaya#if defined( __CL_UCHAR4__)
628af69d88dSmrg    __cl_uchar4     v4;
629af69d88dSmrg#endif
630af69d88dSmrg}cl_uchar4;
631af69d88dSmrg
632af69d88dSmrg/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */
633af69d88dSmrgtypedef  cl_uchar4  cl_uchar3;
634af69d88dSmrg
635af69d88dSmrgtypedef union
636af69d88dSmrg{
637af69d88dSmrg    cl_uchar   CL_ALIGNED(8) s[8];
638af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
639af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  x, y, z, w; };
640af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  s0, s1, s2, s3, s4, s5, s6, s7; };
641af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar4 lo, hi; };
642af69d88dSmrg#endif
64353c12917Smaya#if defined( __CL_UCHAR2__)
644af69d88dSmrg    __cl_uchar2     v2[4];
645af69d88dSmrg#endif
64653c12917Smaya#if defined( __CL_UCHAR4__)
647af69d88dSmrg    __cl_uchar4     v4[2];
648af69d88dSmrg#endif
649af69d88dSmrg#if defined( __CL_UCHAR8__ )
650af69d88dSmrg    __cl_uchar8     v8;
651af69d88dSmrg#endif
652af69d88dSmrg}cl_uchar8;
653af69d88dSmrg
654af69d88dSmrgtypedef union
655af69d88dSmrg{
656af69d88dSmrg    cl_uchar  CL_ALIGNED(16) s[16];
657af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
658af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
659af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
660af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uchar8 lo, hi; };
661af69d88dSmrg#endif
66253c12917Smaya#if defined( __CL_UCHAR2__)
663af69d88dSmrg    __cl_uchar2     v2[8];
664af69d88dSmrg#endif
66553c12917Smaya#if defined( __CL_UCHAR4__)
666af69d88dSmrg    __cl_uchar4     v4[4];
667af69d88dSmrg#endif
668af69d88dSmrg#if defined( __CL_UCHAR8__ )
669af69d88dSmrg    __cl_uchar8     v8[2];
670af69d88dSmrg#endif
671af69d88dSmrg#if defined( __CL_UCHAR16__ )
672af69d88dSmrg    __cl_uchar16    v16;
673af69d88dSmrg#endif
674af69d88dSmrg}cl_uchar16;
675af69d88dSmrg
676af69d88dSmrg
677af69d88dSmrg/* ---- cl_shortn ---- */
678af69d88dSmrgtypedef union
679af69d88dSmrg{
680af69d88dSmrg    cl_short  CL_ALIGNED(4) s[2];
681af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
682af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  x, y; };
683af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  s0, s1; };
684af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  lo, hi; };
685af69d88dSmrg#endif
68653c12917Smaya#if defined( __CL_SHORT2__)
687af69d88dSmrg    __cl_short2     v2;
688af69d88dSmrg#endif
689af69d88dSmrg}cl_short2;
690af69d88dSmrg
691af69d88dSmrgtypedef union
692af69d88dSmrg{
693af69d88dSmrg    cl_short  CL_ALIGNED(8) s[4];
694af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
695af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  x, y, z, w; };
696af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  s0, s1, s2, s3; };
697af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short2 lo, hi; };
698af69d88dSmrg#endif
69953c12917Smaya#if defined( __CL_SHORT2__)
700af69d88dSmrg    __cl_short2     v2[2];
701af69d88dSmrg#endif
70253c12917Smaya#if defined( __CL_SHORT4__)
703af69d88dSmrg    __cl_short4     v4;
704af69d88dSmrg#endif
705af69d88dSmrg}cl_short4;
706af69d88dSmrg
707af69d88dSmrg/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */
708af69d88dSmrgtypedef  cl_short4  cl_short3;
709af69d88dSmrg
710af69d88dSmrgtypedef union
711af69d88dSmrg{
712af69d88dSmrg    cl_short   CL_ALIGNED(16) s[8];
713af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
714af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  x, y, z, w; };
715af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  s0, s1, s2, s3, s4, s5, s6, s7; };
716af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short4 lo, hi; };
717af69d88dSmrg#endif
71853c12917Smaya#if defined( __CL_SHORT2__)
719af69d88dSmrg    __cl_short2     v2[4];
720af69d88dSmrg#endif
72153c12917Smaya#if defined( __CL_SHORT4__)
722af69d88dSmrg    __cl_short4     v4[2];
723af69d88dSmrg#endif
724af69d88dSmrg#if defined( __CL_SHORT8__ )
725af69d88dSmrg    __cl_short8     v8;
726af69d88dSmrg#endif
727af69d88dSmrg}cl_short8;
728af69d88dSmrg
729af69d88dSmrgtypedef union
730af69d88dSmrg{
731af69d88dSmrg    cl_short  CL_ALIGNED(32) s[16];
732af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
733af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
734af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
735af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_short8 lo, hi; };
736af69d88dSmrg#endif
73753c12917Smaya#if defined( __CL_SHORT2__)
738af69d88dSmrg    __cl_short2     v2[8];
739af69d88dSmrg#endif
74053c12917Smaya#if defined( __CL_SHORT4__)
741af69d88dSmrg    __cl_short4     v4[4];
742af69d88dSmrg#endif
743af69d88dSmrg#if defined( __CL_SHORT8__ )
744af69d88dSmrg    __cl_short8     v8[2];
745af69d88dSmrg#endif
746af69d88dSmrg#if defined( __CL_SHORT16__ )
747af69d88dSmrg    __cl_short16    v16;
748af69d88dSmrg#endif
749af69d88dSmrg}cl_short16;
750af69d88dSmrg
751af69d88dSmrg
752af69d88dSmrg/* ---- cl_ushortn ---- */
753af69d88dSmrgtypedef union
754af69d88dSmrg{
755af69d88dSmrg    cl_ushort  CL_ALIGNED(4) s[2];
756af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
757af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  x, y; };
758af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  s0, s1; };
759af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  lo, hi; };
760af69d88dSmrg#endif
76153c12917Smaya#if defined( __CL_USHORT2__)
762af69d88dSmrg    __cl_ushort2     v2;
763af69d88dSmrg#endif
764af69d88dSmrg}cl_ushort2;
765af69d88dSmrg
766af69d88dSmrgtypedef union
767af69d88dSmrg{
768af69d88dSmrg    cl_ushort  CL_ALIGNED(8) s[4];
769af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
770af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  x, y, z, w; };
771af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  s0, s1, s2, s3; };
772af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort2 lo, hi; };
773af69d88dSmrg#endif
77453c12917Smaya#if defined( __CL_USHORT2__)
775af69d88dSmrg    __cl_ushort2     v2[2];
776af69d88dSmrg#endif
77753c12917Smaya#if defined( __CL_USHORT4__)
778af69d88dSmrg    __cl_ushort4     v4;
779af69d88dSmrg#endif
780af69d88dSmrg}cl_ushort4;
781af69d88dSmrg
782af69d88dSmrg/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */
783af69d88dSmrgtypedef  cl_ushort4  cl_ushort3;
784af69d88dSmrg
785af69d88dSmrgtypedef union
786af69d88dSmrg{
787af69d88dSmrg    cl_ushort   CL_ALIGNED(16) s[8];
788af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
789af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  x, y, z, w; };
790af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  s0, s1, s2, s3, s4, s5, s6, s7; };
791af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort4 lo, hi; };
792af69d88dSmrg#endif
79353c12917Smaya#if defined( __CL_USHORT2__)
794af69d88dSmrg    __cl_ushort2     v2[4];
795af69d88dSmrg#endif
79653c12917Smaya#if defined( __CL_USHORT4__)
797af69d88dSmrg    __cl_ushort4     v4[2];
798af69d88dSmrg#endif
799af69d88dSmrg#if defined( __CL_USHORT8__ )
800af69d88dSmrg    __cl_ushort8     v8;
801af69d88dSmrg#endif
802af69d88dSmrg}cl_ushort8;
803af69d88dSmrg
804af69d88dSmrgtypedef union
805af69d88dSmrg{
806af69d88dSmrg    cl_ushort  CL_ALIGNED(32) s[16];
807af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
808af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
809af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
810af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ushort8 lo, hi; };
811af69d88dSmrg#endif
81253c12917Smaya#if defined( __CL_USHORT2__)
813af69d88dSmrg    __cl_ushort2     v2[8];
814af69d88dSmrg#endif
81553c12917Smaya#if defined( __CL_USHORT4__)
816af69d88dSmrg    __cl_ushort4     v4[4];
817af69d88dSmrg#endif
818af69d88dSmrg#if defined( __CL_USHORT8__ )
819af69d88dSmrg    __cl_ushort8     v8[2];
820af69d88dSmrg#endif
821af69d88dSmrg#if defined( __CL_USHORT16__ )
822af69d88dSmrg    __cl_ushort16    v16;
823af69d88dSmrg#endif
824af69d88dSmrg}cl_ushort16;
825af69d88dSmrg
82653c12917Smaya
82753c12917Smaya/* ---- cl_halfn ---- */
82853c12917Smayatypedef union
82953c12917Smaya{
83053c12917Smaya    cl_half  CL_ALIGNED(4) s[2];
83153c12917Smaya#if __CL_HAS_ANON_STRUCT__
83253c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  x, y; };
83353c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  s0, s1; };
83453c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  lo, hi; };
83553c12917Smaya#endif
83653c12917Smaya#if defined( __CL_HALF2__)
83753c12917Smaya    __cl_half2     v2;
83853c12917Smaya#endif
83953c12917Smaya}cl_half2;
84053c12917Smaya
84153c12917Smayatypedef union
84253c12917Smaya{
84353c12917Smaya    cl_half  CL_ALIGNED(8) s[4];
84453c12917Smaya#if __CL_HAS_ANON_STRUCT__
84553c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  x, y, z, w; };
84653c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  s0, s1, s2, s3; };
84753c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half2 lo, hi; };
84853c12917Smaya#endif
84953c12917Smaya#if defined( __CL_HALF2__)
85053c12917Smaya    __cl_half2     v2[2];
85153c12917Smaya#endif
85253c12917Smaya#if defined( __CL_HALF4__)
85353c12917Smaya    __cl_half4     v4;
85453c12917Smaya#endif
85553c12917Smaya}cl_half4;
85653c12917Smaya
85753c12917Smaya/* cl_half3 is identical in size, alignment and behavior to cl_half4. See section 6.1.5. */
85853c12917Smayatypedef  cl_half4  cl_half3;
85953c12917Smaya
86053c12917Smayatypedef union
86153c12917Smaya{
86253c12917Smaya    cl_half   CL_ALIGNED(16) s[8];
86353c12917Smaya#if __CL_HAS_ANON_STRUCT__
86453c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  x, y, z, w; };
86553c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  s0, s1, s2, s3, s4, s5, s6, s7; };
86653c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half4 lo, hi; };
86753c12917Smaya#endif
86853c12917Smaya#if defined( __CL_HALF2__)
86953c12917Smaya    __cl_half2     v2[4];
87053c12917Smaya#endif
87153c12917Smaya#if defined( __CL_HALF4__)
87253c12917Smaya    __cl_half4     v4[2];
87353c12917Smaya#endif
87453c12917Smaya#if defined( __CL_HALF8__ )
87553c12917Smaya    __cl_half8     v8;
87653c12917Smaya#endif
87753c12917Smaya}cl_half8;
87853c12917Smaya
87953c12917Smayatypedef union
88053c12917Smaya{
88153c12917Smaya    cl_half  CL_ALIGNED(32) s[16];
88253c12917Smaya#if __CL_HAS_ANON_STRUCT__
88353c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
88453c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
88553c12917Smaya    __CL_ANON_STRUCT__ struct{ cl_half8 lo, hi; };
88653c12917Smaya#endif
88753c12917Smaya#if defined( __CL_HALF2__)
88853c12917Smaya    __cl_half2     v2[8];
88953c12917Smaya#endif
89053c12917Smaya#if defined( __CL_HALF4__)
89153c12917Smaya    __cl_half4     v4[4];
89253c12917Smaya#endif
89353c12917Smaya#if defined( __CL_HALF8__ )
89453c12917Smaya    __cl_half8     v8[2];
89553c12917Smaya#endif
89653c12917Smaya#if defined( __CL_HALF16__ )
89753c12917Smaya    __cl_half16    v16;
89853c12917Smaya#endif
89953c12917Smaya}cl_half16;
90053c12917Smaya
901af69d88dSmrg/* ---- cl_intn ---- */
902af69d88dSmrgtypedef union
903af69d88dSmrg{
904af69d88dSmrg    cl_int  CL_ALIGNED(8) s[2];
905af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
906af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  x, y; };
907af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  s0, s1; };
908af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  lo, hi; };
909af69d88dSmrg#endif
91053c12917Smaya#if defined( __CL_INT2__)
911af69d88dSmrg    __cl_int2     v2;
912af69d88dSmrg#endif
913af69d88dSmrg}cl_int2;
914af69d88dSmrg
915af69d88dSmrgtypedef union
916af69d88dSmrg{
917af69d88dSmrg    cl_int  CL_ALIGNED(16) s[4];
918af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
919af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  x, y, z, w; };
920af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  s0, s1, s2, s3; };
921af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int2 lo, hi; };
922af69d88dSmrg#endif
92353c12917Smaya#if defined( __CL_INT2__)
924af69d88dSmrg    __cl_int2     v2[2];
925af69d88dSmrg#endif
92653c12917Smaya#if defined( __CL_INT4__)
927af69d88dSmrg    __cl_int4     v4;
928af69d88dSmrg#endif
929af69d88dSmrg}cl_int4;
930af69d88dSmrg
931af69d88dSmrg/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */
932af69d88dSmrgtypedef  cl_int4  cl_int3;
933af69d88dSmrg
934af69d88dSmrgtypedef union
935af69d88dSmrg{
936af69d88dSmrg    cl_int   CL_ALIGNED(32) s[8];
937af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
938af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  x, y, z, w; };
939af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  s0, s1, s2, s3, s4, s5, s6, s7; };
940af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int4 lo, hi; };
941af69d88dSmrg#endif
94253c12917Smaya#if defined( __CL_INT2__)
943af69d88dSmrg    __cl_int2     v2[4];
944af69d88dSmrg#endif
94553c12917Smaya#if defined( __CL_INT4__)
946af69d88dSmrg    __cl_int4     v4[2];
947af69d88dSmrg#endif
948af69d88dSmrg#if defined( __CL_INT8__ )
949af69d88dSmrg    __cl_int8     v8;
950af69d88dSmrg#endif
951af69d88dSmrg}cl_int8;
952af69d88dSmrg
953af69d88dSmrgtypedef union
954af69d88dSmrg{
955af69d88dSmrg    cl_int  CL_ALIGNED(64) s[16];
956af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
957af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
958af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
959af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_int8 lo, hi; };
960af69d88dSmrg#endif
96153c12917Smaya#if defined( __CL_INT2__)
962af69d88dSmrg    __cl_int2     v2[8];
963af69d88dSmrg#endif
96453c12917Smaya#if defined( __CL_INT4__)
965af69d88dSmrg    __cl_int4     v4[4];
966af69d88dSmrg#endif
967af69d88dSmrg#if defined( __CL_INT8__ )
968af69d88dSmrg    __cl_int8     v8[2];
969af69d88dSmrg#endif
970af69d88dSmrg#if defined( __CL_INT16__ )
971af69d88dSmrg    __cl_int16    v16;
972af69d88dSmrg#endif
973af69d88dSmrg}cl_int16;
974af69d88dSmrg
975af69d88dSmrg
976af69d88dSmrg/* ---- cl_uintn ---- */
977af69d88dSmrgtypedef union
978af69d88dSmrg{
979af69d88dSmrg    cl_uint  CL_ALIGNED(8) s[2];
980af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
981af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  x, y; };
982af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  s0, s1; };
983af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  lo, hi; };
984af69d88dSmrg#endif
98553c12917Smaya#if defined( __CL_UINT2__)
986af69d88dSmrg    __cl_uint2     v2;
987af69d88dSmrg#endif
988af69d88dSmrg}cl_uint2;
989af69d88dSmrg
990af69d88dSmrgtypedef union
991af69d88dSmrg{
992af69d88dSmrg    cl_uint  CL_ALIGNED(16) s[4];
993af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
994af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  x, y, z, w; };
995af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  s0, s1, s2, s3; };
996af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint2 lo, hi; };
997af69d88dSmrg#endif
99853c12917Smaya#if defined( __CL_UINT2__)
999af69d88dSmrg    __cl_uint2     v2[2];
1000af69d88dSmrg#endif
100153c12917Smaya#if defined( __CL_UINT4__)
1002af69d88dSmrg    __cl_uint4     v4;
1003af69d88dSmrg#endif
1004af69d88dSmrg}cl_uint4;
1005af69d88dSmrg
1006af69d88dSmrg/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */
1007af69d88dSmrgtypedef  cl_uint4  cl_uint3;
1008af69d88dSmrg
1009af69d88dSmrgtypedef union
1010af69d88dSmrg{
1011af69d88dSmrg    cl_uint   CL_ALIGNED(32) s[8];
1012af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1013af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  x, y, z, w; };
1014af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  s0, s1, s2, s3, s4, s5, s6, s7; };
1015af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint4 lo, hi; };
1016af69d88dSmrg#endif
101753c12917Smaya#if defined( __CL_UINT2__)
1018af69d88dSmrg    __cl_uint2     v2[4];
1019af69d88dSmrg#endif
102053c12917Smaya#if defined( __CL_UINT4__)
1021af69d88dSmrg    __cl_uint4     v4[2];
1022af69d88dSmrg#endif
1023af69d88dSmrg#if defined( __CL_UINT8__ )
1024af69d88dSmrg    __cl_uint8     v8;
1025af69d88dSmrg#endif
1026af69d88dSmrg}cl_uint8;
1027af69d88dSmrg
1028af69d88dSmrgtypedef union
1029af69d88dSmrg{
1030af69d88dSmrg    cl_uint  CL_ALIGNED(64) s[16];
1031af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1032af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1033af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1034af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_uint8 lo, hi; };
1035af69d88dSmrg#endif
103653c12917Smaya#if defined( __CL_UINT2__)
1037af69d88dSmrg    __cl_uint2     v2[8];
1038af69d88dSmrg#endif
103953c12917Smaya#if defined( __CL_UINT4__)
1040af69d88dSmrg    __cl_uint4     v4[4];
1041af69d88dSmrg#endif
1042af69d88dSmrg#if defined( __CL_UINT8__ )
1043af69d88dSmrg    __cl_uint8     v8[2];
1044af69d88dSmrg#endif
1045af69d88dSmrg#if defined( __CL_UINT16__ )
1046af69d88dSmrg    __cl_uint16    v16;
1047af69d88dSmrg#endif
1048af69d88dSmrg}cl_uint16;
1049af69d88dSmrg
1050af69d88dSmrg/* ---- cl_longn ---- */
1051af69d88dSmrgtypedef union
1052af69d88dSmrg{
1053af69d88dSmrg    cl_long  CL_ALIGNED(16) s[2];
1054af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1055af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  x, y; };
1056af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  s0, s1; };
1057af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  lo, hi; };
1058af69d88dSmrg#endif
105953c12917Smaya#if defined( __CL_LONG2__)
1060af69d88dSmrg    __cl_long2     v2;
1061af69d88dSmrg#endif
1062af69d88dSmrg}cl_long2;
1063af69d88dSmrg
1064af69d88dSmrgtypedef union
1065af69d88dSmrg{
1066af69d88dSmrg    cl_long  CL_ALIGNED(32) s[4];
1067af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1068af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  x, y, z, w; };
1069af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  s0, s1, s2, s3; };
1070af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long2 lo, hi; };
1071af69d88dSmrg#endif
107253c12917Smaya#if defined( __CL_LONG2__)
1073af69d88dSmrg    __cl_long2     v2[2];
1074af69d88dSmrg#endif
107553c12917Smaya#if defined( __CL_LONG4__)
1076af69d88dSmrg    __cl_long4     v4;
1077af69d88dSmrg#endif
1078af69d88dSmrg}cl_long4;
1079af69d88dSmrg
1080af69d88dSmrg/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */
1081af69d88dSmrgtypedef  cl_long4  cl_long3;
1082af69d88dSmrg
1083af69d88dSmrgtypedef union
1084af69d88dSmrg{
1085af69d88dSmrg    cl_long   CL_ALIGNED(64) s[8];
1086af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1087af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  x, y, z, w; };
1088af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  s0, s1, s2, s3, s4, s5, s6, s7; };
1089af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long4 lo, hi; };
1090af69d88dSmrg#endif
109153c12917Smaya#if defined( __CL_LONG2__)
1092af69d88dSmrg    __cl_long2     v2[4];
1093af69d88dSmrg#endif
109453c12917Smaya#if defined( __CL_LONG4__)
1095af69d88dSmrg    __cl_long4     v4[2];
1096af69d88dSmrg#endif
1097af69d88dSmrg#if defined( __CL_LONG8__ )
1098af69d88dSmrg    __cl_long8     v8;
1099af69d88dSmrg#endif
1100af69d88dSmrg}cl_long8;
1101af69d88dSmrg
1102af69d88dSmrgtypedef union
1103af69d88dSmrg{
1104af69d88dSmrg    cl_long  CL_ALIGNED(128) s[16];
1105af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1106af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1107af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1108af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_long8 lo, hi; };
1109af69d88dSmrg#endif
111053c12917Smaya#if defined( __CL_LONG2__)
1111af69d88dSmrg    __cl_long2     v2[8];
1112af69d88dSmrg#endif
111353c12917Smaya#if defined( __CL_LONG4__)
1114af69d88dSmrg    __cl_long4     v4[4];
1115af69d88dSmrg#endif
1116af69d88dSmrg#if defined( __CL_LONG8__ )
1117af69d88dSmrg    __cl_long8     v8[2];
1118af69d88dSmrg#endif
1119af69d88dSmrg#if defined( __CL_LONG16__ )
1120af69d88dSmrg    __cl_long16    v16;
1121af69d88dSmrg#endif
1122af69d88dSmrg}cl_long16;
1123af69d88dSmrg
1124af69d88dSmrg
1125af69d88dSmrg/* ---- cl_ulongn ---- */
1126af69d88dSmrgtypedef union
1127af69d88dSmrg{
1128af69d88dSmrg    cl_ulong  CL_ALIGNED(16) s[2];
1129af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1130af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  x, y; };
1131af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  s0, s1; };
1132af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  lo, hi; };
1133af69d88dSmrg#endif
113453c12917Smaya#if defined( __CL_ULONG2__)
1135af69d88dSmrg    __cl_ulong2     v2;
1136af69d88dSmrg#endif
1137af69d88dSmrg}cl_ulong2;
1138af69d88dSmrg
1139af69d88dSmrgtypedef union
1140af69d88dSmrg{
1141af69d88dSmrg    cl_ulong  CL_ALIGNED(32) s[4];
1142af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1143af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  x, y, z, w; };
1144af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  s0, s1, s2, s3; };
1145af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong2 lo, hi; };
1146af69d88dSmrg#endif
114753c12917Smaya#if defined( __CL_ULONG2__)
1148af69d88dSmrg    __cl_ulong2     v2[2];
1149af69d88dSmrg#endif
115053c12917Smaya#if defined( __CL_ULONG4__)
1151af69d88dSmrg    __cl_ulong4     v4;
1152af69d88dSmrg#endif
1153af69d88dSmrg}cl_ulong4;
1154af69d88dSmrg
1155af69d88dSmrg/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */
1156af69d88dSmrgtypedef  cl_ulong4  cl_ulong3;
1157af69d88dSmrg
1158af69d88dSmrgtypedef union
1159af69d88dSmrg{
1160af69d88dSmrg    cl_ulong   CL_ALIGNED(64) s[8];
1161af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1162af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  x, y, z, w; };
1163af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  s0, s1, s2, s3, s4, s5, s6, s7; };
1164af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong4 lo, hi; };
1165af69d88dSmrg#endif
116653c12917Smaya#if defined( __CL_ULONG2__)
1167af69d88dSmrg    __cl_ulong2     v2[4];
1168af69d88dSmrg#endif
116953c12917Smaya#if defined( __CL_ULONG4__)
1170af69d88dSmrg    __cl_ulong4     v4[2];
1171af69d88dSmrg#endif
1172af69d88dSmrg#if defined( __CL_ULONG8__ )
1173af69d88dSmrg    __cl_ulong8     v8;
1174af69d88dSmrg#endif
1175af69d88dSmrg}cl_ulong8;
1176af69d88dSmrg
1177af69d88dSmrgtypedef union
1178af69d88dSmrg{
1179af69d88dSmrg    cl_ulong  CL_ALIGNED(128) s[16];
1180af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1181af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1182af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1183af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_ulong8 lo, hi; };
1184af69d88dSmrg#endif
118553c12917Smaya#if defined( __CL_ULONG2__)
1186af69d88dSmrg    __cl_ulong2     v2[8];
1187af69d88dSmrg#endif
118853c12917Smaya#if defined( __CL_ULONG4__)
1189af69d88dSmrg    __cl_ulong4     v4[4];
1190af69d88dSmrg#endif
1191af69d88dSmrg#if defined( __CL_ULONG8__ )
1192af69d88dSmrg    __cl_ulong8     v8[2];
1193af69d88dSmrg#endif
1194af69d88dSmrg#if defined( __CL_ULONG16__ )
1195af69d88dSmrg    __cl_ulong16    v16;
1196af69d88dSmrg#endif
1197af69d88dSmrg}cl_ulong16;
1198af69d88dSmrg
1199af69d88dSmrg
1200af69d88dSmrg/* --- cl_floatn ---- */
1201af69d88dSmrg
1202af69d88dSmrgtypedef union
1203af69d88dSmrg{
1204af69d88dSmrg    cl_float  CL_ALIGNED(8) s[2];
1205af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1206af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float  x, y; };
1207af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float  s0, s1; };
1208af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float  lo, hi; };
1209af69d88dSmrg#endif
121053c12917Smaya#if defined( __CL_FLOAT2__)
1211af69d88dSmrg    __cl_float2     v2;
1212af69d88dSmrg#endif
1213af69d88dSmrg}cl_float2;
1214af69d88dSmrg
1215af69d88dSmrgtypedef union
1216af69d88dSmrg{
1217af69d88dSmrg    cl_float  CL_ALIGNED(16) s[4];
1218af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1219af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float   x, y, z, w; };
1220af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float   s0, s1, s2, s3; };
1221af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float2  lo, hi; };
1222af69d88dSmrg#endif
122353c12917Smaya#if defined( __CL_FLOAT2__)
1224af69d88dSmrg    __cl_float2     v2[2];
1225af69d88dSmrg#endif
122653c12917Smaya#if defined( __CL_FLOAT4__)
1227af69d88dSmrg    __cl_float4     v4;
1228af69d88dSmrg#endif
1229af69d88dSmrg}cl_float4;
1230af69d88dSmrg
1231af69d88dSmrg/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */
1232af69d88dSmrgtypedef  cl_float4  cl_float3;
1233af69d88dSmrg
1234af69d88dSmrgtypedef union
1235af69d88dSmrg{
1236af69d88dSmrg    cl_float   CL_ALIGNED(32) s[8];
1237af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1238af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float   x, y, z, w; };
1239af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float   s0, s1, s2, s3, s4, s5, s6, s7; };
1240af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float4  lo, hi; };
1241af69d88dSmrg#endif
124253c12917Smaya#if defined( __CL_FLOAT2__)
1243af69d88dSmrg    __cl_float2     v2[4];
1244af69d88dSmrg#endif
124553c12917Smaya#if defined( __CL_FLOAT4__)
1246af69d88dSmrg    __cl_float4     v4[2];
1247af69d88dSmrg#endif
1248af69d88dSmrg#if defined( __CL_FLOAT8__ )
1249af69d88dSmrg    __cl_float8     v8;
1250af69d88dSmrg#endif
1251af69d88dSmrg}cl_float8;
1252af69d88dSmrg
1253af69d88dSmrgtypedef union
1254af69d88dSmrg{
1255af69d88dSmrg    cl_float  CL_ALIGNED(64) s[16];
1256af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1257af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1258af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1259af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_float8 lo, hi; };
1260af69d88dSmrg#endif
126153c12917Smaya#if defined( __CL_FLOAT2__)
1262af69d88dSmrg    __cl_float2     v2[8];
1263af69d88dSmrg#endif
126453c12917Smaya#if defined( __CL_FLOAT4__)
1265af69d88dSmrg    __cl_float4     v4[4];
1266af69d88dSmrg#endif
1267af69d88dSmrg#if defined( __CL_FLOAT8__ )
1268af69d88dSmrg    __cl_float8     v8[2];
1269af69d88dSmrg#endif
1270af69d88dSmrg#if defined( __CL_FLOAT16__ )
1271af69d88dSmrg    __cl_float16    v16;
1272af69d88dSmrg#endif
1273af69d88dSmrg}cl_float16;
1274af69d88dSmrg
1275af69d88dSmrg/* --- cl_doublen ---- */
1276af69d88dSmrg
1277af69d88dSmrgtypedef union
1278af69d88dSmrg{
1279af69d88dSmrg    cl_double  CL_ALIGNED(16) s[2];
1280af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1281af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double  x, y; };
1282af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double s0, s1; };
1283af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double lo, hi; };
1284af69d88dSmrg#endif
128553c12917Smaya#if defined( __CL_DOUBLE2__)
1286af69d88dSmrg    __cl_double2     v2;
1287af69d88dSmrg#endif
1288af69d88dSmrg}cl_double2;
1289af69d88dSmrg
1290af69d88dSmrgtypedef union
1291af69d88dSmrg{
1292af69d88dSmrg    cl_double  CL_ALIGNED(32) s[4];
1293af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1294af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double  x, y, z, w; };
1295af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double  s0, s1, s2, s3; };
1296af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double2 lo, hi; };
1297af69d88dSmrg#endif
129853c12917Smaya#if defined( __CL_DOUBLE2__)
1299af69d88dSmrg    __cl_double2     v2[2];
1300af69d88dSmrg#endif
130153c12917Smaya#if defined( __CL_DOUBLE4__)
1302af69d88dSmrg    __cl_double4     v4;
1303af69d88dSmrg#endif
1304af69d88dSmrg}cl_double4;
1305af69d88dSmrg
1306af69d88dSmrg/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */
1307af69d88dSmrgtypedef  cl_double4  cl_double3;
1308af69d88dSmrg
1309af69d88dSmrgtypedef union
1310af69d88dSmrg{
1311af69d88dSmrg    cl_double   CL_ALIGNED(64) s[8];
1312af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1313af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double  x, y, z, w; };
1314af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double  s0, s1, s2, s3, s4, s5, s6, s7; };
1315af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double4 lo, hi; };
1316af69d88dSmrg#endif
131753c12917Smaya#if defined( __CL_DOUBLE2__)
1318af69d88dSmrg    __cl_double2     v2[4];
1319af69d88dSmrg#endif
132053c12917Smaya#if defined( __CL_DOUBLE4__)
1321af69d88dSmrg    __cl_double4     v4[2];
1322af69d88dSmrg#endif
1323af69d88dSmrg#if defined( __CL_DOUBLE8__ )
1324af69d88dSmrg    __cl_double8     v8;
1325af69d88dSmrg#endif
1326af69d88dSmrg}cl_double8;
1327af69d88dSmrg
1328af69d88dSmrgtypedef union
1329af69d88dSmrg{
1330af69d88dSmrg    cl_double  CL_ALIGNED(128) s[16];
1331af69d88dSmrg#if __CL_HAS_ANON_STRUCT__
1332af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double  x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
1333af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double  s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
1334af69d88dSmrg   __CL_ANON_STRUCT__ struct{ cl_double8 lo, hi; };
1335af69d88dSmrg#endif
133653c12917Smaya#if defined( __CL_DOUBLE2__)
1337af69d88dSmrg    __cl_double2     v2[8];
1338af69d88dSmrg#endif
133953c12917Smaya#if defined( __CL_DOUBLE4__)
1340af69d88dSmrg    __cl_double4     v4[4];
1341af69d88dSmrg#endif
1342af69d88dSmrg#if defined( __CL_DOUBLE8__ )
1343af69d88dSmrg    __cl_double8     v8[2];
1344af69d88dSmrg#endif
1345af69d88dSmrg#if defined( __CL_DOUBLE16__ )
1346af69d88dSmrg    __cl_double16    v16;
1347af69d88dSmrg#endif
1348af69d88dSmrg}cl_double16;
1349af69d88dSmrg
135053c12917Smaya/* Macro to facilitate debugging
1351af69d88dSmrg * Usage:
135253c12917Smaya *   Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source.
1353af69d88dSmrg *   The first line ends with:   CL_PROGRAM_STRING_DEBUG_INFO \"
1354af69d88dSmrg *   Each line thereafter of OpenCL C source must end with: \n\
1355af69d88dSmrg *   The last line ends in ";
1356af69d88dSmrg *
1357af69d88dSmrg *   Example:
1358af69d88dSmrg *
1359af69d88dSmrg *   const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\
1360af69d88dSmrg *   kernel void foo( int a, float * b )             \n\
1361af69d88dSmrg *   {                                               \n\
1362af69d88dSmrg *      // my comment                                \n\
1363af69d88dSmrg *      *b[ get_global_id(0)] = a;                   \n\
1364af69d88dSmrg *   }                                               \n\
1365af69d88dSmrg *   ";
1366af69d88dSmrg *
136753c12917Smaya * This should correctly set up the line, (column) and file information for your source
1368af69d88dSmrg * string so you can do source level debugging.
1369af69d88dSmrg */
1370af69d88dSmrg#define  __CL_STRINGIFY( _x )               # _x
1371af69d88dSmrg#define  _CL_STRINGIFY( _x )                __CL_STRINGIFY( _x )
137253c12917Smaya#define  CL_PROGRAM_STRING_DEBUG_INFO       "#line "  _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n"
137353c12917Smaya
1374af69d88dSmrg#ifdef __cplusplus
1375af69d88dSmrg}
1376af69d88dSmrg#endif
1377af69d88dSmrg
13787ec681f3Smrg#if defined( _WIN32) && defined(_MSC_VER) && ! defined(__STDC__)
137953c12917Smaya    #if _MSC_VER >=1500
138053c12917Smaya    #pragma warning( pop )
138153c12917Smaya    #endif
1382af69d88dSmrg#endif
1383af69d88dSmrg
1384af69d88dSmrg#endif  /* __CL_PLATFORM_H  */
1385