From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1C7093851427; Mon, 20 Apr 2020 08:12:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C7093851427 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587370329; bh=46W0mUBMJC10qu40NXoLdTo/oFWn3nUUCCkDqMWAHbs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XEthdZHX7Ksc0zLNPqCO4EvH2gpHXSWn8GMBpFgBD/UVcrRbvG9+PcHIM2imTHheX MQ3O3TLbK1OWyP3BRwjbIcnzBdePfYFnwq4onFfuxH0eo+DwZwX6/Fdz01DmJb8FNS lbAsuRCyHzKXPD8fq4sZvz885sMAID7HPcwAPLq4= From: "z.zhanghaijian at huawei dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/94665] missed minmax optimization opportunity for if/else structure. Date: Mon, 20 Apr 2020 08:12:08 +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: z.zhanghaijian at huawei dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2020 08:12:09 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94665 --- Comment #6 from z.zhanghaijian at huawei dot com --- (In reply to Segher Boessenkool from comment #5) > Can you show the -fdump-rtl-combine-all dump where that insn is > created? >=20 > It is fine to generate min or max insns here; but you need to handle the= =20 > case where vara is NaN: you should return that NaN then. Other than that > your function is just the max of vara, varb, varc. The dump info=EF=BC=9A Trying 39 -> 40: 39: cc:CCFPE=3Dcmp(r94:SF,r93:SF) 40: r94:SF=3D{(cc:CCFPE<0)?r94:SF:r93:SF} REG_DEAD r93:SF REG_DEAD cc:CCFPE Successfully matched this instruction: (set (reg:SF 94 [ _4 ]) (smin:SF (reg:SF 94 [ _4 ]) (reg:SF 93 [ _2 ]))) allowing combination of insns 39 and 40 original costs 4 + 4 =3D 8 replacement cost 8 deferring deletion of insn with uid =3D 39. modifying insn i3 40: r94:SF=3Dsmin(r94:SF,r93:SF) REG_DEAD r93:SF deferring rescan insn with uid =3D 40.=