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 middle-end/101642] [12 Regression] ice in decompose, at wide-int.h:984
Date: Tue, 27 Jul 2021 14:11:48 +0000	[thread overview]
Message-ID: <bug-101642-4-LeOBLIMkWF@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101642-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I think better testcase would be
int x;

unsigned short
foo (void)
{
  return __builtin_bswap16 (x) ? : x;
}
because otherwise you're asking for it to be DCEd.

The problem is that for __builtin_bswap16 like for many other builtins with 8
or 16-bit argument(s) the operand is promoted to int.
So, many of the match.pd rules just don't trigger for it at all, like:
 (simplify
  (bswap (bswap @0))
  @0)
 (simplify
  (bswap (bit_not (bswap @0)))
  (bit_not @0))
 (for bitop (bit_xor bit_ior bit_and)
  (simplify
   (bswap (bitop:c (bswap @0) @1))
   (bitop @0 (bswap @1))))
because there are casts it doesn't take into account for bswap16, others are
just incorrect, like:
 (for cmp (eq ne)
  (simplify
   (cmp (bswap @0) (bswap @1))
   (cmp @0 @1))
- it needs to convert @0 and @1 to the type of one of the bswaps, otherwise it
could be comparing even the upper bits, and others are both incorrect and cause
ICE, like
  (simplify
    (cmp (bswap @0) INTEGER_CST@1)
   (cmp @0 (bswap @1))))
Let me deal with just those now and the rest that just don't match can be dealt
with later on.

  parent reply	other threads:[~2021-07-27 14:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 12:08 [Bug c/101642] New: " dcb314 at hotmail dot com
2021-07-27 12:13 ` [Bug c/101642] " dcb314 at hotmail dot com
2021-07-27 12:21 ` dcb314 at hotmail dot com
2021-07-27 12:24 ` dcb314 at hotmail dot com
2021-07-27 12:43 ` dcb314 at hotmail dot com
2021-07-27 12:43 ` jakub at gcc dot gnu.org
2021-07-27 12:50 ` [Bug middle-end/101642] [12 Regression] " rguenth at gcc dot gnu.org
2021-07-27 12:55 ` zsojka at seznam dot cz
2021-07-27 14:11 ` jakub at gcc dot gnu.org [this message]
2021-07-27 14:15 ` zsojka at seznam dot cz
2021-07-27 14:17 ` jakub at gcc dot gnu.org
2021-07-27 14:50 ` jakub at gcc dot gnu.org
2021-07-27 15:08 ` roger at nextmovesoftware dot com
2021-07-28 16:42 ` cvs-commit at gcc dot gnu.org
2021-07-28 16:46 ` jakub at gcc dot gnu.org
2021-08-02 12:31 ` cvs-commit 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-101642-4-LeOBLIMkWF@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).