Skip to content

Commit abe0608

Browse files
committed
better docs
1 parent 74ee49f commit abe0608

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

clang/include/clang/Basic/AttrDocs.td

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,9 +1119,10 @@ def ExtVectorTypeDocs : Documentation {
11191119

11201120
The ext_vector_type(N) attribute specifies that a type is a vector with N
11211121
elements, directly mapping to an LLVM vector type. Originally from OpenCL, it
1122-
allows element access via [] or x, y, z, w for graphics-style indexing. This
1123-
attribute enables efficient SIMD operations and is usable in general-purpose
1124-
code.
1122+
allows element access the array subscript operator ``[]``, ``sN`` where ``N`` is
1123+
a hexadecimal value, or ``x``, ``y``, ``z``, ``w`` for graphics-style indexing.
1124+
This attribute enables efficient SIMD operations and is usable in
1125+
general-purpose code.
11251126

11261127
.. code-block:: c++
11271128

@@ -1133,6 +1134,14 @@ code.
11331134
}
11341135
return sum;
11351136
}
1137+
1138+
The vector type also supports swizzling up to sixteen elements. This can be done
1139+
using the object accessors.
1140+
.. code-block:: c++
1141+
1142+
using f16_x16 = _Float16 __attribute__((ext_vector_type(16)));
1143+
1144+
f16_x16 reverse(f16_x16 v) { return v.sfedcba9876543210; }
11361145
}];
11371146
}
11381147

0 commit comments

Comments
 (0)