From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 92670385B515; Mon, 3 Apr 2023 00:39:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92670385B515 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680482366; bh=WL95s79n4ZOIRbejsyMLuqm5mSElUdPPrZCgp1scEOU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=y0BmPHymzzpn4T1ub1I5EtrKTNPp4GbEouJ0mr+gqjVIBTPvoF7OvPVLAiLFv7ASY C5+fcIz5K2Vc5bIoWVWhgGuJfm+kTIny6QL4qpKJPaUqZDH2O/tjiNBnGIY20QiH3y WSxVAMTtPWfq5kW44Un3VftIF0P5RYndFG0Yb2FI= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109378] new builtin like __builtin_sqrt but does not set errno Date: Mon, 03 Apr 2023 00:39:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org 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: resolution 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=3D109378 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |INVALID --- Comment #12 from Andrew Pinski --- (In reply to g.peterhoff from comment #11) > Ok, in detail: > std::sqrt/__builtin_sqrt performs the check for nan in the calling contex= t. > This causes the following problems: It is a check for less than 0; not NAN. > * the calling context contains error handling/conditional jumps, which ha= ve > nothing to do there but have to be handled in the error handling of std::= sqrt > * Because this does NOT happen in your implementation of std::sqrt, the c= ode > gets bloated, at the latest when a function contains more than one std::s= qrt. There could be a check on errno later on even ... There is no way for GCC to know that. >=20 > Therefore > * do complete error handling in std::sqrt/__builtin_sqrt > * so there is only one exact call for std::sqrt, which can/must be > vectorized. Again it still cannot be vectorized because it needs to be exact. It is also hard to detect if errno is not being used too.=