public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "crazylht at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/107863] [10/11/12/13 Regression] ICE with unrecognizable insn when using -funsigned-char with some SSE/AVX builtins
Date: Fri, 25 Nov 2022 05:16:25 +0000	[thread overview]
Message-ID: <bug-107863-4-qVy9WNQktz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107863-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Hongtao.liu <crazylht at gmail dot com> ---
For pattern
(set (reg:QI 607)
    (const_int 255 [0xff]))

general_operand return false for op const_int 255 QImode since
trunc_int_for_mode (INTVAL (op), mode) return -1, INVAL (op) is 255.

---cut from general_operand (rtx, machine_mode)----------
  if (CONST_INT_P (op)
      && mode != VOIDmode
      && trunc_int_for_mode (INTVAL (op), mode) != INTVAL (op))
    return false;
---cut end-----------------


and in trunc_int_for_mode, it does signed extend, not unsigned_extend for
!flag_signed_char.

----cut from trunc_int_for_mode------------
  /* Sign-extend for the requested mode.  */

  if (width < HOST_BITS_PER_WIDE_INT)
    {
      HOST_WIDE_INT sign = 1;
      sign <<= width - 1;
      c &= (sign << 1) - 1;
      c ^= sign;
      c -= sign;
    }

  return c;
--------------cut end--------------


Should we do something like 


modified   gcc/explow.cc
@@ -64,7 +64,8 @@ trunc_int_for_mode (HOST_WIDE_INT c, machine_mode mode)

   /* Sign-extend for the requested mode.  */

-  if (width < HOST_BITS_PER_WIDE_INT)
+  if (width < HOST_BITS_PER_WIDE_INT
+      && (mode != QImode || !flag_signed_char))
     {
       HOST_WIDE_INT sign = 1;
       sign <<= width - 1;

  parent reply	other threads:[~2022-11-25  5:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 19:06 [Bug target/107863] New: ICE with unrecognizable insn when using -funsigned-char with some AVX builtins bouanto at zoho dot com
2022-11-24 19:30 ` [Bug target/107863] [10/11/12/13 Regression] ICE with unrecognizable insn when using -funsigned-char with some SSE/AVX builtins pinskia at gcc dot gnu.org
2022-11-24 19:35 ` pinskia at gcc dot gnu.org
2022-11-24 20:12 ` rguenth at gcc dot gnu.org
2022-11-25  2:26 ` crazylht at gmail dot com
2022-11-25  2:52 ` crazylht at gmail dot com
2022-11-25  5:16 ` crazylht at gmail dot com [this message]
2022-11-25  5:32 ` crazylht at gmail dot com
2022-11-25  6:06 ` crazylht at gmail dot com
2022-11-28  7:36 ` crazylht at gmail dot com
2022-11-29  6:17 ` crazylht at gmail dot com
2022-12-01  3:31 ` cvs-commit at gcc dot gnu.org
2022-12-01  3:33 ` cvs-commit at gcc dot gnu.org
2022-12-01  3:35 ` cvs-commit at gcc dot gnu.org
2022-12-01  3:37 ` cvs-commit at gcc dot gnu.org
2022-12-01  3:38 ` crazylht at gmail dot com
2022-12-01 15:45 ` jakub 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-107863-4-qVy9WNQktz@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).