From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BC30C3858D1E; Mon, 19 Jun 2023 20:07:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BC30C3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687205234; bh=dP6uEYmvKwwgGCTRBghj3fcjNyptcyMzbFJvJBWeVos=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Key0u50wrAo+JlYCVk3k28nCPoHq7j4O6gd07UEE4164fx+hI6uli4Z+dNVIkUWVZ IUJAmnm7kcNZ22vlHAa+TrlebmWMtaydl3nJx4gzZxBdbUDUxaEoj8c2xJV7ywIaKh o/JSJrgK8ZC3wXCAa+mW/lLh1L3XkDAKnrqqNEnw= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/110305] Incorrect optimization with -O3 -fsignaling-nans -fno-signed-zeros Date: Mon, 19 Jun 2023 20:07:14 +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: 14.0 X-Bugzilla-Keywords: wrong-code 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: 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=3D110305 --- Comment #7 from Andrew Pinski --- (In reply to Michael Morrell from comment #6) > I'm curious why this transformation is being done by both > fold_real_zero_addition_p AND simplify_binary_operation_1.=20=20 The answer there involves the history of GCC and the history of how optimizations were done in GCC. Basically fold_real_zero_addition_p (fold) would only act a statement while simplify_binary_operation_1 could happen between statements (while doing CSE and combine, etc.). That changed with the merge of tree-ssa in r0-58166-g6de9cd9a886ea6 (2004).=20 simplify_binary_operation_1 had the optimization since the begining of git (though it moved from cse.c to simplify-rtx in r0-24738-g0cedb36cbd7e0c and= the HONOR_SIGNED_ZEROS was done by r0-41258-g71925bc04f24a4, in 2002 before it = was just checking ieee float format and unsafe-math). fold had it since the begining of git also (and changed in a similar fashio= n as simplify-rtx for the HONOR_SIGNED_ZEROS).=