cl_platform.h 37 KB

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