From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A06993852C79; Fri, 25 Nov 2022 05:16:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A06993852C79 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669353386; bh=+t3SCZknKKEJblrSP5uR890ixLL6z2EuiLAjWuh6k0M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Pn0oqYbRJniJYdQkF9aJkv03yVoolhOz44v6Bt8SNPXH0UxgWJDJPxmuGoP2oLwBR a8Zfy5qxBcdcSuprLAMgk6Fyf1Zume7aop7FKxer8lyiXVho1Q/6mDXfkiYoBI7khw lkRyc2ztTkiXWu2rIOXD54qIdUukLPN8vRiUiOyY= 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: Fri, 25 Nov 2022 05:16:25 +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 #6 from Hongtao.liu --- 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 !=3D VOIDmode && trunc_int_for_mode (INTVAL (op), mode) !=3D 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 =3D 1; sign <<=3D width - 1; c &=3D (sign << 1) - 1; c ^=3D sign; c -=3D sign; } return c; --------------cut end-------------- Should we do something like=20 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 !=3D QImode || !flag_signed_char)) { HOST_WIDE_INT sign =3D 1; sign <<=3D width - 1;=