summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorjfb@chromium.org <jfb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-24 17:07:45 +0000
committerjfb@chromium.org <jfb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-24 17:07:45 +0000
commit2d46b9b553597fde97ae323cd0c2b4bb1c2c63ac (patch)
treeb2411be1b7ae0cec017dda475003739ba2ef9b75 /native_client_sdk
parent556d0943b29176b68cc0b0963aa0afa59fb6a1b2 (diff)
downloadchromium_src-2d46b9b553597fde97ae323cd0c2b4bb1c2c63ac.zip
chromium_src-2d46b9b553597fde97ae323cd0c2b4bb1c2c63ac.tar.gz
chromium_src-2d46b9b553597fde97ae323cd0c2b4bb1c2c63ac.tar.bz2
PNaCl documentation: add SIMD vectors.
R= dschuff@chromium.org, nfullagar@chromium.org BUG= https://code.google.com/p/nativeclient/issues/detail?id=2205 TEST= none NOTRY=true (documentation only change) Review URL: https://codereview.chromium.org/250433002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265948 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/doc_generated/_static/pygments.css4
-rw-r--r--native_client_sdk/doc_generated/faq.html6
-rw-r--r--native_client_sdk/doc_generated/nacl-and-pnacl.html8
-rw-r--r--native_client_sdk/doc_generated/reference/pnacl-c-cpp-language-support.html167
-rw-r--r--native_client_sdk/doc_generated/reference/pnacl-undefined-behavior.html13
-rw-r--r--native_client_sdk/doc_generated/sdk/release-notes.html77
-rw-r--r--native_client_sdk/doc_generated/sitemap.html2
-rw-r--r--native_client_sdk/src/doc/faq.rst9
-rw-r--r--native_client_sdk/src/doc/nacl-and-pnacl.rst8
-rw-r--r--native_client_sdk/src/doc/reference/pnacl-c-cpp-language-support.rst113
-rw-r--r--native_client_sdk/src/doc/reference/pnacl-undefined-behavior.rst12
-rw-r--r--native_client_sdk/src/doc/sdk/release-notes.rst11
12 files changed, 347 insertions, 83 deletions
diff --git a/native_client_sdk/doc_generated/_static/pygments.css b/native_client_sdk/doc_generated/_static/pygments.css
index 1a14f2a..d79caa1 100644
--- a/native_client_sdk/doc_generated/_static/pygments.css
+++ b/native_client_sdk/doc_generated/_static/pygments.css
@@ -13,11 +13,11 @@
.highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
-.highlight .go { color: #303030 } /* Generic.Output */
+.highlight .go { color: #333333 } /* Generic.Output */
.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-.highlight .gt { color: #0040D0 } /* Generic.Traceback */
+.highlight .gt { color: #0044DD } /* Generic.Traceback */
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
diff --git a/native_client_sdk/doc_generated/faq.html b/native_client_sdk/doc_generated/faq.html
index 8282066..2bf6fe1 100644
--- a/native_client_sdk/doc_generated/faq.html
+++ b/native_client_sdk/doc_generated/faq.html
@@ -168,6 +168,9 @@ LLVM:</p>
cases are likely to achieve better or worse performance than the above
averages. For example floating-point heavy code usually exhibits much
lower overheads whereas very branch-heavy code often performs worse.</p>
+<p>Note that PNaCl supports performance features that are often used in
+native code such as <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#language-support-threading"><em>threading</em></a> and
+<a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</em></a>.</p>
<p>For details, see:</p>
<ul class="small-gap">
<li><a class="reference external" href="https://nativeclient.googlecode.com/svn/data/site/NaCl_SFI.pdf">Adapting Software Fault Isolation to Contemporary CPU Architectures</a> (PDF).</li>
@@ -277,7 +280,8 @@ Chrome</a>.</p>
<h3 id="does-native-client-support-simd-vector-instructions">Does Native Client support SIMD vector instructions?</h3>
<p>Native Client currently supports SSE on x86 and NEON on ARM. Support for
AVX on x86 is under way.</p>
-<p>Portable Native Client should support SIMD vectors in the near future.</p>
+<p>Portable Native Client supports portable SIMD vectors, as detailed in
+<a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</em></a>.</p>
</section><section id="can-i-use-native-client-for-3d-graphics">
<h3 id="can-i-use-native-client-for-3d-graphics">Can I use Native Client for 3D graphics?</h3>
<p>Yes. Native Client supports <a class="reference external" href="https://www.khronos.org/opengles/">OpenGL ES 2.0</a>.</p>
diff --git a/native_client_sdk/doc_generated/nacl-and-pnacl.html b/native_client_sdk/doc_generated/nacl-and-pnacl.html
index b88ca9a..6b29514 100644
--- a/native_client_sdk/doc_generated/nacl-and-pnacl.html
+++ b/native_client_sdk/doc_generated/nacl-and-pnacl.html
@@ -92,15 +92,13 @@ for all supported architectures.</p>
these limitations are critical for your application, you should use
non-portable NaCl:</p>
<ul class="small-gap">
-<li>By its nature, PNaCl does not support architecture-specific instructions in
-an application (i.e., inline assembly). Future editions of PNaCl will
-attempt to mitigate this problem by introducing portable intrinsics for vector
-operations.</li>
+<li>By its nature, PNaCl does not support architecture-specific
+instructions in an application (i.e., inline assembly), but tries to
+offer high-performance portable equivalents.</li>
<li>Currently PNaCl only supports static linking with the <code>newlib</code>
C standard library (the Native Client SDK provides a PNaCl port of
<code>newlib</code>). Dynamic linking and <code>glibc</code> are not yet supported.
Work is under way to enable dynamic linking in future versions of PNaCl.</li>
-<li>In the initial release, PNaCl does not support vector types and SIMD.</li>
<li>In the initial release, PNaCl does not support some GNU extensions
like taking the address of a label for computed <code>goto</code>, or nested
functions.</li>
diff --git a/native_client_sdk/doc_generated/reference/pnacl-c-cpp-language-support.html b/native_client_sdk/doc_generated/reference/pnacl-c-cpp-language-support.html
index ce1bfea..ad5869d 100644
--- a/native_client_sdk/doc_generated/reference/pnacl-c-cpp-language-support.html
+++ b/native_client_sdk/doc_generated/reference/pnacl-c-cpp-language-support.html
@@ -4,31 +4,36 @@
<h1 id="pnacl-c-c-language-support">PNaCl C/C++ Language Support</h1>
<div class="contents local" id="contents" style="display: none">
<ul class="small-gap">
-<li><p class="first"><a class="reference internal" href="#source-language-support" id="id2">Source language support</a></p>
+<li><p class="first"><a class="reference internal" href="#source-language-support" id="id3">Source language support</a></p>
<ul class="small-gap">
-<li><a class="reference internal" href="#versions" id="id3">Versions</a></li>
-<li><a class="reference internal" href="#preprocessor-definitions" id="id4">Preprocessor definitions</a></li>
+<li><a class="reference internal" href="#versions" id="id4">Versions</a></li>
+<li><a class="reference internal" href="#preprocessor-definitions" id="id5">Preprocessor definitions</a></li>
</ul>
</li>
-<li><p class="first"><a class="reference internal" href="#memory-model-and-atomics" id="id5">Memory Model and Atomics</a></p>
+<li><p class="first"><a class="reference internal" href="#memory-model-and-atomics" id="id6">Memory Model and Atomics</a></p>
<ul class="small-gap">
-<li><a class="reference internal" href="#memory-model-for-concurrent-operations" id="id6">Memory Model for Concurrent Operations</a></li>
-<li><a class="reference internal" href="#atomic-memory-ordering-constraints" id="id7">Atomic Memory Ordering Constraints</a></li>
-<li><a class="reference internal" href="#volatile-memory-accesses" id="id8">Volatile Memory Accesses</a></li>
+<li><a class="reference internal" href="#memory-model-for-concurrent-operations" id="id7">Memory Model for Concurrent Operations</a></li>
+<li><a class="reference internal" href="#atomic-memory-ordering-constraints" id="id8">Atomic Memory Ordering Constraints</a></li>
+<li><a class="reference internal" href="#volatile-memory-accesses" id="id9">Volatile Memory Accesses</a></li>
</ul>
</li>
-<li><a class="reference internal" href="#threading" id="id9">Threading</a></li>
-<li><a class="reference internal" href="#setjmp-and-longjmp" id="id10"><code>setjmp</code> and <code>longjmp</code></a></li>
-<li><a class="reference internal" href="#c-exception-handling" id="id11">C++ Exception Handling</a></li>
-<li><a class="reference internal" href="#inline-assembly" id="id12">Inline Assembly</a></li>
-<li><a class="reference internal" href="#undefined-behavior" id="id13">Undefined Behavior</a></li>
-<li><a class="reference internal" href="#floating-point" id="id14">Floating-Point</a></li>
-<li><a class="reference internal" href="#computed-goto" id="id15">Computed <code>goto</code></a></li>
-<li><p class="first"><a class="reference internal" href="#future-directions" id="id16">Future Directions</a></p>
+<li><a class="reference internal" href="#threading" id="id10">Threading</a></li>
+<li><a class="reference internal" href="#setjmp-and-longjmp" id="id11"><code>setjmp</code> and <code>longjmp</code></a></li>
+<li><a class="reference internal" href="#c-exception-handling" id="id12">C++ Exception Handling</a></li>
+<li><a class="reference internal" href="#inline-assembly" id="id13">Inline Assembly</a></li>
+<li><p class="first"><a class="reference internal" href="#portable-simd-vectors" id="id14">Portable SIMD Vectors</a></p>
<ul class="small-gap">
-<li><a class="reference internal" href="#simd" id="id17">SIMD</a></li>
-<li><a class="reference internal" href="#inter-process-communication" id="id18">Inter-Process Communication</a></li>
-<li><a class="reference internal" href="#posix-style-signal-handling" id="id19">POSIX-style Signal Handling</a></li>
+<li><a class="reference internal" href="#hand-coding-vector-extensions" id="id15">Hand-Coding Vector Extensions</a></li>
+<li><a class="reference internal" href="#auto-vectorization" id="id16">Auto-Vectorization</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#undefined-behavior" id="id17">Undefined Behavior</a></li>
+<li><a class="reference internal" href="#floating-point" id="id18">Floating-Point</a></li>
+<li><a class="reference internal" href="#computed-goto" id="id19">Computed <code>goto</code></a></li>
+<li><p class="first"><a class="reference internal" href="#future-directions" id="id20">Future Directions</a></p>
+<ul class="small-gap">
+<li><a class="reference internal" href="#inter-process-communication" id="id21">Inter-Process Communication</a></li>
+<li><a class="reference internal" href="#posix-style-signal-handling" id="id22">POSIX-style Signal Handling</a></li>
</ul>
</li>
</ul>
@@ -180,7 +185,124 @@ prevent reordering of memory accesses to objects which may escape.</p>
<p>NaCl supports a fairly wide subset of inline assembly through GCC&#8217;s
inline assembly syntax, with the restriction that the sandboxing model
for the target architecture has to be respected.</p>
-</section><section id="undefined-behavior">
+</section><section id="portable-simd-vectors">
+<span id="id2"></span><h2 id="portable-simd-vectors"><span id="id2"></span>Portable SIMD Vectors</h2>
+<p>SIMD vectors aren&#8217;t part of the C/C++ standards and are traditionally
+very hardware-specific. Portable Native Client offers a portable version
+of SIMD vector datatypes and operations which map well to modern
+architectures and offer performance which matches or approaches
+hardware-specific uses.</p>
+<p>SIMD vector support was added to Portable Native Client for version 36
+of Chrome, and more features are expected to be added in subsequent
+releases.</p>
+<section id="hand-coding-vector-extensions">
+<h3 id="hand-coding-vector-extensions">Hand-Coding Vector Extensions</h3>
+<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>
+and <a class="reference external" href="http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html">GCC vectors</a> since these
+are well supported by different hardware platforms and don&#8217;t require any
+new compiler intrinsics.</p>
+<p>Vector types can be used through the <code>vector_size</code> attribute:</p>
+<pre class="prettyprint">
+typedef int v4si __attribute__((vector_size(16)));
+v4si a = {1,2,3,4};
+v4si b = {5,6,7,8};
+v4si c, d, e;
+c = b + 1; /* c = b + {1,1,1,1}; */
+d = 2 * b; /* d = {2,2,2,2} * b; */
+e = c + d;
+</pre>
+<p>Vector comparisons are represented as a bitmask as wide as the compared
+elements of all <code>0</code> or all <code>1</code>:</p>
+<pre class="prettyprint">
+typedef int v4si __attribute__((vector_size(16)));
+v4si snip(v2si in) {
+ v4si limit = {32,64,128,256};
+ vs4i mask = in &gt; limit;
+ vs4i ret = in &amp; mask;
+ return ret;
+}
+</pre>
+<p>Vector datatypes are currently expected to be 128-bit wide with one of
+the following element types:</p>
+<table border="1" class="docutils">
+<colgroup>
+</colgroup>
+<thead valign="bottom">
+<tr class="row-odd"><th class="head">Type</th>
+<th class="head">Num Elements</th>
+<th class="head">Vector Bit Width</th>
+</tr>
+</thead>
+<tbody valign="top">
+<tr class="row-even"><td><code>uint8_t</code></td>
+<td>16</td>
+<td>128</td>
+</tr>
+<tr class="row-odd"><td><code>int8_t</code></td>
+<td>16</td>
+<td>128</td>
+</tr>
+<tr class="row-even"><td><code>uint16_t</code></td>
+<td>8</td>
+<td>128</td>
+</tr>
+<tr class="row-odd"><td><code>int16_t</code></td>
+<td>8</td>
+<td>128</td>
+</tr>
+<tr class="row-even"><td><code>uint32_t</code></td>
+<td>4</td>
+<td>128</td>
+</tr>
+<tr class="row-odd"><td><code>int32_t</code></td>
+<td>4</td>
+<td>128</td>
+</tr>
+<tr class="row-even"><td><code>float</code></td>
+<td>4</td>
+<td>128</td>
+</tr>
+</tbody>
+</table>
+<p>64-bit integers and double-precision floating point will be supported in
+a future release, as will 256-bit and 512-bit vectors.</p>
+<p>The following operators are supported on vectors:</p>
+<table border="1" class="docutils">
+<colgroup>
+</colgroup>
+<tbody valign="top">
+<tr class="row-odd"><td>unary <code>+</code>, <code>-</code></td>
+</tr>
+<tr class="row-even"><td><code>++</code>, <code>--</code></td>
+</tr>
+<tr class="row-odd"><td><code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>, <code>%</code></td>
+</tr>
+<tr class="row-even"><td><code>&amp;</code>, <code>|</code>, <code>^</code>, <code>~</code></td>
+</tr>
+<tr class="row-odd"><td><code>&gt;&gt;</code>, <code>&lt;&lt;</code></td>
+</tr>
+<tr class="row-even"><td><code>!</code>, <code>&amp;&amp;</code>, <code>||</code></td>
+</tr>
+<tr class="row-odd"><td><code>==</code>, <code>!=</code>, <code>&gt;</code>, <code>&lt;</code>, <code>&gt;=</code>, <code>&lt;=</code></td>
+</tr>
+<tr class="row-even"><td><code>=</code></td>
+</tr>
+</tbody>
+</table>
+<p>Furthermore, C-style casts can be used for:</p>
+<ul class="small-gap">
+<li>Truncation.</li>
+<li>Zero- and sign-extension.</li>
+<li>Conversion to/from floating-point and signed/unsigned integer.</li>
+</ul>
+<p>It is also possible to use array-style indexing into vectors to extract
+individual elements using <code>[]</code>.</p>
+<p>Vector shuffles are currently unsupported but will be added soon.</p>
+</section><section id="auto-vectorization">
+<h3 id="auto-vectorization">Auto-Vectorization</h3>
+<p>Auto-vectorization is currently not enabled for Portable Native Client,
+but will be in a future release.</p>
+</section></section><section id="undefined-behavior">
<h2 id="undefined-behavior">Undefined Behavior</h2>
<p>The C and C++ languages expose some undefined behavior which is
discussed in <a class="reference internal" href="/native-client/reference/pnacl-undefined-behavior.html#undefined-behavior"><em>PNaCl Undefined Behavior</em></a>.</p>
@@ -226,12 +348,7 @@ does extra work to take advantage of computed <code>goto</code>).</p>
<p>NaCl supports computed <code>goto</code> without any transformation.</p>
</section><section id="future-directions">
<h2 id="future-directions">Future Directions</h2>
-<section id="simd">
-<h3 id="simd">SIMD</h3>
-<p>PNaCl currently doesn&#8217;t support SIMD. We plan to add SIMD support in the
-very near future.</p>
-<p>NaCl supports SIMD.</p>
-</section><section id="inter-process-communication">
+<section id="inter-process-communication">
<h3 id="inter-process-communication">Inter-Process Communication</h3>
<p>Inter-process communication through shared memory is currently not
supported by PNaCl/NaCl. When implemented, it may be limited to
diff --git a/native_client_sdk/doc_generated/reference/pnacl-undefined-behavior.html b/native_client_sdk/doc_generated/reference/pnacl-undefined-behavior.html
index e10c67b..272b4a7 100644
--- a/native_client_sdk/doc_generated/reference/pnacl-undefined-behavior.html
+++ b/native_client_sdk/doc_generated/reference/pnacl-undefined-behavior.html
@@ -13,7 +13,8 @@
<ul class="small-gap">
<li><a class="reference internal" href="#potentially-fixable" id="id7">Potentially Fixable</a></li>
<li><a class="reference internal" href="#floating-point" id="id8">Floating-Point</a></li>
-<li><a class="reference internal" href="#hard-to-fix" id="id9">Hard to Fix</a></li>
+<li><a class="reference internal" href="#simd-vectors" id="id9">SIMD Vectors</a></li>
+<li><a class="reference internal" href="#hard-to-fix" id="id10">Hard to Fix</a></li>
</ul>
</li>
</ul>
@@ -174,6 +175,16 @@ SIMD operations.</li>
function implementation isn&#8217;t, e.g. <code>std::min</code> and <code>std::max</code>), is
well-defined in the <em>pexe</em>.</li>
</ul>
+</section><section id="simd-vectors">
+<h4 id="simd-vectors">SIMD Vectors</h4>
+<p>SIMD vector instructions aren&#8217;t part of the C/C++ standards and as such
+their behavior isn&#8217;t specified at all in C/C++; it is usually left up to
+the target architecture to specify behavior. Portable Native Client
+instead exposed <a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#portable-simd-vectors"><em>Portable SIMD Vectors</em></a> and
+offers the same guarantees on these vectors as the guarantees offered by
+the contained elements. Of notable interest amongst these guarantees are
+those of alignment for load/store instructions on vectors: they have the
+same alignment restriction as the contained elements.</p>
</section><section id="hard-to-fix">
<h4 id="hard-to-fix">Hard to Fix</h4>
<ul class="small-gap">
diff --git a/native_client_sdk/doc_generated/sdk/release-notes.html b/native_client_sdk/doc_generated/sdk/release-notes.html
index 3dc34db..72c1966 100644
--- a/native_client_sdk/doc_generated/sdk/release-notes.html
+++ b/native_client_sdk/doc_generated/sdk/release-notes.html
@@ -2,11 +2,20 @@
<section id="release-notes">
<span id="sdk-release-notes"></span><h1 id="release-notes"><span id="sdk-release-notes"></span>Release Notes</h1>
-<section id="chrome-pepper-35-31-mar-2014">
-<h2 id="chrome-pepper-35-31-mar-2014">Chrome/Pepper 35 (31 Mar 2014)</h2>
+<section id="chrome-pepper-36-09-may-2014">
+<h2 id="chrome-pepper-36-09-may-2014">Chrome/Pepper 36 (09 May 2014)</h2>
<section id="pnacl">
<h3 id="pnacl">PNaCl</h3>
<ul class="small-gap">
+<li>Support <a class="reference external" href="http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors">LLVM vectors</a>
+and <a class="reference external" href="http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html">GCC vectors</a> for SIMD
+vectors.</li>
+</ul>
+</section></section><section id="chrome-pepper-35-31-mar-2014">
+<h2 id="chrome-pepper-35-31-mar-2014">Chrome/Pepper 35 (31 Mar 2014)</h2>
+<section id="id1">
+<h3 id="id1">PNaCl</h3>
+<ul class="small-gap">
<li>Upgraded LLVM to version 3.4.</li>
<li>Translation now uses dynamic load balancing, making translation time faster.</li>
<li>Unstable pexes (i.e. non-finalized) with debug information can be loaded by
@@ -25,8 +34,8 @@ Chrome, simplifying debugging with PNaCl. See <a class="reference internal" href
<a class="reference external" href="/native-client/pepper_dev/cpp/classpp_1_1_media_stream_video_track">pp::MediaStreamVideoTrack</a> for
more details.</li>
</ul>
-</section><section id="id1">
-<h3 id="id1">PNaCl</h3>
+</section><section id="id2">
+<h3 id="id2">PNaCl</h3>
<ul class="small-gap">
<li>Parallel translation: at least 1.7x faster, even with older pexes.</li>
<li>Intelligent abbreviations in the bitcode: 20% reduction in binary size using
@@ -165,8 +174,8 @@ for an application can specify a source file to compile such as
<p>The Pepper 26 bundle includes a new HTTP filesystem type in the nacl_mounts
library (which has been renamed nacl_io), changes to the example Makefiles, a
simple new 3D example, and a threaded file IO example.</p>
-<section id="id2">
-<h3 id="id2">Build tools and toolchains</h3>
+<section id="id3">
+<h3 id="id3">Build tools and toolchains</h3>
<ul class="small-gap">
<li><p class="first">Makefiles have been changed significantly:</p>
<ul class="small-gap">
@@ -186,16 +195,16 @@ with all toolchains.</li>
the same set of header files as host builds. Previously host and NaCl builds
used different headers, which could cause build problems.</li>
</ul>
-</section><section id="id3">
-<h3 id="id3">Libraries</h3>
+</section><section id="id4">
+<h3 id="id4">Libraries</h3>
<ul class="small-gap">
<li>The nacl_mounts library has been renamed <strong>nacl_io</strong>, and has been expanded
with a new type of mount, httpfs, which can be used to read URLs via HTTP.
For details see <code>include/nacl_io/nacl_io.h</code>, as well as the
<code>hello_nacl_io</code> example.</li>
</ul>
-</section><section id="id4">
-<h3 id="id4">Examples</h3>
+</section><section id="id5">
+<h3 id="id5">Examples</h3>
<ul class="small-gap">
<li>A new example, <strong>hello_world_instance3d</strong>, has been added to demonstrate a
simplified 3D app.</li>
@@ -219,8 +228,8 @@ which provides a virtual file system that you can use with standard C file
operations, and ppapi_main, which lets you implement a Native Client module
using a simple ppapi_main function), and two new examples that demonstrate how
to use the nacl_mounts and ppapi_main libraries.</p>
-<section id="id5">
-<h3 id="id5">Build tools and toolchains</h3>
+<section id="id6">
+<h3 id="id6">Build tools and toolchains</h3>
<ul class="small-gap">
<li><p class="first">The SDK includes a new toolchain to build Native Client executables (.nexe
files) for <strong>ARM devices</strong>.</p>
@@ -258,8 +267,8 @@ see <code>pepper_25/include/ppapi/utility/threading/simple_thread.h</code>. Note
you cannot make asynchronous PPAPI calls on a background thread without
creating and using a message loop.</li>
</ul>
-</section><section id="id6">
-<h3 id="id6">Libraries</h3>
+</section><section id="id7">
+<h3 id="id7">Libraries</h3>
<p>The SDK includes two new libraries:</p>
<ul class="small-gap">
<li><p class="first">The <strong>nacl_mounts</strong> library provides a virtual file system that your module
@@ -293,8 +302,8 @@ how to use ppapi_main, see examples/hello_world_stdio.</li>
<p>Header files for the new libraries are in the <code>include/</code> directory, source
files are in the <code>src/</code> directory, and compiled libraries are in the <code>lib/</code>
directory.</p>
-</section><section id="id7">
-<h3 id="id7">Examples</h3>
+</section><section id="id8">
+<h3 id="id8">Examples</h3>
<ul class="small-gap">
<li><p class="first">The SDK includes two new examples:</p>
<ul class="small-gap">
@@ -336,8 +345,8 @@ source dependencies, and invokes the build rules in a separate file
for &#8220;Portable Native Client&#8221;), a new library (pthreads-win32) for the Windows
SDK, and an expanded list of attributes for Pepper 3D contexts that lets
applications specify a GPU preference for low power or performance.</p>
-<section id="id8">
-<h3 id="id8">Build tools and toolchains</h3>
+<section id="id9">
+<h3 id="id9">Build tools and toolchains</h3>
<ul class="small-gap">
<li>The SDK includes a new, experimental toolchain called <a class="reference external" href="http://nativeclient.googlecode.com/svn/data/site/pnacl.pdf">PNaCl</a> (pronounced
&#8220;pinnacle&#8221;). The PNaCl toolchain produces architecture-independent executable
@@ -353,8 +362,8 @@ determine the architecture of .nexe files. That means you can change the
names of your .nexe files and <code>create_nmf.py</code> will still be able to
generate the appropriate Native Client manifest file for your application.</li>
</ul>
-</section><section id="id10">
-<h3 id="id10">Examples</h3>
+</section><section id="id11">
+<h3 id="id11">Examples</h3>
<ul class="small-gap">
<li>The SDK examples now build with four toolchains: the glibc and newlib
toolchains, the experimental PNaCl toolchain, and the hosted toolchain on
@@ -365,8 +374,8 @@ builds both a debug and a release version.</li>
drawing function is now set up as the Flush() callback, which allows 2D
drawing to occur as quickly as possible.</li>
</ul>
-</section><section id="id11">
-<h3 id="id11">PPAPI</h3>
+</section><section id="id12">
+<h3 id="id12">PPAPI</h3>
<ul class="small-gap">
<li>When creating a 3D rendering context, the <a class="reference external" href="https://developers.google.com/native-client/dev/pepperc/group___enums#ga7df48e1c55f6401beea2a1b9c07967e8">attribute list</a>
for the context can specify whether to prefer low power or performance for
@@ -442,8 +451,8 @@ Note that you must set the <code>CHROME_PATH</code> environment variable and sta
</ul>
</li>
</ul>
-</section><section id="id12">
-<h3 id="id12">Examples</h3>
+</section><section id="id13">
+<h3 id="id13">Examples</h3>
<ul class="small-gap">
<li>On Linux and Windows systems, most of the examples now build with three
toolchains: the Native Client glibc and newlib toolchains, and the native
@@ -459,8 +468,8 @@ onclick=&quot;...&quot;&gt;</code>). See <a class="reference external" href="ht
changes between version 1 and version 2 of the manifest file format, and a
support schedule for applications that use version 1.</li>
</ul>
-</section><section id="id13">
-<h3 id="id13">PPAPI</h3>
+</section><section id="id14">
+<h3 id="id14">PPAPI</h3>
<ul class="small-gap">
<li><a class="reference external" href="https://developers.google.com/native-client/pepper23/pepperc/group___enums#ga21b811ac0484a214a8751aa3e1c959d9">PP_InputEvent_Modifier</a>
has two new enum values (_ISLEFT and _ISRIGHT).</li>
@@ -472,16 +481,16 @@ API has been fixed.</li>
<p>The Pepper 22 bundle includes a <strong>command-line debugger</strong>, resources to enable
<strong>hosted development on Windows</strong>, and changes to the example Makefiles (each
example now builds both a debug and a release version).</p>
-<section id="id14">
-<h3 id="id14">Tools</h3>
+<section id="id15">
+<h3 id="id15">Tools</h3>
<ul class="small-gap">
<li>The SDK now includes a <strong>command-line debugger</strong> that you can use to debug
Native Client modules. See <a class="reference internal" href="/native-client/devguide/devcycle/debugging.html#devcycle-debugging"><em>Debugging with nacl-gdb</em></a> for instructions on how to use this debugger. For now,
nacl-gdb only works on 64-bit Windows, 64-bit Linux, and 32-bit Linux
systems. Support for Mac and 32-bit Windows systems will be added soon.</li>
</ul>
-</section><section id="id15">
-<h3 id="id15">Windows SDK</h3>
+</section><section id="id16">
+<h3 id="id16">Windows SDK</h3>
<ul class="small-gap">
<li><p class="first">Developers using the Windows SDK can now <strong>build a module as a Pepper
plugin</strong> (sometimes called a &#8220;trusted&#8221; or &#8220;in-process&#8221; plugin) using the
@@ -529,8 +538,8 @@ or <a class="reference external" href="http://www.chromium.org/nativeclient/how-
In the future, the SDK will include resources for hosted development on Mac
and Linux as well as Windows.
</aside>
-</section><section id="id16">
-<h3 id="id16">Examples</h3>
+</section><section id="id17">
+<h3 id="id17">Examples</h3>
<ul class="small-gap">
<li>Each example in the SDK now builds both a debug and a release version. As
before, most examples also build newlib and glibc versions, which means that
@@ -544,8 +553,8 @@ in each example&#8217;s web page, attaches event listeners to monitor the loadin
of the module, and implements handleMessage() to respond to messages sent
from the NaCl module to the JavaScript side of the application</li>
</ul>
-</section><section id="id17">
-<h3 id="id17">PPAPI</h3>
+</section><section id="id18">
+<h3 id="id18">PPAPI</h3>
<ul class="small-gap">
<li>The <code>CompletionCallbackFactory</code> class template now takes a thread traits
class as its second parameter. For details see the <a class="reference external" href="https://developers.google.com/native-client/pepper22/peppercpp/classpp_1_1_completion_callback_factory#details">CompletionCallbackFactory
diff --git a/native_client_sdk/doc_generated/sitemap.html b/native_client_sdk/doc_generated/sitemap.html
index ca6d916..8b2d712 100644
--- a/native_client_sdk/doc_generated/sitemap.html
+++ b/native_client_sdk/doc_generated/sitemap.html
@@ -40,6 +40,7 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="/native-client/sdk/release-notes.html">Release Notes</a><ul class="small-gap">
+<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/release-notes.html#chrome-pepper-36-09-may-2014">Chrome/Pepper 36 (09 May 2014)</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/release-notes.html#chrome-pepper-35-31-mar-2014">Chrome/Pepper 35 (31 Mar 2014)</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/release-notes.html#chrome-pepper-34-20-feb-2014">Chrome/Pepper 34 (20 Feb 2014)</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/sdk/release-notes.html#chrome-pepper-33-16-dec-2013">Chrome/Pepper 33 (16 Dec 2013)</a></li>
@@ -340,6 +341,7 @@
<li class="toctree-l2"><a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#setjmp-and-longjmp"><code>setjmp</code> and <code>longjmp</code></a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#c-exception-handling">C++ Exception Handling</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#inline-assembly">Inline Assembly</a></li>
+<li class="toctree-l2"><a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#portable-simd-vectors">Portable SIMD Vectors</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#undefined-behavior">Undefined Behavior</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#floating-point">Floating-Point</a></li>
<li class="toctree-l2"><a class="reference internal" href="/native-client/reference/pnacl-c-cpp-language-support.html#computed-goto">Computed <code>goto</code></a></li>
diff --git a/native_client_sdk/src/doc/faq.rst b/native_client_sdk/src/doc/faq.rst
index c27a711..37b84fe 100644
--- a/native_client_sdk/src/doc/faq.rst
+++ b/native_client_sdk/src/doc/faq.rst
@@ -65,7 +65,7 @@ Portable Native client further enhances the above:
.. causes of slowness? How can code be made faster? What's the best way
.. to use Pepper's asynchronous APIs? What do I need to know about
.. threads and inter-thread communications? Can I use SIMD or other
-.. processor-specific instructions? What aboutt he GPU?
+.. processor-specific instructions? What about the GPU?
For more details, refer to the :doc:`history behind and comparison of
NaCl and PNaCl <nacl-and-pnacl>`.
@@ -113,6 +113,10 @@ cases are likely to achieve better or worse performance than the above
averages. For example floating-point heavy code usually exhibits much
lower overheads whereas very branch-heavy code often performs worse.
+Note that PNaCl supports performance features that are often used in
+native code such as :ref:`threading <language_support_threading>` and
+:ref:`Portable SIMD Vectors <portable_simd_vectors>`.
+
For details, see:
* `Adapting Software Fault Isolation to Contemporary CPU Architectures
@@ -271,7 +275,8 @@ Does Native Client support SIMD vector instructions?
Native Client currently supports SSE on x86 and NEON on ARM. Support for
AVX on x86 is under way.
-Portable Native Client should support SIMD vectors in the near future.
+Portable Native Client supports portable SIMD vectors, as detailed in
+:ref:`Portable SIMD Vectors <portable_simd_vectors>`.
Can I use Native Client for 3D graphics?
----------------------------------------
diff --git a/native_client_sdk/src/doc/nacl-and-pnacl.rst b/native_client_sdk/src/doc/nacl-and-pnacl.rst
index fb3171e..845ad9e 100644
--- a/native_client_sdk/src/doc/nacl-and-pnacl.rst
+++ b/native_client_sdk/src/doc/nacl-and-pnacl.rst
@@ -108,15 +108,13 @@ The limitations below apply to the current release of PNaCl. If any of
these limitations are critical for your application, you should use
non-portable NaCl:
-* By its nature, PNaCl does not support architecture-specific instructions in
- an application (i.e., inline assembly). Future editions of PNaCl will
- attempt to mitigate this problem by introducing portable intrinsics for vector
- operations.
+* By its nature, PNaCl does not support architecture-specific
+ instructions in an application (i.e., inline assembly), but tries to
+ offer high-performance portable equivalents.
* Currently PNaCl only supports static linking with the ``newlib``
C standard library (the Native Client SDK provides a PNaCl port of
``newlib``). Dynamic linking and ``glibc`` are not yet supported.
Work is under way to enable dynamic linking in future versions of PNaCl.
-* In the initial release, PNaCl does not support vector types and SIMD.
* In the initial release, PNaCl does not support some GNU extensions
like taking the address of a label for computed ``goto``, or nested
functions.
diff --git a/native_client_sdk/src/doc/reference/pnacl-c-cpp-language-support.rst b/native_client_sdk/src/doc/reference/pnacl-c-cpp-language-support.rst
index cd62a2b..1e0feaa 100644
--- a/native_client_sdk/src/doc/reference/pnacl-c-cpp-language-support.rst
+++ b/native_client_sdk/src/doc/reference/pnacl-c-cpp-language-support.rst
@@ -198,6 +198,111 @@ NaCl supports a fairly wide subset of inline assembly through GCC's
inline assembly syntax, with the restriction that the sandboxing model
for the target architecture has to be respected.
+.. _portable_simd_vectors:
+
+Portable SIMD Vectors
+=====================
+
+SIMD vectors aren't part of the C/C++ standards and are traditionally
+very hardware-specific. Portable Native Client offers a portable version
+of SIMD vector datatypes and operations which map well to modern
+architectures and offer performance which matches or approaches
+hardware-specific uses.
+
+SIMD vector support was added to Portable Native Client for version 36
+of Chrome, and more features are expected to be added in subsequent
+releases.
+
+Hand-Coding Vector Extensions
+-----------------------------
+
+The initial vector support in Portable Native Client adds `LLVM vectors
+<http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors>`_
+and `GCC vectors
+<http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html>`_ since these
+are well supported by different hardware platforms and don't require any
+new compiler intrinsics.
+
+Vector types can be used through the ``vector_size`` attribute:
+
+.. naclcode::
+
+ typedef int v4si __attribute__((vector_size(16)));
+ v4si a = {1,2,3,4};
+ v4si b = {5,6,7,8};
+ v4si c, d, e;
+ c = b + 1; /* c = b + {1,1,1,1}; */
+ d = 2 * b; /* d = {2,2,2,2} * b; */
+ e = c + d;
+
+Vector comparisons are represented as a bitmask as wide as the compared
+elements of all ``0`` or all ``1``:
+
+.. naclcode::
+
+ typedef int v4si __attribute__((vector_size(16)));
+ v4si snip(v2si in) {
+ v4si limit = {32,64,128,256};
+ vs4i mask = in > limit;
+ vs4i ret = in & mask;
+ return ret;
+ }
+
+Vector datatypes are currently expected to be 128-bit wide with one of
+the following element types:
+
+============ ============ ================
+Type Num Elements Vector Bit Width
+============ ============ ================
+``uint8_t`` 16 128
+``int8_t`` 16 128
+``uint16_t`` 8 128
+``int16_t`` 8 128
+``uint32_t`` 4 128
+``int32_t`` 4 128
+``float`` 4 128
+============ ============ ================
+
+64-bit integers and double-precision floating point will be supported in
+a future release, as will 256-bit and 512-bit vectors.
+
+The following operators are supported on vectors:
+
++----------------------------------------------+
+| unary ``+``, ``-`` |
++----------------------------------------------+
+| ``++``, ``--`` |
++----------------------------------------------+
+| ``+``, ``-``, ``*``, ``/``, ``%`` |
++----------------------------------------------+
+| ``&``, ``|``, ``^``, ``~`` |
++----------------------------------------------+
+| ``>>``, ``<<`` |
++----------------------------------------------+
+| ``!``, ``&&``, ``||`` |
++----------------------------------------------+
+| ``==``, ``!=``, ``>``, ``<``, ``>=``, ``<=`` |
++----------------------------------------------+
+| ``=`` |
++----------------------------------------------+
+
+Furthermore, C-style casts can be used for:
+
+* Truncation.
+* Zero- and sign-extension.
+* Conversion to/from floating-point and signed/unsigned integer.
+
+It is also possible to use array-style indexing into vectors to extract
+individual elements using ``[]``.
+
+Vector shuffles are currently unsupported but will be added soon.
+
+Auto-Vectorization
+------------------
+
+Auto-vectorization is currently not enabled for Portable Native Client,
+but will be in a future release.
+
Undefined Behavior
==================
@@ -250,14 +355,6 @@ NaCl supports computed ``goto`` without any transformation.
Future Directions
=================
-SIMD
-----
-
-PNaCl currently doesn't support SIMD. We plan to add SIMD support in the
-very near future.
-
-NaCl supports SIMD.
-
Inter-Process Communication
---------------------------
diff --git a/native_client_sdk/src/doc/reference/pnacl-undefined-behavior.rst b/native_client_sdk/src/doc/reference/pnacl-undefined-behavior.rst
index 30d95f9..7ab270a 100644
--- a/native_client_sdk/src/doc/reference/pnacl-undefined-behavior.rst
+++ b/native_client_sdk/src/doc/reference/pnacl-undefined-behavior.rst
@@ -177,6 +177,18 @@ sources of undefined behavior which are believed to be fixable:
function implementation isn't, e.g. ``std::min`` and ``std::max``), is
well-defined in the *pexe*.
+SIMD Vectors
+^^^^^^^^^^^^
+
+SIMD vector instructions aren't part of the C/C++ standards and as such
+their behavior isn't specified at all in C/C++; it is usually left up to
+the target architecture to specify behavior. Portable Native Client
+instead exposed :ref:`Portable SIMD Vectors <portable_simd_vectors>` and
+offers the same guarantees on these vectors as the guarantees offered by
+the contained elements. Of notable interest amongst these guarantees are
+those of alignment for load/store instructions on vectors: they have the
+same alignment restriction as the contained elements.
+
Hard to Fix
^^^^^^^^^^^
diff --git a/native_client_sdk/src/doc/sdk/release-notes.rst b/native_client_sdk/src/doc/sdk/release-notes.rst
index 13f372e..b4734ff 100644
--- a/native_client_sdk/src/doc/sdk/release-notes.rst
+++ b/native_client_sdk/src/doc/sdk/release-notes.rst
@@ -4,6 +4,17 @@
Release Notes
#############
+Chrome/Pepper 36 (09 May 2014)
+==============================
+
+PNaCl
+-----
+* Support `LLVM vectors
+ <http://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors>`_
+ and `GCC vectors
+ <http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html>`_ for SIMD
+ vectors.
+
Chrome/Pepper 35 (31 Mar 2014)
==============================