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: Mon, 28 Nov 2022 07:36:20 +0000	[thread overview]
Message-ID: <bug-107863-4-vhymLRz7BV@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 #9 from Hongtao.liu <crazylht at gmail dot com> ---
expand_expr_real_1 generates (const_int 255) without considering the target
mode.
I guess it's on purpose, so I'll leave that alone and only change the expander
in the backend. After applying convert_modes to (const_int 255), it's
transformed to (const_int -1) which should fix the issue.


-----------cut from expand_expr_real_1--------------
11010    case INTEGER_CST:
11011      {
11012        /* Given that TYPE_PRECISION (type) is not always equal to
11013           GET_MODE_PRECISION (TYPE_MODE (type)), we need to extend from
11014           the former to the latter according to the signedness of the
11015           type.  */
11016        scalar_int_mode int_mode = SCALAR_INT_TYPE_MODE (type);
11017        temp = immed_wide_int_const
11018          (wi::to_wide (exp, GET_MODE_PRECISION (int_mode)), int_mode);
11019        return temp;
11020      }
-----------cut ends------------------------


Proposed patch:

diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 0373c3614a4..c639ee3a9f7 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -12475,7 +12475,7 @@ ix86_expand_vec_set_builtin (tree exp)
   op1 = expand_expr (arg1, NULL_RTX, mode1, EXPAND_NORMAL);
   elt = get_element_number (TREE_TYPE (arg0), arg2);

-  if (GET_MODE (op1) != mode1 && GET_MODE (op1) != VOIDmode)
+  if (GET_MODE (op1) != mode1)
     op1 = convert_modes (mode1, GET_MODE (op1), op1, true);

   op0 = force_reg (tmode, op0);

  parent reply	other threads:[~2022-11-28  7:36 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
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 [this message]
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-vhymLRz7BV@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).