aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2014-01-31 13:59:44 +0100
committerMarc Glisse <glisse@gcc.gnu.org>2014-01-31 12:59:44 +0000
commit0878d68a0b6e1bc0d89be4cb738e4ee34f004a6c (patch)
tree850ff8d54ef12cd970222d67cd8343205375f8b8 /gcc
parent6c02e13986163b2cb9fb312ed2dd5d4cbcee65e7 (diff)
downloadgcc-0878d68a0b6e1bc0d89be4cb738e4ee34f004a6c.zip
gcc-0878d68a0b6e1bc0d89be4cb738e4ee34f004a6c.tar.gz
gcc-0878d68a0b6e1bc0d89be4cb738e4ee34f004a6c.tar.bz2
extend.texi (Vector Extensions): Document ?: in C++.
2014-01-31 Marc Glisse <marc.glisse@inria.fr> gcc/ * doc/extend.texi (Vector Extensions): Document ?: in C++. From-SVN: r207340
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/doc/extend.texi13
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bbf6b47..db13a3e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2014-01-31 Marc Glisse <marc.glisse@inria.fr>
+
+ * doc/extend.texi (Vector Extensions): Document ?: in C++.
+
2014-01-31 Richard Biener <rguenther@suse.de>
PR middle-end/59990
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 2f4f91d..ee98b2c 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -7233,6 +7233,19 @@ c = a > b; /* The result would be @{0, 0,-1, 0@} */
c = a == b; /* The result would be @{0,-1, 0,-1@} */
@end smallexample
+In C++, the ternary operator @code{?:} is available. @code{a?b:c}, where
+@code{b} and @code{c} are vectors of the same type and @code{a} is an
+integer vector with the same number of elements of the same size as @code{b}
+and @code{c}, computes all three arguments and creates a vector
+@code{@{a[0]?b[0]:c[0], a[1]?b[1]:c[1], @dots{}@}}. Note that unlike in
+OpenCL, @code{a} is thus interpreted as @code{a != 0} and not @code{a < 0}.
+As in the case of binary operations, this syntax is also accepted when
+one of @code{b} or @code{c} is a scalar that is then transformed into a
+vector. If both @code{b} and @code{c} are scalars and the type of
+@code{true?b:c} has the same size as the element type of @code{a}, then
+@code{b} and @code{c} are converted to a vector type whose elements have
+this type and with the same number of elements as @code{a}.
+
Vector shuffling is available using functions
@code{__builtin_shuffle (vec, mask)} and
@code{__builtin_shuffle (vec0, vec1, mask)}.