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