1848b8605Smrg/********************************************************************************** 2b8e80941Smrg * Copyright (c) 2008-2018 The Khronos Group Inc. 3848b8605Smrg * 4848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5848b8605Smrg * copy of this software and/or associated documentation files (the 6848b8605Smrg * "Materials"), to deal in the Materials without restriction, including 7848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish, 8848b8605Smrg * distribute, sublicense, and/or sell copies of the Materials, and to 9848b8605Smrg * permit persons to whom the Materials are furnished to do so, subject to 10848b8605Smrg * the following conditions: 11848b8605Smrg * 12848b8605Smrg * The above copyright notice and this permission notice shall be included 13848b8605Smrg * in all copies or substantial portions of the Materials. 14848b8605Smrg * 15b8e80941Smrg * MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS 16b8e80941Smrg * KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS 17b8e80941Smrg * SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT 18b8e80941Smrg * https://www.khronos.org/registry/ 19b8e80941Smrg * 20848b8605Smrg * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 21848b8605Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 22848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 23848b8605Smrg * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 24848b8605Smrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 25848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 26848b8605Smrg * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 27848b8605Smrg **********************************************************************************/ 28848b8605Smrg 29848b8605Smrg#ifndef __CL_PLATFORM_H 30848b8605Smrg#define __CL_PLATFORM_H 31848b8605Smrg 32b8e80941Smrg#include <CL/cl_version.h> 33848b8605Smrg 34848b8605Smrg#ifdef __cplusplus 35848b8605Smrgextern "C" { 36848b8605Smrg#endif 37848b8605Smrg 38848b8605Smrg#if defined(_WIN32) 39848b8605Smrg #define CL_API_ENTRY 40848b8605Smrg #define CL_API_CALL __stdcall 41848b8605Smrg #define CL_CALLBACK __stdcall 42848b8605Smrg#else 43848b8605Smrg #define CL_API_ENTRY 44848b8605Smrg #define CL_API_CALL 45848b8605Smrg #define CL_CALLBACK 46848b8605Smrg#endif 47848b8605Smrg 48b8e80941Smrg/* 49b8e80941Smrg * Deprecation flags refer to the last version of the header in which the 50b8e80941Smrg * feature was not deprecated. 51b8e80941Smrg * 52b8e80941Smrg * E.g. VERSION_1_1_DEPRECATED means the feature is present in 1.1 without 53b8e80941Smrg * deprecation but is deprecated in versions later than 1.1. 54b8e80941Smrg */ 55b8e80941Smrg 56b8e80941Smrg#define CL_EXTENSION_WEAK_LINK 57b8e80941Smrg#define CL_API_SUFFIX__VERSION_1_0 58b8e80941Smrg#define CL_EXT_SUFFIX__VERSION_1_0 59b8e80941Smrg#define CL_API_SUFFIX__VERSION_1_1 60b8e80941Smrg#define CL_EXT_SUFFIX__VERSION_1_1 61b8e80941Smrg#define CL_API_SUFFIX__VERSION_1_2 62b8e80941Smrg#define CL_EXT_SUFFIX__VERSION_1_2 63b8e80941Smrg#define CL_API_SUFFIX__VERSION_2_0 64b8e80941Smrg#define CL_EXT_SUFFIX__VERSION_2_0 65b8e80941Smrg#define CL_API_SUFFIX__VERSION_2_1 66b8e80941Smrg#define CL_EXT_SUFFIX__VERSION_2_1 67b8e80941Smrg#define CL_API_SUFFIX__VERSION_2_2 68b8e80941Smrg#define CL_EXT_SUFFIX__VERSION_2_2 69b8e80941Smrg 70b8e80941Smrg#ifdef __GNUC__ 71b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS 72b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED 73b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED 74b8e80941Smrg #else 75b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated)) 76b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED 77b8e80941Smrg #endif 78b8e80941Smrg 79b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS 80b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED 81848b8605Smrg #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED 82848b8605Smrg #else 83b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated)) 84b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED 85848b8605Smrg #endif 86b8e80941Smrg 87b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS 88b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED 89b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED 90848b8605Smrg #else 91b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED __attribute__((deprecated)) 92b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED 93b8e80941Smrg #endif 94b8e80941Smrg 95b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS 96b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED 97b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED 98b8e80941Smrg #else 99b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED __attribute__((deprecated)) 100b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED 101b8e80941Smrg #endif 102b8e80941Smrg 103b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS 104b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED 105b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED 106b8e80941Smrg #else 107b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED __attribute__((deprecated)) 108b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED 109b8e80941Smrg #endif 110b8e80941Smrg#elif defined(_WIN32) 111b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS 112848b8605Smrg #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED 113848b8605Smrg #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED 114b8e80941Smrg #else 115b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED 116b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated) 117b8e80941Smrg #endif 118b8e80941Smrg 119b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS 120848b8605Smrg #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED 121848b8605Smrg #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED 122b8e80941Smrg #else 123b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED 124b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated) 125b8e80941Smrg #endif 126b8e80941Smrg 127b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_1_2_APIS 128b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED 129b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED 130b8e80941Smrg #else 131b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED 132b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED __declspec(deprecated) 133b8e80941Smrg #endif 134b8e80941Smrg 135b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_2_0_APIS 136b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED 137b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED 138b8e80941Smrg #else 139b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED 140b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED __declspec(deprecated) 141b8e80941Smrg #endif 142b8e80941Smrg 143b8e80941Smrg #ifdef CL_USE_DEPRECATED_OPENCL_2_1_APIS 144b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED 145b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED 146b8e80941Smrg #else 147b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED 148b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED __declspec(deprecated) 149848b8605Smrg #endif 150b8e80941Smrg#else 151b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED 152b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED 153b8e80941Smrg 154b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED 155b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED 156b8e80941Smrg 157b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_1_2_DEPRECATED 158b8e80941Smrg #define CL_EXT_PREFIX__VERSION_1_2_DEPRECATED 159b8e80941Smrg 160b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_0_DEPRECATED 161b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_0_DEPRECATED 162b8e80941Smrg 163b8e80941Smrg #define CL_EXT_SUFFIX__VERSION_2_1_DEPRECATED 164b8e80941Smrg #define CL_EXT_PREFIX__VERSION_2_1_DEPRECATED 165848b8605Smrg#endif 166848b8605Smrg 167848b8605Smrg#if (defined (_WIN32) && defined(_MSC_VER)) 168848b8605Smrg 169848b8605Smrg/* scalar types */ 170848b8605Smrgtypedef signed __int8 cl_char; 171848b8605Smrgtypedef unsigned __int8 cl_uchar; 172848b8605Smrgtypedef signed __int16 cl_short; 173848b8605Smrgtypedef unsigned __int16 cl_ushort; 174848b8605Smrgtypedef signed __int32 cl_int; 175848b8605Smrgtypedef unsigned __int32 cl_uint; 176848b8605Smrgtypedef signed __int64 cl_long; 177848b8605Smrgtypedef unsigned __int64 cl_ulong; 178848b8605Smrg 179848b8605Smrgtypedef unsigned __int16 cl_half; 180848b8605Smrgtypedef float cl_float; 181848b8605Smrgtypedef double cl_double; 182848b8605Smrg 183848b8605Smrg/* Macro names and corresponding values defined by OpenCL */ 184848b8605Smrg#define CL_CHAR_BIT 8 185848b8605Smrg#define CL_SCHAR_MAX 127 186848b8605Smrg#define CL_SCHAR_MIN (-127-1) 187848b8605Smrg#define CL_CHAR_MAX CL_SCHAR_MAX 188848b8605Smrg#define CL_CHAR_MIN CL_SCHAR_MIN 189848b8605Smrg#define CL_UCHAR_MAX 255 190848b8605Smrg#define CL_SHRT_MAX 32767 191848b8605Smrg#define CL_SHRT_MIN (-32767-1) 192848b8605Smrg#define CL_USHRT_MAX 65535 193848b8605Smrg#define CL_INT_MAX 2147483647 194848b8605Smrg#define CL_INT_MIN (-2147483647-1) 195848b8605Smrg#define CL_UINT_MAX 0xffffffffU 196848b8605Smrg#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL) 197848b8605Smrg#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL) 198848b8605Smrg#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL) 199848b8605Smrg 200848b8605Smrg#define CL_FLT_DIG 6 201848b8605Smrg#define CL_FLT_MANT_DIG 24 202848b8605Smrg#define CL_FLT_MAX_10_EXP +38 203848b8605Smrg#define CL_FLT_MAX_EXP +128 204848b8605Smrg#define CL_FLT_MIN_10_EXP -37 205848b8605Smrg#define CL_FLT_MIN_EXP -125 206848b8605Smrg#define CL_FLT_RADIX 2 207848b8605Smrg#define CL_FLT_MAX 340282346638528859811704183484516925440.0f 208848b8605Smrg#define CL_FLT_MIN 1.175494350822287507969e-38f 209b8e80941Smrg#define CL_FLT_EPSILON 1.1920928955078125e-7f 210b8e80941Smrg 211b8e80941Smrg#define CL_HALF_DIG 3 212b8e80941Smrg#define CL_HALF_MANT_DIG 11 213b8e80941Smrg#define CL_HALF_MAX_10_EXP +4 214b8e80941Smrg#define CL_HALF_MAX_EXP +16 215b8e80941Smrg#define CL_HALF_MIN_10_EXP -4 216b8e80941Smrg#define CL_HALF_MIN_EXP -13 217b8e80941Smrg#define CL_HALF_RADIX 2 218b8e80941Smrg#define CL_HALF_MAX 65504.0f 219b8e80941Smrg#define CL_HALF_MIN 6.103515625e-05f 220b8e80941Smrg#define CL_HALF_EPSILON 9.765625e-04f 221848b8605Smrg 222848b8605Smrg#define CL_DBL_DIG 15 223848b8605Smrg#define CL_DBL_MANT_DIG 53 224848b8605Smrg#define CL_DBL_MAX_10_EXP +308 225848b8605Smrg#define CL_DBL_MAX_EXP +1024 226848b8605Smrg#define CL_DBL_MIN_10_EXP -307 227848b8605Smrg#define CL_DBL_MIN_EXP -1021 228848b8605Smrg#define CL_DBL_RADIX 2 229b8e80941Smrg#define CL_DBL_MAX 1.7976931348623158e+308 230848b8605Smrg#define CL_DBL_MIN 2.225073858507201383090e-308 231848b8605Smrg#define CL_DBL_EPSILON 2.220446049250313080847e-16 232848b8605Smrg 233b8e80941Smrg#define CL_M_E 2.7182818284590452354 234b8e80941Smrg#define CL_M_LOG2E 1.4426950408889634074 235b8e80941Smrg#define CL_M_LOG10E 0.43429448190325182765 236b8e80941Smrg#define CL_M_LN2 0.69314718055994530942 237b8e80941Smrg#define CL_M_LN10 2.30258509299404568402 238b8e80941Smrg#define CL_M_PI 3.14159265358979323846 239b8e80941Smrg#define CL_M_PI_2 1.57079632679489661923 240b8e80941Smrg#define CL_M_PI_4 0.78539816339744830962 241b8e80941Smrg#define CL_M_1_PI 0.31830988618379067154 242b8e80941Smrg#define CL_M_2_PI 0.63661977236758134308 243b8e80941Smrg#define CL_M_2_SQRTPI 1.12837916709551257390 244b8e80941Smrg#define CL_M_SQRT2 1.41421356237309504880 245b8e80941Smrg#define CL_M_SQRT1_2 0.70710678118654752440 246b8e80941Smrg 247b8e80941Smrg#define CL_M_E_F 2.718281828f 248b8e80941Smrg#define CL_M_LOG2E_F 1.442695041f 249b8e80941Smrg#define CL_M_LOG10E_F 0.434294482f 250b8e80941Smrg#define CL_M_LN2_F 0.693147181f 251b8e80941Smrg#define CL_M_LN10_F 2.302585093f 252b8e80941Smrg#define CL_M_PI_F 3.141592654f 253b8e80941Smrg#define CL_M_PI_2_F 1.570796327f 254b8e80941Smrg#define CL_M_PI_4_F 0.785398163f 255b8e80941Smrg#define CL_M_1_PI_F 0.318309886f 256b8e80941Smrg#define CL_M_2_PI_F 0.636619772f 257b8e80941Smrg#define CL_M_2_SQRTPI_F 1.128379167f 258b8e80941Smrg#define CL_M_SQRT2_F 1.414213562f 259b8e80941Smrg#define CL_M_SQRT1_2_F 0.707106781f 260848b8605Smrg 261848b8605Smrg#define CL_NAN (CL_INFINITY - CL_INFINITY) 262848b8605Smrg#define CL_HUGE_VALF ((cl_float) 1e50) 263848b8605Smrg#define CL_HUGE_VAL ((cl_double) 1e500) 264848b8605Smrg#define CL_MAXFLOAT CL_FLT_MAX 265848b8605Smrg#define CL_INFINITY CL_HUGE_VALF 266848b8605Smrg 267848b8605Smrg#else 268848b8605Smrg 269848b8605Smrg#include <stdint.h> 270848b8605Smrg 271848b8605Smrg/* scalar types */ 272848b8605Smrgtypedef int8_t cl_char; 273848b8605Smrgtypedef uint8_t cl_uchar; 274848b8605Smrgtypedef int16_t cl_short __attribute__((aligned(2))); 275848b8605Smrgtypedef uint16_t cl_ushort __attribute__((aligned(2))); 276848b8605Smrgtypedef int32_t cl_int __attribute__((aligned(4))); 277848b8605Smrgtypedef uint32_t cl_uint __attribute__((aligned(4))); 278848b8605Smrgtypedef int64_t cl_long __attribute__((aligned(8))); 279848b8605Smrgtypedef uint64_t cl_ulong __attribute__((aligned(8))); 280848b8605Smrg 281848b8605Smrgtypedef uint16_t cl_half __attribute__((aligned(2))); 282848b8605Smrgtypedef float cl_float __attribute__((aligned(4))); 283848b8605Smrgtypedef double cl_double __attribute__((aligned(8))); 284848b8605Smrg 285848b8605Smrg/* Macro names and corresponding values defined by OpenCL */ 286848b8605Smrg#define CL_CHAR_BIT 8 287848b8605Smrg#define CL_SCHAR_MAX 127 288848b8605Smrg#define CL_SCHAR_MIN (-127-1) 289848b8605Smrg#define CL_CHAR_MAX CL_SCHAR_MAX 290848b8605Smrg#define CL_CHAR_MIN CL_SCHAR_MIN 291848b8605Smrg#define CL_UCHAR_MAX 255 292848b8605Smrg#define CL_SHRT_MAX 32767 293848b8605Smrg#define CL_SHRT_MIN (-32767-1) 294848b8605Smrg#define CL_USHRT_MAX 65535 295848b8605Smrg#define CL_INT_MAX 2147483647 296848b8605Smrg#define CL_INT_MIN (-2147483647-1) 297848b8605Smrg#define CL_UINT_MAX 0xffffffffU 298848b8605Smrg#define CL_LONG_MAX ((cl_long) 0x7FFFFFFFFFFFFFFFLL) 299848b8605Smrg#define CL_LONG_MIN ((cl_long) -0x7FFFFFFFFFFFFFFFLL - 1LL) 300848b8605Smrg#define CL_ULONG_MAX ((cl_ulong) 0xFFFFFFFFFFFFFFFFULL) 301848b8605Smrg 302848b8605Smrg#define CL_FLT_DIG 6 303848b8605Smrg#define CL_FLT_MANT_DIG 24 304848b8605Smrg#define CL_FLT_MAX_10_EXP +38 305848b8605Smrg#define CL_FLT_MAX_EXP +128 306848b8605Smrg#define CL_FLT_MIN_10_EXP -37 307848b8605Smrg#define CL_FLT_MIN_EXP -125 308848b8605Smrg#define CL_FLT_RADIX 2 309b8e80941Smrg#define CL_FLT_MAX 340282346638528859811704183484516925440.0f 310b8e80941Smrg#define CL_FLT_MIN 1.175494350822287507969e-38f 311b8e80941Smrg#define CL_FLT_EPSILON 1.1920928955078125e-7f 312b8e80941Smrg 313b8e80941Smrg#define CL_HALF_DIG 3 314b8e80941Smrg#define CL_HALF_MANT_DIG 11 315b8e80941Smrg#define CL_HALF_MAX_10_EXP +4 316b8e80941Smrg#define CL_HALF_MAX_EXP +16 317b8e80941Smrg#define CL_HALF_MIN_10_EXP -4 318b8e80941Smrg#define CL_HALF_MIN_EXP -13 319b8e80941Smrg#define CL_HALF_RADIX 2 320b8e80941Smrg#define CL_HALF_MAX 65504.0f 321b8e80941Smrg#define CL_HALF_MIN 6.103515625e-05f 322b8e80941Smrg#define CL_HALF_EPSILON 9.765625e-04f 323848b8605Smrg 324848b8605Smrg#define CL_DBL_DIG 15 325848b8605Smrg#define CL_DBL_MANT_DIG 53 326848b8605Smrg#define CL_DBL_MAX_10_EXP +308 327848b8605Smrg#define CL_DBL_MAX_EXP +1024 328848b8605Smrg#define CL_DBL_MIN_10_EXP -307 329848b8605Smrg#define CL_DBL_MIN_EXP -1021 330848b8605Smrg#define CL_DBL_RADIX 2 331b8e80941Smrg#define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 332b8e80941Smrg#define CL_DBL_MIN 2.225073858507201383090e-308 333b8e80941Smrg#define CL_DBL_EPSILON 2.220446049250313080847e-16 334b8e80941Smrg 335b8e80941Smrg#define CL_M_E 2.7182818284590452354 336b8e80941Smrg#define CL_M_LOG2E 1.4426950408889634074 337b8e80941Smrg#define CL_M_LOG10E 0.43429448190325182765 338b8e80941Smrg#define CL_M_LN2 0.69314718055994530942 339b8e80941Smrg#define CL_M_LN10 2.30258509299404568402 340b8e80941Smrg#define CL_M_PI 3.14159265358979323846 341b8e80941Smrg#define CL_M_PI_2 1.57079632679489661923 342b8e80941Smrg#define CL_M_PI_4 0.78539816339744830962 343b8e80941Smrg#define CL_M_1_PI 0.31830988618379067154 344b8e80941Smrg#define CL_M_2_PI 0.63661977236758134308 345b8e80941Smrg#define CL_M_2_SQRTPI 1.12837916709551257390 346b8e80941Smrg#define CL_M_SQRT2 1.41421356237309504880 347b8e80941Smrg#define CL_M_SQRT1_2 0.70710678118654752440 348b8e80941Smrg 349b8e80941Smrg#define CL_M_E_F 2.718281828f 350b8e80941Smrg#define CL_M_LOG2E_F 1.442695041f 351b8e80941Smrg#define CL_M_LOG10E_F 0.434294482f 352b8e80941Smrg#define CL_M_LN2_F 0.693147181f 353b8e80941Smrg#define CL_M_LN10_F 2.302585093f 354b8e80941Smrg#define CL_M_PI_F 3.141592654f 355b8e80941Smrg#define CL_M_PI_2_F 1.570796327f 356b8e80941Smrg#define CL_M_PI_4_F 0.785398163f 357b8e80941Smrg#define CL_M_1_PI_F 0.318309886f 358b8e80941Smrg#define CL_M_2_PI_F 0.636619772f 359b8e80941Smrg#define CL_M_2_SQRTPI_F 1.128379167f 360b8e80941Smrg#define CL_M_SQRT2_F 1.414213562f 361b8e80941Smrg#define CL_M_SQRT1_2_F 0.707106781f 362848b8605Smrg 363848b8605Smrg#if defined( __GNUC__ ) 364848b8605Smrg #define CL_HUGE_VALF __builtin_huge_valf() 365848b8605Smrg #define CL_HUGE_VAL __builtin_huge_val() 366848b8605Smrg #define CL_NAN __builtin_nanf( "" ) 367848b8605Smrg#else 368848b8605Smrg #define CL_HUGE_VALF ((cl_float) 1e50) 369848b8605Smrg #define CL_HUGE_VAL ((cl_double) 1e500) 370848b8605Smrg float nanf( const char * ); 371b8e80941Smrg #define CL_NAN nanf( "" ) 372848b8605Smrg#endif 373848b8605Smrg#define CL_MAXFLOAT CL_FLT_MAX 374848b8605Smrg#define CL_INFINITY CL_HUGE_VALF 375848b8605Smrg 376848b8605Smrg#endif 377848b8605Smrg 378848b8605Smrg#include <stddef.h> 379848b8605Smrg 380848b8605Smrg/* 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. */ 381848b8605Smrgtypedef unsigned int cl_GLuint; 382848b8605Smrgtypedef int cl_GLint; 383848b8605Smrgtypedef unsigned int cl_GLenum; 384848b8605Smrg 385848b8605Smrg/* 386b8e80941Smrg * Vector types 387848b8605Smrg * 388b8e80941Smrg * Note: OpenCL requires that all types be naturally aligned. 389848b8605Smrg * This means that vector types must be naturally aligned. 390848b8605Smrg * For example, a vector of four floats must be aligned to 391b8e80941Smrg * a 16 byte boundary (calculated as 4 * the natural 4-byte 392848b8605Smrg * alignment of the float). The alignment qualifiers here 393848b8605Smrg * will only function properly if your compiler supports them 394848b8605Smrg * and if you don't actively work to defeat them. For example, 395848b8605Smrg * in order for a cl_float4 to be 16 byte aligned in a struct, 396b8e80941Smrg * the start of the struct must itself be 16-byte aligned. 397848b8605Smrg * 398848b8605Smrg * Maintaining proper alignment is the user's responsibility. 399848b8605Smrg */ 400848b8605Smrg 401848b8605Smrg/* Define basic vector types */ 402848b8605Smrg#if defined( __VEC__ ) 403848b8605Smrg #include <altivec.h> /* may be omitted depending on compiler. AltiVec spec provides no way to detect whether the header is required. */ 404b8e80941Smrg typedef __vector unsigned char __cl_uchar16; 405b8e80941Smrg typedef __vector signed char __cl_char16; 406b8e80941Smrg typedef __vector unsigned short __cl_ushort8; 407b8e80941Smrg typedef __vector signed short __cl_short8; 408b8e80941Smrg typedef __vector unsigned int __cl_uint4; 409b8e80941Smrg typedef __vector signed int __cl_int4; 410b8e80941Smrg typedef __vector float __cl_float4; 411848b8605Smrg #define __CL_UCHAR16__ 1 412848b8605Smrg #define __CL_CHAR16__ 1 413848b8605Smrg #define __CL_USHORT8__ 1 414848b8605Smrg #define __CL_SHORT8__ 1 415848b8605Smrg #define __CL_UINT4__ 1 416848b8605Smrg #define __CL_INT4__ 1 417848b8605Smrg #define __CL_FLOAT4__ 1 418848b8605Smrg#endif 419848b8605Smrg 420848b8605Smrg#if defined( __SSE__ ) 421848b8605Smrg #if defined( __MINGW64__ ) 422848b8605Smrg #include <intrin.h> 423848b8605Smrg #else 424848b8605Smrg #include <xmmintrin.h> 425848b8605Smrg #endif 426848b8605Smrg #if defined( __GNUC__ ) 427848b8605Smrg typedef float __cl_float4 __attribute__((vector_size(16))); 428848b8605Smrg #else 429848b8605Smrg typedef __m128 __cl_float4; 430848b8605Smrg #endif 431848b8605Smrg #define __CL_FLOAT4__ 1 432848b8605Smrg#endif 433848b8605Smrg 434848b8605Smrg#if defined( __SSE2__ ) 435848b8605Smrg #if defined( __MINGW64__ ) 436848b8605Smrg #include <intrin.h> 437848b8605Smrg #else 438848b8605Smrg #include <emmintrin.h> 439848b8605Smrg #endif 440848b8605Smrg #if defined( __GNUC__ ) 441848b8605Smrg typedef cl_uchar __cl_uchar16 __attribute__((vector_size(16))); 442848b8605Smrg typedef cl_char __cl_char16 __attribute__((vector_size(16))); 443848b8605Smrg typedef cl_ushort __cl_ushort8 __attribute__((vector_size(16))); 444848b8605Smrg typedef cl_short __cl_short8 __attribute__((vector_size(16))); 445848b8605Smrg typedef cl_uint __cl_uint4 __attribute__((vector_size(16))); 446848b8605Smrg typedef cl_int __cl_int4 __attribute__((vector_size(16))); 447848b8605Smrg typedef cl_ulong __cl_ulong2 __attribute__((vector_size(16))); 448848b8605Smrg typedef cl_long __cl_long2 __attribute__((vector_size(16))); 449848b8605Smrg typedef cl_double __cl_double2 __attribute__((vector_size(16))); 450848b8605Smrg #else 451848b8605Smrg typedef __m128i __cl_uchar16; 452848b8605Smrg typedef __m128i __cl_char16; 453848b8605Smrg typedef __m128i __cl_ushort8; 454848b8605Smrg typedef __m128i __cl_short8; 455848b8605Smrg typedef __m128i __cl_uint4; 456848b8605Smrg typedef __m128i __cl_int4; 457848b8605Smrg typedef __m128i __cl_ulong2; 458848b8605Smrg typedef __m128i __cl_long2; 459848b8605Smrg typedef __m128d __cl_double2; 460848b8605Smrg #endif 461848b8605Smrg #define __CL_UCHAR16__ 1 462848b8605Smrg #define __CL_CHAR16__ 1 463848b8605Smrg #define __CL_USHORT8__ 1 464848b8605Smrg #define __CL_SHORT8__ 1 465848b8605Smrg #define __CL_INT4__ 1 466848b8605Smrg #define __CL_UINT4__ 1 467848b8605Smrg #define __CL_ULONG2__ 1 468848b8605Smrg #define __CL_LONG2__ 1 469848b8605Smrg #define __CL_DOUBLE2__ 1 470848b8605Smrg#endif 471848b8605Smrg 472848b8605Smrg#if defined( __MMX__ ) 473848b8605Smrg #include <mmintrin.h> 474848b8605Smrg #if defined( __GNUC__ ) 475848b8605Smrg typedef cl_uchar __cl_uchar8 __attribute__((vector_size(8))); 476848b8605Smrg typedef cl_char __cl_char8 __attribute__((vector_size(8))); 477848b8605Smrg typedef cl_ushort __cl_ushort4 __attribute__((vector_size(8))); 478848b8605Smrg typedef cl_short __cl_short4 __attribute__((vector_size(8))); 479848b8605Smrg typedef cl_uint __cl_uint2 __attribute__((vector_size(8))); 480848b8605Smrg typedef cl_int __cl_int2 __attribute__((vector_size(8))); 481848b8605Smrg typedef cl_ulong __cl_ulong1 __attribute__((vector_size(8))); 482848b8605Smrg typedef cl_long __cl_long1 __attribute__((vector_size(8))); 483848b8605Smrg typedef cl_float __cl_float2 __attribute__((vector_size(8))); 484848b8605Smrg #else 485848b8605Smrg typedef __m64 __cl_uchar8; 486848b8605Smrg typedef __m64 __cl_char8; 487848b8605Smrg typedef __m64 __cl_ushort4; 488848b8605Smrg typedef __m64 __cl_short4; 489848b8605Smrg typedef __m64 __cl_uint2; 490848b8605Smrg typedef __m64 __cl_int2; 491848b8605Smrg typedef __m64 __cl_ulong1; 492848b8605Smrg typedef __m64 __cl_long1; 493848b8605Smrg typedef __m64 __cl_float2; 494848b8605Smrg #endif 495848b8605Smrg #define __CL_UCHAR8__ 1 496848b8605Smrg #define __CL_CHAR8__ 1 497848b8605Smrg #define __CL_USHORT4__ 1 498848b8605Smrg #define __CL_SHORT4__ 1 499848b8605Smrg #define __CL_INT2__ 1 500848b8605Smrg #define __CL_UINT2__ 1 501848b8605Smrg #define __CL_ULONG1__ 1 502848b8605Smrg #define __CL_LONG1__ 1 503848b8605Smrg #define __CL_FLOAT2__ 1 504848b8605Smrg#endif 505848b8605Smrg 506848b8605Smrg#if defined( __AVX__ ) 507848b8605Smrg #if defined( __MINGW64__ ) 508848b8605Smrg #include <intrin.h> 509848b8605Smrg #else 510b8e80941Smrg #include <immintrin.h> 511848b8605Smrg #endif 512848b8605Smrg #if defined( __GNUC__ ) 513848b8605Smrg typedef cl_float __cl_float8 __attribute__((vector_size(32))); 514848b8605Smrg typedef cl_double __cl_double4 __attribute__((vector_size(32))); 515848b8605Smrg #else 516848b8605Smrg typedef __m256 __cl_float8; 517848b8605Smrg typedef __m256d __cl_double4; 518848b8605Smrg #endif 519848b8605Smrg #define __CL_FLOAT8__ 1 520848b8605Smrg #define __CL_DOUBLE4__ 1 521848b8605Smrg#endif 522848b8605Smrg 523848b8605Smrg/* Define capabilities for anonymous struct members. */ 524b8e80941Smrg#if !defined(__cplusplus) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L 525b8e80941Smrg#define __CL_HAS_ANON_STRUCT__ 1 526b8e80941Smrg#define __CL_ANON_STRUCT__ 527b8e80941Smrg#elif defined( __GNUC__) && ! defined( __STRICT_ANSI__ ) 528848b8605Smrg#define __CL_HAS_ANON_STRUCT__ 1 529848b8605Smrg#define __CL_ANON_STRUCT__ __extension__ 530b8e80941Smrg#elif defined( _WIN32) && defined(_MSC_VER) 531b8e80941Smrg #if _MSC_VER >= 1500 532848b8605Smrg /* Microsoft Developer Studio 2008 supports anonymous structs, but 533848b8605Smrg * complains by default. */ 534b8e80941Smrg #define __CL_HAS_ANON_STRUCT__ 1 535b8e80941Smrg #define __CL_ANON_STRUCT__ 536848b8605Smrg /* Disable warning C4201: nonstandard extension used : nameless 537848b8605Smrg * struct/union */ 538b8e80941Smrg #pragma warning( push ) 539b8e80941Smrg #pragma warning( disable : 4201 ) 540b8e80941Smrg #endif 541848b8605Smrg#else 542848b8605Smrg#define __CL_HAS_ANON_STRUCT__ 0 543848b8605Smrg#define __CL_ANON_STRUCT__ 544848b8605Smrg#endif 545848b8605Smrg 546848b8605Smrg/* Define alignment keys */ 547848b8605Smrg#if defined( __GNUC__ ) 548848b8605Smrg #define CL_ALIGNED(_x) __attribute__ ((aligned(_x))) 549848b8605Smrg#elif defined( _WIN32) && (_MSC_VER) 550848b8605Smrg /* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */ 551848b8605Smrg /* http://msdn.microsoft.com/en-us/library/373ak2y1%28VS.71%29.aspx */ 552848b8605Smrg /* #include <crtdefs.h> */ 553848b8605Smrg /* #define CL_ALIGNED(_x) _CRT_ALIGN(_x) */ 554848b8605Smrg #define CL_ALIGNED(_x) 555848b8605Smrg#else 556848b8605Smrg #warning Need to implement some method to align data here 557848b8605Smrg #define CL_ALIGNED(_x) 558848b8605Smrg#endif 559848b8605Smrg 560848b8605Smrg/* Indicate whether .xyzw, .s0123 and .hi.lo are supported */ 561848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 562848b8605Smrg /* .xyzw and .s0123...{f|F} are supported */ 563848b8605Smrg #define CL_HAS_NAMED_VECTOR_FIELDS 1 564848b8605Smrg /* .hi and .lo are supported */ 565848b8605Smrg #define CL_HAS_HI_LO_VECTOR_FIELDS 1 566848b8605Smrg#endif 567848b8605Smrg 568848b8605Smrg/* Define cl_vector types */ 569848b8605Smrg 570848b8605Smrg/* ---- cl_charn ---- */ 571848b8605Smrgtypedef union 572848b8605Smrg{ 573848b8605Smrg cl_char CL_ALIGNED(2) s[2]; 574848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 575848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char x, y; }; 576848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char s0, s1; }; 577848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char lo, hi; }; 578848b8605Smrg#endif 579b8e80941Smrg#if defined( __CL_CHAR2__) 580848b8605Smrg __cl_char2 v2; 581848b8605Smrg#endif 582848b8605Smrg}cl_char2; 583848b8605Smrg 584848b8605Smrgtypedef union 585848b8605Smrg{ 586848b8605Smrg cl_char CL_ALIGNED(4) s[4]; 587848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 588848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; }; 589848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3; }; 590848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char2 lo, hi; }; 591848b8605Smrg#endif 592b8e80941Smrg#if defined( __CL_CHAR2__) 593848b8605Smrg __cl_char2 v2[2]; 594848b8605Smrg#endif 595b8e80941Smrg#if defined( __CL_CHAR4__) 596848b8605Smrg __cl_char4 v4; 597848b8605Smrg#endif 598848b8605Smrg}cl_char4; 599848b8605Smrg 600848b8605Smrg/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */ 601848b8605Smrgtypedef cl_char4 cl_char3; 602848b8605Smrg 603848b8605Smrgtypedef union 604848b8605Smrg{ 605848b8605Smrg cl_char CL_ALIGNED(8) s[8]; 606848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 607848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w; }; 608848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; }; 609848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char4 lo, hi; }; 610848b8605Smrg#endif 611b8e80941Smrg#if defined( __CL_CHAR2__) 612848b8605Smrg __cl_char2 v2[4]; 613848b8605Smrg#endif 614b8e80941Smrg#if defined( __CL_CHAR4__) 615848b8605Smrg __cl_char4 v4[2]; 616848b8605Smrg#endif 617848b8605Smrg#if defined( __CL_CHAR8__ ) 618848b8605Smrg __cl_char8 v8; 619848b8605Smrg#endif 620848b8605Smrg}cl_char8; 621848b8605Smrg 622848b8605Smrgtypedef union 623848b8605Smrg{ 624848b8605Smrg cl_char CL_ALIGNED(16) s[16]; 625848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 626848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 627848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 628848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_char8 lo, hi; }; 629848b8605Smrg#endif 630b8e80941Smrg#if defined( __CL_CHAR2__) 631848b8605Smrg __cl_char2 v2[8]; 632848b8605Smrg#endif 633b8e80941Smrg#if defined( __CL_CHAR4__) 634848b8605Smrg __cl_char4 v4[4]; 635848b8605Smrg#endif 636848b8605Smrg#if defined( __CL_CHAR8__ ) 637848b8605Smrg __cl_char8 v8[2]; 638848b8605Smrg#endif 639848b8605Smrg#if defined( __CL_CHAR16__ ) 640848b8605Smrg __cl_char16 v16; 641848b8605Smrg#endif 642848b8605Smrg}cl_char16; 643848b8605Smrg 644848b8605Smrg 645848b8605Smrg/* ---- cl_ucharn ---- */ 646848b8605Smrgtypedef union 647848b8605Smrg{ 648848b8605Smrg cl_uchar CL_ALIGNED(2) s[2]; 649848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 650848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar x, y; }; 651848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1; }; 652848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar lo, hi; }; 653848b8605Smrg#endif 654b8e80941Smrg#if defined( __cl_uchar2__) 655848b8605Smrg __cl_uchar2 v2; 656848b8605Smrg#endif 657848b8605Smrg}cl_uchar2; 658848b8605Smrg 659848b8605Smrgtypedef union 660848b8605Smrg{ 661848b8605Smrg cl_uchar CL_ALIGNED(4) s[4]; 662848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 663848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; }; 664848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3; }; 665848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar2 lo, hi; }; 666848b8605Smrg#endif 667b8e80941Smrg#if defined( __CL_UCHAR2__) 668848b8605Smrg __cl_uchar2 v2[2]; 669848b8605Smrg#endif 670b8e80941Smrg#if defined( __CL_UCHAR4__) 671848b8605Smrg __cl_uchar4 v4; 672848b8605Smrg#endif 673848b8605Smrg}cl_uchar4; 674848b8605Smrg 675848b8605Smrg/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */ 676848b8605Smrgtypedef cl_uchar4 cl_uchar3; 677848b8605Smrg 678848b8605Smrgtypedef union 679848b8605Smrg{ 680848b8605Smrg cl_uchar CL_ALIGNED(8) s[8]; 681848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 682848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w; }; 683848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; }; 684848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar4 lo, hi; }; 685848b8605Smrg#endif 686b8e80941Smrg#if defined( __CL_UCHAR2__) 687848b8605Smrg __cl_uchar2 v2[4]; 688848b8605Smrg#endif 689b8e80941Smrg#if defined( __CL_UCHAR4__) 690848b8605Smrg __cl_uchar4 v4[2]; 691848b8605Smrg#endif 692848b8605Smrg#if defined( __CL_UCHAR8__ ) 693848b8605Smrg __cl_uchar8 v8; 694848b8605Smrg#endif 695848b8605Smrg}cl_uchar8; 696848b8605Smrg 697848b8605Smrgtypedef union 698848b8605Smrg{ 699848b8605Smrg cl_uchar CL_ALIGNED(16) s[16]; 700848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 701848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 702848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 703848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uchar8 lo, hi; }; 704848b8605Smrg#endif 705b8e80941Smrg#if defined( __CL_UCHAR2__) 706848b8605Smrg __cl_uchar2 v2[8]; 707848b8605Smrg#endif 708b8e80941Smrg#if defined( __CL_UCHAR4__) 709848b8605Smrg __cl_uchar4 v4[4]; 710848b8605Smrg#endif 711848b8605Smrg#if defined( __CL_UCHAR8__ ) 712848b8605Smrg __cl_uchar8 v8[2]; 713848b8605Smrg#endif 714848b8605Smrg#if defined( __CL_UCHAR16__ ) 715848b8605Smrg __cl_uchar16 v16; 716848b8605Smrg#endif 717848b8605Smrg}cl_uchar16; 718848b8605Smrg 719848b8605Smrg 720848b8605Smrg/* ---- cl_shortn ---- */ 721848b8605Smrgtypedef union 722848b8605Smrg{ 723848b8605Smrg cl_short CL_ALIGNED(4) s[2]; 724848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 725848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short x, y; }; 726848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short s0, s1; }; 727848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short lo, hi; }; 728848b8605Smrg#endif 729b8e80941Smrg#if defined( __CL_SHORT2__) 730848b8605Smrg __cl_short2 v2; 731848b8605Smrg#endif 732848b8605Smrg}cl_short2; 733848b8605Smrg 734848b8605Smrgtypedef union 735848b8605Smrg{ 736848b8605Smrg cl_short CL_ALIGNED(8) s[4]; 737848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 738848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; }; 739848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3; }; 740848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short2 lo, hi; }; 741848b8605Smrg#endif 742b8e80941Smrg#if defined( __CL_SHORT2__) 743848b8605Smrg __cl_short2 v2[2]; 744848b8605Smrg#endif 745b8e80941Smrg#if defined( __CL_SHORT4__) 746848b8605Smrg __cl_short4 v4; 747848b8605Smrg#endif 748848b8605Smrg}cl_short4; 749848b8605Smrg 750848b8605Smrg/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */ 751848b8605Smrgtypedef cl_short4 cl_short3; 752848b8605Smrg 753848b8605Smrgtypedef union 754848b8605Smrg{ 755848b8605Smrg cl_short CL_ALIGNED(16) s[8]; 756848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 757848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w; }; 758848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; }; 759848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short4 lo, hi; }; 760848b8605Smrg#endif 761b8e80941Smrg#if defined( __CL_SHORT2__) 762848b8605Smrg __cl_short2 v2[4]; 763848b8605Smrg#endif 764b8e80941Smrg#if defined( __CL_SHORT4__) 765848b8605Smrg __cl_short4 v4[2]; 766848b8605Smrg#endif 767848b8605Smrg#if defined( __CL_SHORT8__ ) 768848b8605Smrg __cl_short8 v8; 769848b8605Smrg#endif 770848b8605Smrg}cl_short8; 771848b8605Smrg 772848b8605Smrgtypedef union 773848b8605Smrg{ 774848b8605Smrg cl_short CL_ALIGNED(32) s[16]; 775848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 776848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 777848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 778848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_short8 lo, hi; }; 779848b8605Smrg#endif 780b8e80941Smrg#if defined( __CL_SHORT2__) 781848b8605Smrg __cl_short2 v2[8]; 782848b8605Smrg#endif 783b8e80941Smrg#if defined( __CL_SHORT4__) 784848b8605Smrg __cl_short4 v4[4]; 785848b8605Smrg#endif 786848b8605Smrg#if defined( __CL_SHORT8__ ) 787848b8605Smrg __cl_short8 v8[2]; 788848b8605Smrg#endif 789848b8605Smrg#if defined( __CL_SHORT16__ ) 790848b8605Smrg __cl_short16 v16; 791848b8605Smrg#endif 792848b8605Smrg}cl_short16; 793848b8605Smrg 794848b8605Smrg 795848b8605Smrg/* ---- cl_ushortn ---- */ 796848b8605Smrgtypedef union 797848b8605Smrg{ 798848b8605Smrg cl_ushort CL_ALIGNED(4) s[2]; 799848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 800848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort x, y; }; 801848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1; }; 802848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort lo, hi; }; 803848b8605Smrg#endif 804b8e80941Smrg#if defined( __CL_USHORT2__) 805848b8605Smrg __cl_ushort2 v2; 806848b8605Smrg#endif 807848b8605Smrg}cl_ushort2; 808848b8605Smrg 809848b8605Smrgtypedef union 810848b8605Smrg{ 811848b8605Smrg cl_ushort CL_ALIGNED(8) s[4]; 812848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 813848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; }; 814848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3; }; 815848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort2 lo, hi; }; 816848b8605Smrg#endif 817b8e80941Smrg#if defined( __CL_USHORT2__) 818848b8605Smrg __cl_ushort2 v2[2]; 819848b8605Smrg#endif 820b8e80941Smrg#if defined( __CL_USHORT4__) 821848b8605Smrg __cl_ushort4 v4; 822848b8605Smrg#endif 823848b8605Smrg}cl_ushort4; 824848b8605Smrg 825848b8605Smrg/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */ 826848b8605Smrgtypedef cl_ushort4 cl_ushort3; 827848b8605Smrg 828848b8605Smrgtypedef union 829848b8605Smrg{ 830848b8605Smrg cl_ushort CL_ALIGNED(16) s[8]; 831848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 832848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w; }; 833848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; }; 834848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort4 lo, hi; }; 835848b8605Smrg#endif 836b8e80941Smrg#if defined( __CL_USHORT2__) 837848b8605Smrg __cl_ushort2 v2[4]; 838848b8605Smrg#endif 839b8e80941Smrg#if defined( __CL_USHORT4__) 840848b8605Smrg __cl_ushort4 v4[2]; 841848b8605Smrg#endif 842848b8605Smrg#if defined( __CL_USHORT8__ ) 843848b8605Smrg __cl_ushort8 v8; 844848b8605Smrg#endif 845848b8605Smrg}cl_ushort8; 846848b8605Smrg 847848b8605Smrgtypedef union 848848b8605Smrg{ 849848b8605Smrg cl_ushort CL_ALIGNED(32) s[16]; 850848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 851848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 852848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 853848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ushort8 lo, hi; }; 854848b8605Smrg#endif 855b8e80941Smrg#if defined( __CL_USHORT2__) 856848b8605Smrg __cl_ushort2 v2[8]; 857848b8605Smrg#endif 858b8e80941Smrg#if defined( __CL_USHORT4__) 859848b8605Smrg __cl_ushort4 v4[4]; 860848b8605Smrg#endif 861848b8605Smrg#if defined( __CL_USHORT8__ ) 862848b8605Smrg __cl_ushort8 v8[2]; 863848b8605Smrg#endif 864848b8605Smrg#if defined( __CL_USHORT16__ ) 865848b8605Smrg __cl_ushort16 v16; 866848b8605Smrg#endif 867848b8605Smrg}cl_ushort16; 868848b8605Smrg 869b8e80941Smrg 870b8e80941Smrg/* ---- cl_halfn ---- */ 871b8e80941Smrgtypedef union 872b8e80941Smrg{ 873b8e80941Smrg cl_half CL_ALIGNED(4) s[2]; 874b8e80941Smrg#if __CL_HAS_ANON_STRUCT__ 875b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half x, y; }; 876b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half s0, s1; }; 877b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half lo, hi; }; 878b8e80941Smrg#endif 879b8e80941Smrg#if defined( __CL_HALF2__) 880b8e80941Smrg __cl_half2 v2; 881b8e80941Smrg#endif 882b8e80941Smrg}cl_half2; 883b8e80941Smrg 884b8e80941Smrgtypedef union 885b8e80941Smrg{ 886b8e80941Smrg cl_half CL_ALIGNED(8) s[4]; 887b8e80941Smrg#if __CL_HAS_ANON_STRUCT__ 888b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; }; 889b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3; }; 890b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half2 lo, hi; }; 891b8e80941Smrg#endif 892b8e80941Smrg#if defined( __CL_HALF2__) 893b8e80941Smrg __cl_half2 v2[2]; 894b8e80941Smrg#endif 895b8e80941Smrg#if defined( __CL_HALF4__) 896b8e80941Smrg __cl_half4 v4; 897b8e80941Smrg#endif 898b8e80941Smrg}cl_half4; 899b8e80941Smrg 900b8e80941Smrg/* cl_half3 is identical in size, alignment and behavior to cl_half4. See section 6.1.5. */ 901b8e80941Smrgtypedef cl_half4 cl_half3; 902b8e80941Smrg 903b8e80941Smrgtypedef union 904b8e80941Smrg{ 905b8e80941Smrg cl_half CL_ALIGNED(16) s[8]; 906b8e80941Smrg#if __CL_HAS_ANON_STRUCT__ 907b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w; }; 908b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7; }; 909b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half4 lo, hi; }; 910b8e80941Smrg#endif 911b8e80941Smrg#if defined( __CL_HALF2__) 912b8e80941Smrg __cl_half2 v2[4]; 913b8e80941Smrg#endif 914b8e80941Smrg#if defined( __CL_HALF4__) 915b8e80941Smrg __cl_half4 v4[2]; 916b8e80941Smrg#endif 917b8e80941Smrg#if defined( __CL_HALF8__ ) 918b8e80941Smrg __cl_half8 v8; 919b8e80941Smrg#endif 920b8e80941Smrg}cl_half8; 921b8e80941Smrg 922b8e80941Smrgtypedef union 923b8e80941Smrg{ 924b8e80941Smrg cl_half CL_ALIGNED(32) s[16]; 925b8e80941Smrg#if __CL_HAS_ANON_STRUCT__ 926b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 927b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 928b8e80941Smrg __CL_ANON_STRUCT__ struct{ cl_half8 lo, hi; }; 929b8e80941Smrg#endif 930b8e80941Smrg#if defined( __CL_HALF2__) 931b8e80941Smrg __cl_half2 v2[8]; 932b8e80941Smrg#endif 933b8e80941Smrg#if defined( __CL_HALF4__) 934b8e80941Smrg __cl_half4 v4[4]; 935b8e80941Smrg#endif 936b8e80941Smrg#if defined( __CL_HALF8__ ) 937b8e80941Smrg __cl_half8 v8[2]; 938b8e80941Smrg#endif 939b8e80941Smrg#if defined( __CL_HALF16__ ) 940b8e80941Smrg __cl_half16 v16; 941b8e80941Smrg#endif 942b8e80941Smrg}cl_half16; 943b8e80941Smrg 944848b8605Smrg/* ---- cl_intn ---- */ 945848b8605Smrgtypedef union 946848b8605Smrg{ 947848b8605Smrg cl_int CL_ALIGNED(8) s[2]; 948848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 949848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int x, y; }; 950848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int s0, s1; }; 951848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int lo, hi; }; 952848b8605Smrg#endif 953b8e80941Smrg#if defined( __CL_INT2__) 954848b8605Smrg __cl_int2 v2; 955848b8605Smrg#endif 956848b8605Smrg}cl_int2; 957848b8605Smrg 958848b8605Smrgtypedef union 959848b8605Smrg{ 960848b8605Smrg cl_int CL_ALIGNED(16) s[4]; 961848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 962848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; }; 963848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3; }; 964848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int2 lo, hi; }; 965848b8605Smrg#endif 966b8e80941Smrg#if defined( __CL_INT2__) 967848b8605Smrg __cl_int2 v2[2]; 968848b8605Smrg#endif 969b8e80941Smrg#if defined( __CL_INT4__) 970848b8605Smrg __cl_int4 v4; 971848b8605Smrg#endif 972848b8605Smrg}cl_int4; 973848b8605Smrg 974848b8605Smrg/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */ 975848b8605Smrgtypedef cl_int4 cl_int3; 976848b8605Smrg 977848b8605Smrgtypedef union 978848b8605Smrg{ 979848b8605Smrg cl_int CL_ALIGNED(32) s[8]; 980848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 981848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w; }; 982848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; }; 983848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int4 lo, hi; }; 984848b8605Smrg#endif 985b8e80941Smrg#if defined( __CL_INT2__) 986848b8605Smrg __cl_int2 v2[4]; 987848b8605Smrg#endif 988b8e80941Smrg#if defined( __CL_INT4__) 989848b8605Smrg __cl_int4 v4[2]; 990848b8605Smrg#endif 991848b8605Smrg#if defined( __CL_INT8__ ) 992848b8605Smrg __cl_int8 v8; 993848b8605Smrg#endif 994848b8605Smrg}cl_int8; 995848b8605Smrg 996848b8605Smrgtypedef union 997848b8605Smrg{ 998848b8605Smrg cl_int CL_ALIGNED(64) s[16]; 999848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1000848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 1001848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 1002848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_int8 lo, hi; }; 1003848b8605Smrg#endif 1004b8e80941Smrg#if defined( __CL_INT2__) 1005848b8605Smrg __cl_int2 v2[8]; 1006848b8605Smrg#endif 1007b8e80941Smrg#if defined( __CL_INT4__) 1008848b8605Smrg __cl_int4 v4[4]; 1009848b8605Smrg#endif 1010848b8605Smrg#if defined( __CL_INT8__ ) 1011848b8605Smrg __cl_int8 v8[2]; 1012848b8605Smrg#endif 1013848b8605Smrg#if defined( __CL_INT16__ ) 1014848b8605Smrg __cl_int16 v16; 1015848b8605Smrg#endif 1016848b8605Smrg}cl_int16; 1017848b8605Smrg 1018848b8605Smrg 1019848b8605Smrg/* ---- cl_uintn ---- */ 1020848b8605Smrgtypedef union 1021848b8605Smrg{ 1022848b8605Smrg cl_uint CL_ALIGNED(8) s[2]; 1023848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1024848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint x, y; }; 1025848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint s0, s1; }; 1026848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint lo, hi; }; 1027848b8605Smrg#endif 1028b8e80941Smrg#if defined( __CL_UINT2__) 1029848b8605Smrg __cl_uint2 v2; 1030848b8605Smrg#endif 1031848b8605Smrg}cl_uint2; 1032848b8605Smrg 1033848b8605Smrgtypedef union 1034848b8605Smrg{ 1035848b8605Smrg cl_uint CL_ALIGNED(16) s[4]; 1036848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1037848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; }; 1038848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3; }; 1039848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint2 lo, hi; }; 1040848b8605Smrg#endif 1041b8e80941Smrg#if defined( __CL_UINT2__) 1042848b8605Smrg __cl_uint2 v2[2]; 1043848b8605Smrg#endif 1044b8e80941Smrg#if defined( __CL_UINT4__) 1045848b8605Smrg __cl_uint4 v4; 1046848b8605Smrg#endif 1047848b8605Smrg}cl_uint4; 1048848b8605Smrg 1049848b8605Smrg/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */ 1050848b8605Smrgtypedef cl_uint4 cl_uint3; 1051848b8605Smrg 1052848b8605Smrgtypedef union 1053848b8605Smrg{ 1054848b8605Smrg cl_uint CL_ALIGNED(32) s[8]; 1055848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1056848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w; }; 1057848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; }; 1058848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint4 lo, hi; }; 1059848b8605Smrg#endif 1060b8e80941Smrg#if defined( __CL_UINT2__) 1061848b8605Smrg __cl_uint2 v2[4]; 1062848b8605Smrg#endif 1063b8e80941Smrg#if defined( __CL_UINT4__) 1064848b8605Smrg __cl_uint4 v4[2]; 1065848b8605Smrg#endif 1066848b8605Smrg#if defined( __CL_UINT8__ ) 1067848b8605Smrg __cl_uint8 v8; 1068848b8605Smrg#endif 1069848b8605Smrg}cl_uint8; 1070848b8605Smrg 1071848b8605Smrgtypedef union 1072848b8605Smrg{ 1073848b8605Smrg cl_uint CL_ALIGNED(64) s[16]; 1074848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1075848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 1076848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 1077848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_uint8 lo, hi; }; 1078848b8605Smrg#endif 1079b8e80941Smrg#if defined( __CL_UINT2__) 1080848b8605Smrg __cl_uint2 v2[8]; 1081848b8605Smrg#endif 1082b8e80941Smrg#if defined( __CL_UINT4__) 1083848b8605Smrg __cl_uint4 v4[4]; 1084848b8605Smrg#endif 1085848b8605Smrg#if defined( __CL_UINT8__ ) 1086848b8605Smrg __cl_uint8 v8[2]; 1087848b8605Smrg#endif 1088848b8605Smrg#if defined( __CL_UINT16__ ) 1089848b8605Smrg __cl_uint16 v16; 1090848b8605Smrg#endif 1091848b8605Smrg}cl_uint16; 1092848b8605Smrg 1093848b8605Smrg/* ---- cl_longn ---- */ 1094848b8605Smrgtypedef union 1095848b8605Smrg{ 1096848b8605Smrg cl_long CL_ALIGNED(16) s[2]; 1097848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1098848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long x, y; }; 1099848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long s0, s1; }; 1100848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long lo, hi; }; 1101848b8605Smrg#endif 1102b8e80941Smrg#if defined( __CL_LONG2__) 1103848b8605Smrg __cl_long2 v2; 1104848b8605Smrg#endif 1105848b8605Smrg}cl_long2; 1106848b8605Smrg 1107848b8605Smrgtypedef union 1108848b8605Smrg{ 1109848b8605Smrg cl_long CL_ALIGNED(32) s[4]; 1110848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1111848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; }; 1112848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3; }; 1113848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long2 lo, hi; }; 1114848b8605Smrg#endif 1115b8e80941Smrg#if defined( __CL_LONG2__) 1116848b8605Smrg __cl_long2 v2[2]; 1117848b8605Smrg#endif 1118b8e80941Smrg#if defined( __CL_LONG4__) 1119848b8605Smrg __cl_long4 v4; 1120848b8605Smrg#endif 1121848b8605Smrg}cl_long4; 1122848b8605Smrg 1123848b8605Smrg/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */ 1124848b8605Smrgtypedef cl_long4 cl_long3; 1125848b8605Smrg 1126848b8605Smrgtypedef union 1127848b8605Smrg{ 1128848b8605Smrg cl_long CL_ALIGNED(64) s[8]; 1129848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1130848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w; }; 1131848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; }; 1132848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long4 lo, hi; }; 1133848b8605Smrg#endif 1134b8e80941Smrg#if defined( __CL_LONG2__) 1135848b8605Smrg __cl_long2 v2[4]; 1136848b8605Smrg#endif 1137b8e80941Smrg#if defined( __CL_LONG4__) 1138848b8605Smrg __cl_long4 v4[2]; 1139848b8605Smrg#endif 1140848b8605Smrg#if defined( __CL_LONG8__ ) 1141848b8605Smrg __cl_long8 v8; 1142848b8605Smrg#endif 1143848b8605Smrg}cl_long8; 1144848b8605Smrg 1145848b8605Smrgtypedef union 1146848b8605Smrg{ 1147848b8605Smrg cl_long CL_ALIGNED(128) s[16]; 1148848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1149848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 1150848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 1151848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_long8 lo, hi; }; 1152848b8605Smrg#endif 1153b8e80941Smrg#if defined( __CL_LONG2__) 1154848b8605Smrg __cl_long2 v2[8]; 1155848b8605Smrg#endif 1156b8e80941Smrg#if defined( __CL_LONG4__) 1157848b8605Smrg __cl_long4 v4[4]; 1158848b8605Smrg#endif 1159848b8605Smrg#if defined( __CL_LONG8__ ) 1160848b8605Smrg __cl_long8 v8[2]; 1161848b8605Smrg#endif 1162848b8605Smrg#if defined( __CL_LONG16__ ) 1163848b8605Smrg __cl_long16 v16; 1164848b8605Smrg#endif 1165848b8605Smrg}cl_long16; 1166848b8605Smrg 1167848b8605Smrg 1168848b8605Smrg/* ---- cl_ulongn ---- */ 1169848b8605Smrgtypedef union 1170848b8605Smrg{ 1171848b8605Smrg cl_ulong CL_ALIGNED(16) s[2]; 1172848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1173848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong x, y; }; 1174848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1; }; 1175848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong lo, hi; }; 1176848b8605Smrg#endif 1177b8e80941Smrg#if defined( __CL_ULONG2__) 1178848b8605Smrg __cl_ulong2 v2; 1179848b8605Smrg#endif 1180848b8605Smrg}cl_ulong2; 1181848b8605Smrg 1182848b8605Smrgtypedef union 1183848b8605Smrg{ 1184848b8605Smrg cl_ulong CL_ALIGNED(32) s[4]; 1185848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1186848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; }; 1187848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3; }; 1188848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong2 lo, hi; }; 1189848b8605Smrg#endif 1190b8e80941Smrg#if defined( __CL_ULONG2__) 1191848b8605Smrg __cl_ulong2 v2[2]; 1192848b8605Smrg#endif 1193b8e80941Smrg#if defined( __CL_ULONG4__) 1194848b8605Smrg __cl_ulong4 v4; 1195848b8605Smrg#endif 1196848b8605Smrg}cl_ulong4; 1197848b8605Smrg 1198848b8605Smrg/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */ 1199848b8605Smrgtypedef cl_ulong4 cl_ulong3; 1200848b8605Smrg 1201848b8605Smrgtypedef union 1202848b8605Smrg{ 1203848b8605Smrg cl_ulong CL_ALIGNED(64) s[8]; 1204848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1205848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w; }; 1206848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; }; 1207848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong4 lo, hi; }; 1208848b8605Smrg#endif 1209b8e80941Smrg#if defined( __CL_ULONG2__) 1210848b8605Smrg __cl_ulong2 v2[4]; 1211848b8605Smrg#endif 1212b8e80941Smrg#if defined( __CL_ULONG4__) 1213848b8605Smrg __cl_ulong4 v4[2]; 1214848b8605Smrg#endif 1215848b8605Smrg#if defined( __CL_ULONG8__ ) 1216848b8605Smrg __cl_ulong8 v8; 1217848b8605Smrg#endif 1218848b8605Smrg}cl_ulong8; 1219848b8605Smrg 1220848b8605Smrgtypedef union 1221848b8605Smrg{ 1222848b8605Smrg cl_ulong CL_ALIGNED(128) s[16]; 1223848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1224848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 1225848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 1226848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_ulong8 lo, hi; }; 1227848b8605Smrg#endif 1228b8e80941Smrg#if defined( __CL_ULONG2__) 1229848b8605Smrg __cl_ulong2 v2[8]; 1230848b8605Smrg#endif 1231b8e80941Smrg#if defined( __CL_ULONG4__) 1232848b8605Smrg __cl_ulong4 v4[4]; 1233848b8605Smrg#endif 1234848b8605Smrg#if defined( __CL_ULONG8__ ) 1235848b8605Smrg __cl_ulong8 v8[2]; 1236848b8605Smrg#endif 1237848b8605Smrg#if defined( __CL_ULONG16__ ) 1238848b8605Smrg __cl_ulong16 v16; 1239848b8605Smrg#endif 1240848b8605Smrg}cl_ulong16; 1241848b8605Smrg 1242848b8605Smrg 1243848b8605Smrg/* --- cl_floatn ---- */ 1244848b8605Smrg 1245848b8605Smrgtypedef union 1246848b8605Smrg{ 1247848b8605Smrg cl_float CL_ALIGNED(8) s[2]; 1248848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1249848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float x, y; }; 1250848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float s0, s1; }; 1251848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float lo, hi; }; 1252848b8605Smrg#endif 1253b8e80941Smrg#if defined( __CL_FLOAT2__) 1254848b8605Smrg __cl_float2 v2; 1255848b8605Smrg#endif 1256848b8605Smrg}cl_float2; 1257848b8605Smrg 1258848b8605Smrgtypedef union 1259848b8605Smrg{ 1260848b8605Smrg cl_float CL_ALIGNED(16) s[4]; 1261848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1262848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; }; 1263848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3; }; 1264848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float2 lo, hi; }; 1265848b8605Smrg#endif 1266b8e80941Smrg#if defined( __CL_FLOAT2__) 1267848b8605Smrg __cl_float2 v2[2]; 1268848b8605Smrg#endif 1269b8e80941Smrg#if defined( __CL_FLOAT4__) 1270848b8605Smrg __cl_float4 v4; 1271848b8605Smrg#endif 1272848b8605Smrg}cl_float4; 1273848b8605Smrg 1274848b8605Smrg/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */ 1275848b8605Smrgtypedef cl_float4 cl_float3; 1276848b8605Smrg 1277848b8605Smrgtypedef union 1278848b8605Smrg{ 1279848b8605Smrg cl_float CL_ALIGNED(32) s[8]; 1280848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1281848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w; }; 1282848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; }; 1283848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float4 lo, hi; }; 1284848b8605Smrg#endif 1285b8e80941Smrg#if defined( __CL_FLOAT2__) 1286848b8605Smrg __cl_float2 v2[4]; 1287848b8605Smrg#endif 1288b8e80941Smrg#if defined( __CL_FLOAT4__) 1289848b8605Smrg __cl_float4 v4[2]; 1290848b8605Smrg#endif 1291848b8605Smrg#if defined( __CL_FLOAT8__ ) 1292848b8605Smrg __cl_float8 v8; 1293848b8605Smrg#endif 1294848b8605Smrg}cl_float8; 1295848b8605Smrg 1296848b8605Smrgtypedef union 1297848b8605Smrg{ 1298848b8605Smrg cl_float CL_ALIGNED(64) s[16]; 1299848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1300848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 1301848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 1302848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_float8 lo, hi; }; 1303848b8605Smrg#endif 1304b8e80941Smrg#if defined( __CL_FLOAT2__) 1305848b8605Smrg __cl_float2 v2[8]; 1306848b8605Smrg#endif 1307b8e80941Smrg#if defined( __CL_FLOAT4__) 1308848b8605Smrg __cl_float4 v4[4]; 1309848b8605Smrg#endif 1310848b8605Smrg#if defined( __CL_FLOAT8__ ) 1311848b8605Smrg __cl_float8 v8[2]; 1312848b8605Smrg#endif 1313848b8605Smrg#if defined( __CL_FLOAT16__ ) 1314848b8605Smrg __cl_float16 v16; 1315848b8605Smrg#endif 1316848b8605Smrg}cl_float16; 1317848b8605Smrg 1318848b8605Smrg/* --- cl_doublen ---- */ 1319848b8605Smrg 1320848b8605Smrgtypedef union 1321848b8605Smrg{ 1322848b8605Smrg cl_double CL_ALIGNED(16) s[2]; 1323848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1324848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double x, y; }; 1325848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double s0, s1; }; 1326848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double lo, hi; }; 1327848b8605Smrg#endif 1328b8e80941Smrg#if defined( __CL_DOUBLE2__) 1329848b8605Smrg __cl_double2 v2; 1330848b8605Smrg#endif 1331848b8605Smrg}cl_double2; 1332848b8605Smrg 1333848b8605Smrgtypedef union 1334848b8605Smrg{ 1335848b8605Smrg cl_double CL_ALIGNED(32) s[4]; 1336848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1337848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; }; 1338848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3; }; 1339848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double2 lo, hi; }; 1340848b8605Smrg#endif 1341b8e80941Smrg#if defined( __CL_DOUBLE2__) 1342848b8605Smrg __cl_double2 v2[2]; 1343848b8605Smrg#endif 1344b8e80941Smrg#if defined( __CL_DOUBLE4__) 1345848b8605Smrg __cl_double4 v4; 1346848b8605Smrg#endif 1347848b8605Smrg}cl_double4; 1348848b8605Smrg 1349848b8605Smrg/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */ 1350848b8605Smrgtypedef cl_double4 cl_double3; 1351848b8605Smrg 1352848b8605Smrgtypedef union 1353848b8605Smrg{ 1354848b8605Smrg cl_double CL_ALIGNED(64) s[8]; 1355848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1356848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w; }; 1357848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; }; 1358848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double4 lo, hi; }; 1359848b8605Smrg#endif 1360b8e80941Smrg#if defined( __CL_DOUBLE2__) 1361848b8605Smrg __cl_double2 v2[4]; 1362848b8605Smrg#endif 1363b8e80941Smrg#if defined( __CL_DOUBLE4__) 1364848b8605Smrg __cl_double4 v4[2]; 1365848b8605Smrg#endif 1366848b8605Smrg#if defined( __CL_DOUBLE8__ ) 1367848b8605Smrg __cl_double8 v8; 1368848b8605Smrg#endif 1369848b8605Smrg}cl_double8; 1370848b8605Smrg 1371848b8605Smrgtypedef union 1372848b8605Smrg{ 1373848b8605Smrg cl_double CL_ALIGNED(128) s[16]; 1374848b8605Smrg#if __CL_HAS_ANON_STRUCT__ 1375848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; }; 1376848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; }; 1377848b8605Smrg __CL_ANON_STRUCT__ struct{ cl_double8 lo, hi; }; 1378848b8605Smrg#endif 1379b8e80941Smrg#if defined( __CL_DOUBLE2__) 1380848b8605Smrg __cl_double2 v2[8]; 1381848b8605Smrg#endif 1382b8e80941Smrg#if defined( __CL_DOUBLE4__) 1383848b8605Smrg __cl_double4 v4[4]; 1384848b8605Smrg#endif 1385848b8605Smrg#if defined( __CL_DOUBLE8__ ) 1386848b8605Smrg __cl_double8 v8[2]; 1387848b8605Smrg#endif 1388848b8605Smrg#if defined( __CL_DOUBLE16__ ) 1389848b8605Smrg __cl_double16 v16; 1390848b8605Smrg#endif 1391848b8605Smrg}cl_double16; 1392848b8605Smrg 1393b8e80941Smrg/* Macro to facilitate debugging 1394848b8605Smrg * Usage: 1395b8e80941Smrg * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source. 1396848b8605Smrg * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \" 1397848b8605Smrg * Each line thereafter of OpenCL C source must end with: \n\ 1398848b8605Smrg * The last line ends in "; 1399848b8605Smrg * 1400848b8605Smrg * Example: 1401848b8605Smrg * 1402848b8605Smrg * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\ 1403848b8605Smrg * kernel void foo( int a, float * b ) \n\ 1404848b8605Smrg * { \n\ 1405848b8605Smrg * // my comment \n\ 1406848b8605Smrg * *b[ get_global_id(0)] = a; \n\ 1407848b8605Smrg * } \n\ 1408848b8605Smrg * "; 1409848b8605Smrg * 1410b8e80941Smrg * This should correctly set up the line, (column) and file information for your source 1411848b8605Smrg * string so you can do source level debugging. 1412848b8605Smrg */ 1413848b8605Smrg#define __CL_STRINGIFY( _x ) # _x 1414848b8605Smrg#define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x ) 1415b8e80941Smrg#define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n" 1416b8e80941Smrg 1417848b8605Smrg#ifdef __cplusplus 1418848b8605Smrg} 1419848b8605Smrg#endif 1420848b8605Smrg 1421848b8605Smrg#undef __CL_HAS_ANON_STRUCT__ 1422848b8605Smrg#undef __CL_ANON_STRUCT__ 1423b8e80941Smrg#if defined( _WIN32) && defined(_MSC_VER) 1424b8e80941Smrg #if _MSC_VER >=1500 1425b8e80941Smrg #pragma warning( pop ) 1426b8e80941Smrg #endif 1427848b8605Smrg#endif 1428848b8605Smrg 1429848b8605Smrg#endif /* __CL_PLATFORM_H */ 1430