OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="pnacl-c-c-language-support"> | 3 <section id="pnacl-c-c-language-support"> |
4 <h1 id="pnacl-c-c-language-support">PNaCl C/C++ Language Support</h1> | 4 <h1 id="pnacl-c-c-language-support">PNaCl C/C++ Language Support</h1> |
5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
7 <li><p class="first"><a class="reference internal" href="#source-language-suppor
t" id="id3">Source language support</a></p> | 7 <li><p class="first"><a class="reference internal" href="#source-language-suppor
t" id="id3">Source language support</a></p> |
8 <ul class="small-gap"> | 8 <ul class="small-gap"> |
9 <li><a class="reference internal" href="#versions" id="id4">Versions</a></li> | 9 <li><a class="reference internal" href="#versions" id="id4">Versions</a></li> |
10 <li><a class="reference internal" href="#preprocessor-definitions" id="id5">Prep
rocessor definitions</a></li> | 10 <li><a class="reference internal" href="#preprocessor-definitions" id="id5">Prep
rocessor definitions</a></li> |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 <p>NaCl supports full zero-cost C++ exception handling.</p> | 175 <p>NaCl supports full zero-cost C++ exception handling.</p> |
176 </section><section id="inline-assembly"> | 176 </section><section id="inline-assembly"> |
177 <h2 id="inline-assembly">Inline Assembly</h2> | 177 <h2 id="inline-assembly">Inline Assembly</h2> |
178 <p>Inline assembly isn’t supported by PNaCl because it isn’t portabl
e. The | 178 <p>Inline assembly isn’t supported by PNaCl because it isn’t portabl
e. The |
179 one current exception is the common compiler barrier idiom | 179 one current exception is the common compiler barrier idiom |
180 <code>asm("":::"memory")</code>, which gets transformed to a
sequentially | 180 <code>asm("":::"memory")</code>, which gets transformed to a
sequentially |
181 consistent memory barrier (equivalent to <code>__sync_synchronize()</code>). In | 181 consistent memory barrier (equivalent to <code>__sync_synchronize()</code>). In |
182 PNaCl this barrier is only guaranteed to order <code>volatile</code> and atomic | 182 PNaCl this barrier is only guaranteed to order <code>volatile</code> and atomic |
183 memory accesses, though in practice the implementation attempts to also | 183 memory accesses, though in practice the implementation attempts to also |
184 prevent reordering of memory accesses to objects which may escape.</p> | 184 prevent reordering of memory accesses to objects which may escape.</p> |
| 185 <p>PNaCl supports <a class="reference internal" href="#portable-simd-vectors"><e
m>Portable SIMD Vectors</em></a>, |
| 186 which are traditionally expressed through target-specific intrinsics or |
| 187 inline assembly.</p> |
185 <p>NaCl supports a fairly wide subset of inline assembly through GCC’s | 188 <p>NaCl supports a fairly wide subset of inline assembly through GCC’s |
186 inline assembly syntax, with the restriction that the sandboxing model | 189 inline assembly syntax, with the restriction that the sandboxing model |
187 for the target architecture has to be respected.</p> | 190 for the target architecture has to be respected.</p> |
188 </section><section id="portable-simd-vectors"> | 191 </section><section id="portable-simd-vectors"> |
189 <span id="id2"></span><h2 id="portable-simd-vectors"><span id="id2"></span>Porta
ble SIMD Vectors</h2> | 192 <span id="id2"></span><h2 id="portable-simd-vectors"><span id="id2"></span>Porta
ble SIMD Vectors</h2> |
190 <p>SIMD vectors aren’t part of the C/C++ standards and are traditionally | 193 <p>SIMD vectors aren’t part of the C/C++ standards and are traditionally |
191 very hardware-specific. Portable Native Client offers a portable version | 194 very hardware-specific. Portable Native Client offers a portable version |
192 of SIMD vector datatypes and operations which map well to modern | 195 of SIMD vector datatypes and operations which map well to modern |
193 architectures and offer performance which matches or approaches | 196 architectures and offer performance which matches or approaches |
194 hardware-specific uses.</p> | 197 hardware-specific uses.</p> |
195 <p>SIMD vector support was added to Portable Native Client for version 36 | 198 <p>SIMD vector support was added to Portable Native Client for version 37 |
196 of Chrome, and more features are expected to be added in subsequent | 199 of Chrome and more features, including performance enhancements, are |
197 releases.</p> | 200 expected to be added in subsequent releases.</p> |
198 <section id="hand-coding-vector-extensions"> | 201 <section id="hand-coding-vector-extensions"> |
199 <h3 id="hand-coding-vector-extensions">Hand-Coding Vector Extensions</h3> | 202 <h3 id="hand-coding-vector-extensions">Hand-Coding Vector Extensions</h3> |
200 <p>The initial vector support in Portable Native Client adds <a class="reference
external" href="http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-
extended-vectors">LLVM vectors</a> | 203 <p>The initial vector support in Portable Native Client adds <a class="reference
external" href="http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-
extended-vectors">LLVM vectors</a> |
201 and <a class="reference external" href="http://gcc.gnu.org/onlinedocs/gcc/Vector
-Extensions.html">GCC vectors</a> since these | 204 and <a class="reference external" href="http://gcc.gnu.org/onlinedocs/gcc/Vector
-Extensions.html">GCC vectors</a> since these |
202 are well supported by different hardware platforms and don’t require any | 205 are well supported by different hardware platforms and don’t require any |
203 new compiler intrinsics.</p> | 206 new compiler intrinsics.</p> |
204 <p>Vector types can be used through the <code>vector_size</code> attribute:</p> | 207 <p>Vector types can be used through the <code>vector_size</code> attribute:</p> |
205 <pre class="prettyprint"> | 208 <pre class="prettyprint"> |
206 #define VECTOR_BYTES 16 | 209 #define VECTOR_BYTES 16 |
207 typedef int v4s __attribute__((vector_size(VECTOR_BYTES))); | 210 typedef int v4s __attribute__((vector_size(VECTOR_BYTES))); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 <p>Neither PNaCl nor NaCl currently support asynchronous interruption | 426 <p>Neither PNaCl nor NaCl currently support asynchronous interruption |
424 or suspension of threads.</p> | 427 or suspension of threads.</p> |
425 </li> | 428 </li> |
426 </ul> | 429 </ul> |
427 <p>If PNaCl were to support either of these, the interaction of | 430 <p>If PNaCl were to support either of these, the interaction of |
428 <code>volatile</code> and atomics with same-thread signal handling would need | 431 <code>volatile</code> and atomics with same-thread signal handling would need |
429 to be carefully detailed.</p> | 432 to be carefully detailed.</p> |
430 </section></section></section> | 433 </section></section></section> |
431 | 434 |
432 {{/partials.standard_nacl_article}} | 435 {{/partials.standard_nacl_article}} |
OLD | NEW |