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