From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A73E23858C36; Thu, 21 Sep 2023 13:45:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A73E23858C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695303947; bh=GEaaHq9O9a6zP/pbuOKeR2Qh1fzjf/GR0g2F6LHsxEg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=IGngLtBDXnEX9bJvBJu5AtmvBB6MTc0uOZHeXkuVioz0JpZffLMsorCU1VC9vDi9E lkc8OeVWW/Fel0O3BZKdcWbK6b8opk8lyl3bLz+nojlv/K6mzLz+8dKKJnGXlZZ/Zb /f6mK/Nv0oaddxlqEdz+ViNd9C9Cd0KZ4YIV+SVc= From: "xry111 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110622] x87: Miscompilation at O2 level (O1 is working) Date: Thu, 21 Sep 2023 13:45:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xry111 at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE 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=3D110622 --- Comment #15 from Xi Ruoyao --- (In reply to Mathieu Malaterre from comment #14) > (In reply to Andrew Pinski from comment #13) > > (In reply to Mathieu Malaterre from comment #12) > > > I am seeing a difference in result (log1p computation) in the range: > > >=20 > > > 4318952042648305665 - 0x1.0000000000001p-64 > > > 4368493837572636672 - 0x1.002p-53 > > >=20 > > > the other values seems to match expectation of log1p computation. > >=20 > > But you used excess-precision=3Dfast > >=20 > > *** This bug has been marked as a duplicate of bug 323 *** >=20 > AFAIK bug #323 does not mention my trick: >=20 > asm volatile("" : "+r"(y.raw[0]) : : "memory"); >=20 > That simple line totally changed the optimizer code generation. Because in x87 the excessive precision only exists in x87 stack-like regist= ers. The "memory" clobber forces a store and reload for all non-register variab= les, thus the value is truncated into a normal double value and the excessive precision is lost. There are infinite ways to work around an issue, but it does not mean PR 323 must mention all of them.=