From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1A4753858C50; Fri, 21 Apr 2023 21:18:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A4753858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682111893; bh=5DJbfy6q1TbCLY/y2lMJ5nExU8BtMCpONcNHSYO9d5k=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CEk7LK2a7prG4P4AGhp0YeHjCVB8O5T4OKsgQZMG7mYrIx1VXWpd19WThhF+4eSDr 40QMwUGGs61dTEsREWP9NoYHr6+E9VAVoCBMd9/QfK8IlOdj6MWoYtnjMTXqP+joTK qzeEEskD3IOGe04lPupzXGQffkz+hA1D7q6H0t4k= From: "vineetg at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106888] [RISCV] Negative optimization that excess andi instructions are generated in gcc.dg/pr90838.c Date: Fri, 21 Apr 2023 21:18:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vineetg 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: --- 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=3D106888 --- Comment #7 from Vineet Gupta --- (In reply to Roger Sayle from comment #5) > Created attachment 54905 [details] > proposed patch >=20 > This patch should fix this problem, by adding another pattern the machine > description to also recognize zero_extend of clz/ctz/pcnt, matching the > current pattern that only matches sign_extend. Clearly for SI operands, = the > result must always be 0..32, so sign extension and zero extension are > equivalent, and the zero extension is perhaps (now) the preferred canonic= al > form. Thx for the patch Roger, but as Jeff noted, it alone is not enough and generates same extra ANDI. Would you have expected combine to recog() the n= ew pattern ?=