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.133.124]) by sourceware.org (Postfix) with ESMTPS id 1D65E3858D28 for ; Thu, 18 Aug 2022 19:16:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1D65E3858D28 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=1660850201; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=mQTe8W9nBtqPBLOUNETsxIyakjA/3oQVgIQ2jVKaoy0=; b=cRQRCRvwI5Lj5SHoRxJ8S0IhYDIcTXtYd8ERJEg4SVLgm5NMPKylhT2/f0Ryg7CQWAJQ0U t3yKeLMDWNQr+M6pk8XaUkbBWU06vVKjmSCKOssQDNzg04gVTHS/g4yDkL3JtazCVWck2Y WLzHItFQ7MTWCh/MQkwkLXQg3XOzSWI= 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-584-OgfqVg48OgGPjMoHxrSRmg-1; Thu, 18 Aug 2022 15:16:40 -0400 X-MC-Unique: OgfqVg48OgGPjMoHxrSRmg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2302685A585; Thu, 18 Aug 2022 19:16:40 +0000 (UTC) Received: from calimero.vinschen.de (unknown [10.39.193.176]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00DCF2166B26; Thu, 18 Aug 2022 19:16:39 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id E5E25A8072E; Thu, 18 Aug 2022 21:16:37 +0200 (CEST) Date: Thu, 18 Aug 2022 21:16:37 +0200 From: Corinna Vinschen To: Joel Sherrill , newlib@sourceware.org Subject: Re: Revisiting More Complete long double Support Message-ID: Reply-To: newlib@sourceware.org Mail-Followup-To: Joel Sherrill , newlib@sourceware.org References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2022 19:16:43 -0000 On Aug 18 09:49, Joel Sherrill wrote: > On Thu, Aug 18, 2022 at 2:57 AM Corinna Vinschen wrote: > > On Aug 17 17:06, Joel Sherrill wrote: > > > [...] > > > ifdef _LDBL_EQ_DBL > > > long double > > > acosl (long double x) > > > { > > > return acos(x); > > > } > > > #else > > > #include "acosl_freebsd.c" > > > #endif > > > > > > which would definitely avoid edits to the FreeBSD source. > > > > Question is, do we really still need this? > > > > These #ifdef have been added just as a cheap workaround for small > > targets, because nobody provided the actual long double implementations, > > yet. If we merge the actual long double implementations from FreeBSD, > > there's no need for this anymore and we can probably drop the > > _LDBL_EQ_DBL flag entirely. > > I think that's hopeful thinking although I like the idea of importing the > FreeBSD code. I have attached a slightly updated version of the script > I used to probe which targets were _LDBL_EQ_DBL. Two yes'es means > that _LDBL_EQ_DBL implementation is used. Two no's means that > it needs a real long double implementation -- if my script and probe program > are correct. > > has_long_double]$ sh j > TARGET in lib ldbl=dbl > ================= ====== ======== > aarch64-rtems6 no no > arm-rtems6 yes yes > bfin-rtems6 yes yes > i386-rtems6 no no > lm32-rtems6 yes yes > m68k-rtems6 no no > microblaze-rtems6 yes yes > mips-rtems6 yes yes > moxie-rtems6 yes yes > nios2-rtems6 yes yes > or1k-rtems6 yes yes > powerpc-rtems6 yes yes > riscv-rtems6 no no > sh-rtems6 yes yes > sparc64-rtems6 no no > sparc-rtems6 yes yes > v850-rtems6 yes yes > x86_64-rtems6 no no > > Hopefully that aligns ok on your side. Most of the targets seem to be able > to legitimately use the current _LDBL_EQ_DBL implementations. They might be able to use it, but if so, they are only able to do so since 2009. It was really just a cheap trick to allow calling long double functions on targets which don't require a real long double lib. As you may remember, it's not the first time we talk about long double functions... However, if we have a *real*, generic implementation of all long double functions, there's just no need to keep up with the _LDBL_EQ_DBL hackery. > > > (2) More i386 assembly versions > > > > > > Then there appears to be some long double methods for the i386/87 here > > > which newlib doesn't currently have: > > > > > > https://github.com/freebsd/freebsd-src/tree/main/lib/msun/i387 > > > > > > Thoughts on adding this long double code from FreeBSD? > > > > ...and merge the occasional CPU-specific assembler code from > > FreeBSD's lib/msun/ into our libm/machine/ dir, that > > should work nicely. > > > > :) > > I think you've said in the past that Cygwin has these but the > calling conventions are different. Is that something that has to > be taken into account in newlib? No worries. It wouldn't matter for i386, but we dropped 32 bit support in master anyway. For x86_64, Cygwin uses the Windows AMD64 calling convention, so we can't use the assembler functions using the standard calling convention there. As a side note, I added x86_64 assembler memcpy/memset functions from FreeBSD to Cygwin at one point. The code is untouched, I just added wrapper code which reshuffles the arg registers according to the different calling conventions. That could help using the FreeBSD x86_64 long double functions for Cygwin, too, using wrapper macros or something like that. However, the Mingw64 long double functions work nicely for a couple of years, so there's no reason to force this. We're sticking to the Mingw64 functions in Cygwin for the time being. Corinna