From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2134) id 95FAB385C305; Mon, 11 Apr 2022 16:01:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 95FAB385C305 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jeff Johnston To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Aarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2 X-Act-Checkin: newlib-cygwin X-Git-Author: Andrea Corallo X-Git-Refname: refs/heads/master X-Git-Oldrev: 45cfcfbd71a02608db543c2e57371881aad4c0b1 X-Git-Newrev: 27f0913c17c216548b2f5eea79037ee90038f375 Message-Id: <20220411160101.95FAB385C305@sourceware.org> Date: Mon, 11 Apr 2022 16:01:01 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2022 16:01:01 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D27f0913c17c= 216548b2f5eea79037ee90038f375 commit 27f0913c17c216548b2f5eea79037ee90038f375 Author: Andrea Corallo Date: Wed Mar 30 15:40:59 2022 +0200 Aarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2 =20 2022-03-30 Andrea Corallo =20 * libc/include/machine/ieeefp.h (__FLOAT_TYPE, __DOUBLE_TYPE): = New macros. * libc/include/math.h: Uses __DOUBLE_TYPE __FLOAT_TYPE to define double_t float_t if possible. Diff: --- newlib/libc/include/machine/ieeefp.h | 14 ++++++++++++++ newlib/libc/include/math.h | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/mac= hine/ieeefp.h index 3c1f41e03..9bb8af02f 100644 --- a/newlib/libc/include/machine/ieeefp.h +++ b/newlib/libc/include/machine/ieeefp.h @@ -90,6 +90,13 @@ #ifndef __SOFTFP__ # define _SUPPORTS_ERREXCEPT #endif +/* As per ISO/IEC TS 18661 '__FLT_EVAL_METHOD__' will be defined to 16 + (if compiling with +fp16 support) so it can't be used by math.h to + define float_t and double_t. For values of '__FLT_EVAL_METHOD__' + other than 0, 1, 2 the definition of float_t and double_t is + implementation-defined. */ +#define __DOUBLE_TYPE double +#define __FLOAT_TYPE float #endif =20 #if defined (__aarch64__) @@ -102,6 +109,13 @@ #ifdef __ARM_FP # define _SUPPORTS_ERREXCEPT #endif +/* As per ISO/IEC TS 18661 '__FLT_EVAL_METHOD__' will be defined to 16 + (if compiling with +fp16 support) so it can't be used by math.h to + define float_t and double_t. For values of '__FLT_EVAL_METHOD__' + other than 0, 1, 2 the definition of float_t and double_t is + implementation-defined. */ +#define __DOUBLE_TYPE double +#define __FLOAT_TYPE float #endif =20 #ifdef __epiphany__ diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h index 799ac494a..54e30ef82 100644 --- a/newlib/libc/include/math.h +++ b/newlib/libc/include/math.h @@ -168,6 +168,15 @@ extern int isnan (double); #else /* Implementation-defined. Assume float_t and double_t have been * defined previously for this configuration (e.g. config.h). */ + + /* If __DOUBLE_TYPE is defined (__FLOAT_TYPE is then supposed to be + defined as well) float_t and double_t definition is suggested by + an arch specific header. */ + #ifdef __DOUBLE_TYPE + typedef __DOUBLE_TYPE double_t; + typedef __FLOAT_TYPE float_t; + #endif + /* Assume config.h has provided these types. */ #endif #else /* Assume basic definitions. */