From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E4CB0385828E; Fri, 17 Feb 2023 18:24:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4CB0385828E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676658244; bh=ozwQfs17a3+llNjHrpabp7wd+EO4+mEnrc69EpEkZWQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=P1vvSeb5OZLsZlg/Q54tROhQh/wZnpHXXQgjPRlWu1tBu58A2DL64xeB6heBcpgIY lIXRzka1EdGIvYOxHMypFWj34ip9P5mhFGqN41RRkn20qeZ1XscET4wPdTDdzyEKNh 4cilOu+555zUDHDXywhgCAqTHldrpzPLrFicHOPw= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94782] Simple multiplication-related arithmetic not optimized to direct multiplication Date: Fri, 17 Feb 2023 18:24:04 +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: 10.0 X-Bugzilla-Keywords: missed-optimization, TREE X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia 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: keywords 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=3D94782 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |TREE --- Comment #3 from Andrew Pinski --- It is fixed on the RTL level but not the gimple level. Combine does it for x86_64: Trying 7, 8 -> 9: 7: {r91:SI=3Dr93:SI-0x1;clobber flags:CC;} REG_DEAD r93:SI REG_UNUSED flags:CC 8: {r92:SI=3Dr91:SI*r94:SI;clobber flags:CC;} REG_UNUSED flags:CC REG_DEAD r91:SI 9: r90:SI=3Dr92:SI+r94:SI REG_DEAD r94:SI REG_DEAD r92:SI Successfully matched this instruction: (set (reg:SI 90) (mult:SI (reg:SI 93) (reg:SI 94))) allowing combination of insns 7, 8 and 9 original costs 4 + 12 + 4 =3D 20 replacement cost 12 But it fails to do it on aarch64: Trying 7 -> 14: 7: r101:SI=3Dr103:SI-0x1 REG_DEAD r103:SI 14: x0:SI=3Dr101:SI*r104:SI+r104:SI REG_DEAD r101:SI REG_DEAD r104:SI=