From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B7B3038582BB; Wed, 31 Jan 2024 10:26:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7B3038582BB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706696783; bh=9LDrDA2gUOoyvHIEb3CZNohN2cn/Z0wY30iXjZkTVh4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=h2OFRxcEzHkvMQdSl4weHs1D6Ui0wBaMUFUCi4CCVhBcA+jizxXxSiXki1lcr3t8F F9ZZdRD8/xLk62SiAZh4U0M5GTODzBCV14fjYBfNiDfvX+zrpiCi6YahcXnxnZJWIS ZPorYK8f34+zGcgNXqCLZj/FbsJZJf3dW0EoZCvA= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64 Date: Wed, 31 Jan 2024 10:26:23 +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.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: cc 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=3D113679 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #7 from Jakub Jelinek --- And while SSE/SSE2 has instructions for performing arithmetics in IEEE754 single and double formats, x87 does not, everything is done in extended precision (unless the FPU is configured to use smaller precision but then it doesn't support the extended precision long double on the other side) and conversions to IEEE754 single/double have to be done when storing the exten= ded precision registers into memory. So, it is impossible to achieve the expected IEEE754 single and double arithmetics behavior, one can get only something close to it (but with doub= le rounding problems) if all the temporaries are immediately stored into memory and loaded from it again. The -ffloat-store option does it to a limited extent (doesn't convert everything though), but still, the performance is terrible. C allows extended precision and specifies how to should behave, that is the -fexcess-precision=3Dstandard model (e.g. enabled by default for -std=3Dc{99,11,...} options as opposed to -std=3Dgnu..., then it is consist= ently using the excess precision with some casts/assignments mandating rounding to lower precisions, while -fexcess-precision=3Dfast is what gcc has been implementing before it has been introduced, excess precision is used there = as long as something is kept in the FPU registers and conversions are done whe= n it needs to be spilled to memory.=