From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4C6AD3858401; Wed, 3 Apr 2024 16:13:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C6AD3858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1712160794; bh=qXEQ1hmOxTuyREjOgpC+xWWcdkXMT1pUL4qA8MCE1ZE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eb0+xKCrXPKsac9ZPZZqxdjNgfMVUHuOlg1GnDyacnJUs+dG9RJZ5tl5dZWUNGiJR Ygl8SKA5CvQXCQcqz2arOkt9WNRBYtrXE2MPQ7QyRSvxG6OyyR1fSD8OqxiN+P/xs7 UMDq4iWhupzKHVzhTF+GwuGlPiuk81MNThY2Z4O4= From: "wilco at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/93565] [11/12/13 Regression] Combine duplicates instructions Date: Wed, 03 Apr 2024 16:13:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: wilco at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 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=3D93565 --- Comment #31 from Wilco --- (In reply to Andrew Pinski from comment #29) > Looking back at this one, I (In reply to Wilco from comment #8) > > Here is a much simpler example: > >=20 > > void f (int *p, int y) > > { > > int a =3D y & 14; > > *p =3D a | p[a]; > > } > After r14-9692-g839bc42772ba7af66af3bd16efed4a69511312ae, we now get: > f: > .LFB0: > .cfi_startproc > and w2, w1, 14 > mov x1, x2 > ldr w2, [x0, x2, lsl 2] > orr w1, w2, w1 > str w1, [x0] > ret > .cfi_endproc >=20 > There is an extra move still but the duplicated and is gone. (with > -frename-registers added, the move is gone as REE is able to remove the z= ero > extend but then there is a life range conflict so can't remove the move t= oo). Even with the mov it is better since that can be done with zero latency in rename in most CPUs. > So maybe this should be closed as fixed for GCC 14 and the cost changes f= or > clz reverted. The ctz costs are correct since it is a 2-instruction sequence - it only ne= eds adjusting for CSSC.=