]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
doc: clarify semantics of vector bitwise shifts
authorAlexander Monakov <amonakov@ispras.ru>
Wed, 24 May 2023 12:48:29 +0000 (15:48 +0300)
committerAlexander Monakov <amonakov@ispras.ru>
Fri, 2 Jun 2023 12:17:30 +0000 (15:17 +0300)
Explicitly say that attempted shift past element bit width is UB for
vector types.  Mention that integer promotions do not happen.

gcc/ChangeLog:

* doc/extend.texi (Vector Extensions): Clarify bitwise shift
semantics.

gcc/doc/extend.texi

index f9d13b495ade01e9c9fc61e2c1089dc6a28becc7..cdbd4b34a35270889d3920a582d268d07e8fe8e5 100644 (file)
@@ -12026,7 +12026,14 @@ elements in the operand.
 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
+@dots{}, an >> bn@}}@.  Unlike OpenCL, values of @code{b} are not
+implicitly taken modulo bit width of the base type @code{B}, and the behavior
+is undefined if any @code{bi} is greater than or equal to @code{B}.
+
+In contrast to scalar operations in C and C++, operands of integer vector
+operations do not undergo integer promotions.
+
+Operands of binary vector operations must have the same number of
 elements. 
 
 For convenience, it is allowed to use a binary vector operation