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