The Opencl™ C 2.0 Specification
Total Page:16
File Type:pdf, Size:1020Kb
The OpenCL™ C 2.0 Specification Khronos® OpenCL Working Group Version V2.2-11, Fri, 19 Jul 2019 14:13:00 +0000 Table of Contents 6. The OpenCL C Programming Language . 2 6.1. Supported Data Types . 2 6.1.1. Built-in Scalar Data Types . 2 4 6.1.2. Built-in Vector Data Types . 5 6.1.3. Other Built-in Data Types . 6 6.1.4. Reserved Data Types . 7 6.1.5. Alignment of Types. 8 6.1.6. Vector Literals . 9 6.1.7. Vector Components. 9 6.1.8. Aliasing Rules. 14 6.1.9. Keywords . 14 6.2. Conversions and Type Casting. 14 6.2.1. Implicit Conversions . 14 6.2.2. Explicit Casts . 15 6.2.3. Explicit Conversions. 16 6.2.4. Reinterpreting Data As Another Type . 19 6.2.5. Pointer Casting. 22 6.2.6. Usual Arithmetic Conversions . 22 6.3. Operators . 23 6.3.1. Arithmetic Operators . 23 6.3.2. Unary Operators . 23 6.3.3. Pre- and Post-Operators . 23 6.3.4. Relational Operators . 24 6.3.5. Equality Operators . 24 6.3.6. Bitwise Operators . 25 6.3.7. Logical Operators . 25 6.3.8. Unary Logical Operator. 26 6.3.9. Ternary Selection Operator . 26 6.3.10. Shift Operators . 26 6.3.11. Sizeof Operator . 27 6.3.12. Comma Operator . 27 6.3.13. Indirection Operator . 27 6.3.14. Address Operator . 28 6.3.15. Assignment Operator. 28 6.4. Vector Operations . 29 6.5. Address Space Qualifiers . 30 6.5.1. __global (or global). 31 6.5.2. __local (or local). 32 6.5.3. __constant (or constant). 33 6.5.4. __private (or private). 34 6.5.5. The generic address space . 34 6.5.6. Changes to C99. 36 6.6. Access Qualifiers. 42 6.7. Function Qualifiers . 42 6.7.1. __kernel (or kernel). 42 6.7.2. Optional Attribute Qualifiers . 43 6.8. Storage-Class Specifiers. 45 6.9. Restrictions. 45 6.10. Preprocessor Directives and Macros . 48 6.11. Attribute Qualifiers . 49 6.11.1. Specifying Attributes of Types. 50 6.11.2. Specifying Attributes of Functions . 52 6.11.3. Specifying Attributes of Variables . 53 6.11.4. Specifying Attributes of Blocks and Control-Flow-Statements . 55 6.11.5. Specifying Attribute For Unrolling Loops . 56 6.11.6. Extending Attribute Qualifiers . ..