From patchwork Fri Aug 18 22:49:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1823198 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=woL3fD+7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RSHDJ4dLzz1ygW for ; Sat, 19 Aug 2023 08:51:28 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED53738A908D for ; Fri, 18 Aug 2023 22:51:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED53738A908D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692399085; bh=cyQy3bSWGJr3KdrEXGMtUeOuZiYbKBPZuPhVIXb0PA4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=woL3fD+7hvSEsSMDTGO5fcgyle8xCMLQwNHzWNVoZxfu5OBTPNTf3YS2l/yJMIPy9 o9IMtKsx7/7RPaANmY3wSziT6nyQ01PDp7qViqoptmrXM5Xdr4jyNfHtb9fNbfZY4H k0OFT9YDli9WeKXAIioDGiNbFl3fQy/HRLC4nr4w= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 56A12389942F for ; Fri, 18 Aug 2023 22:50:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 56A12389942F Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-iCbd_ydvNae0kiTBc2ppOQ-1; Fri, 18 Aug 2023 18:50:27 -0400 X-MC-Unique: iCbd_ydvNae0kiTBc2ppOQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18AB785CCE0; Fri, 18 Aug 2023 22:50:27 +0000 (UTC) Received: from localhost (unknown [10.42.28.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7B4F140E96E; Fri, 18 Aug 2023 22:50:26 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Revert pre-C++23 support for 16-bit float types [PR111060] Date: Fri, 18 Aug 2023 23:49:56 +0100 Message-ID: <20230818225026.1399063-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux (--with-arch-32=i686). Pushed to trunk. -- >8 -- In r14-3304-g1a566fddea212a and r14-3305-g6cf214b4fc97f5 I tried to enable std::format for 16-bit float types before C++23. This causes errors for targets where the types are defined but can't actually be used, e.g. i686 without sse2. Make the std::numeric_limits and std::formatter specializations for _Float16 and __bfloat16_t depend on the __STDCPP_FLOAT16_T__ and __STDCPP_BFLOAT16_T__ macros again, so they're only defined for C++23 when the type is fully supported. This is OK because the main point of my earlier commits was to add better support for _Float32 and _Float64. It seems fine for the new 16-bit types to only be supported for C++23, as they were never present before GCC 13 anyway. libstdc++-v3/ChangeLog: PR target/111060 * include/std/format (formatter): Only define specializations for 16-bit floating-point types for C++23. * include/std/limits (numeric_limits): Likewise. --- libstdc++-v3/include/std/format | 4 ++-- libstdc++-v3/include/std/limits | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index 648f847ad96..f3d9ae152f9 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -2083,7 +2083,7 @@ namespace __format }; #endif -#if defined(__FLT16_DIG__) +#ifdef __STDCPP_FLOAT16_T__ // Reuse __formatter_fp::format for _Float16. template<__format::__char _CharT> struct formatter<_Float16, _CharT> @@ -2171,7 +2171,7 @@ namespace __format }; #endif -#if defined(__BFLT16_DIG__) +#ifdef __STDCPP_BFLOAT16_T__ // Reuse __formatter_fp::format for bfloat16_t. template<__format::__char _CharT> struct formatter<__gnu_cxx::__bfloat16_t, _CharT> diff --git a/libstdc++-v3/include/std/limits b/libstdc++-v3/include/std/limits index 7a59e7520eb..ec0b7a1ca7b 100644 --- a/libstdc++-v3/include/std/limits +++ b/libstdc++-v3/include/std/limits @@ -1982,7 +1982,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION = round_to_nearest; \ }; \ -#ifdef __FLT16_DIG__ +#ifdef __STDCPP_FLOAT16_T__ __glibcxx_float_n(16) #endif #ifdef __FLT32_DIG__ @@ -2002,7 +2002,7 @@ __glibcxx_float_n(128) # undef __max_digits10 #endif -#ifdef __BFLT16_DIG__ +#ifdef __STDCPP_BFLOAT16_T__ __extension__ template<> struct numeric_limits<__gnu_cxx::__bfloat16_t> @@ -2079,7 +2079,7 @@ __glibcxx_float_n(128) static _GLIBCXX_USE_CONSTEXPR float_round_style round_style = round_to_nearest; }; -#endif +#endif // __STDCPP_BFLOAT16_T__ #if defined(_GLIBCXX_USE_FLOAT128) // We either need Q literal suffixes, or IEEE double.