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