public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106513] [10/11/12/13 Regression] bswap pass misses that >>56 for signed types can be replicate the sign bit
Date: Fri, 05 Aug 2022 22:15:25 +0000	[thread overview]
Message-ID: <bug-106513-4-wtzJEkdIVy@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106513-4@http.gcc.gnu.org/bugzilla/>

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
      Known to fail|                            |4.5.3, 4.6.4
            Summary|bswap is incorrectly        |[10/11/12/13 Regression]
                   |generated                   |bswap pass misses that >>56
                   |                            |for signed types can be
                   |                            |replicate the sign bit
      Known to work|                            |4.4.7
   Target Milestone|---                         |10.5
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-08-05

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

Better testcase (without the questionable undefined behavior):

typedef long long int int64_t;

__attribute__((noinline)) int64_t
swap64 (int64_t n)
{
  return (((n & (((int64_t) 0xff) )) << 56) |
          ((n & (((int64_t) 0xff) << 8)) << 40) |
          ((n & (((int64_t) 0xff) << 16)) << 24) |
          ((n & (((int64_t) 0xff) << 24)) << 8) |
          ((n & (((int64_t) 0xff) << 32)) >> 8) |
          ((n & (((int64_t) 0xff) << 40)) >> 24) |
          ((n & (((int64_t) 0xff) << 48)) >> 40) |
          ((n & ((int64_t)(0xffull << 56))) >> 56));
}

int main (void)
{
  volatile int64_t n = 0x8000000000000000l;

  if (swap64(n) != 0xffffffffffffff80l)
    __builtin_abort ();

  return 0;
}

  parent reply	other threads:[~2022-08-05 22:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03 11:56 [Bug tree-optimization/106513] New: bswap is incorrectly generated kristerw at gcc dot gnu.org
2022-08-03 12:12 ` [Bug tree-optimization/106513] " schwab@linux-m68k.org
2022-08-03 12:41 ` kristerw at gcc dot gnu.org
2022-08-05 22:15 ` pinskia at gcc dot gnu.org [this message]
2022-08-10 13:43 ` [Bug tree-optimization/106513] [10/11/12/13 Regression] bswap pass misses that >>56 for signed types can be replicate the sign bit rguenth at gcc dot gnu.org
2022-08-10 13:51 ` rguenth at gcc dot gnu.org
2022-08-10 14:39 ` cvs-commit at gcc dot gnu.org
2022-08-10 14:40 ` cvs-commit at gcc dot gnu.org
2022-10-11 13:04 ` [Bug tree-optimization/106513] [10/11 " cvs-commit at gcc dot gnu.org
2022-10-14 10:47 ` [Bug tree-optimization/106513] [10 " cvs-commit at gcc dot gnu.org
2022-10-14 10:48 ` rguenth 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-106513-4-wtzJEkdIVy@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).