| OLD | NEW |
| 1 ============================ | 1 ============================ |
| 2 PNaCl C/C++ Language Support | 2 PNaCl C/C++ Language Support |
| 3 ============================ | 3 ============================ |
| 4 | 4 |
| 5 .. contents:: | 5 .. contents:: |
| 6 :local: | 6 :local: |
| 7 :backlinks: none | 7 :backlinks: none |
| 8 :depth: 3 | 8 :depth: 3 |
| 9 | 9 |
| 10 Source language support | 10 Source language support |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 Portable SIMD Vectors | 209 Portable SIMD Vectors |
| 210 ===================== | 210 ===================== |
| 211 | 211 |
| 212 SIMD vectors aren't part of the C/C++ standards and are traditionally | 212 SIMD vectors aren't part of the C/C++ standards and are traditionally |
| 213 very hardware-specific. Portable Native Client offers a portable version | 213 very hardware-specific. Portable Native Client offers a portable version |
| 214 of SIMD vector datatypes and operations which map well to modern | 214 of SIMD vector datatypes and operations which map well to modern |
| 215 architectures and offer performance which matches or approaches | 215 architectures and offer performance which matches or approaches |
| 216 hardware-specific uses. | 216 hardware-specific uses. |
| 217 | 217 |
| 218 SIMD vector support was added to Portable Native Client for version 37 | 218 SIMD vector support was added to Portable Native Client for version 37 of Chrome |
| 219 of Chrome and more features, including performance enhancements, are | 219 and more features, including performance enhancements, have been added in |
| 220 expected to be added in subsequent releases. | 220 subsequent releases. |
| 221 | 221 |
| 222 Hand-Coding Vector Extensions | 222 Hand-Coding Vector Extensions |
| 223 ----------------------------- | 223 ----------------------------- |
| 224 | 224 |
| 225 The initial vector support in Portable Native Client adds `LLVM vectors | 225 The initial vector support in Portable Native Client adds `LLVM vectors |
| 226 <http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors
>`_ | 226 <http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors
>`_ |
| 227 and `GCC vectors | 227 and `GCC vectors |
| 228 <http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html>`_ since these | 228 <http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html>`_ since these |
| 229 are well supported by different hardware platforms and don't require any | 229 are well supported by different hardware platforms and don't require any |
| 230 new compiler intrinsics. | 230 new compiler intrinsics. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 247 .. naclcode:: | 247 .. naclcode:: |
| 248 | 248 |
| 249 typedef int v4s __attribute__((vector_size(16))); | 249 typedef int v4s __attribute__((vector_size(16))); |
| 250 v4s snip(v4s in) { | 250 v4s snip(v4s in) { |
| 251 v4s limit = {32,64,128,256}; | 251 v4s limit = {32,64,128,256}; |
| 252 v4s mask = in > limit; | 252 v4s mask = in > limit; |
| 253 v4s ret = in & mask; | 253 v4s ret = in & mask; |
| 254 return ret; | 254 return ret; |
| 255 } | 255 } |
| 256 | 256 |
| 257 Vector datatypes are currently expected to be 128-bit wide with one of | 257 Vector datatypes are currently expected to be 128-bit wide with one of the |
| 258 the following element types: | 258 following element types, and they're expected to be alignment to the underlying |
| 259 element's bit width (loads and store will otherwise be broken up into scalar |
| 260 accesses to prevent faults): |
| 259 | 261 |
| 260 ============ ============ ================ | 262 ============ ============ ================ ====================== |
| 261 Type Num Elements Vector Bit Width | 263 Type Num Elements Vector Bit Width Expected Bit Alignment |
| 262 ============ ============ ================ | 264 ============ ============ ================ ====================== |
| 263 ``uint8_t`` 16 128 | 265 ``uint8_t`` 16 128 8 |
| 264 ``int8_t`` 16 128 | 266 ``int8_t`` 16 128 8 |
| 265 ``uint16_t`` 8 128 | 267 ``uint16_t`` 8 128 16 |
| 266 ``int16_t`` 8 128 | 268 ``int16_t`` 8 128 16 |
| 267 ``uint32_t`` 4 128 | 269 ``uint32_t`` 4 128 32 |
| 268 ``int32_t`` 4 128 | 270 ``int32_t`` 4 128 32 |
| 269 ``float`` 4 128 | 271 ``float`` 4 128 32 |
| 270 ============ ============ ================ | 272 ============ ============ ================ ====================== |
| 271 | 273 |
| 272 64-bit integers and double-precision floating point will be supported in | 274 64-bit integers and double-precision floating point will be supported in |
| 273 a future release, as will 256-bit and 512-bit vectors. | 275 a future release, as will 256-bit and 512-bit vectors. |
| 274 | 276 |
| 275 The following operators are supported on vectors: | 277 The following operators are supported on vectors: |
| 276 | 278 |
| 277 +----------------------------------------------+ | 279 +----------------------------------------------+ |
| 278 | unary ``+``, ``-`` | | 280 | unary ``+``, ``-`` | |
| 279 +----------------------------------------------+ | 281 +----------------------------------------------+ |
| 280 | ``++``, ``--`` | | 282 | ``++``, ``--`` | |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 A similar feature is **thread suspension**: The ability to | 456 A similar feature is **thread suspension**: The ability to |
| 455 asynchronously suspend and resume a thread and inspect or modify its | 457 asynchronously suspend and resume a thread and inspect or modify its |
| 456 execution state (such as register state). | 458 execution state (such as register state). |
| 457 | 459 |
| 458 Neither PNaCl nor NaCl currently support asynchronous interruption | 460 Neither PNaCl nor NaCl currently support asynchronous interruption |
| 459 or suspension of threads. | 461 or suspension of threads. |
| 460 | 462 |
| 461 If PNaCl were to support either of these, the interaction of | 463 If PNaCl were to support either of these, the interaction of |
| 462 ``volatile`` and atomics with same-thread signal handling would need | 464 ``volatile`` and atomics with same-thread signal handling would need |
| 463 to be carefully detailed. | 465 to be carefully detailed. |
| OLD | NEW |