[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commits] r22591 - in /fsf/trunk/libc: ./ malloc/ sysdeps/ieee754/ldbl-128ibm/ sysdeps/powerpc/ sysdeps/powerpc/fpu/ sysdeps/powerpc/p...
- To: commits@xxxxxxxxxx
- Subject: [Commits] r22591 - in /fsf/trunk/libc: ./ malloc/ sysdeps/ieee754/ldbl-128ibm/ sysdeps/powerpc/ sysdeps/powerpc/fpu/ sysdeps/powerpc/p...
- From: eglibc@xxxxxxxxxx
- Date: Sat, 09 Mar 2013 00:02:02 -0000
Author: eglibc
Date: Sat Mar 9 00:02:01 2013
New Revision: 22591
Log:
Import glibc-mainline for 2013-03-09
Added:
fsf/trunk/libc/sysdeps/powerpc/power4/
fsf/trunk/libc/sysdeps/powerpc/power4/fpu/
fsf/trunk/libc/sysdeps/powerpc/power4/fpu/Makefile
fsf/trunk/libc/sysdeps/powerpc/power4/fpu/mpa.c
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/Implies
fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/Implies
Removed:
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/Makefile
fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c
fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/fpu/Makefile
fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/Implies
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/Makeconfig
fsf/trunk/libc/malloc/arena.c
fsf/trunk/libc/malloc/hooks.c
fsf/trunk/libc/malloc/malloc.c
fsf/trunk/libc/malloc/malloc.h
fsf/trunk/libc/malloc/mcheck.c
fsf/trunk/libc/malloc/morecore.c
fsf/trunk/libc/malloc/mtrace.c
fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
fsf/trunk/libc/sysdeps/powerpc/Implies
fsf/trunk/libc/sysdeps/powerpc/fpu/math_ldbl.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Mar 9 00:02:01 2013
@@ -1,3 +1,89 @@
+2013-03-08 Roland McGrath <roland@xxxxxxxxxxxxx>
+
+ * Makeconfig ($(common-objpfx)config.status): Depend on
+ sysdeps/*/preconfigure{,.in} too.
+
+2013-03-08 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * malloc/malloc.h (__malloc_ptr_t): Remove macro.
+ (__free_hook): Use void * instead of __malloc_ptr_t.
+ (__malloc_hook): Likewise.
+ (__realloc_hook): Likewise.
+ (__memalign_hook): Likewise.
+ (__after_morecore_hook): Likewise.
+ * malloc/arena.c (save_malloc_hook): Likewise.
+ (save_free_hook): Likewise.
+ * malloc/hooks.c (malloc_hook_ini): Likewise.
+ (realloc_hook_ini): Likewise.
+ (memalign_hook_ini): Likewise.
+ * malloc/malloc.c (malloc_hook_ini): Likewise.
+ (realloc_hook_ini): Likewise.
+ (memalign_hook_ini): Likewise.
+ (__free_hook): Likewise.
+ (__malloc_hook): Likewise.
+ (__realloc_hook): Likewise.
+ (__memalign_hook): Likewise.
+ (__libc_malloc): Likewise.
+ (__libc_free): Likewise.
+ (__libc_realloc): Likewise.
+ (__libc_memalign): Likewise.
+ (__libc_valloc): Likewise.
+ (__libc_pvalloc): Likewise.
+ (__libc_calloc): Likewise.
+ (__posix_memalign): Likewise.
+ * malloc/morecore.c (__sbrk): Likewise.
+ (__default_morecore): Likewise.
+
+ * malloc/morecore.c (__default_morecore): Use ISO C prototype.
+
+ * malloc/malloc.h (__malloc_ptrdiff_t): Remove macro.
+ * malloc/morecore.c (__default_morecore): Use ptrdiff_t instead of
+ __malloc_ptrdiff_t.
+
+ * malloc/malloc.h (__malloc_size_t): Remove macro.
+ * malloc/mcheck.c (old_malloc_hook): Use size_t instead of
+ __malloc_size_t.
+ (old_memalign_hook): Likewise.
+ (old_realloc_hook): Likewise.
+ (struct hdr): Likewise.
+ (flood): Likewise.
+ (mallochook): Likewise.
+ (memalignhook): Likewise.
+ (reallochook): Likewise.
+ * malloc/mtrace.c (tr_old_malloc_hook): Likewise.
+ (tr_old_realloc_hook): Likewise.
+ (tr_old_memalign_hook): Likewise.
+ (tr_mallochook): Likewise.
+ (tr_reallochook): Likewise.
+ (tr_memalignhook): Likewise.
+
+2013-03-08 Adhemerval Zanella <azanella@xxxxxxxxxxxxxxxxxx>
+
+ * sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_pack): Rename to
+ default_ldbl_pack and using as default implementation.
+ (ldbl_unpack): Rename to default_ldbl_unpack and using as default
+ implementation.
+ * sysdeps/powerpc/fpu/math_ldbl.h (ldbl_extract_mantissa): Remove
+ redundant definition.
+ (ldbl_insert_mantissa): Likewise.
+ (ldbl_canonicalize): Likewise.
+ (ldbl_nearbyint): Likewise.
+ (ldbl_pack): Rename to ldbl_pack_ppc.
+ (ldbl_unpack): Rename to ldbl_unpack_ppc.
+ * sysdeps/unix/sysv/linux/powerpc/Implies: Remove file.
+ * sysdeps/powerpc/Implies: Add ieee754/ldbl-opt after ieee754/ldbl-128ibm.
+
+2013-03-08 Siddhesh Poyarekar <siddhesh@xxxxxxxxxx>
+
+ * sysdeps/powerpc/powerpc32/power4/fpu/mpa.c: Move file...
+ * sysdeps/powerpc/power4/fpu/mpa.c: ... here.
+ * sysdeps/powerpc/powerpc32/power4/fpu/Makefile: Move file...
+ * sysdeps/powerpc/power4/fpu/Makefile: ... here.
+ * sysdeps/powerpc/powerpc64/power4/fpu/mpa.c: Remove file.
+ * sysdeps/powerpc/powerpc64/power4/fpu/Makefile: Remove file.
+ * sysdeps/powerpc/powerpc32/power4/Implies: New file.
+ * sysdeps/powerpc/powerpc64/power4/Implies: New file.
+
2013-03-07 Andreas Jaeger <aj@xxxxxxx>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
Modified: fsf/trunk/libc/Makeconfig
==============================================================================
--- fsf/trunk/libc/Makeconfig (original)
+++ fsf/trunk/libc/Makeconfig Sat Mar 9 00:02:01 2013
@@ -90,10 +90,14 @@
$(firstword $(wildcard \
$(addprefix $(dir)/,configure configure.in))))) \
$(patsubst %.in,%,\
+ $(wildcard $(..)sysdeps/*/preconfigure $(..)sysdeps/*/preconfigure.in)) \
+ $(patsubst %.in,%,\
$(foreach add-on,$(add-ons),\
$(firstword $(wildcard \
$(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
- configure configure.in)))))
+ configure configure.in))) \
+ $(wildcard $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\
+ sysdeps/*/preconfigure sysdeps/*/preconfigure.in))))
@cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
echo The GNU C library has not been configured. >&2; \
echo Run \`configure\' to configure it before building. >&2; \
Modified: fsf/trunk/libc/malloc/arena.c
==============================================================================
--- fsf/trunk/libc/malloc/arena.c (original)
+++ fsf/trunk/libc/malloc/arena.c Sat Mar 9 00:02:01 2013
@@ -144,11 +144,9 @@
/* atfork support. */
-static __malloc_ptr_t (*save_malloc_hook) (size_t __size,
- const __malloc_ptr_t);
-static void (*save_free_hook) (__malloc_ptr_t __ptr,
- const __malloc_ptr_t);
-static void* save_arena;
+static void *(*save_malloc_hook) (size_t __size, const void *);
+static void (*save_free_hook) (void *__ptr, const void *);
+static void *save_arena;
#ifdef ATFORK_MEM
ATFORK_MEM;
Modified: fsf/trunk/libc/malloc/hooks.c
==============================================================================
--- fsf/trunk/libc/malloc/hooks.c (original)
+++ fsf/trunk/libc/malloc/hooks.c Sat Mar 9 00:02:01 2013
@@ -25,7 +25,7 @@
initialization routine, then do the normal work. */
static void*
-malloc_hook_ini(size_t sz, const __malloc_ptr_t caller)
+malloc_hook_ini(size_t sz, const void *caller)
{
__malloc_hook = NULL;
ptmalloc_init();
@@ -33,7 +33,7 @@
}
static void*
-realloc_hook_ini(void* ptr, size_t sz, const __malloc_ptr_t caller)
+realloc_hook_ini(void* ptr, size_t sz, const void *caller)
{
__malloc_hook = NULL;
__realloc_hook = NULL;
@@ -42,7 +42,7 @@
}
static void*
-memalign_hook_ini(size_t alignment, size_t sz, const __malloc_ptr_t caller)
+memalign_hook_ini(size_t alignment, size_t sz, const void *caller)
{
__memalign_hook = NULL;
ptmalloc_init();
Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Sat Mar 9 00:02:01 2013
@@ -1841,22 +1841,22 @@
/* Forward declarations. */
static void* malloc_hook_ini (size_t sz,
- const __malloc_ptr_t caller) __THROW;
+ const void *caller) __THROW;
static void* realloc_hook_ini (void* ptr, size_t sz,
- const __malloc_ptr_t caller) __THROW;
+ const void *caller) __THROW;
static void* memalign_hook_ini (size_t alignment, size_t sz,
- const __malloc_ptr_t caller) __THROW;
+ const void *caller) __THROW;
void weak_variable (*__malloc_initialize_hook) (void) = NULL;
-void weak_variable (*__free_hook) (__malloc_ptr_t __ptr,
- const __malloc_ptr_t) = NULL;
-__malloc_ptr_t weak_variable (*__malloc_hook)
- (size_t __size, const __malloc_ptr_t) = malloc_hook_ini;
-__malloc_ptr_t weak_variable (*__realloc_hook)
- (__malloc_ptr_t __ptr, size_t __size, const __malloc_ptr_t)
+void weak_variable (*__free_hook) (void *__ptr,
+ const void *) = NULL;
+void *weak_variable (*__malloc_hook)
+ (size_t __size, const void *) = malloc_hook_ini;
+void *weak_variable (*__realloc_hook)
+ (void *__ptr, size_t __size, const void *)
= realloc_hook_ini;
-__malloc_ptr_t weak_variable (*__memalign_hook)
- (size_t __alignment, size_t __size, const __malloc_ptr_t)
+void *weak_variable (*__memalign_hook)
+ (size_t __alignment, size_t __size, const void *)
= memalign_hook_ini;
void weak_variable (*__after_morecore_hook) (void) = NULL;
@@ -2842,7 +2842,7 @@
mstate ar_ptr;
void *victim;
- __malloc_ptr_t (*hook) (size_t, const __malloc_ptr_t)
+ void *(*hook) (size_t, const void *)
= force_reg (__malloc_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(bytes, RETURN_ADDRESS (0));
@@ -2873,7 +2873,7 @@
mstate ar_ptr;
mchunkptr p; /* chunk corresponding to mem */
- void (*hook) (__malloc_ptr_t, const __malloc_ptr_t)
+ void (*hook) (void *, const void *)
= force_reg (__free_hook);
if (__builtin_expect (hook != NULL, 0)) {
(*hook)(mem, RETURN_ADDRESS (0));
@@ -2912,7 +2912,7 @@
void* newp; /* chunk to return */
- __malloc_ptr_t (*hook) (__malloc_ptr_t, size_t, const __malloc_ptr_t) =
+ void *(*hook) (void *, size_t, const void *) =
force_reg (__realloc_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(oldmem, bytes, RETURN_ADDRESS (0));
@@ -3004,7 +3004,7 @@
mstate ar_ptr;
void *p;
- __malloc_ptr_t (*hook) (size_t, size_t, const __malloc_ptr_t) =
+ void *(*hook) (size_t, size_t, const void *) =
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(alignment, bytes, RETURN_ADDRESS (0));
@@ -3046,7 +3046,7 @@
size_t pagesz = GLRO(dl_pagesize);
- __malloc_ptr_t (*hook) (size_t, size_t, const __malloc_ptr_t) =
+ void *(*hook) (size_t, size_t, const void *) =
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(pagesz, bytes, RETURN_ADDRESS (0));
@@ -3082,7 +3082,7 @@
size_t page_mask = GLRO(dl_pagesize) - 1;
size_t rounded_bytes = (bytes + page_mask) & ~(page_mask);
- __malloc_ptr_t (*hook) (size_t, size_t, const __malloc_ptr_t) =
+ void *(*hook) (size_t, size_t, const void *) =
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(pagesz, rounded_bytes, RETURN_ADDRESS (0));
@@ -3125,7 +3125,7 @@
}
}
- __malloc_ptr_t (*hook) (size_t, const __malloc_ptr_t) =
+ void *(*hook) (size_t, const void *) =
force_reg (__malloc_hook);
if (__builtin_expect (hook != NULL, 0)) {
sz = bytes;
@@ -4916,7 +4916,7 @@
/* Call the hook here, so that caller is posix_memalign's caller
and not posix_memalign itself. */
- __malloc_ptr_t (*hook) (size_t, size_t, const __malloc_ptr_t) =
+ void *(*hook) (size_t, size_t, const void *) =
force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
mem = (*hook)(alignment, size, RETURN_ADDRESS (0));
Modified: fsf/trunk/libc/malloc/malloc.h
==============================================================================
--- fsf/trunk/libc/malloc/malloc.h (original)
+++ fsf/trunk/libc/malloc/malloc.h Sat Mar 9 00:02:01 2013
@@ -22,11 +22,6 @@
#include <features.h>
#include <stddef.h>
#include <stdio.h>
-# define __malloc_ptr_t void *
-
-/* Used by GNU libc internals. */
-#define __malloc_size_t size_t
-#define __malloc_ptrdiff_t ptrdiff_t
#ifdef _LIBC
# define __MALLOC_HOOK_VOLATILE
@@ -153,18 +148,18 @@
__MALLOC_DEPRECATED;
/* Hooks for debugging and user-defined versions. */
extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr,
- const __malloc_ptr_t)
+ const void *)
__MALLOC_DEPRECATED;
extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook) (size_t __size,
- const __malloc_ptr_t)
+ const void *)
__MALLOC_DEPRECATED;
extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook) (void *__ptr,
size_t __size,
- const __malloc_ptr_t)
+ const void *)
__MALLOC_DEPRECATED;
extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook) (size_t __alignment,
size_t __size,
- const __malloc_ptr_t)
+ const void *)
__MALLOC_DEPRECATED;
extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void);
Modified: fsf/trunk/libc/malloc/mcheck.c
==============================================================================
--- fsf/trunk/libc/malloc/mcheck.c (original)
+++ fsf/trunk/libc/malloc/mcheck.c Sat Mar 9 00:02:01 2013
@@ -29,11 +29,10 @@
/* Old hook values. */
static void (*old_free_hook) (__ptr_t ptr, const __ptr_t);
-static __ptr_t (*old_malloc_hook) (__malloc_size_t size, const __ptr_t);
-static __ptr_t (*old_memalign_hook) (__malloc_size_t alignment,
- __malloc_size_t size,
+static __ptr_t (*old_malloc_hook) (size_t size, const __ptr_t);
+static __ptr_t (*old_memalign_hook) (size_t alignment, size_t size,
const __ptr_t);
-static __ptr_t (*old_realloc_hook) (__ptr_t ptr, __malloc_size_t size,
+static __ptr_t (*old_realloc_hook) (__ptr_t ptr, size_t size,
const __ptr_t);
/* Function to call when something awful happens. */
@@ -48,7 +47,7 @@
struct hdr
{
- __malloc_size_t size; /* Exact size requested by user. */
+ size_t size; /* Exact size requested by user. */
unsigned long int magic; /* Magic number to check header integrity. */
struct hdr *prev;
struct hdr *next;
@@ -69,12 +68,12 @@
# include <string.h>
# define flood memset
#else
-static void flood (__ptr_t, int, __malloc_size_t);
+static void flood (__ptr_t, int, size_t);
static void
flood (ptr, val, size)
__ptr_t ptr;
int val;
- __malloc_size_t size;
+ size_t size;
{
char *cp = ptr;
while (size--)
@@ -202,7 +201,7 @@
}
static __ptr_t
-mallochook (__malloc_size_t size, const __ptr_t caller)
+mallochook (size_t size, const __ptr_t caller)
{
struct hdr *hdr;
@@ -235,11 +234,11 @@
}
static __ptr_t
-memalignhook (__malloc_size_t alignment, __malloc_size_t size,
+memalignhook (size_t alignment, size_t size,
const __ptr_t caller)
{
struct hdr *hdr;
- __malloc_size_t slop;
+ size_t slop;
char *block;
if (pedantic)
@@ -274,7 +273,7 @@
}
static __ptr_t
-reallochook (__ptr_t ptr, __malloc_size_t size, const __ptr_t caller)
+reallochook (__ptr_t ptr, size_t size, const __ptr_t caller)
{
if (size == 0)
{
@@ -283,7 +282,7 @@
}
struct hdr *hdr;
- __malloc_size_t osize;
+ size_t osize;
if (pedantic)
mcheck_check_all ();
Modified: fsf/trunk/libc/malloc/morecore.c
==============================================================================
--- fsf/trunk/libc/malloc/morecore.c (original)
+++ fsf/trunk/libc/malloc/morecore.c Sat Mar 9 00:02:01 2013
@@ -30,7 +30,7 @@
#include <stddef.h>
#include <stdlib.h>
-extern __malloc_ptr_t __sbrk (ptrdiff_t increment) __THROW;
+extern void *__sbrk (ptrdiff_t increment) __THROW;
libc_hidden_proto (__sbrk)
#endif
@@ -41,12 +41,11 @@
/* Allocate INCREMENT more bytes of data space,
and return the start of data space, or NULL on errors.
If INCREMENT is negative, shrink data space. */
-__malloc_ptr_t
-__default_morecore (increment)
- __malloc_ptrdiff_t increment;
+void *
+__default_morecore (ptrdiff_t increment)
{
- __malloc_ptr_t result = (__malloc_ptr_t) __sbrk (increment);
- if (result == (__malloc_ptr_t) -1)
+ void *result = (void *) __sbrk (increment);
+ if (result == (void *) -1)
return NULL;
return result;
}
Modified: fsf/trunk/libc/malloc/mtrace.c
==============================================================================
--- fsf/trunk/libc/malloc/mtrace.c (original)
+++ fsf/trunk/libc/malloc/mtrace.c Sat Mar 9 00:02:01 2013
@@ -58,11 +58,10 @@
/* Old hook values. */
static void (*tr_old_free_hook) (__ptr_t ptr, const __ptr_t);
-static __ptr_t (*tr_old_malloc_hook) (__malloc_size_t size, const __ptr_t);
-static __ptr_t (*tr_old_realloc_hook) (__ptr_t ptr, __malloc_size_t size,
+static __ptr_t (*tr_old_malloc_hook) (size_t size, const __ptr_t);
+static __ptr_t (*tr_old_realloc_hook) (__ptr_t ptr, size_t size,
const __ptr_t);
-static __ptr_t (*tr_old_memalign_hook) (__malloc_size_t __alignment,
- __malloc_size_t __size,
+static __ptr_t (*tr_old_memalign_hook) (size_t __alignment, size_t __size,
const __ptr_t);
/* This function is called when the block being alloc'd, realloc'd, or
@@ -160,10 +159,10 @@
__libc_lock_unlock (lock);
}
-static __ptr_t tr_mallochook (__malloc_size_t, const __ptr_t) __THROW;
+static __ptr_t tr_mallochook (size_t, const __ptr_t) __THROW;
static __ptr_t
tr_mallochook (size, caller)
- __malloc_size_t size;
+ size_t size;
const __ptr_t caller;
{
__ptr_t hdr;
@@ -190,12 +189,12 @@
return hdr;
}
-static __ptr_t tr_reallochook (__ptr_t, __malloc_size_t, const __ptr_t)
+static __ptr_t tr_reallochook (__ptr_t, size_t, const __ptr_t)
__THROW;
static __ptr_t
tr_reallochook (ptr, size, caller)
__ptr_t ptr;
- __malloc_size_t size;
+ size_t size;
const __ptr_t caller;
{
__ptr_t hdr;
@@ -243,11 +242,11 @@
return hdr;
}
-static __ptr_t tr_memalignhook (__malloc_size_t, __malloc_size_t,
+static __ptr_t tr_memalignhook (size_t, size_t,
const __ptr_t) __THROW;
static __ptr_t
tr_memalignhook (alignment, size, caller)
- __malloc_size_t alignment, size;
+ size_t alignment, size;
const __ptr_t caller;
{
__ptr_t hdr;
Modified: fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (original)
+++ fsf/trunk/libc/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h Sat Mar 9 00:02:01 2013
@@ -125,7 +125,7 @@
/* Handy utility functions to pack/unpack/cononicalize and find the nearbyint
of long double implemented as double double. */
static inline long double
-ldbl_pack (double a, double aa)
+default_ldbl_pack (double a, double aa)
{
union ibm_extended_long_double u;
u.dd[0] = a;
@@ -134,7 +134,7 @@
}
static inline void
-ldbl_unpack (long double l, double *a, double *aa)
+default_ldbl_unpack (long double l, double *a, double *aa)
{
union ibm_extended_long_double u;
u.d = l;
@@ -142,6 +142,12 @@
*aa = u.dd[1];
}
+#ifndef ldbl_pack
+# define ldbl_pack default_ldbl_pack
+#endif
+#ifndef ldbl_unpack
+# define ldbl_unpack default_ldbl_unpack
+#endif
/* Convert a finite long double to canonical form.
Does not handle +/-Inf properly. */
Modified: fsf/trunk/libc/sysdeps/powerpc/Implies
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/Implies (original)
+++ fsf/trunk/libc/sysdeps/powerpc/Implies Sat Mar 9 00:02:01 2013
@@ -1,4 +1,5 @@
# On PowerPC we use the IBM extended long double format.
ieee754/ldbl-128ibm
+ieee754/ldbl-opt
ieee754/dbl-64
ieee754/flt-32
Modified: fsf/trunk/libc/sysdeps/powerpc/fpu/math_ldbl.h
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/fpu/math_ldbl.h (original)
+++ fsf/trunk/libc/sysdeps/powerpc/fpu/math_ldbl.h Sat Mar 9 00:02:01 2013
@@ -2,132 +2,12 @@
#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
#endif
-#include <sysdeps/ieee754/ldbl-128/math_ldbl.h>
-#include <ieee754.h>
-
-static inline void
-ldbl_extract_mantissa (int64_t *hi64, u_int64_t *lo64, int *exp, long double x)
-{
- /* We have 105 bits of mantissa plus one implicit digit. Since
- 106 bits are representable we use the first implicit digit for
- the number before the decimal point and the second implicit bit
- as bit 53 of the mantissa. */
- unsigned long long hi, lo;
- int ediff;
- union ibm_extended_long_double eldbl;
- eldbl.d = x;
- *exp = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
-
- lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
- hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
- /* If the lower double is not a denomal or zero then set the hidden
- 53rd bit. */
- if (eldbl.ieee.exponent2 > 0x001)
- {
- lo |= (1ULL << 52);
- lo = lo << 7; /* pre-shift lo to match ieee854. */
- /* The lower double is normalized separately from the upper. We
- may need to adjust the lower mantissa to reflect this. */
- ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;
- if (ediff > 53)
- lo = lo >> (ediff-53);
- }
- hi |= (1ULL << 52);
-
- if ((eldbl.ieee.negative != eldbl.ieee.negative2)
- && ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))
- {
- hi--;
- lo = (1ULL << 60) - lo;
- if (hi < (1ULL << 52))
- {
- /* we have a borrow from the hidden bit, so shift left 1. */
- hi = (hi << 1) | (lo >> 59);
- lo = 0xfffffffffffffffLL & (lo << 1);
- *exp = *exp - 1;
- }
- }
- *lo64 = (hi << 60) | lo;
- *hi64 = hi >> 4;
-}
-
+/* GCC does not optimize the default ldbl_pack code to not spill register
+ in the stack. The following optimization tells gcc that pack/unpack
+ is really a nop. We use fr1/fr2 because those are the regs used to
+ pass/return a single long double arg. */
static inline long double
-ldbl_insert_mantissa (int sign, int exp, int64_t hi64, u_int64_t lo64)
-{
- union ibm_extended_long_double u;
- unsigned long hidden2, lzcount;
- unsigned long long hi, lo;
-
- u.ieee.negative = sign;
- u.ieee.negative2 = sign;
- u.ieee.exponent = exp + IBM_EXTENDED_LONG_DOUBLE_BIAS;
- u.ieee.exponent2 = exp-53 + IBM_EXTENDED_LONG_DOUBLE_BIAS;
- /* Expect 113 bits (112 bits + hidden) right justified in two longs.
- The low order 53 bits (52 + hidden) go into the lower double */
- lo = (lo64 >> 7)& ((1ULL << 53) - 1);
- hidden2 = (lo64 >> 59) & 1ULL;
- /* The high order 53 bits (52 + hidden) go into the upper double */
- hi = (lo64 >> 60) & ((1ULL << 11) - 1);
- hi |= (hi64 << 4);
-
- if (lo != 0LL)
- {
- /* hidden2 bit of low double controls rounding of the high double.
- If hidden2 is '1' then round up hi and adjust lo (2nd mantissa)
- plus change the sign of the low double to compensate. */
- if (hidden2)
- {
- hi++;
- u.ieee.negative2 = !sign;
- lo = (1ULL << 53) - lo;
- }
- /* The hidden bit of the lo mantissa is zero so we need to
- normalize the it for the low double. Shift it left until the
- hidden bit is '1' then adjust the 2nd exponent accordingly. */
-
- if (sizeof (lo) == sizeof (long))
- lzcount = __builtin_clzl (lo);
- else if ((lo >> 32) != 0)
- lzcount = __builtin_clzl ((long) (lo >> 32));
- else
- lzcount = __builtin_clzl ((long) lo) + 32;
- lzcount = lzcount - 11;
- if (lzcount > 0)
- {
- int expnt2 = u.ieee.exponent2 - lzcount;
- if (expnt2 >= 1)
- {
- /* Not denormal. Normalize and set low exponent. */
- lo = lo << lzcount;
- u.ieee.exponent2 = expnt2;
- }
- else
- {
- /* Is denormal. */
- lo = lo << (lzcount + expnt2);
- u.ieee.exponent2 = 0;
- }
- }
- }
- else
- {
- u.ieee.negative2 = 0;
- u.ieee.exponent2 = 0;
- }
-
- u.ieee.mantissa3 = lo & ((1ULL << 32) - 1);
- u.ieee.mantissa2 = (lo >> 32) & ((1ULL << 20) - 1);
- u.ieee.mantissa1 = hi & ((1ULL << 32) - 1);
- u.ieee.mantissa0 = (hi >> 32) & ((1ULL << 20) - 1);
- return u.d;
-}
-
-/* gcc generates disgusting code to pack and unpack long doubles.
- This tells gcc that pack/unpack is really a nop. We use fr1/fr2
- because those are the regs used to pass/return a single
- long double arg. */
-static inline long double
-ldbl_pack (double a, double aa)
+ldbl_pack_ppc (double a, double aa)
{
register long double x __asm__ ("fr1");
register double xh __asm__ ("fr1");
@@ -139,7 +19,7 @@
}
static inline void
-ldbl_unpack (long double l, double *a, double *aa)
+ldbl_unpack_ppc (long double l, double *a, double *aa)
{
register long double x __asm__ ("fr1");
register double xh __asm__ ("fr1");
@@ -150,40 +30,7 @@
*aa = xl;
}
+#define ldbl_pack ldbl_pack_ppc
+#define ldbl_unpack ldbl_unpack_ppc
-/* Convert a finite long double to canonical form.
- Does not handle +/-Inf properly. */
-static inline void
-ldbl_canonicalize (double *a, double *aa)
-{
- double xh, xl;
-
- xh = *a + *aa;
- xl = (*a - xh) + *aa;
- *a = xh;
- *aa = xl;
-}
-
-/* Simple inline nearbyint (double) function .
- Only works in the default rounding mode
- but is useful in long double rounding functions. */
-static inline double
-ldbl_nearbyint (double a)
-{
- double two52 = 0x10000000000000LL;
-
- if (__builtin_expect ((__builtin_fabs (a) < two52), 1))
- {
- if (__builtin_expect ((a > 0.0), 1))
- {
- a += two52;
- a -= two52;
- }
- else if (__builtin_expect ((a < 0.0), 1))
- {
- a = two52 - a;
- a = -(a - two52);
- }
- }
- return a;
-}
+#include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h>
Added: fsf/trunk/libc/sysdeps/powerpc/power4/fpu/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/power4/fpu/Makefile (added)
+++ fsf/trunk/libc/sysdeps/powerpc/power4/fpu/Makefile Sat Mar 9 00:02:01 2013
@@ -1,0 +1,7 @@
+# Makefile fragment for POWER4/5/5+ with FPU.
+
+ifeq ($(subdir),math)
+CFLAGS-mpa.c += --param max-unroll-times=4 -funroll-loops -fpeel-loops
+CPPFLAGS-slowpow.c += -DUSE_LONG_DOUBLE_FOR_MP=1
+CPPFLAGS-slowexp.c += -DUSE_LONG_DOUBLE_FOR_MP=1
+endif
Added: fsf/trunk/libc/sysdeps/powerpc/power4/fpu/mpa.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/power4/fpu/mpa.c (added)
+++ fsf/trunk/libc/sysdeps/powerpc/power4/fpu/mpa.c Sat Mar 9 00:02:01 2013
@@ -1,0 +1,214 @@
+
+/*
+ * IBM Accurate Mathematical Library
+ * written by International Business Machines Corp.
+ * Copyright (C) 2001-2013 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Define __mul and __sqr and use the rest from generic code. */
+#define NO__MUL
+#define NO__SQR
+
+#include <sysdeps/ieee754/dbl-64/mpa.c>
+
+/* Multiply *X and *Y and store result in *Z. X and Y may overlap but not X
+ and Z or Y and Z. For P in [1, 2, 3], the exact result is truncated to P
+ digits. In case P > 3 the error is bounded by 1.001 ULP. */
+void
+__mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
+{
+ long i, i1, i2, j, k, k2;
+ long p2 = p;
+ double u, zk, zk2;
+
+ /* Is z=0? */
+ if (__glibc_unlikely (X[0] * Y[0] == ZERO))
+ {
+ Z[0] = ZERO;
+ return;
+ }
+
+ /* Multiply, add and carry */
+ k2 = (p2 < 3) ? p2 + p2 : p2 + 3;
+ zk = Z[k2] = ZERO;
+ for (k = k2; k > 1;)
+ {
+ if (k > p2)
+ {
+ i1 = k - p2;
+ i2 = p2 + 1;
+ }
+ else
+ {
+ i1 = 1;
+ i2 = k;
+ }
+#if 1
+ /* Rearrange this inner loop to allow the fmadd instructions to be
+ independent and execute in parallel on processors that have
+ dual symmetrical FP pipelines. */
+ if (i1 < (i2 - 1))
+ {
+ /* Make sure we have at least 2 iterations. */
+ if (((i2 - i1) & 1L) == 1L)
+ {
+ /* Handle the odd iterations case. */
+ zk2 = x->d[i2 - 1] * y->d[i1];
+ }
+ else
+ zk2 = 0.0;
+ /* Do two multiply/adds per loop iteration, using independent
+ accumulators; zk and zk2. */
+ for (i = i1, j = i2 - 1; i < i2 - 1; i += 2, j -= 2)
+ {
+ zk += x->d[i] * y->d[j];
+ zk2 += x->d[i + 1] * y->d[j - 1];
+ }
+ zk += zk2; /* Final sum. */
+ }
+ else
+ {
+ /* Special case when iterations is 1. */
+ zk += x->d[i1] * y->d[i1];
+ }
+#else
+ /* The original code. */
+ for (i = i1, j = i2 - 1; i < i2; i++, j--)
+ zk += X[i] * Y[j];
+#endif
+
+ u = (zk + CUTTER) - CUTTER;
+ if (u > zk)
+ u -= RADIX;
+ Z[k] = zk - u;
+ zk = u * RADIXI;
+ --k;
+ }
+ Z[k] = zk;
+
+ int e = EX + EY;
+ /* Is there a carry beyond the most significant digit? */
+ if (Z[1] == ZERO)
+ {
+ for (i = 1; i <= p2; i++)
+ Z[i] = Z[i + 1];
+ e--;
+ }
+
+ EZ = e;
+ Z[0] = X[0] * Y[0];
+}
+
+/* Square *X and store result in *Y. X and Y may not overlap. For P in
+ [1, 2, 3], the exact result is truncated to P digits. In case P > 3 the
+ error is bounded by 1.001 ULP. This is a faster special case of
+ multiplication. */
+void
+__sqr (const mp_no *x, mp_no *y, int p)
+{
+ long i, j, k, ip;
+ double u, yk;
+
+ /* Is z=0? */
+ if (__glibc_unlikely (X[0] == ZERO))
+ {
+ Y[0] = ZERO;
+ return;
+ }
+
+ /* We need not iterate through all X's since it's pointless to
+ multiply zeroes. */
+ for (ip = p; ip > 0; ip--)
+ if (X[ip] != ZERO)
+ break;
+
+ k = (__glibc_unlikely (p < 3)) ? p + p : p + 3;
+
+ while (k > 2 * ip + 1)
+ Y[k--] = ZERO;
+
+ yk = ZERO;
+
+ while (k > p)
+ {
+ double yk2 = 0.0;
+ long lim = k / 2;
+
+ if (k % 2 == 0)
+ {
+ yk += X[lim] * X[lim];
+ lim--;
+ }
+
+ /* In __mul, this loop (and the one within the next while loop) run
+ between a range to calculate the mantissa as follows:
+
+ Z[k] = X[k] * Y[n] + X[k+1] * Y[n-1] ... + X[n-1] * Y[k+1]
+ + X[n] * Y[k]
+
+ For X == Y, we can get away with summing halfway and doubling the
+ result. For cases where the range size is even, the mid-point needs
+ to be added separately (above). */
+ for (i = k - p, j = p; i <= lim; i++, j--)
+ yk2 += X[i] * X[j];
+
+ yk += 2.0 * yk2;
+
+ u = (yk + CUTTER) - CUTTER;
+ if (u > yk)
+ u -= RADIX;
+ Y[k--] = yk - u;
+ yk = u * RADIXI;
+ }
+
+ while (k > 1)
+ {
+ double yk2 = 0.0;
+ long lim = k / 2;
+
+ if (k % 2 == 0)
+ {
+ yk += X[lim] * X[lim];
+ lim--;
+ }
+
+ /* Likewise for this loop. */
+ for (i = 1, j = k - 1; i <= lim; i++, j--)
+ yk2 += X[i] * X[j];
+
+ yk += 2.0 * yk2;
+
+ u = (yk + CUTTER) - CUTTER;
+ if (u > yk)
+ u -= RADIX;
+ Y[k--] = yk - u;
+ yk = u * RADIXI;
+ }
+ Y[k] = yk;
+
+ /* Squares are always positive. */
+ Y[0] = 1.0;
+
+ int e = EX * 2;
+ /* Is there a carry beyond the most significant digit? */
+ if (__glibc_unlikely (Y[1] == ZERO))
+ {
+ for (i = 1; i <= p; i++)
+ Y[i] = Y[i + 1];
+ e--;
+ }
+ EY = e;
+}
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/Implies
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/Implies (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/Implies Sat Mar 9 00:02:01 2013
@@ -1,0 +1,2 @@
+powerpc/power4/fpu
+powerpc/power4
Removed: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/Makefile (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/Makefile (removed)
@@ -1,7 +1,0 @@
-# Makefile fragment for POWER4/5/5+ with FPU.
-
-ifeq ($(subdir),math)
-CFLAGS-mpa.c += --param max-unroll-times=4 -funroll-loops -fpeel-loops
-CPPFLAGS-slowpow.c += -DUSE_LONG_DOUBLE_FOR_MP=1
-CPPFLAGS-slowexp.c += -DUSE_LONG_DOUBLE_FOR_MP=1
-endif
Removed: fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc32/power4/fpu/mpa.c (removed)
@@ -1,214 +1,0 @@
-
-/*
- * IBM Accurate Mathematical Library
- * written by International Business Machines Corp.
- * Copyright (C) 2001-2013 Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/* Define __mul and __sqr and use the rest from generic code. */
-#define NO__MUL
-#define NO__SQR
-
-#include <sysdeps/ieee754/dbl-64/mpa.c>
-
-/* Multiply *X and *Y and store result in *Z. X and Y may overlap but not X
- and Z or Y and Z. For P in [1, 2, 3], the exact result is truncated to P
- digits. In case P > 3 the error is bounded by 1.001 ULP. */
-void
-__mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
-{
- long i, i1, i2, j, k, k2;
- long p2 = p;
- double u, zk, zk2;
-
- /* Is z=0? */
- if (__glibc_unlikely (X[0] * Y[0] == ZERO))
- {
- Z[0] = ZERO;
- return;
- }
-
- /* Multiply, add and carry */
- k2 = (p2 < 3) ? p2 + p2 : p2 + 3;
- zk = Z[k2] = ZERO;
- for (k = k2; k > 1;)
- {
- if (k > p2)
- {
- i1 = k - p2;
- i2 = p2 + 1;
- }
- else
- {
- i1 = 1;
- i2 = k;
- }
-#if 1
- /* Rearrange this inner loop to allow the fmadd instructions to be
- independent and execute in parallel on processors that have
- dual symmetrical FP pipelines. */
- if (i1 < (i2 - 1))
- {
- /* Make sure we have at least 2 iterations. */
- if (((i2 - i1) & 1L) == 1L)
- {
- /* Handle the odd iterations case. */
- zk2 = x->d[i2 - 1] * y->d[i1];
- }
- else
- zk2 = 0.0;
- /* Do two multiply/adds per loop iteration, using independent
- accumulators; zk and zk2. */
- for (i = i1, j = i2 - 1; i < i2 - 1; i += 2, j -= 2)
- {
- zk += x->d[i] * y->d[j];
- zk2 += x->d[i + 1] * y->d[j - 1];
- }
- zk += zk2; /* Final sum. */
- }
- else
- {
- /* Special case when iterations is 1. */
- zk += x->d[i1] * y->d[i1];
- }
-#else
- /* The original code. */
- for (i = i1, j = i2 - 1; i < i2; i++, j--)
- zk += X[i] * Y[j];
-#endif
-
- u = (zk + CUTTER) - CUTTER;
- if (u > zk)
- u -= RADIX;
- Z[k] = zk - u;
- zk = u * RADIXI;
- --k;
- }
- Z[k] = zk;
-
- int e = EX + EY;
- /* Is there a carry beyond the most significant digit? */
- if (Z[1] == ZERO)
- {
- for (i = 1; i <= p2; i++)
- Z[i] = Z[i + 1];
- e--;
- }
-
- EZ = e;
- Z[0] = X[0] * Y[0];
-}
-
-/* Square *X and store result in *Y. X and Y may not overlap. For P in
- [1, 2, 3], the exact result is truncated to P digits. In case P > 3 the
- error is bounded by 1.001 ULP. This is a faster special case of
- multiplication. */
-void
-__sqr (const mp_no *x, mp_no *y, int p)
-{
- long i, j, k, ip;
- double u, yk;
-
- /* Is z=0? */
- if (__glibc_unlikely (X[0] == ZERO))
- {
- Y[0] = ZERO;
- return;
- }
-
- /* We need not iterate through all X's since it's pointless to
- multiply zeroes. */
- for (ip = p; ip > 0; ip--)
- if (X[ip] != ZERO)
- break;
-
- k = (__glibc_unlikely (p < 3)) ? p + p : p + 3;
-
- while (k > 2 * ip + 1)
- Y[k--] = ZERO;
-
- yk = ZERO;
-
- while (k > p)
- {
- double yk2 = 0.0;
- long lim = k / 2;
-
- if (k % 2 == 0)
- {
- yk += X[lim] * X[lim];
- lim--;
- }
-
- /* In __mul, this loop (and the one within the next while loop) run
- between a range to calculate the mantissa as follows:
-
- Z[k] = X[k] * Y[n] + X[k+1] * Y[n-1] ... + X[n-1] * Y[k+1]
- + X[n] * Y[k]
-
- For X == Y, we can get away with summing halfway and doubling the
- result. For cases where the range size is even, the mid-point needs
- to be added separately (above). */
- for (i = k - p, j = p; i <= lim; i++, j--)
- yk2 += X[i] * X[j];
-
- yk += 2.0 * yk2;
-
- u = (yk + CUTTER) - CUTTER;
- if (u > yk)
- u -= RADIX;
- Y[k--] = yk - u;
- yk = u * RADIXI;
- }
-
- while (k > 1)
- {
- double yk2 = 0.0;
- long lim = k / 2;
-
- if (k % 2 == 0)
- {
- yk += X[lim] * X[lim];
- lim--;
- }
-
- /* Likewise for this loop. */
- for (i = 1, j = k - 1; i <= lim; i++, j--)
- yk2 += X[i] * X[j];
-
- yk += 2.0 * yk2;
-
- u = (yk + CUTTER) - CUTTER;
- if (u > yk)
- u -= RADIX;
- Y[k--] = yk - u;
- yk = u * RADIXI;
- }
- Y[k] = yk;
-
- /* Squares are always positive. */
- Y[0] = 1.0;
-
- int e = EX * 2;
- /* Is there a carry beyond the most significant digit? */
- if (__glibc_unlikely (Y[1] == ZERO))
- {
- for (i = 1; i <= p; i++)
- Y[i] = Y[i + 1];
- e--;
- }
- EY = e;
-}
Added: fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/Implies
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/Implies (added)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/Implies Sat Mar 9 00:02:01 2013
@@ -1,0 +1,2 @@
+powerpc/power4/fpu
+powerpc/power4
Removed: fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/fpu/Makefile
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/fpu/Makefile (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/fpu/Makefile (removed)
@@ -1,7 +1,0 @@
-# Makefile fragment for POWER4/5/5+ platforms with FPU.
-
-ifeq ($(subdir),math)
-CFLAGS-mpa.c += --param max-unroll-times=4 -funroll-loops -fpeel-loops
-CPPFLAGS-slowpow.c += -DUSE_LONG_DOUBLE_FOR_MP=1
-CPPFLAGS-slowexp.c += -DUSE_LONG_DOUBLE_FOR_MP=1
-endif
Removed: fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c
==============================================================================
--- fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c (original)
+++ fsf/trunk/libc/sysdeps/powerpc/powerpc64/power4/fpu/mpa.c (removed)
@@ -1,214 +1,0 @@
-
-/*
- * IBM Accurate Mathematical Library
- * written by International Business Machines Corp.
- * Copyright (C) 2001-2013 Free Software Foundation, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/* Define __mul and __sqr and use the rest from generic code. */
-#define NO__MUL
-#define NO__SQR
-
-#include <sysdeps/ieee754/dbl-64/mpa.c>
-
-/* Multiply *X and *Y and store result in *Z. X and Y may overlap but not X
- and Z or Y and Z. For P in [1, 2, 3], the exact result is truncated to P
- digits. In case P > 3 the error is bounded by 1.001 ULP. */
-void
-__mul (const mp_no *x, const mp_no *y, mp_no *z, int p)
-{
- long i, i1, i2, j, k, k2;
- long p2 = p;
- double u, zk, zk2;
-
- /* Is z=0? */
- if (__glibc_unlikely (X[0] * Y[0] == ZERO))
- {
- Z[0] = ZERO;
- return;
- }
-
- /* Multiply, add and carry */
- k2 = (p2 < 3) ? p2 + p2 : p2 + 3;
- zk = Z[k2] = ZERO;
- for (k = k2; k > 1;)
- {
- if (k > p2)
- {
- i1 = k - p2;
- i2 = p2 + 1;
- }
- else
- {
- i1 = 1;
- i2 = k;
- }
-#if 1
- /* Rearrange this inner loop to allow the fmadd instructions to be
- independent and execute in parallel on processors that have
- dual symmetrical FP pipelines. */
- if (i1 < (i2 - 1))
- {
- /* Make sure we have at least 2 iterations. */
- if (((i2 - i1) & 1L) == 1L)
- {
- /* Handle the odd iterations case. */
- zk2 = x->d[i2 - 1] * y->d[i1];
- }
- else
- zk2 = 0.0;
- /* Do two multiply/adds per loop iteration, using independent
- accumulators; zk and zk2. */
- for (i = i1, j = i2 - 1; i < i2 - 1; i += 2, j -= 2)
- {
- zk += x->d[i] * y->d[j];
- zk2 += x->d[i + 1] * y->d[j - 1];
- }
- zk += zk2; /* Final sum. */
- }
- else
- {
- /* Special case when iterations is 1. */
- zk += x->d[i1] * y->d[i1];
- }
-#else
- /* The original code. */
- for (i = i1, j = i2 - 1; i < i2; i++, j--)
- zk += X[i] * Y[j];
-#endif
-
- u = (zk + CUTTER) - CUTTER;
- if (u > zk)
- u -= RADIX;
- Z[k] = zk - u;
- zk = u * RADIXI;
- --k;
- }
- Z[k] = zk;
-
- int e = EX + EY;
- /* Is there a carry beyond the most significant digit? */
- if (Z[1] == ZERO)
- {
- for (i = 1; i <= p2; i++)
- Z[i] = Z[i + 1];
- e--;
- }
-
- EZ = e;
- Z[0] = X[0] * Y[0];
-}
-
-/* Square *X and store result in *Y. X and Y may not overlap. For P in
- [1, 2, 3], the exact result is truncated to P digits. In case P > 3 the
- error is bounded by 1.001 ULP. This is a faster special case of
- multiplication. */
-void
-__sqr (const mp_no *x, mp_no *y, int p)
-{
- long i, j, k, ip;
- double u, yk;
-
- /* Is z=0? */
- if (__glibc_unlikely (X[0] == ZERO))
- {
- Y[0] = ZERO;
- return;
- }
-
- /* We need not iterate through all X's since it's pointless to
- multiply zeroes. */
- for (ip = p; ip > 0; ip--)
- if (X[ip] != ZERO)
- break;
-
- k = (__glibc_unlikely (p < 3)) ? p + p : p + 3;
-
- while (k > 2 * ip + 1)
- Y[k--] = ZERO;
-
- yk = ZERO;
-
- while (k > p)
- {
- double yk2 = 0.0;
- long lim = k / 2;
-
- if (k % 2 == 0)
- {
- yk += X[lim] * X[lim];
- lim--;
- }
-
- /* In __mul, this loop (and the one within the next while loop) run
- between a range to calculate the mantissa as follows:
-
- Z[k] = X[k] * Y[n] + X[k+1] * Y[n-1] ... + X[n-1] * Y[k+1]
- + X[n] * Y[k]
-
- For X == Y, we can get away with summing halfway and doubling the
- result. For cases where the range size is even, the mid-point needs
- to be added separately (above). */
- for (i = k - p, j = p; i <= lim; i++, j--)
- yk2 += X[i] * X[j];
-
- yk += 2.0 * yk2;
-
- u = (yk + CUTTER) - CUTTER;
- if (u > yk)
- u -= RADIX;
- Y[k--] = yk - u;
- yk = u * RADIXI;
- }
-
- while (k > 1)
- {
- double yk2 = 0.0;
- long lim = k / 2;
-
- if (k % 2 == 0)
- {
- yk += X[lim] * X[lim];
- lim--;
- }
-
- /* Likewise for this loop. */
- for (i = 1, j = k - 1; i <= lim; i++, j--)
- yk2 += X[i] * X[j];
-
- yk += 2.0 * yk2;
-
- u = (yk + CUTTER) - CUTTER;
- if (u > yk)
- u -= RADIX;
- Y[k--] = yk - u;
- yk = u * RADIXI;
- }
- Y[k] = yk;
-
- /* Squares are always positive. */
- Y[0] = 1.0;
-
- int e = EX * 2;
- /* Is there a carry beyond the most significant digit? */
- if (__glibc_unlikely (Y[1] == ZERO))
- {
- for (i = 1; i <= p; i++)
- Y[i] = Y[i + 1];
- e--;
- }
- EY = e;
-}
Removed: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/Implies
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/Implies (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/Implies (removed)
@@ -1,4 +1,0 @@
-# Make sure these routines come before ldbl-opt.
-ieee754/ldbl-128ibm
-# These supply the ABI compatibility for when long double was double.
-ieee754/ldbl-opt
_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits