From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E05503858C50; Fri, 28 Apr 2023 22:47:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E05503858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682722020; bh=Hd/MK1djN6N07tfhfLMXxHIzhbd0IG4dN8tku4zCE00=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LkvqNhhU+zjnFo4gDziq5N80PQ2ML7Y9fQ6SfKllCPHnObyHXCGUhXZv4Cv5EIhqO Bj7XQksWGMIeKYlQ07ARbUClbzZEQs1D41FUuHuqe4NtPTKIGoPc3kl1mnSUEFecgl kwcRZmGrFrivUjk7yQjbyJRVDICZf5pJ/xBaSA+4= From: "law at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/106585] RISC-V: Mis-optimized code gen for zbs Date: Fri, 28 Apr 2023 22:46:59 +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: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: law at gcc dot gnu.org 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: --- 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=3D106585 --- Comment #11 from Jeffrey A. Law --- Coming back to this. WRT extension elimination. I've been pondering if we want a late pass to d= o a bit of this that can't be handled by REE. So let's take the case of a Zbs instruction operating on a variable bit in RV64. I think we can probably agree that in the absence of additional information= we can't do those kind of bit manipulations because we could potentially change bit 31 and have the result escape as a parameter to a function call, return value or get used in a compare type instruction. So to make use of the Zbs instructions that manipulate a variable bit we co= uld could emit a suitable sign extension after each such operation. That, of course, has the potential to be expensive. But if we chase down the uses we can probably eliminate a lot of these extensions. Essentially we need to know if the extension reaches a compari= son, one of the ABI escape points or a real 64bit operation. If not, then the extension is unnecessary and can be dropped. Ideally we'd find that a significant number of extensions could be dropped. We're not actively working on this, but it is something rattling around in = the empty space between my ears.=