From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34835 invoked by alias); 28 Aug 2019 15:41:51 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 34824 invoked by uid 89); 28 Aug 2019 15:41:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=enforce, HTo:U*joel, bsd3clause, BSD3Clause X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Aug 2019 15:41:49 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 546EC307D84D; Wed, 28 Aug 2019 15:41:48 +0000 (UTC) Received: from calimero.vinschen.de (ovpn-116-213.ams2.redhat.com [10.36.116.213]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F108C5D70D; Wed, 28 Aug 2019 15:41:47 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 9F73DA804B1; Wed, 28 Aug 2019 17:41:46 +0200 (CEST) Date: Wed, 28 Aug 2019 15:41:00 -0000 From: Corinna Vinschen To: joel@rtems.org Cc: newlib@sourceware.org Subject: Re: [PATCH 3/3] Add i386 and x86_64 fenv support from Cygwin. Message-ID: <20190828154146.GP11632@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: joel@rtems.org, newlib@sourceware.org References: <1567004819-5473-1-git-send-email-joel@rtems.org> <1567004819-5473-4-git-send-email-joel@rtems.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="spcZW7qGO+dl6Mj8" Content-Disposition: inline In-Reply-To: <1567004819-5473-4-git-send-email-joel@rtems.org> User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019/txt/msg00526.txt.bz2 --spcZW7qGO+dl6Mj8 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 3827 On Aug 28 10:06, joel@rtems.org wrote: > From: Joel Sherrill >=20 > --- > newlib/libc/machine/i386/sys/fenv.h | 1 + > newlib/libc/machine/x86_64/sys/fenv.h | 150 ++++++++++ > newlib/libm/machine/i386/Makefile.am | 2 +- > newlib/libm/machine/i386/fenv.c | 1 + > newlib/libm/machine/x86_64/Makefile.am | 18 ++ > newlib/libm/machine/x86_64/fenv.c | 485 +++++++++++++++++++++++++++= ++++++ > 6 files changed, 656 insertions(+), 1 deletion(-) > create mode 120000 newlib/libc/machine/i386/sys/fenv.h > create mode 100644 newlib/libc/machine/x86_64/sys/fenv.h > create mode 120000 newlib/libm/machine/i386/fenv.c > create mode 100644 newlib/libm/machine/x86_64/Makefile.am > create mode 100644 newlib/libm/machine/x86_64/fenv.c >=20 > diff --git a/newlib/libc/machine/i386/sys/fenv.h b/newlib/libc/machine/i3= 86/sys/fenv.h > new file mode 120000 > index 0000000..2180578 > --- /dev/null > +++ b/newlib/libc/machine/i386/sys/fenv.h > @@ -0,0 +1 @@ > +../../x86_64/sys/fenv.h > \ No newline at end of file > diff --git a/newlib/libc/machine/x86_64/sys/fenv.h b/newlib/libc/machine/= x86_64/sys/fenv.h > new file mode 100644 > index 0000000..69f7bef > --- /dev/null > +++ b/newlib/libc/machine/x86_64/sys/fenv.h > @@ -0,0 +1,150 @@ > +/* fenv.h > + > +This file is part of Cygwin. > + > +This software is a copyrighted work licensed under the terms of the > +Cygwin license. Please consult the file "CYGWIN_LICENSE" for > +details. */ SPDX-License-Identifier: BSD-2-Clause not BSD-3-Clause as I wrote in other mail. > +/* The header shall define the following constant, which > + represents the default floating-point environment (that is, the one > + installed at program startup) and has type pointer to const-qualified > + fenv_t. It can be used as an argument to the functions within the > + header that manage the floating-point environment. */ > + > +extern const fenv_t *_fe_dfl_env; > +#define FE_DFL_ENV (_fe_dfl_env) These can go away, right? They are already defined in newlib/libc/include/sys/fenv.h. > +#if __GNU_VISIBLE > +/* If possible, the GNU C Library defines a macro FE_NOMASK_ENV which > + represents an environment where every exception raised causes a trap > + to occur. You can test for this macro using #ifdef. It is only defined > + if _GNU_SOURCE is defined. */ > +extern const fenv_t *_fe_nomask_env; > +#define FE_NOMASK_ENV (_fe_nomask_env) > +#endif /* __GNU_VISIBLE */ And those you just added to newlib/libc/include/sys/fenv.h in patch 2 of this set. > +/* These are writable so we can initialise them at startup. */ > +static fenv_t fe_nomask_env; > + > +/* These pointers provide the outside world with read-only access to the= m. */ > +const fenv_t *_fe_nomask_env =3D &fe_nomask_env; Given these are now declared in a shared header, shouldn't these be added to their own file, newlib/libm/fenv/fe_nomask_env.c parallel to newlib/libm/fenv/fe_dfl_env.c? > +/* Although Cygwin assumes i686 or above (hence SSE available) these Please drop Cygwin-specific comments. They just don't make sense in common newlib code, except in rare cases to explain a difference to other targets. > [...] > +#if defined(__CYGWIN__) Great. > +/* Returns the currently selected precision, represented by one of the > + values of the defined precision macros. */ > +int > +fegetprec (void) > +{ > [...] > +int > +fesetprec (int prec) > +{ > [...] > +#endif Uh oh. What about _feinitialise()? Cygwin calls this function right from the initial code, but is it really the right thing to enforce this for all i386/x86_64 targets? Any idea how we can generate the default environment on the fly while maintaining backward compat on Cygwin? Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --spcZW7qGO+dl6Mj8 Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl1moLoACgkQ9TYGna5E T6CZnQ/+Ib1ktxcchLH3cipP34xVcr6TavukIcMTy6tEdFRmcp94OIwFJ5veNp/n lIvTVyN/O37XUU61NAb5ox2ZLE1iYbuz6rWHjtX/Hb+9nrRuoIuG5+NHs8z32zok 5z+qBNbS9t1d6t61Y7hzRuXQyjkYSvToIgU14C0KwVpvoV2zcwfT9v2vRffaLxAT KHGhxGKKuc6k8b13XO9hwlNyTAZPGeDMcZJC/v6N79wUg2tQt8XgLdGvzy/e4hgt ckXHusduD+ZH3zRLQmwfgEVVfkYfD983efIGG3xkonbgdN+Z/+rO4Ue9bNrtzsYi 37Q6IyDM6EAv7uVsChzl57Wy8fd7xJG/66SdfUc/BMPWaHbZTpx5Eto/NTf8JmRJ bMKauQi0ec/2NcrLLgwuVIePeAPBpCPDPcRTwKr1VL5VRUo6KdSQkTkXm4/nPluX RLhjp/zSCAWyDt++tY0Ze50EsQrUdXdndHrMocRIgg3Q2/gBh62mUK5hcJSxHU1P XoxVtDihyx+ifcsI+pxhxvhn6lYCQ/wFWUM0F2AnCOXcw2RrhSFGaGANNoUaJUof 1lIJAykfwrudhyH+HQkcVAy3XVLLrVqyPlXNEldH9KvWhrssNovJGFJ6Vi09V/wh qLllFuvark6Ra9J1vmPucBFAbohFmaufS/QjAXw6N0/aKfl01mU= =4vo0 -----END PGP SIGNATURE----- --spcZW7qGO+dl6Mj8--