From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DAF553858022 for ; Mon, 17 Oct 2022 13:07:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DAF553858022 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666012034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=69bLkAyhlLQ9k3t2IXBkyCizERT3vRm9tue4eqcqjdA=; b=V9aTzpWMOecrUqmc3ErDat8iYYBhyrpIOIqrg94k/alZqrNCR6bb7MF+/Yt66QANPtLwks uio2DcNPmwRI/fGvHqQ41eeB8FUTbusUCP7WmTBLxW1Z0fhgX4kZ3kg+MBCmhdL+4gXt5w F+GrK+XQKA0C11pcHiBGSZQMPhwBDAc= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-411-Z-TyN5FzMBmXJfB0lnAO8g-1; Mon, 17 Oct 2022 09:07:12 -0400 X-MC-Unique: Z-TyN5FzMBmXJfB0lnAO8g-1 Received: by mail-qk1-f198.google.com with SMTP id t1-20020a05620a450100b006ee79ceeb6fso9453843qkp.11 for ; Mon, 17 Oct 2022 06:07:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=69bLkAyhlLQ9k3t2IXBkyCizERT3vRm9tue4eqcqjdA=; b=RSftUsJdOSiIigxaApd6J7uF7M+VPAXgbBFgqtdU5sMOV8A1MW5mGoR4uA68LQSL3O iWizFa+00pJ6IPhH9WQ8N3wEpytgHttijXwyGfuyLHzOTG4dLgLvje/tVLzAdpU2zSV1 MVGNWsSBJkcjwZbEJW2H0dTQrTmwy96RJtJRr4q/8WKgsEQU1XTshMueO/sCqSS1tj2U P8GyWqjzsJOd+sDM1AeClql2bWUBiEAn9z3UFgQFYErv/i80XCnFcYn54MT3StmfFXd+ hCRXfDrZpvxwWXubb1XzkFkx02FkXUusv0McZrGkkHRyU0egkVn5eonctNiSQSGpNsRo kBDg== X-Gm-Message-State: ACrzQf3bYskRIcl+W9mbcTovIukwnVdGGV1AiBl1UEjSxrI9E+iTLT/K CAVS+YEKog/FhhP0/xiGDYv+7uEmzwnS+BUp+zkhxynqAu08IC5LAidlvls2EhERwWjjhdUzPX3 uy7/d4EKbHOg0+BQy9gbiahuPOGpKFyI= X-Received: by 2002:a05:622a:19a0:b0:39c:ba70:e475 with SMTP id u32-20020a05622a19a000b0039cba70e475mr8487193qtc.50.1666012031783; Mon, 17 Oct 2022 06:07:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Kkr722NDxRSOilVDUGqaP755JLCAqChWOOgqUOkDblTZMIPZUlbpLyG3TVx6dsgxC1g2d+OcNZdC8we3bPJ4= X-Received: by 2002:a05:622a:19a0:b0:39c:ba70:e475 with SMTP id u32-20020a05622a19a000b0039cba70e475mr8487169qtc.50.1666012031551; Mon, 17 Oct 2022 06:07:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Mon, 17 Oct 2022 14:07:00 +0100 Message-ID: Subject: Re: [RFC PATCH] libstdc++, v2: Partial library support for std::float{16,32,64,128}_t To: Jakub Jelinek Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sun, 16 Oct 2022 at 11:23, Jakub Jelinek wrote: > > Hi! > > As the __bf16 support is now in at least on x86_64/i686, I've > updated my patch to cover bfloat16_t as well and implemented almost > everything for - the only thing missing I'm aware of is > std::nextafter std::float16_t and std::bfloat16_t overloads (I think > we probably need to implement that out of line somewhere, or inline? - might > need inline asm barriers) and std::nexttoward overloads (those are > intentional, you said there is a LWG issue about that). Yes, that's now https://cplusplus.github.io/LWG/issue3790 The current proposed resolution is to just restore the C++20 functions and not provide anything for the new types. > If you want to have done in a different way, e.g. the patch > groups a lot of different function overloads by the floating point type, > is that ok or do you want to have them one function at a time for all types, > then next? No, I think this way makes more sense. Otherwise the line count in the file will baloon with all the repeated #if #endif directives. The only comment I have about the changes is that I think all the new functions should be just 'constexpr' not 'inline _GLIBCXX_CONSTEXPR'. The __STDCPP_FLOATN__ macros are only defined for C++23, right? So _GLIBCXX_CONSTEXPR is always just 'constexpr' (it's only something different for C++98), and that already implies 'inline' too. So just: constexpr _Float16 log10(_Float16 __x) { return _Float16(__builtin_log10f(__x)); } > I could try to handle too, but am kind of lost there. > The paper dropped the explicit std::complex specializations, can they stay > around as is and should new overloads be added for the > _Float*/__gnu_cxx::__bfloat16_t types? The explicit specializations can stay, they do no harm. I think to handle the new FP types we can modify the primary template as shown in P1467. I don't think we'll need to add any new function overloads for the new types. I can take care of the changes. > And I/O etc. support is missing, not sure I'm able to handle that and if it > is e.g. possible to keep that support out of libstdc++.so.6, because what > extended floating point types one has on a particular arch could change over > time (I mean e.g. bfloat16_t support or float16_t support can be added > etc.). Yes, I think we can add the I/O functions as always_inline because all they're going to do is convert the argument to float, double, or long double and then call the existing overloads. There will be no new virtual functions. I can take care of that too. > --- libstdc++-v3/include/bits/c++config.jj 2022-05-23 21:44:49.082847038 +0200 > +++ libstdc++-v3/include/bits/c++config 2022-10-14 22:32:55.411346463 +0200 > @@ -1,4 +1,4 @@ > -// Predefined symbols and macros -*- C++ -*- > + // Predefined symbols and macros -*- C++ -*- This whitespace change looks accidental. Apart from that and simplifying 'inline _GLIBCXX_CONSTEXPR' to just 'constexpr' this looks good for trunk.