From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D14E43858CDB; Mon, 28 Nov 2022 07:36:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D14E43858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669620980; bh=FrWmR0bywwwekirJwOTM6BEi33a42bMO4JkwiIKq+zY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kIhCQojdoh+G1wCTDCTJLN4+KXaYouHUwtI+JJZwuVdT+whPAHJwGDAyn9TfAb8FG xXwi9cChqPRjr/VxnBxM2EteN6aRXpReIzxUsLNs8BvFxXBkJezr/rhSzU1XG71nAG MUQx2iNdUPBK+JSxRBfrcIbkqadist/xrPQA1MXk= From: "crazylht at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: FIXME, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107863 --- Comment #9 from Hongtao.liu --- 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 expan= der 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 fr= om 11014 the former to the latter according to the signedness of the 11015 type. */ 11016 scalar_int_mode int_mode =3D SCALAR_INT_TYPE_MODE (type); 11017 temp =3D 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 =3D expand_expr (arg1, NULL_RTX, mode1, EXPAND_NORMAL); elt =3D get_element_number (TREE_TYPE (arg0), arg2); - if (GET_MODE (op1) !=3D mode1 && GET_MODE (op1) !=3D VOIDmode) + if (GET_MODE (op1) !=3D mode1) op1 =3D convert_modes (mode1, GET_MODE (op1), op1, true); op0 =3D force_reg (tmode, op0);=