From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8E34B38582AD; Thu, 4 Jan 2024 14:52:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8E34B38582AD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704379921; bh=RbSN/8vFGdk7oa2fAbpXYD4U66byXqTdupRPli020LI=; h=From:To:Subject:Date:From; b=gn6Bf2W3BKGwNY4NOq1k3L4uS+JJqaSjDIpqS/y6wtVeUdVhlPCVlXEWnsujqZgyR e3LSBbN8GpZwd6GsR6LcqvR5yOjCZ5wqsDFco5xJwVmvHldvOs5elKOlACp9M/tLLt mCSZOoV6A5LHEmsuG5nJCD8/bHrFFHtgeQfWPMSY= From: "denis.campredon at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/113234] New: missing folding to builtin_isunordered if manual nan comparison is used Date: Thu, 04 Jan 2024 14:52:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: denis.campredon at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D113234 Bug ID: 113234 Summary: missing folding to builtin_isunordered if manual nan comparison is used Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiled with -O1, on x86-64, f1 and f2 should produce the same code than f3 and f4, but f1 and f2 use two comparisons whereas f3 and f4 only use 1. ------------------- bool f1(float i, float j) { return i !=3Di || j !=3D j; } bool f2(float i, float j) { return i =3D=3D i && j =3D=3D j; } bool f3(float i, float j) { return __builtin_isnan(i) || __builtin_isnan(j); } bool f4(float i, float j) { return !__builtin_isnan(i) && !__builtin_isnan(j); } ------------------------------- It seems that gcc does not fold "f !=3D f" to __builtin_isnan, or too late, leading to the missed optimisation.=