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 3691F384D191 for ; Fri, 26 Aug 2022 20:45:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3691F384D191 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=1661546743; h=from:from: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=LawkiyIbXDLWN9T+oL4r8LAAmVuuLiMo4szJp10lrPE=; b=ZaOQjvrfL/BJpz7i/yyDFJsIjrWTTQ96LdXyBqsGnZPXdP02gwMKTW9mbA9SDwO7PYmlqX 5P9mqWpcX868uBEmEhATR+/9Qm4+yx+pFoCxoDeiRFq92fi7OKvaOZdmuOS50HYEHb9Bj7 21a7DJVjbuVSI0uEA4/tJMmpcH5h+UQ= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-500-bF8scnzcP3iVk0F59KvOxg-1; Fri, 26 Aug 2022 16:45:42 -0400 X-MC-Unique: bF8scnzcP3iVk0F59KvOxg-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-33dce8cae71so42717007b3.8 for ; Fri, 26 Aug 2022 13:45:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc; bh=LawkiyIbXDLWN9T+oL4r8LAAmVuuLiMo4szJp10lrPE=; b=vM3mlkbRymeHCePvCum7ZCpOEsVle9n9mZNeW9Qm2lbnGnlrqO/h5ewptEvv7qGd3Y xoI2amtesqqEbrRrljPyV0W+kGrCc2ZqoOvgB0UcNvDBuOg6gFqTqhU6B2wzJ+b0y84r RWs1eKAjPxW6+UNJHzx1ZX4QnVMywx+hdQgspXJ2rUMxBoSpzbeh1mzpMFaXWR9sP8P6 0G9qx4vGdmSaBPRQYQTcO/S2A6x/GZeDf7otatd/pK3t2MoF7QF8Gd4A1whf6EyX1W7j cQEpHPIptnqVG0qmhI73AjrDWCduk+9dqus08Lo2jlV7CxowAh9TzT74NHgdqi5wxZou 3GCw== X-Gm-Message-State: ACgBeo2g/e7+6+St6Hjba19oDFwl9MSDupq+yKWxOoCA+TYgpKRxkxda ISRrlcx9ApRcZAtlsClmwDTrmKxK+xLBZVZKEPrhcrJHFSCanVsTCZNoDyQz1pBjn1a9oOJMQwR awIflijXbHQ+XRPSe9kwbpH8aK/T4P2k= X-Received: by 2002:a25:c613:0:b0:695:ea5e:5303 with SMTP id k19-20020a25c613000000b00695ea5e5303mr1567221ybf.156.1661546741745; Fri, 26 Aug 2022 13:45:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR7GMZjXNXBzxchrzFsQ6kBPfGd3hbrGm43TMjJCJnGS/XJMFSnes/08zrs2LJ/UF+tPq+TpXz05Jyw8C17h6VE= X-Received: by 2002:a25:c613:0:b0:695:ea5e:5303 with SMTP id k19-20020a25c613000000b00695ea5e5303mr1567203ybf.156.1661546741492; Fri, 26 Aug 2022 13:45:41 -0700 (PDT) MIME-Version: 1.0 References: <20220822225022.32209-1-joel@rtems.org> In-Reply-To: From: Jeff Johnston Date: Fri, 26 Aug 2022 16:45:30 -0400 Message-ID: Subject: Re: [PATCH newlib v1 0/4] Add FreeBSD long double functions To: Newlib X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Fri, 26 Aug 2022 20:45:46 -0000 On Fri, Aug 26, 2022 at 1:45 PM Corinna Vinschen wrote: > On Aug 26 10:45, Joel Sherrill wrote: > > On Fri, Aug 26, 2022 at 10:05 AM Corinna Vinschen > > wrote: > > > No, I wrote, create a *single* _fpmath.h file with the massive amount > > > of definitions (*all* seven) based on LDBL_MANT_DIG. > > > > > > There are very few special targets, like x86/x86_64 which need a tweak > > > in the macros, most of the time the macros should be the same. > > > > > > Instead of having 61 files, only have one. In theory there should be > > > only two definitions for targets with LDBL_MANT_DIG == DBL_MANT_DIG > > > to support little and big endian, more shouldn't be required. > > > > > > For all others, we already have *ieee*.h files with matching > definitions > > > which can be used as role models for the various (but few) definitions > of > > > union IEEEl2bits. See, for instance, > newlib/libc/include/machine/ieee.h. > > > > > > > This approach works and doesn't abandon the targets which the > > > > ldbl==dbl method works for. > > > > > > I never said to abandon these targets, but fwiw, I think you're > > > overestimating the complexity to generate a single _fpmath.h > > > file with matching definitions for these targes as well. The > > > information is basically already present in newlib. > > > > > So don't preserve the FreeBSD files as close to a direct copy > > as possible? > > We're only talking about the _fpmath.h files, not all the other > files. > > If you like, copy over the handful of target-dependent _fpmath.h > files, but *also* add a generic _fpmath.h file for all other > targets, IMHO. > > > Maybe I am overestimating it. I just don't see the single _fpmath.h > > to rule them all with confidence like you do. I am not seeing the > > set of parameters in my head which makes this generic with > > some macros. > > > > I'd appreciate help on this. > > newlib/libc/include/machine/ieee.h does not help? > > Kind of like this: > > #if LDBL_MANT_DIG == 24 > union IEEEl2bits { > long double e; > # ifdef __IEEE_LITTLE_ENDIAN > struct { > __uint32_t manl :16; > __uint32_t manh :7; > __uint32_t exp :8; > __uint32_t sign :1; > } bits; > struct { > __uint32_t manl :16; > __uint32_t manh :7; > __uint32_t expsign :9; > } xbits; > # else > struct { > __uint32_t sign :1; > __uint32_t exp :8; > __uint32_t manh :7; > __uint32_t manl :16; > } bits; > struct { > __uint32_t expsign :9; > __uint32_t manh :7; > __uint32_t manl :16; > } xbits; > # endif > }; > # define LDBL_NBIT 0 > # define LDBL_IMPLICIT_NBIT > # define mask_nbit_l(u) ((void)0) > > # define LDBL_MANH_SIZE 7 > # define LDBL_MANL_SIZE 16 > > # define LDBL_TO_ARRAY32(u, a) do { \ > (a)[0] = (uint32_t)(u).bits.manl \ > | ((uint32_t)(u).bits.manh << LDBL_MANL_SIZE) \ > (a)[1] = 0; \ > } while(0) > #elif LDBL_MANT_DIG == 53 > union IEEEl2bits { > long double e; > # ifdef __IEEE_LITTLE_ENDIAN > struct { > __uint64_t manl :32; > __uint64_t manh :20; > __uint64_t exp :11; > __uint64_t sign :1; > } bits; > struct { > __uint64_t manl :32; > __uint64_t manh :20; > __uint64_t expsign :12; > } xbits; > # else > struct { > __uint64_t sign :1; > __uint64_t exp :11; > __uint64_t manh :20; > __uint64_t manl :32; > } bits; > struct { > __uint64_t expsign :12; > __uint64_t manh :20; > __uint64_t manl :32; > } xbits; > # endif > }; > # define LDBL_NBIT 0 > # define LDBL_IMPLICIT_NBIT > # define mask_nbit_l(u) ((void)0) > > # define LDBL_MANH_SIZE 20 > # define LDBL_MANL_SIZE 32 > > # define LDBL_TO_ARRAY32(u, a) do { \ > (a)[0] = (uint32_t)(u).bits.manl; \ > (a)[1] = (uint32_t)(u).bits.manh; \ > } while(0) > #elif LDBL_MANT_DIG == 64 > union IEEEl2bits { > long double e; > # ifdef __IEEE_LITTLE_ENDIAN > struct { > __uint64_t manl :32; > __uint64_t manh :32; > __uint64_t exp :15; > __uint64_t sign :1; > __uint64_t junk :16 > } bits; > struct { > __uint64_t man :64; > __uint64_t expsign :16; > __uint64_t junk :16 > } xbits; > # else > struct { > __uint64_t junk :16 > __uint64_t sign :1; > __uint64_t exp :15; > __uint64_t manh :32; > __uint64_t manl :32; > } bits; > struct { > __uint64_t junk :16 > __uint64_t expsign :16; > __uint64_t man :64; > } xbits; > # endif > }; > > # define LDBL_NBIT 0x80000000 > # define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT) > > # define LDBL_MANH_SIZE 32 > # define LDBL_MANL_SIZE 32 > > # define LDBL_TO_ARRAY32(u, a) do { \ > (a)[0] = (uint32_t)(u).bits.manl; \ > (a)[1] = (uint32_t)(u).bits.manh; \ > } while(0) > #elif LDBL_MANT_DIG == 113 > union IEEEl2bits { > long double e; > # ifdef __IEEE_LITTLE_ENDIAN > struct { > __uint64_t manl :64; > __uint64_t manh :48; > __uint64_t exp :15; > __uint64_t sign :1; > } bits; > struct { > __uint64_t manl :64; > __uint64_t manh :48; > __uint64_t expsign :16; > } xbits; > # else > struct { > __uint64_t sign :1; > __uint64_t exp :15; > __uint64_t manh :48; > __uint64_t manl :64; > } bits; > struct { > __uint64_t expsign :16; > __uint64_t manh :48; > __uint64_t manl :64; > } xbits; > # endif > }; > > # define LDBL_NBIT 0 > # define LDBL_IMPLICIT_NBIT > # define mask_nbit_l(u) ((void)0) > > # define LDBL_MANH_SIZE 48 > # define LDBL_MANL_SIZE 64 > > # define LDBL_TO_ARRAY32(u, a) do { \ > (a)[0] = (uint32_t)(u).bits.manl; \ > (a)[1] = (uint32_t)((u).bits.manl >> 32); \ > (a)[2] = (uint32_t)(u).bits.manh; \ > (a)[3] = (uint32_t)((u).bits.manh >> 32); \ > } while(0) > #endif > > There's also a ___IEEE_BYTES_LITTLE_ENDIAN definition which I ignored > for now. Also, the LDBL_MANT_DIG == 64 is defined for x86-only and the > manl/manh fields for LDBL_MANT_DIG == 23 are faked on a 16 bit border > just to have a manl and a manh definition. > > I don't claim that it works OOTB with the above, but apart from > the LDBL_NBIT/mask_nbit_l values which differ for x86/x86_64 CPUs, > it should be a good start, I think. > > > > Jeff, ping? Your POV would be much appreciated here. > > > > Sorry for the late reply. I agree with your proposal Corinna. > > > +1 > > > > I also have come across there needs to be a way to pick between ld80 > > and ld128 headers and implementation files. FreeBSD has them in > > separate directories. Apparently their build system builds common > > plus an architecture specific _fpmath.h and a choice of ld80/ld128 > > which adds at least two other header files > > But then again, FreeBSD supports ARM and PowerPC, both of which come > with 64 bit long double. So, besides ld80/ld128, there's apparently a > generic implementation, too, to support non-ld80 and non-ld128 long > double, right? > > > Corinna > > 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 3691F384D191 for ; Fri, 26 Aug 2022 20:45:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3691F384D191 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=1661546743; h=from:from: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=LawkiyIbXDLWN9T+oL4r8LAAmVuuLiMo4szJp10lrPE=; b=ZaOQjvrfL/BJpz7i/yyDFJsIjrWTTQ96LdXyBqsGnZPXdP02gwMKTW9mbA9SDwO7PYmlqX 5P9mqWpcX868uBEmEhATR+/9Qm4+yx+pFoCxoDeiRFq92fi7OKvaOZdmuOS50HYEHb9Bj7 21a7DJVjbuVSI0uEA4/tJMmpcH5h+UQ= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-500-bF8scnzcP3iVk0F59KvOxg-1; Fri, 26 Aug 2022 16:45:42 -0400 X-MC-Unique: bF8scnzcP3iVk0F59KvOxg-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-33dce8cae71so42717007b3.8 for ; Fri, 26 Aug 2022 13:45:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc; bh=LawkiyIbXDLWN9T+oL4r8LAAmVuuLiMo4szJp10lrPE=; b=vM3mlkbRymeHCePvCum7ZCpOEsVle9n9mZNeW9Qm2lbnGnlrqO/h5ewptEvv7qGd3Y xoI2amtesqqEbrRrljPyV0W+kGrCc2ZqoOvgB0UcNvDBuOg6gFqTqhU6B2wzJ+b0y84r RWs1eKAjPxW6+UNJHzx1ZX4QnVMywx+hdQgspXJ2rUMxBoSpzbeh1mzpMFaXWR9sP8P6 0G9qx4vGdmSaBPRQYQTcO/S2A6x/GZeDf7otatd/pK3t2MoF7QF8Gd4A1whf6EyX1W7j cQEpHPIptnqVG0qmhI73AjrDWCduk+9dqus08Lo2jlV7CxowAh9TzT74NHgdqi5wxZou 3GCw== X-Gm-Message-State: ACgBeo2g/e7+6+St6Hjba19oDFwl9MSDupq+yKWxOoCA+TYgpKRxkxda ISRrlcx9ApRcZAtlsClmwDTrmKxK+xLBZVZKEPrhcrJHFSCanVsTCZNoDyQz1pBjn1a9oOJMQwR awIflijXbHQ+XRPSe9kwbpH8aK/T4P2k= X-Received: by 2002:a25:c613:0:b0:695:ea5e:5303 with SMTP id k19-20020a25c613000000b00695ea5e5303mr1567221ybf.156.1661546741745; Fri, 26 Aug 2022 13:45:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR7GMZjXNXBzxchrzFsQ6kBPfGd3hbrGm43TMjJCJnGS/XJMFSnes/08zrs2LJ/UF+tPq+TpXz05Jyw8C17h6VE= X-Received: by 2002:a25:c613:0:b0:695:ea5e:5303 with SMTP id k19-20020a25c613000000b00695ea5e5303mr1567203ybf.156.1661546741492; Fri, 26 Aug 2022 13:45:41 -0700 (PDT) MIME-Version: 1.0 References: <20220822225022.32209-1-joel@rtems.org> In-Reply-To: From: Jeff Johnston Date: Fri, 26 Aug 2022 16:45:30 -0400 Message-ID: Subject: Re: [PATCH newlib v1 0/4] Add FreeBSD long double functions To: Newlib X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000004dfeee05e72aff70" X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,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 List-Id: Message-ID: <20220826204530.PrMK4oD9n84tF-BOcQdX8ukH20_HvNu5eGnjL0l5bXc@z> --0000000000004dfeee05e72aff70 Content-Type: text/plain; charset="UTF-8" On Fri, Aug 26, 2022 at 1:45 PM Corinna Vinschen wrote: > On Aug 26 10:45, Joel Sherrill wrote: > > On Fri, Aug 26, 2022 at 10:05 AM Corinna Vinschen > > wrote: > > > No, I wrote, create a *single* _fpmath.h file with the massive amount > > > of definitions (*all* seven) based on LDBL_MANT_DIG. > > > > > > There are very few special targets, like x86/x86_64 which need a tweak > > > in the macros, most of the time the macros should be the same. > > > > > > Instead of having 61 files, only have one. In theory there should be > > > only two definitions for targets with LDBL_MANT_DIG == DBL_MANT_DIG > > > to support little and big endian, more shouldn't be required. > > > > > > For all others, we already have *ieee*.h files with matching > definitions > > > which can be used as role models for the various (but few) definitions > of > > > union IEEEl2bits. See, for instance, > newlib/libc/include/machine/ieee.h. > > > > > > > This approach works and doesn't abandon the targets which the > > > > ldbl==dbl method works for. > > > > > > I never said to abandon these targets, but fwiw, I think you're > > > overestimating the complexity to generate a single _fpmath.h > > > file with matching definitions for these targes as well. The > > > information is basically already present in newlib. > > > > > So don't preserve the FreeBSD files as close to a direct copy > > as possible? > > We're only talking about the _fpmath.h files, not all the other > files. > > If you like, copy over the handful of target-dependent _fpmath.h > files, but *also* add a generic _fpmath.h file for all other > targets, IMHO. > > > Maybe I am overestimating it. I just don't see the single _fpmath.h > > to rule them all with confidence like you do. I am not seeing the > > set of parameters in my head which makes this generic with > > some macros. > > > > I'd appreciate help on this. > > newlib/libc/include/machine/ieee.h does not help? > > Kind of like this: > > #if LDBL_MANT_DIG == 24 > union IEEEl2bits { > long double e; > # ifdef __IEEE_LITTLE_ENDIAN > struct { > __uint32_t manl :16; > __uint32_t manh :7; > __uint32_t exp :8; > __uint32_t sign :1; > } bits; > struct { > __uint32_t manl :16; > __uint32_t manh :7; > __uint32_t expsign :9; > } xbits; > # else > struct { > __uint32_t sign :1; > __uint32_t exp :8; > __uint32_t manh :7; > __uint32_t manl :16; > } bits; > struct { > __uint32_t expsign :9; > __uint32_t manh :7; > __uint32_t manl :16; > } xbits; > # endif > }; > # define LDBL_NBIT 0 > # define LDBL_IMPLICIT_NBIT > # define mask_nbit_l(u) ((void)0) > > # define LDBL_MANH_SIZE 7 > # define LDBL_MANL_SIZE 16 > > # define LDBL_TO_ARRAY32(u, a) do { \ > (a)[0] = (uint32_t)(u).bits.manl \ > | ((uint32_t)(u).bits.manh << LDBL_MANL_SIZE) \ > (a)[1] = 0; \ > } while(0) > #elif LDBL_MANT_DIG == 53 > union IEEEl2bits { > long double e; > # ifdef __IEEE_LITTLE_ENDIAN > struct { > __uint64_t manl :32; > __uint64_t manh :20; > __uint64_t exp :11; > __uint64_t sign :1; > } bits; > struct { > __uint64_t manl :32; > __uint64_t manh :20; > __uint64_t expsign :12; > } xbits; > # else > struct { > __uint64_t sign :1; > __uint64_t exp :11; > __uint64_t manh :20; > __uint64_t manl :32; > } bits; > struct { > __uint64_t expsign :12; > __uint64_t manh :20; > __uint64_t manl :32; > } xbits; > # endif > }; > # define LDBL_NBIT 0 > # define LDBL_IMPLICIT_NBIT > # define mask_nbit_l(u) ((void)0) > > # define LDBL_MANH_SIZE 20 > # define LDBL_MANL_SIZE 32 > > # define LDBL_TO_ARRAY32(u, a) do { \ > (a)[0] = (uint32_t)(u).bits.manl; \ > (a)[1] = (uint32_t)(u).bits.manh; \ > } while(0) > #elif LDBL_MANT_DIG == 64 > union IEEEl2bits { > long double e; > # ifdef __IEEE_LITTLE_ENDIAN > struct { > __uint64_t manl :32; > __uint64_t manh :32; > __uint64_t exp :15; > __uint64_t sign :1; > __uint64_t junk :16 > } bits; > struct { > __uint64_t man :64; > __uint64_t expsign :16; > __uint64_t junk :16 > } xbits; > # else > struct { > __uint64_t junk :16 > __uint64_t sign :1; > __uint64_t exp :15; > __uint64_t manh :32; > __uint64_t manl :32; > } bits; > struct { > __uint64_t junk :16 > __uint64_t expsign :16; > __uint64_t man :64; > } xbits; > # endif > }; > > # define LDBL_NBIT 0x80000000 > # define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT) > > # define LDBL_MANH_SIZE 32 > # define LDBL_MANL_SIZE 32 > > # define LDBL_TO_ARRAY32(u, a) do { \ > (a)[0] = (uint32_t)(u).bits.manl; \ > (a)[1] = (uint32_t)(u).bits.manh; \ > } while(0) > #elif LDBL_MANT_DIG == 113 > union IEEEl2bits { > long double e; > # ifdef __IEEE_LITTLE_ENDIAN > struct { > __uint64_t manl :64; > __uint64_t manh :48; > __uint64_t exp :15; > __uint64_t sign :1; > } bits; > struct { > __uint64_t manl :64; > __uint64_t manh :48; > __uint64_t expsign :16; > } xbits; > # else > struct { > __uint64_t sign :1; > __uint64_t exp :15; > __uint64_t manh :48; > __uint64_t manl :64; > } bits; > struct { > __uint64_t expsign :16; > __uint64_t manh :48; > __uint64_t manl :64; > } xbits; > # endif > }; > > # define LDBL_NBIT 0 > # define LDBL_IMPLICIT_NBIT > # define mask_nbit_l(u) ((void)0) > > # define LDBL_MANH_SIZE 48 > # define LDBL_MANL_SIZE 64 > > # define LDBL_TO_ARRAY32(u, a) do { \ > (a)[0] = (uint32_t)(u).bits.manl; \ > (a)[1] = (uint32_t)((u).bits.manl >> 32); \ > (a)[2] = (uint32_t)(u).bits.manh; \ > (a)[3] = (uint32_t)((u).bits.manh >> 32); \ > } while(0) > #endif > > There's also a ___IEEE_BYTES_LITTLE_ENDIAN definition which I ignored > for now. Also, the LDBL_MANT_DIG == 64 is defined for x86-only and the > manl/manh fields for LDBL_MANT_DIG == 23 are faked on a 16 bit border > just to have a manl and a manh definition. > > I don't claim that it works OOTB with the above, but apart from > the LDBL_NBIT/mask_nbit_l values which differ for x86/x86_64 CPUs, > it should be a good start, I think. > > > > Jeff, ping? Your POV would be much appreciated here. > > > > Sorry for the late reply. I agree with your proposal Corinna. > > > +1 > > > > I also have come across there needs to be a way to pick between ld80 > > and ld128 headers and implementation files. FreeBSD has them in > > separate directories. Apparently their build system builds common > > plus an architecture specific _fpmath.h and a choice of ld80/ld128 > > which adds at least two other header files > > But then again, FreeBSD supports ARM and PowerPC, both of which come > with 64 bit long double. So, besides ld80/ld128, there's apparently a > generic implementation, too, to support non-ld80 and non-ld128 long > double, right? > > > Corinna > > --0000000000004dfeee05e72aff70--