From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 17BB53858C98; Mon, 18 Mar 2024 09:08:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17BB53858C98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710752913; bh=G0g9r2R0NDf1TD763HfEyzvvtxj2z+03cqLRT3XRqS4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RAeP8OYS8vDGLZV6l4VBXiDR5c5uNxH+ewqiYExbZTshcR/p/RXP8C11REivOR/f4 bn34CcFdOZVOzb+gKT/i18tk9zDjPE/zMiYmRALM3QK4U0Lxzf2fFjOzG48chgcuzo fWRNMqDS3wEm6T9cK6IrWb2HnCBjSXVW4h8J95rM= From: "liuhongt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114347] wrong constant folding when casting __bf16 to int Date: Mon, 18 Mar 2024 09:08:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: liuhongt at gcc dot gnu.org 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: 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=3D114347 --- Comment #9 from Hongtao Liu --- (In reply to Richard Biener from comment #7) > (In reply to Jakub Jelinek from comment #6) > > You can use -fexcess-precision=3D16 if you don't want treating _Float16= and > > __bf16 as having excess precision. With excess precision, I think the = above > > behavior is correct. > > You'd need (int) (__bf16) 257.0bf16 to get 256 even with excess precisi= on. >=20 > Ah, -fexcess-precision=3D16 doesn't seem to be documented though (how does > this influence long double handling then?) Oh, I forgot to add that in invoke.texi. -fexcess-precision=3D16 doesn't impact types with precision > 16. And it's = not compatible with -mfpmath=3D387.=