public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexander Monakov <amonakov@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-1494] doc: clarify semantics of vector bitwise shifts
Date: Fri,  2 Jun 2023 12:17:40 +0000 (GMT)	[thread overview]
Message-ID: <20230602121740.41AEE3858D3C@sourceware.org> (raw)

https://gcc.gnu.org/g:9f926f3a0c8dee7edb6807323a1fe2a92b33bfaa

commit r14-1494-g9f926f3a0c8dee7edb6807323a1fe2a92b33bfaa
Author: Alexander Monakov <amonakov@ispras.ru>
Date:   Wed May 24 15:48:29 2023 +0300

    doc: clarify semantics of vector bitwise shifts
    
    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.

Diff:
---
 gcc/doc/extend.texi | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index f9d13b495ad..cdbd4b34a35 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -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

                 reply	other threads:[~2023-06-02 12:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230602121740.41AEE3858D3C@sourceware.org \
    --to=amonakov@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).