public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/31178] VRP can infer a range for b in a >> b and a << b
Date: Wed, 23 Mar 2022 08:31:38 +0000	[thread overview]
Message-ID: <bug-31178-4-1ZHpKxlWqh@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-31178-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31178

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Andrew Macleod from comment #9)
> Seems like it may expose a problem in gcc.target/i386/sse2-v1ti-shift-3.c as
> well:
> 
>  for (i=0; i<128; i++) {
> <...>
>     if ((ti)rotr_v1ti(ut,i) != (ti)rotr_ti(x,i))
>       __builtin_abort();
>     if ((ti)rotl_v1ti(ut,i) != (ti)rotl_ti(x,i))
> 
> And those are defined:
> 
> uv1ti rotr_v1ti(uv1ti x, unsigned int i) { return (x >> i) | (x << (128-i));
> }
> uv1ti rotl_v1ti(uv1ti x, unsigned int i) { return (x << i) | (x >> (128-i));
> }
> 
> so when i is 0, they can perform a shift of 128 on a 128 bit object.

That just means they should be fixed.
As documented above simplify_rotate in tree-ssa-forwprop.cc, we pattern match a
lot of forms and many of those are safe for any rotate count.
If only 0..127 is supposed to be valid for i, then e.g.
   (x << i) | (x >> ((-i) & 127))
will do.

  parent reply	other threads:[~2022-03-23  8:31 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-31178-4@http.gcc.gnu.org/bugzilla/>
2013-02-11  7:48 ` rguenth at gcc dot gnu.org
2013-02-11  8:00 ` jakub at gcc dot gnu.org
2022-03-22 14:21 ` amacleod at redhat dot com
2022-03-22 17:03 ` amacleod at redhat dot com
2022-03-23  8:08 ` rguenther at suse dot de
2022-03-23  8:26 ` jakub at gcc dot gnu.org
2022-03-23  8:31 ` jakub at gcc dot gnu.org [this message]
2022-04-05 17:58 ` amacleod at redhat dot com
2022-04-05 18:06 ` jakub at gcc dot gnu.org
2022-04-05 18:24 ` amacleod at redhat dot com
2022-04-06  6:00 ` rguenth at gcc dot gnu.org
2022-04-06  8:16 ` vincent-gcc at vinc17 dot net
2022-04-06  8:22 ` rguenther at suse dot de
2022-04-06  8:45 ` vincent-gcc at vinc17 dot net
2022-04-06 13:10 ` amacleod at redhat dot com
2022-04-06 13:13 ` jakub at gcc dot gnu.org
2022-04-06 13:16 ` rguenther at suse dot de
2024-06-20 16:07 ` pinskia at gcc dot gnu.org
2024-06-26  5:44 ` pinskia at gcc dot gnu.org
2007-03-14 21:13 [Bug tree-optimization/31178] New: " rguenth at gcc dot gnu dot org
2007-03-15 14:43 ` [Bug tree-optimization/31178] " rguenth at gcc dot gnu dot org
2009-02-08 14:21 ` steven at gcc dot gnu dot org
2009-02-08 14:47 ` rguenth at gcc dot gnu dot org

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=bug-31178-4-1ZHpKxlWqh@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).