From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A986A383F840; Fri, 28 Aug 2020 09:40:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A986A383F840 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598607607; bh=k4qmxCERUSenPKSGtZAmSOB2b0/uX+qrIfthObApsKM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LNEYDMqMXrcVDhyhZOHPAj/TtBLiKEAJ2wBu16in51iwFxQ6o09NREdYaowWFw4lN RJ0X5lMzRB49pNitWqMXtBFOED1qZ88D2Wt4yGoMsm626XJfBrLdAz4doZVWhM1zr3 UeqUhSHsJav4QI5mrARX8sGQZdehH2dAqPDAOoKQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD Date: Fri, 28 Aug 2020 09:40:07 +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: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ubizjak at gmail dot com X-Bugzilla-Target-Milestone: 8.5 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Aug 2020 09:40:07 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96793 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |glisse at gcc dot gnu.org --- Comment #10 from Richard Biener --- (In reply to Uro=C5=A1 Bizjak from comment #7) > Created attachment 49144 [details] > Proposed patch >=20 > Patch in testing. OTOH we _do_ try to compensate for HONOR_SIGNED_ZEROS so I wonder whether we really need to punt for -frounding-math? I also doubt glibc gets it correct, does it? I guess /* Compensate: xa =3D xa - (xa > operand1 ? 1 : 0) */ tmp =3D ix86_expand_sse_compare_mask (UNGT, xa, res, !do_floor); emit_insn (gen_rtx_SET (tmp, gen_rtx_AND (mode, one, tmp))); tmp =3D expand_simple_binop (mode, do_floor ? MINUS : PLUS, xa, tmp, NULL_RTX, 0, OPTAB_DIRECT); might be in error for FE_DOWNWARD if 0 - 0 behaves differently depending on rounding mode... or the compensation is off if (HONOR_SIGNED_ZEROS (mode)) ix86_sse_copysign_to_positive (res, res, force_reg (mode, operand1), ma= sk);=