@ -188,7 +188,8 @@ vector unsigned __int128 x = { (((unsigned __int128)0x1020304050607080) <<
<para>
<para>
One vector type may be cast to another vector type without
One vector type may be cast to another vector type without
restriction. Such a cast is simply a reinterpretation of the
restriction. Such a cast is simply a reinterpretation of the
bits, and does not change the data.
bits, and does not change the data. There are no default
conversions for vector types.
</para>
</para>
<para>
<para>
Compilers are expected to recognize and optimize multiple
Compilers are expected to recognize and optimize multiple
@ -495,12 +496,14 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
valid for pointers to vector types.
valid for pointers to vector types.
</para>
</para>
<para>
<para>
The traditional C/C++ operators are defined on vector types
The traditional C/C++ unary operators (<code>+</code>
for unary and binary <code>+</code>,
<code>-</code>, and <code>~</code>), are defined on vector types.
unary and binary –, binary <code>*</code>, binary
The traditional C/C++ binary operators (<code>+</code>,
<code>%</code>, and binary <code>/</code> as well as the unary
<code>-</code>, <code>*</code>, <code>%</code>, <code>/</code>,
and binary shift, logical and comparison operators, and the
shift, logical, and comparison) and the ternary operator
ternary <code>?:</code> operator. These operators perform their
(<code>?:</code>)
are defined on like vector types.
Other than <code>?:</code>, these operators perform their
operations "elementwise" on the base elements of the operands,
operations "elementwise" on the base elements of the operands,
as follows.
as follows.
</para>
</para>
@ -533,6 +536,27 @@ a = a + b;</programlisting>
</para>
</para>
<programlisting>vector signed int a, b;
<programlisting>vector signed int a, b;
a = vec_add (a, b);</programlisting>
a = vec_add (a, b);</programlisting>
<para>
For the ternary operator (<code>?:</code>), the first operand must
be an integral type, used to select between the second and third
operands which must be of the same vector type.
The result of the ternary operator will also have that type.
For example,
<programlisting>
int test_value;
vector signed int a, b, r;
r = test_value ? a : b;
</programlisting>
produces the same result as
<programlisting>
int test_value;
vector signed int a, b, r;
if (test_value)
r = a;
else
r = b;
</programlisting>
</para>
<para>
<para>
Further, the array reference operator may be applied to vector
Further, the array reference operator may be applied to vector
data types, yielding an l-value corresponding to the specified
data types, yielding an l-value corresponding to the specified