Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: native_client_sdk/doc_generated/reference/pnacl-c-cpp-language-support.html

Issue 293093004: PNaCl SIMD documentation: fix vector-scalar examples, currently unsupported by LLVM (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/doc/reference/pnacl-c-cpp-language-support.rst » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: native_client_sdk/doc_generated/reference/pnacl-c-cpp-language-support.html
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 512c063b019c4fb750fa65da927b342407e14866..0c1c8f2610440367c421f1660075ddf254a31af8 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
@@ -208,9 +208,8 @@ typedef int v4s __attribute__((vector_size(VECTOR_BYTES)));
v4s a = {1,2,3,4};
v4s b = {5,6,7,8};
v4s c, d, e;
-c = b + 1; /* c = b + {1,1,1,1}; */
-d = 2 * b; /* d = {2,2,2,2} * b; */
-e = c + d;
+c = a + b; /* c = {6,8,10,12} */
+d = b >> a; /* d = {2,1,0,0} */
</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>
@@ -331,21 +330,30 @@ to the number of indices specified.</p>
// identity operation - return 4-element vector v1.
__builtin_shufflevector(v1, v1, 0, 1, 2, 3)
-// &quot;Splat&quot; element 0 of V1 into a 4-element result.
-__builtin_shufflevector(V1, V1, 0, 0, 0, 0)
+// &quot;Splat&quot; element 0 of v1 into a 4-element result.
+__builtin_shufflevector(v1, v1, 0, 0, 0, 0)
-// Reverse 4-element vector V1.
-__builtin_shufflevector(V1, V1, 3, 2, 1, 0)
+// Reverse 4-element vector v1.
+__builtin_shufflevector(v1, v1, 3, 2, 1, 0)
-// Concatenate every other element of 4-element vectors V1 and V2.
-__builtin_shufflevector(V1, V2, 0, 2, 4, 6)
+// Concatenate every other element of 4-element vectors v1 and v2.
+__builtin_shufflevector(v1, v2, 0, 2, 4, 6)
-// Concatenate every other element of 8-element vectors V1 and V2.
-__builtin_shufflevector(V1, V2, 0, 2, 4, 6, 8, 10, 12, 14)
+// Concatenate every other element of 8-element vectors v1 and v2.
+__builtin_shufflevector(v1, v2, 0, 2, 4, 6, 8, 10, 12, 14)
// Shuffle v1 with some elements being undefined
__builtin_shufflevector(v1, v1, 3, -1, 1, -1)
</pre>
+<p>One common use of <code>__builtin_shufflevector</code> is to perform
+vector-scalar operations:</p>
+<pre class="prettyprint">
+typedef int v4s __attribute__((vector_size(16)));
+v4s shift_right_by(v4s shift_me, int shift_amount) {
+ v4s tmp = {shift_amount};
+ return shift_me &gt;&gt; __builtin_shuffle_vector(tmp, tmp, 0, 0, 0, 0);
+}
+</pre>
</section><section id="auto-vectorization">
<h3 id="auto-vectorization">Auto-Vectorization</h3>
<p>Auto-vectorization is currently not enabled for Portable Native Client,
« no previous file with comments | « no previous file | native_client_sdk/src/doc/reference/pnacl-c-cpp-language-support.rst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698