public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/53986] missing vrp on bit-mask test, LSHIFT_EXPR not handled
Date: Sun, 05 Aug 2012 13:32:00 -0000	[thread overview]
Message-ID: <bug-53986-4-TlIA21pQXc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53986-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53986

--- Comment #6 from vries at gcc dot gnu.org 2012-08-05 13:32:15 UTC ---
> s_1         (u)s_1      s_1+16      ((u)s_1)+16      T T
> -16         4294967280  0           0                0 0
> -12         4294967284  4           4                0 0
> -9          4294967287  7           7                0 0
> -17         4294967279  -1          4294967295       0 1
> $

I think you forgot the cast to unsigned after the add that represents the
currently generated code:
...
@@ -13,7 +13,7 @@
       unsigned int uv = (unsigned) v;
       printf ("%-12d%-12u%-12d%-12u\t%2d%2d\n",
           v, uv, v+16, uv+16,
-          (v+16) > 7, (uv+16) > 7);
+          (unsigned int)(v+16) > 7, (uv+16) > 7);
     }
   return 0;
 }
...

With that added I see:
...
s_1         (u)s_1      s_1+16      ((u)s_1)+16      T T
-16         4294967280  0           0                0 0
-12         4294967284  4           4                0 0
-9          4294967287  7           7                0 0
-17         4294967279  -1          4294967295       1 1
...

We now see the correct result for all 4 cases for both methods.


  parent reply	other threads:[~2012-08-05 13:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-16 20:55 [Bug middle-end/53986] New: missing vrp on bit-mask test vries at gcc dot gnu.org
2012-07-17  9:19 ` [Bug tree-optimization/53986] missing vrp on bit-mask test, LSHIFT_EXPR not handled rguenth at gcc dot gnu.org
2012-07-23  6:30 ` vries at gcc dot gnu.org
2012-08-05  9:36 ` vries at gcc dot gnu.org
2012-08-05 11:06 ` steven at gcc dot gnu.org
2012-08-05 11:36 ` steven at gcc dot gnu.org
2012-08-05 13:32 ` vries at gcc dot gnu.org [this message]
2012-08-05 13:53 ` stevenb.gcc at gmail dot com
2012-08-05 15:32 ` vries at gcc dot gnu.org
2012-08-05 18:16 ` vries at gcc dot gnu.org
2012-08-06  8:38 ` vries at gcc dot gnu.org
2012-09-07  9:21 ` vries at gcc dot gnu.org
2012-09-07  9:21 ` vries at gcc dot gnu.org
2012-09-07  9:22 ` vries at gcc dot gnu.org
2012-09-07  9:25 ` vries at gcc dot gnu.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-53986-4-TlIA21pQXc@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).