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