[cfe-commits] r94645 - /cfe/trunk/docs/LanguageExtensions.html
Owen Anderson
resistor at mac.com
Tue Jan 26 17:22:37 PST 2010
Author: resistor
Date: Tue Jan 26 19:22:36 2010
New Revision: 94645
URL: http://llvm.org/viewvc/llvm-project?rev=94645&view=rev
Log:
Clarify the documentation of ext_vector, and add a small example. Hopefully
this will alleviate some confusion about the existence of this feature.
Comments/improvements welcome.
Modified:
cfe/trunk/docs/LanguageExtensions.html
Modified: cfe/trunk/docs/LanguageExtensions.html
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LanguageExtensions.html?rev=94645&r1=94644&r2=94645&view=diff
==============================================================================
--- cfe/trunk/docs/LanguageExtensions.html (original)
+++ cfe/trunk/docs/LanguageExtensions.html Tue Jan 26 19:22:36 2010
@@ -205,12 +205,28 @@
<h2 id="vectors">Vectors and Extended Vectors</h2>
<!-- ======================================================================= -->
-<p>Supports the GCC vector extensions, plus some stuff like V[1]. ext_vector
-with V.xyzw syntax and other tidbits. See also <a
-href="#__builtin_shufflevector">__builtin_shufflevector</a>.</p>
+<p>Supports the GCC vector extensions, plus some stuff like V[1].</p>
+
+<p>Also supports <tt>ext_vector</tt>, which additionally support for V.xyzw
+syntax and other tidbits as seen in OpenCL. An example is:</p>
+
+<blockquote>
+<pre>
+typedef float float4 <b>__attribute__((ext_vector_type(4)))</b>;
+typedef float float2 <b>__attribute__((ext_vector_type(2)))</b>;
+
+float4 foo(float2 a, float2 b) {
+ float4 c;
+ c.xz = a;
+ c.yw = b;
+ return c;
+}
+</blockquote>
<p>Query for this feature with __has_feature(attribute_ext_vector_type).</p>
+<p>See also <a href="#__builtin_shufflevector">__builtin_shufflevector</a>.</p>
+
<!-- ======================================================================= -->
<h2 id="checking_language_features">Checks for Standard Language Features</h2>
<!-- ======================================================================= -->
More information about the cfe-commits
mailing list