From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C141A3858002; Tue, 27 Jul 2021 14:11:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C141A3858002 From: "jakub at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jul 2021 14:11:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101642 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #7 from Jakub Jelinek --- 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 c= ause 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 d= ealt with later on.=