diff options
author | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-03 19:57:01 +0000 |
---|---|---|
committer | glisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-03 19:57:01 +0000 |
commit | 5e84569c0452c39bf60fbd066801edc1907a982f (patch) | |
tree | 99d9326c06a03358bcb02cde8335ee8324fd1bf5 /gcc/doc | |
parent | 007a6c275eb651ed5892d7abf8161e0be8471bca (diff) | |
download | gcc-5e84569c0452c39bf60fbd066801edc1907a982f.tar.gz |
2014-10-03 Marc Glisse <marc.glisse@inria.fr>
PR c++/54427
PR c++/57198
PR c++/58845
gcc/c-family/
* c-common.c (warn_logical_operator): Punt for vectors.
gcc/cp/
* typeck.c (cp_build_binary_op): save_expr after convert to save
redundant operations.
[TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR]: Handle vectors.
(cp_build_unary_op) [TRUTH_NOT_EXPR]: Likewise.
gcc/
* doc/extend.texi (Vector Extensions): Document &&, ||, ! in C++.
gcc/testsuite/
* g++.dg/ext/vector9.C: Update, not an error anymore.
* g++.dg/ext/vector27.C: Replace with new test.
* g++.dg/ext/vector28.C: New file.
* g++.dg/other/error23.C: Update to a different error.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215872 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index c78ffb2dabc..de056618226 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -7918,6 +7918,13 @@ vector. If both @code{b} and @code{c} are scalars and the type of @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}. +In C++, the logic operators @code{!, &&, ||} are available for vectors. +@code{!v} is equivalent to @code{v == 0}, @code{a && b} is equivalent to +@code{a!=0 & b!=0} and @code{a || b} is equivalent to @code{a!=0 | b!=0}. +For mixed operations between a scalar @code{s} and a vector @code{v}, +@code{s && v} is equivalent to @code{s?v!=0:0} (the evaluation is +short-circuit) and @code{v && s} is equivalent to @code{v!=0 & (s?-1:0)}. + Vector shuffling is available using functions @code{__builtin_shuffle (vec, mask)} and @code{__builtin_shuffle (vec0, vec1, mask)}. |