A fairly trivial follow-up to the patch with the code. I added a line for
PR 53024 while I was there...
2012-09-14 Marc Glisse <marc.gli...@inria.fr>
PR c/53024
PR c++/54427
* doc/extend.texi (Vector Extensions): C++ improvements.
Power of 2 size requirement.
--
Marc Glisse
Index: doc/extend.texi
===================================================================
--- doc/extend.texi (revision 191308)
+++ doc/extend.texi (working copy)
@@ -6813,21 +6813,22 @@ typedef int v4si __attribute__ ((vector_
The @code{int} type specifies the base type, while the attribute specifies
the vector size for the variable, measured in bytes. For example, the
declaration above causes the compiler to set the mode for the @code{v4si}
type to be 16 bytes wide and divided into @code{int} sized units. For
a 32-bit @code{int} this means a vector of 4 units of 4 bytes, and the
corresponding mode of @code{foo} will be @acronym{V4SI}.
The @code{vector_size} attribute is only applicable to integral and
float scalars, although arrays, pointers, and function return values
-are allowed in conjunction with this construct.
+are allowed in conjunction with this construct. Only power of two
+sizes are currently allowed.
All the basic integer types can be used as base types, both as signed
and as unsigned: @code{char}, @code{short}, @code{int}, @code{long},
@code{long long}. In addition, @code{float} and @code{double} can be
used to build floating-point vector types.
Specifying a combination that is not valid for the current architecture
will cause GCC to synthesize the instructions using a narrower mode.
For example, if you specify a variable of type @code{V4SI} and your
architecture does not allow for this specific SIMD type, GCC will
@@ -6850,21 +6851,21 @@ v4si a, b, c;
c = a + b;
@end smallexample
Subtraction, multiplication, division, and the logical operations
operate in a similar manner. Likewise, the result of using the unary
minus or complement operators on a vector type is a vector whose
elements are the negative or complemented values of the corresponding
elements in the operand.
-In C it is possible to use shifting operators @code{<<}, @code{>>} on
+It is possible to use shifting operators @code{<<}, @code{>>} on
integer-type vectors. The operation is defined as following: @code{@{a0,
a1, @dots{}, an@} >> @{b0, b1, @dots{}, bn@} == @{a0 >> b0, a1 >> b1,
@dots{}, an >> bn@}}@. Vector operands must have the same number of
elements.
For the convenience in C it is allowed to use a binary vector operation
where one operand is a scalar. In that case the compiler will transform
the scalar operand into a vector where each element is the scalar from
the operation. The transformation will happen only if the scalar could be
safely converted to the vector-element type.
@@ -6881,21 +6882,21 @@ a = 2 * b; /* a = @{2,2,2,2@} * b; */
a = l + a; /* Error, cannot convert long to int. */
@end smallexample
Vectors can be subscripted as if the vector were an array with
the same number of elements and base type. Out of bound accesses
invoke undefined behavior at runtime. Warnings for out of bound
accesses for vector subscription can be enabled with
@option{-Warray-bounds}.
-In GNU C vector comparison is supported within standard comparison
+Vector comparison is supported with standard comparison
operators: @code{==, !=, <, <=, >, >=}. Comparison operands can be
vector expressions of integer-type or real-type. Comparison between
integer-type vectors and real-type vectors are not supported. The
result of the comparison is a vector of the same width and number of
elements as the comparison operands with a signed integral element
type.
Vectors are compared element-wise producing 0 when comparison is false
and -1 (constant of the appropriate type where all bits are set)
otherwise. Consider the following example.