From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BFE23381EC8F; Wed, 7 Dec 2022 22:45:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BFE23381EC8F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670453120; bh=ufAhfqdZBdGgI2ozLzuYfKYHg2b30L+9Sza3TsK+OoI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tjgLhrE7BkOZe5iY2BWnwRlF1T1tm53Ovo7glKXTClNgsrJEKoOd8cAABRO4iZLD9 HsgG2UscnSsW9ETNWAhhdtLpboJ00/1+azvdk3RzLUPxGPsHBkUm4TBzanvJ3fXqtp snkqPZfPHnxNnK+VqppUbN+0yw56zEcVRHwTb+h8= 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: Wed, 07 Dec 2022 22:45:19 +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 #7 from Jeffrey A. Law --- Raphael and I are poking at this a bit. I can't convince myself that it's actually safe to use GPR for the bit manipulation patterns. For rv64 I'm pretty sure the b* instructions are operating on 64bit quantit= ies only. Meaning they might twiddle the SI sign bit without extending. If we were to change these patterns to use GPR and the result then fed an addw (f= or example) then we would have inconsistent register state as operand twiddled= by the prior b* pattern wouldn't have been sign extended. To be clear, I think this is a limitation imposed by the ISA docs, not GCC where this will be reasonably well defined. With that in mind I think the only path forward is new patterns that (sadly) use explicit subregs for sources, but still set a DImode destination. I'm the newbie here, so if I've misinterpreted the ISA docs incorrectly, do= n't hesitate to let me know.=