From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 21E4D3858D20; Sun, 21 May 2023 15:00:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21E4D3858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684681231; bh=nYFnQGtpiQdcf4wl6lSp2hEILZQef9SmlztJFLwKYAk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=R6NPa59DWoTIFBpKwKs2EDYL++ngPapjTzPcfeqpBQYYJgqyvKjsxOwbf8LcmXfmz uOFYyt8gPJortrmCs3nroIpbUnLDc/5//4dAjO5W3nTHpFK97EbDRaQU5ZekbEzS1G TgE5tQ3HjOqcBRizv9CzOrVwliCJxeKIaUWzw8/w= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109924] missing __builtin_nanf16b Date: Sun, 21 May 2023 15:00:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109924 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek --- Why do you need that? The std::bfloat16_t builtins are intentionally limited to only what is real= ly required, there is no support in libc for that type whatever and only minim= um needed in libgcc. A quiet NaN can be created as (decltype (0.0bf16)) __builtin_nanf ("") etc. The reason there is __builtin_nansf16b builtin is that the above doesn't re= ally work for signalling NaNs, as on the cast an exception is emitted and the sN= aN turned into a qNaN. Similarly, there is __builtin_nextafterf16b builtin so that this operation = can be folded for constexpr. Most other operations on bfloat16_t as can be see= n on the libstdc++ implementation or even what gcc emits for such arithmetics on= the type is promote to std::float32_t, perform operation in the wider mode and = then cast back (and the fact that the compiler implements excess precision for t= hat type).=