Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-02-06 19:14:04 +0300
committerNick Clifton <nickc@redhat.com>2015-02-06 19:14:04 +0300
commitb9e7cd9a846cf584049a719bbd0e4cabe3c50bea (patch)
tree33bb86b0a39693a67106d740062bc5975285b87f /newlib/libc
parentdb004c5d7af31d9a56321d7780621b1df6a1559e (diff)
* libc/include/complex.h (cabsl): Add prototype.
(cimagl): Add prototype. (creall): Add prototype. * libc/include/ieeefp.h: Include float.h. (EXT_EXPBITS, EXT_FRACHBITS, EXT_FRACLBITS) (EXT_EXP_INFNAN. EXT_EXP_BIAS, EXT_FRACBITS): Define. (struct ieee_ext, union ieee_ext_u): New types for long double support. * libc/include/math.h (finitel): Add prototype. (hypotl): Add prototype. (sqrtl): Add prototype. * libm/common/Makefile.am (lsrc): Add sl_finite.c. * libm/common/Makefile.in: Regenerate. * libm/common/fdlibm.h (__ieee754_hypotl): Add prototype. * libm/common/hypotl.c (hypotl): Add implementation for when long double is larger than double. * libm/common/sqrtl.c (sqrtl): Likewise. * libm/common/sl_finite.c: New file. Adds implementation of the finitel function. * libm/complex/Makefile.am (lsrc): Define. (libcomplex_la_SOURCES): Add lsrc. (lib_a_SOURCES): Add lsrc. * libm/complex/Makefile.in: Regenerate. * libm/complex/cabs.c: Add documentation of cabsl function. * libm/complex/cimag.c: Add documentation of cimagl function. * libm/complex/creall.c: Add documentation of creall function. * libm/complex/cabsl.c: New file. Adds implementation of the cabsl function. * libm/complex/cimagl.c: New file. Adds implementation of the cimagl function. * libm/complex/creall.c: New file. Adds implementation of the creall function. * libm/math/Makefile.am (lsrc): Define. (libmath_la_SOURCES): Add lsrc. (lib_a_SOURCES): Add lsrc. * libm/math/Makefile.in: Regenerate. * libm/math/el_hypot.c: New file. Adds implementation of the __ieee754_hypotl function.
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/include/complex.h5
-rw-r--r--newlib/libc/include/ieeefp.h73
-rw-r--r--newlib/libc/include/math.h6
-rw-r--r--newlib/libc/include/string.h5
-rw-r--r--newlib/libc/machine/msp430/setjmp.S2
5 files changed, 80 insertions, 11 deletions
diff --git a/newlib/libc/include/complex.h b/newlib/libc/include/complex.h
index 969b20e5f..c3ae3cff8 100644
--- a/newlib/libc/include/complex.h
+++ b/newlib/libc/include/complex.h
@@ -83,6 +83,7 @@ float complex clogf(float complex);
float cabsf(float complex) __RENAME(__c99_cabsf);
#endif
*/
+long double cabsl(long double complex) ;
double cabs(double complex) ;
float cabsf(float complex) ;
@@ -102,7 +103,7 @@ float cargf(float complex);
/* 7.3.9.2 The cimag functions */
double cimag(double complex);
float cimagf(float complex);
-/*long double cimagl(long double complex); */
+long double cimagl(long double complex);
/* 7.3.9.3 The conj functions */
double complex conj(double complex);
@@ -117,7 +118,7 @@ float complex cprojf(float complex);
/* 7.3.9.5 The creal functions */
double creal(double complex);
float crealf(float complex);
-/*long double creall(long double complex); */
+long double creall(long double complex);
__END_DECLS
diff --git a/newlib/libc/include/ieeefp.h b/newlib/libc/include/ieeefp.h
index 0b06fb786..9eb274d86 100644
--- a/newlib/libc/include/ieeefp.h
+++ b/newlib/libc/include/ieeefp.h
@@ -4,11 +4,12 @@
#include "_ansi.h"
#include <machine/ieeefp.h>
+#include <float.h>
_BEGIN_STD_C
/* FIXME FIXME FIXME:
- Neither of __ieee_{float,double}_shape_tape seem to be used anywhere
+ Neither of __ieee_{float,double}_shape_type seem to be used anywhere
except in libm/test. If that is the case, please delete these from here.
If that is not the case, please insert documentation here describing why
they're needed. */
@@ -46,9 +47,7 @@ typedef union
long aslong[2];
} __ieee_double_shape_type;
-#endif
-
-#ifdef __IEEE_LITTLE_ENDIAN
+#elif defined __IEEE_LITTLE_ENDIAN
typedef union
{
@@ -92,7 +91,7 @@ typedef union
} __ieee_double_shape_type;
-#endif
+#endif /* __IEEE_LITTLE_ENDIAN */
#ifdef __IEEE_BIG_ENDIAN
@@ -118,9 +117,7 @@ typedef union
} __ieee_float_shape_type;
-#endif
-
-#ifdef __IEEE_LITTLE_ENDIAN
+#elif defined __IEEE_LITTLE_ENDIAN
typedef union
{
@@ -144,10 +141,70 @@ typedef union
} __ieee_float_shape_type;
+#endif /* __IEEE_LITTLE_ENDIAN */
+
+#ifndef _LDBL_EQ_DBL
+
+#ifndef LDBL_MANT_DIG
+#error "LDBL_MANT_DIG not defined - should be found in float.h"
+
+#elif LDBL_MANT_DIG == DBL_MANT_DIG
+#error "double and long double are the same size but LDBL_EQ_DBL is not defined"
+
+#elif LDBL_MANT_DIG == 53
+/* This happens when doubles are 32-bits and long doubles are 64-bits. */
+#define EXT_EXPBITS 11
+#define EXT_FRACHBITS 20
+#define EXT_FRACLBITS 32
+#define __ieee_ext_field_type unsigned long
+
+#elif LDBL_MANT_DIG == 64
+#define EXT_EXPBITS 15
+#define EXT_FRACHBITS 32
+#define EXT_FRACLBITS 32
+#define __ieee_ext_field_type unsigned int
+
+#elif LDBL_MANT_DIG == 65
+#define EXT_EXPBITS 15
+#define EXT_FRACHBITS 32
+#define EXT_FRACLBITS 32
+#define __ieee_ext_field_type unsigned int
+
+#elif LDBL_MANT_DIG == 112
+#define EXT_EXPBITS 15
+#define EXT_FRACHBITS 48
+#define EXT_FRACLBITS 64
+#define __ieee_ext_field_type unsigned long long
+
+#elif LDBL_MANT_DIG == 113
+#define EXT_EXPBITS 15
+#define EXT_FRACHBITS 48
+#define EXT_FRACLBITS 64
+#define __ieee_ext_field_type unsigned long long
+
+#else
+#error Unsupported value for LDBL_MANT_DIG
#endif
+#define EXT_EXP_INFNAN ((1 << EXT_EXPBITS) - 1) /* 32767 */
+#define EXT_EXP_BIAS ((1 << (EXT_EXPBITS - 1)) - 1) /* 16383 */
+#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
+
+typedef struct ieee_ext
+{
+ __ieee_ext_field_type ext_fracl : EXT_FRACLBITS;
+ __ieee_ext_field_type ext_frach : EXT_FRACHBITS;
+ __ieee_ext_field_type ext_exp : EXT_EXPBITS;
+ __ieee_ext_field_type ext_sign : 1;
+} ieee_ext;
+typedef union ieee_ext_u
+{
+ long double extu_ld;
+ struct ieee_ext extu_ext;
+} ieee_ext_u;
+#endif /* ! _LDBL_EQ_DBL */
/* FLOATING ROUNDING */
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index d16ce3074..3f6766ab8 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -254,6 +254,10 @@ extern int __signbitd (double x);
(__extension__ ({__typeof__(a) __a = (a); __typeof__(b) __b = (b); \
fpclassify(__a) == FP_NAN || fpclassify(__b) == FP_NAN;}))
+/* Non ANSI long double precision functions. */
+
+extern int finitel _PARAMS((long double));
+
/* Non ANSI double precision functions. */
extern double infinity _PARAMS((void));
@@ -454,6 +458,8 @@ extern long double erfl _PARAMS((long double));
extern long double erfcl _PARAMS((long double));
#endif /* ! defined (_REENT_ONLY) */
#else /* !_LDBL_EQ_DBL */
+extern long double hypotl _PARAMS((long double, long double));
+extern long double sqrtl _PARAMS((long double));
#ifdef __i386__
/* Other long double precision functions. */
extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index af5c9da4d..43b36267d 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -104,7 +104,10 @@ char *_EXFUN(strerror_r,(int, char *, size_t));
#else
# ifdef __GNUC__
int _EXFUN(strerror_r,(int, char *, size_t))
- __asm__ (__ASMNAME ("__xpg_strerror_r"));
+#ifdef __ASMNAME
+ __asm__ (__ASMNAME ("__xpg_strerror_r"))
+#endif
+ ;
# else
int _EXFUN(__xpg_strerror_r,(int, char *, size_t));
# define strerror_r __xpg_strerror_r
diff --git a/newlib/libc/machine/msp430/setjmp.S b/newlib/libc/machine/msp430/setjmp.S
index 6684f8acb..f3deefae5 100644
--- a/newlib/libc/machine/msp430/setjmp.S
+++ b/newlib/libc/machine/msp430/setjmp.S
@@ -60,6 +60,7 @@ setjmp:
clr r12
ret
#endif
+ .size setjmp , . - setjmp
.global longjmp
@@ -102,4 +103,5 @@ longjmp:
add.w #2, r1
mov.w r14, r0
#endif
+ .size longjmp , . - longjmp