From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BC4F4384B0C1; Tue, 21 Apr 2020 10:38:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC4F4384B0C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587465533; bh=7HpXJAAZFqfq6l2udIr3juFWTSpI3b206jUM32xJMSM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IfVYdBVtfM7VVG+94uNHESsLOBuYsmyHsHJx+q0MPpTPIMVnySDylOPTn2Jmz3Lte txpVbqVSHmqrP+w9t0MCWJgKiJ2WJkr/oeEi9Ck1mgpgSaibWxmOx36+YPWVrldMzM v8wxUk8MvgYj0ArQReuB9LfHvRlDy4mVHQrBLK/o= 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: Tue, 21 Apr 2020 10:38:53 +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: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: segher 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: Tue, 21 Apr 2020 10:38:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94665 --- Comment #12 from z.zhanghaijian at huawei dot com --- (In reply to Segher Boessenkool from comment #11) > Confirmed the comment 4 problem, on all archs. This is a very old bug. Ok to me, can this optimization change flag_unsafe_math_optimizations to flag_finite_math_only? Like the patch: diff --git a/gcc/combine.c b/gcc/combine.c index cff76cd3303..f394d8dfd03 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -6643,7 +6643,7 @@ simplify_if_then_else (rtx x) /* Look for MIN or MAX. */ - if ((! FLOAT_MODE_P (mode) || flag_unsafe_math_optimizations) + if ((! FLOAT_MODE_P (mode) || flag_finite_math_only) && comparison_p && rtx_equal_p (XEXP (cond, 0), true_rtx) && rtx_equal_p (XEXP (cond, 1), false_rtx) Can this fix the bug=EF=BC=9F=