]> sourceware.org Git - newlib-cygwin.git/commitdiff
Aarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2
authorAndrea Corallo <andrea.corallo@arm.com>
Wed, 30 Mar 2022 13:40:59 +0000 (15:40 +0200)
committerJeff Johnston <jjohnstn@redhat.com>
Mon, 11 Apr 2022 16:00:16 +0000 (12:00 -0400)
2022-03-30  Andrea Corallo  <andrea.corallo@arm.com>

* 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.

newlib/libc/include/machine/ieeefp.h
newlib/libc/include/math.h

index 3c1f41e03504039d109a06e527e46c56e831dad0..9bb8af02f4553b22dafeddde2dfb12926296c5e3 100644 (file)
 #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
 
 #if defined (__aarch64__)
 #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
 
 #ifdef __epiphany__
index 799ac494adc3f134a8f63a06397e833ec89c644a..54e30ef82dae66af36251de0cd4e75f77f13cfbc 100644 (file)
@@ -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.  */
This page took 0.035305 seconds and 5 git commands to generate.