Skip to content

Commit

Permalink
Merge commit 'origin/master' into fedora/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland McGrath committed Aug 27, 2009
2 parents bc9dd94 + 2df4be8 commit 8a344d4
Show file tree
Hide file tree
Showing 32 changed files with 1,006 additions and 71 deletions.
30 changes: 12 additions & 18 deletions CONFORMANCE
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ C99 added %a as another scanf format specifier for floating point
values. This conflicts with the glibc extension where %as, %a[ and
%aS mean to allocate the string for the data read. A strictly
conforming C99 program using %as, %a[ or %aS in a scanf format string
will misbehave under glibc.
will misbehave under glibc if it does not include <stdio.h> and
instead declares scanf itself; if it gets the declaration of scanf
from <stdio.h>, it will use a C99-conforming version.


Compiler limitations
Expand All @@ -144,29 +146,21 @@ GCC doesn't support the optional imaginary types. Nor does it
understand the keyword _Complex before GCC 3.0. This has the
corresponding impact on the relevant headers.

glibc's use of extern inline conflicts with C99: in C99, extern inline
means that an external definition is generated as well as possibly an
inline definition, but in GCC it means that no external definition is
generated. When GCC's C99 mode implements C99 inline semantics, this
will break the uses of extern inline in glibc's headers. (Actually,
glibc uses `extern __inline', which is beyond the scope of the
standard, but it would clearly be very confusing for `__inline' and
plain `inline' to have different meanings in C99 mode.)

glibc's <tgmath.h> implementation is arcane but thought to work
correctly; a clean and comprehensible version requires compiler
builtins.

For most of the headers required of freestanding implementations,
glibc relies on GCC to provide correct versions. (At present, glibc
provides <stdint.h>, and GCC doesn't.)

Implementing MATH_ERRNO, MATH_ERREXCEPT and math_errhandling in
<math.h> needs compiler support: see

http://sources.redhat.com/ml/libc-hacker/2000-06/msg00008.html
http://sources.redhat.com/ml/libc-hacker/2000-06/msg00014.html
http://sources.redhat.com/ml/libc-hacker/2000-06/msg00015.html
provides <stdint.h>, and GCC doesn't before version 4.5.)

The definition of math_errhandling conforms so long as no translation
unit using math_errhandling is compiled with -fno-math-errno,
-fno-trapping-math or options such as -ffast-math that imply these
options. math_errhandling is only conditionally defined depending on
__FAST_MATH__; the compiler does not provide the information needed
for more exact definitions based on settings of -fno-math-errno and
-fno-trapping-math, possibly for only some source files in a program.


Issues with headers
Expand Down
71 changes: 71 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
2009-08-26 Ulrich Drepper <drepper@redhat.com>

* sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: New file.

* sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: New file.

2009-08-25 Ulrich Drepper <drepper@redhat.com>

* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Add llround aliases.
* sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c: New file.

* sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: New file

* sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c: New file.

* sysdeps/ieee754/dbl-64/wordsize-64/s_round.c: New file.

2009-08-25 Joseph Myers <joseph@codesourcery.com>

* math/s_fdiml.c (__fdiml): Use fpclassify instead of fpclassifyl.

2009-08-25 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/fpu/s_scalbln.c: New file.
* sysdeps/x86_64/fpu/s_scalbn.c: New file.

* sysdeps/ieee754/dbl-64/wordsize-64/s_scalbn.c: New file.

* sysdeps/x86_64/fpu/s_signbit.S: New file.
* sysdeps/x86_64/fpu/s_signbitf.S: New file.

* sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: New file.
* sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: New file.

* sysdeps/x86_64/dl-trampoline.S (_dl_runtime_profile): Remove
leftover YMM_SIZE definition.

2009-08-24 Ulrich Drepper <drepper@redhat.com>

* math/math_private.h (ieee_double_shape_type): Add uint64_t word to
union.
(EXTRACT_WORDS64, INSERT_WORDS64): Define.
* sysdeps/x86_64/fpu/math_private.h (EXTRACT_WORDS64, INSERT_WORDS64):
Redefine.
* sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c: New file.

* sysdeps/x86_64/fpu/math_private.h: Add specialized GET_FLOAT_WORD
and SET_FLOAT_WORD definitions.

2009-08-24 Roland McGrath <roland@redhat.com>

* sysdeps/unix/syscall-template.S: New file.
* sysdeps/unix/make-syscalls.sh: Generate rules to use it.
* sysdeps/unix/Makefile (omit-deps): Do not omit syscall stubs' deps.
(compile-syscall): Pass mkdep and -g options as normal.
(s-proto.d, s-proto-cancel.d): Don't "-include" these.
(common-generated): Don't add them here.

2009-08-24 Ulrich Drepper <drepper@redhat.com>

* math/s_fdim.c: In case of overflows set errno.
* math/s_fdimf.c: Likewise.
* math/s_fdiml.c: Likewise.

* math/math.h: Define math_errhandling of __FAST_MATH__ is not defined.
* sysdeps/i386/fpu/bits/mathinline.h: Undefine math_errhandling if we
are using the inline optimizations.

* sysdeps/x86_64/fpu/bits/mathinline.h (__signbit): Optimize.
(__signbitf): Likewise.

2009-08-23 Ulrich Drepper <drepper@redhat.com>

* posix/regcomp.c (parse_dup_op): Verify the expression is correctly
Expand Down
11 changes: 9 additions & 2 deletions math/math.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Declarations for math functions.
Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006
Copyright (C) 1991-1993, 1995-1999, 2001, 2002, 2004, 2006, 2009
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -101,7 +101,7 @@ __BEGIN_DECLS
&& (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
# ifdef __LDBL_COMPAT

# ifdef __USE_ISOC99
# ifdef __USE_ISOC99
extern float __nldbl_nexttowardf (float __x, long double __y)
__THROW __attribute__ ((__const__));
# ifdef __REDIRECT_NTH
Expand Down Expand Up @@ -277,6 +277,13 @@ enum
# define MATH_ERRNO 1 /* errno set by math functions. */
# define MATH_ERREXCEPT 2 /* Exceptions raised by math functions. */

/* By default all functions support both errno and exception handling.
In gcc's fast math mode and if inline functions are defined this
might not be true. */
# ifndef __FAST_MATH__
# define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
# endif

#endif /* Use ISO C99. */

#ifdef __USE_MISC
Expand Down
19 changes: 19 additions & 0 deletions math/math_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define _MATH_PRIVATE_H_

#include <endian.h>
#include <stdint.h>
#include <sys/types.h>

/* The original fdlibm code used statements like:
Expand All @@ -43,6 +44,7 @@ typedef union
u_int32_t msw;
u_int32_t lsw;
} parts;
uint64_t word;
} ieee_double_shape_type;

#endif
Expand All @@ -57,6 +59,7 @@ typedef union
u_int32_t lsw;
u_int32_t msw;
} parts;
uint64_t word;
} ieee_double_shape_type;

#endif
Expand Down Expand Up @@ -89,6 +92,14 @@ do { \
(i) = gl_u.parts.lsw; \
} while (0)

/* Get all in one, efficient on 64-bit machines. */
#define EXTRACT_WORDS64(i,d) \
do { \
ieee_double_shape_type gh_u; \
gh_u.value = (d); \
(i) = gh_u.word; \
} while (0)

/* Set a double from two 32 bit ints. */

#define INSERT_WORDS(d,ix0,ix1) \
Expand All @@ -99,6 +110,14 @@ do { \
(d) = iw_u.value; \
} while (0)

/* Get all in one, efficient on 64-bit machines. */
#define INSERT_WORDS64(i,d) \
do { \
ieee_double_shape_type iw_u; \
iw_u.word = (i); \
(d) = iw_u.value; \
} while (0)

/* Set the more significant 32 bits of a double from an int. */

#define SET_HIGH_WORD(d,v) \
Expand Down
12 changes: 10 additions & 2 deletions math/s_fdim.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
Copyright (C) 1997, 2004 Free Software Foundation, Inc.
Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Expand All @@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <errno.h>
#include <math.h>

double
Expand All @@ -31,7 +32,14 @@ __fdim (double x, double y)
/* Raise invalid flag. */
return x - y;

return x <= y ? 0 : x - y;
if (x <= y)
return 0.0;

double r = x - y;
if (fpclassify (r) == FP_INFINITE)
__set_errno (ERANGE);

return r;
}
weak_alias (__fdim, fdim)
#ifdef NO_LONG_DOUBLE
Expand Down
12 changes: 10 additions & 2 deletions math/s_fdimf.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
Copyright (C) 1997, 2004 Free Software Foundation, Inc.
Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Expand All @@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <errno.h>
#include <math.h>

float
Expand All @@ -31,6 +32,13 @@ __fdimf (float x, float y)
/* Raise invalid flag. */
return x - y;

return x <= y ? 0 : x - y;
if (x <= y)
return 0.0f;

float r = x - y;
if (fpclassify (r) == FP_INFINITE)
__set_errno (ERANGE);

return r;
}
weak_alias (__fdimf, fdimf)
12 changes: 10 additions & 2 deletions math/s_fdiml.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Return positive difference between arguments.
Copyright (C) 1997, 2004 Free Software Foundation, Inc.
Copyright (C) 1997, 2004, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Expand All @@ -18,6 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <errno.h>
#include <math.h>

long double
Expand All @@ -31,6 +32,13 @@ __fdiml (long double x, long double y)
/* Raise invalid flag. */
return x - y;

return x <= y ? 0 : x - y;
if (x <= y)
return 0.0f;

long double r = x - y;
if (fpclassify (r) == FP_INFINITE)
__set_errno (ERANGE);

return r;
}
weak_alias (__fdiml, fdiml)
Loading

0 comments on commit 8a344d4

Please sign in to comment.