From d2bf0cdca441216b0ae7791a59516beac403682d Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 27 Jan 2010 01:22:36 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94645 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/LanguageExtensions.html | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/LanguageExtensions.html b/docs/LanguageExtensions.html index e2a44eaed0..d32842b5d2 100644 --- a/docs/LanguageExtensions.html +++ b/docs/LanguageExtensions.html @@ -205,12 +205,28 @@ is used in the file argument.

Vectors and Extended Vectors

-

Supports the GCC vector extensions, plus some stuff like V[1]. ext_vector -with V.xyzw syntax and other tidbits. See also __builtin_shufflevector.

+

Supports the GCC vector extensions, plus some stuff like V[1].

+ +

Also supports ext_vector, which additionally support for V.xyzw +syntax and other tidbits as seen in OpenCL. An example is:

+ +
+
+typedef float float4 __attribute__((ext_vector_type(4)));
+typedef float float2 __attribute__((ext_vector_type(2)));
+
+float4 foo(float2 a, float2 b) {
+  float4 c;
+  c.xz = a;
+  c.yw = b;
+  return c;
+}
+

Query for this feature with __has_feature(attribute_ext_vector_type).

+

See also __builtin_shufflevector.

+

Checks for Standard Language Features

-- 2.50.1