From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 010B03858C98; Mon, 18 Mar 2024 08:53:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 010B03858C98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1710751990; bh=/KVIViyKtDTWTNTIj3txfooRNn7iyWsieLp3eka4g1I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=yTSj/Lnz34FFCzi7Bs7kWquF9ooX1oTmK5YSRMRLecJRgypV6BGoFuHAOISkyFhyg vu1AJjMEaAqSHgOwIQHgAkZ7NMj46LXRcCDwcxDW6HMSOuS3sSbtDtbQEskTFJ/vpR tCK2h7WS26Zto3rS+nd6rdXG2o5fi9e4lTg1z4GY= From: "rguenth 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 08:53:09 +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: rguenth 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 #7 from Richard Biener --- (In reply to Jakub Jelinek from comment #6) > You can use -fexcess-precision=3D16 if you don't want treating _Float16 a= nd > __bf16 as having excess precision. With excess precision, I think the ab= ove > behavior is correct. > You'd need (int) (__bf16) 257.0bf16 to get 256 even with excess precision. Ah, -fexcess-precision=3D16 doesn't seem to be documented though (how does this influence long double handling then?)=