From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 24D7538582A3; Wed, 6 Mar 2024 12:35:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24D7538582A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709728543; bh=+/8y4PeT1CeU0byjgB1O9iPwsGoUVwL0bMKefqj5wUc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wa5GEMF36s+IGrwl96QwmKYq+NyNtz7yBXF4UFbSA0kYwxizhqazHUIvcr/GIBSUM NECA6JO7xsAwt2XwjmyZHIeyXThZ9U0d2QqchofVBjoCVPQ08CAObKEfWphfI0wbcN 1vyoz9sIVGgFgU0+7+vNsxd4ZwAYeRc+LdME8B7M= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/77776] C++17 std::hypot implementation is poor Date: Wed, 06 Mar 2024 12:35:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 7.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: emsr 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=3D77776 --- Comment #21 from Jonathan Wakely --- (In reply to g.peterhoff from comment #19) > * You were probably wondering why I wrote "if (std::isinf(x) | std::isinf= (y) > | std::isinf(z))", for example. This is intentional. The problem is that = gcc > almost always produces branch code for logical operations, so *a lot* of > conditional jumps. By using arithmetic operations, so instead of || && ju= st > | &, I can get it to generate only actually necessary conditional jumps or > cmoves. branchfree code is always better. In general the code is not equivalent if any of the subexpressions has side effects, such as setting errno, raising an exception for a signalling nan e= tc. but I don't think we care about that here.=