From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 719B63858418; Thu, 29 Dec 2022 01:36:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 719B63858418 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672277799; bh=6Rizof6m8n+JiK/Junu+bVUcTzwU2ZVrolqNR4RnU/Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=i9wAG+6ogXNR5Rlauw4qeb0nhRZE05Xgia2P86rk4mRTegsXCwvv5HTQQs9kdO6+R quPkrz8b3p5u7rAScByGKp8vS6i0t4/7Qfwnbw69aLzZlaMGFpt7/zKsleYoiV+RV5 KbExumMDV1/loyc10cztVVVDcF8Df2PieCdorhcc= From: "andrew at sifive dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108247] Missed opportunity to generate shNadd on risc-v Date: Thu, 29 Dec 2022 01:36:35 +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: X-Bugzilla-Severity: normal X-Bugzilla-Who: andrew at sifive dot com 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108247 Andrew Waterman changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew at sifive dot com --- Comment #1 from Andrew Waterman --- The base-ISA-only code sequence has the same instruction count but smaller = code size: slli a1, a1, 1 addw a0, a1, a0 ret I guess this example is a proxy for a broader set of missed optimizations, = some of which are actually improved by Zba, so maybe my comment is moot. But it would be best not to de-optimize code size in pursuit of opportunities to u= se the Zba instructions. (It also occurs to me that the sh1add + sext.w sequence is easier to fuse because the instructions have the same destination. But choosing to increa= se code size to avail a fusion opportunity is a uarch-specific tuning decision= .)=