svn commit: branches/uClibc-nptl/libm

carmelo at uclibc.org carmelo at uclibc.org
Wed Jun 18 15:28:29 UTC 2008


Author: carmelo
Date: 2008-06-18 08:28:29 -0700 (Wed, 18 Jun 2008)
New Revision: 22426

Log:
Synch libm with trunk

Added:
   branches/uClibc-nptl/libm/carg.c
   branches/uClibc-nptl/libm/s_llrint.c
   branches/uClibc-nptl/libm/s_trunc.c

Modified:
   branches/uClibc-nptl/libm/Makefile.in
   branches/uClibc-nptl/libm/float_wrappers.c
   branches/uClibc-nptl/libm/math_private.h
   branches/uClibc-nptl/libm/w_drem.c


Changeset:
Modified: branches/uClibc-nptl/libm/Makefile.in
===================================================================
--- branches/uClibc-nptl/libm/Makefile.in	2008-06-18 15:25:40 UTC (rev 22425)
+++ branches/uClibc-nptl/libm/Makefile.in	2008-06-18 15:28:29 UTC (rev 22426)
@@ -29,9 +29,24 @@
 
 libm_FULL_NAME := libm-$(VERSION).so
 
-libm_ARCH_DIR:=$(top_srcdir)libm/$(TARGET_ARCH)
-libm_ARCH_OUT:=$(top_builddir)libm/$(TARGET_ARCH)
+libm_DIR:=$(top_srcdir)libm
+libm_OUT:=$(top_builddir)libm
 
+# Fix builds for powerpc as there are different cores in this 
+# section now.`
+ifeq ($(TARGET_ARCH),powerpc)
+ifeq ($(CONFIG_E500),y)
+libm_ARCH_DIR:=$(libm_DIR)/$(TARGET_ARCH)/e500
+libm_ARCH_OUT:=$(libm_OUT)/$(TARGET_ARCH)/e500
+else
+libm_ARCH_DIR:=$(libm_DIR)/$(TARGET_ARCH)/classic
+libm_ARCH_OUT:=$(libm_OUT)/$(TARGET_ARCH)/classic
+endif
+else
+libm_ARCH_DIR:=$(libm_DIR)/$(TARGET_ARCH)
+libm_ARCH_OUT:=$(libm_OUT)/$(TARGET_ARCH)
+endif
+
 libm_ARCH_fpu_DIR:=$(libm_ARCH_DIR)/fpu
 libm_ARCH_fpu_OUT:=$(libm_ARCH_OUT)/fpu
 
@@ -56,11 +71,11 @@
 	s_ilogb.c s_ldexp.c s_lib_version.c s_lrint.c s_lround.c s_llround.c \
 	s_log1p.c s_logb.c s_matherr.c s_modf.c s_nextafter.c s_round.c \
 	s_rint.c s_scalbn.c s_signgam.c s_significand.c s_sin.c s_tan.c \
-	s_tanh.c w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c w_cabs.c \
-	w_cosh.c w_drem.c w_exp.c w_fmod.c w_gamma.c w_gamma_r.c \
+	s_tanh.c s_trunc.c w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c \
+	w_cabs.c w_cosh.c w_drem.c w_exp.c w_fmod.c w_gamma.c w_gamma_r.c \
 	w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c w_lgamma_r.c \
 	w_log.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c \
-	w_sqrt.c fpmacros.c nan.c
+	w_sqrt.c fpmacros.c nan.c carg.c s_llrint.c
 FL_MOBJ := \
 	acosf.o acoshf.o asinf.o asinhf.o atan2f.o atanf.o atanhf.o cbrtf.o \
 	ceilf.o copysignf.o cosf.o coshf.o erfcf.o erff.o exp2f.o expf.o \
@@ -69,7 +84,7 @@
 	log1pf.o log2f.o logbf.o logf.o lrintf.o lroundf.o modff.o nearbyintf.o \
 	nextafterf.o powf.o remainderf.o remquof.o rintf.o roundf.o \
 	scalblnf.o scalbnf.o sinf.o sinhf.o sqrtf.o tanf.o tanhf.o \
-	tgammaf.o truncf.o
+	tgammaf.o truncf.o cargf.o llrintf.o
 else
 # This list of math functions was taken from POSIX/IEEE 1003.1b-1993
 libm_CSRC := \
@@ -85,14 +100,19 @@
 FL_MOBJ := sqrtf.o
 endif
 
-libm_DIR := $(top_srcdir)libm
-libm_OUT := $(top_builddir)libm
-
 # assume that arch specific versions are provided as single sources/objects
 ifeq ($(UCLIBC_HAS_FPU),y)
 ifeq ($(DO_C99_MATH),y)
 ifneq ($(strip $(libm_ARCH_OBJS)),)
+ifeq ($(TARGET_ARCH),powerpc)
+ifeq ($(CONFIG_E500),y)
+CFLAGS-libm/$(TARGET_ARCH)/e500/ := $(CFLAGS-libm)
+else
+CFLAGS-libm/$(TARGET_ARCH)/classic/ := $(CFLAGS-libm)
+endif
+else
 CFLAGS-libm/$(TARGET_ARCH)/ := $(CFLAGS-libm)
+endif
 
 # remove generic sources, if arch specific version is present
 ifneq ($(strip $(libm_ARCH_SRC)),)
@@ -133,30 +153,27 @@
 
 ifeq ($(DOMULTI),n)
 ifeq ($(DOPIC),y)
-$(top_builddir)lib/libm.so: $(top_builddir)lib/libm.a $(libc)
+$(top_builddir)lib/libm.so: $(top_builddir)lib/libm.a $(libc.depend)
 else
-$(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a $(libc)
+$(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a $(libc.depend)
 endif
 	$(call link.so,$(libm_FULL_NAME),$(MAJOR_VERSION))
 else
-$(top_builddir)lib/libm.so: $(libm_OUT)/libm.oS | $(libc)
+$(top_builddir)lib/libm.so: $(libm_OUT)/libm.oS | $(libc.depend)
 	$(call linkm.so,$(libm_FULL_NAME),$(MAJOR_VERSION))
 endif
 
 $(libm_OUT)/libm_so.a: $(libm-so-y)
 	$(Q)$(RM) $@
-	$(do_strip)
 	$(do_ar)
 
 $(libm_OUT)/libm.oS: $(libm_SRC) $(libm_MSRC) $(libm_ARCH_SRC)
 	$(Q)$(RM) $@
 	$(compile-m)
-	$(do_t_strip)
 
 $(top_builddir)lib/libm.a: $(libm-a-y)
 	$(Q)$(INSTALL) -d $(dir $@)
 	$(Q)$(RM) $@
-	$(do_strip)
 	$(do_ar)
 
 $(libm_MOBJ): $(libm_MSRC)

Added: branches/uClibc-nptl/libm/carg.c
===================================================================
--- branches/uClibc-nptl/libm/carg.c	                        (rev 0)
+++ branches/uClibc-nptl/libm/carg.c	2008-06-18 15:28:29 UTC (rev 22426)
@@ -0,0 +1,33 @@
+/* Compute argument of complex double value.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper at cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <complex.h>
+#include <math.h>
+
+libm_hidden_proto(atan2)
+libm_hidden_proto(carg)
+
+double
+carg (__complex__ double x)
+{
+  return atan2 (__imag__ x, __real__ x);
+}
+
+libm_hidden_def(carg)

Modified: branches/uClibc-nptl/libm/float_wrappers.c
===================================================================
--- branches/uClibc-nptl/libm/float_wrappers.c	2008-06-18 15:25:40 UTC (rev 22425)
+++ branches/uClibc-nptl/libm/float_wrappers.c	2008-06-18 15:28:29 UTC (rev 22426)
@@ -10,7 +10,8 @@
  * GNU Lesser General Public License version 2.1 or later.
  */
 
-#include "math.h"
+#include <math.h>
+#include <complex.h>
 
 /* For the time being, do _NOT_ implement these functions
  * that are defined by SuSv3 */
@@ -19,14 +20,12 @@
 #undef L_fmaf          /*float       fmaf(float, float, float);*/
 #undef L_fmaxf         /*float       fmaxf(float, float);*/
 #undef L_fminf         /*float       fminf(float, float);*/
-#undef L_llrintf       /*long long   llrintf(float);*/
 #undef L_log2f         /*float       log2f(float);*/
 #undef L_nearbyintf    /*float       nearbyintf(float);*/
 #undef L_nexttowardf   /*float       nexttowardf(float, long double);*/
 #undef L_remquof       /*float       remquof(float, float, int *);*/
 #undef L_scalblnf      /*float       scalblnf(float, long);*/
 #undef L_tgammaf       /*float       tgammaf(float);*/
-#undef L_truncf        /*float       truncf(float);*/
 
 /* Implement the following, as defined by SuSv3 */
 #if 0
@@ -138,6 +137,15 @@
 #endif
 
 
+#ifdef L_cargf
+libm_hidden_proto(carg)
+float cargf (float complex x)
+{
+	return (float) carg( (double)x );
+}
+#endif
+
+
 #ifdef L_cbrtf
 libm_hidden_proto(cbrt)
 float cbrtf (float x)

Modified: branches/uClibc-nptl/libm/math_private.h
===================================================================
--- branches/uClibc-nptl/libm/math_private.h	2008-06-18 15:25:40 UTC (rev 22425)
+++ branches/uClibc-nptl/libm/math_private.h	2008-06-18 15:28:29 UTC (rev 22426)
@@ -35,13 +35,14 @@
    ints.  */
 
 /*
- * Math on arm is special:
+ * Math on arm is special (read: stupid):
  * For FPA, float words are always big-endian.
- * For VFP, floats words follow the memory system mode.
+ * For VFP, float words follow the memory system mode.
+ * For Maverick, float words are always little-endian.
  */
 
-#if (__BYTE_ORDER == __BIG_ENDIAN) || \
-    (!defined(__VFP_FP__) && (defined(__arm__) || defined(__thumb__)))
+#if !defined(__MAVERICK__) && ((__BYTE_ORDER == __BIG_ENDIAN) || \
+    (!defined(__VFP_FP__) && (defined(__arm__) || defined(__thumb__))))
 
 typedef union
 {

Added: branches/uClibc-nptl/libm/s_llrint.c
===================================================================
--- branches/uClibc-nptl/libm/s_llrint.c	                        (rev 0)
+++ branches/uClibc-nptl/libm/s_llrint.c	2008-06-18 15:28:29 UTC (rev 22426)
@@ -0,0 +1,90 @@
+/* Round argument to nearest integral value according to current rounding
+   direction.
+   Copyright (C) 1997, 2004, 2006 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper at cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+static const double two52[2] =
+{
+  4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
+ -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
+};
+
+libm_hidden_proto(llrint)
+
+long long int
+llrint (double x)
+{
+  int32_t j0;
+  u_int32_t i1, i0;
+  long long int result;
+  volatile double w;
+  double t;
+  int sx;
+
+  EXTRACT_WORDS (i0, i1, x);
+  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+  sx = i0 >> 31;
+  i0 &= 0xfffff;
+  i0 |= 0x100000;
+
+  if (j0 < 20)
+    {
+      w = two52[sx] + x;
+      t = w - two52[sx];
+      EXTRACT_WORDS (i0, i1, t);
+      j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+      i0 &= 0xfffff;
+      i0 |= 0x100000;
+
+      result = (j0 < 0 ? 0 : i0 >> (20 - j0));
+    }
+  else if (j0 < (int32_t) (8 * sizeof (long long int)) - 1)
+    {
+      if (j0 >= 52)
+	result = (((long long int) i0 << 32) | i1) << (j0 - 52);
+      else
+	{
+	  w = two52[sx] + x;
+	  t = w - two52[sx];
+	  EXTRACT_WORDS (i0, i1, t);
+	  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+	  i0 &= 0xfffff;
+	  i0 |= 0x100000;
+
+	  if (j0 == 20)
+	    result = (long long int) i0;
+	  else
+	    result = ((long long int) i0 << (j0 - 20)) | (i1 >> (52 - j0));
+	}
+    }
+  else
+    {
+      /* The number is too large.  It is left implementation defined
+	 what happens.  */
+      return (long long int) x;
+    }
+
+  return sx ? -result : result;
+}
+
+libm_hidden_def(llrint)

Added: branches/uClibc-nptl/libm/s_trunc.c
===================================================================
--- branches/uClibc-nptl/libm/s_trunc.c	                        (rev 0)
+++ branches/uClibc-nptl/libm/s_trunc.c	2008-06-18 15:28:29 UTC (rev 22426)
@@ -0,0 +1,58 @@
+/* Truncate argument to nearest integral value not larger than the argument.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper at cygnus.com>, 1997.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <math.h>
+
+#include "math_private.h"
+
+
+libm_hidden_proto(trunc)
+double
+trunc (double x)
+{
+  int32_t i0, j0;
+  u_int32_t i1;
+  int sx;
+
+  EXTRACT_WORDS (i0, i1, x);
+  sx = i0 & 0x80000000;
+  j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+  if (j0 < 20)
+    {
+      if (j0 < 0)
+	/* The magnitude of the number is < 1 so the result is +-0.  */
+	INSERT_WORDS (x, sx, 0);
+      else
+	INSERT_WORDS (x, sx | (i0 & ~(0x000fffff >> j0)), 0);
+    }
+  else if (j0 > 51)
+    {
+      if (j0 == 0x400)
+	/* x is inf or NaN.  */
+	return x + x;
+    }
+  else
+    {
+      INSERT_WORDS (x, i0, i1 & ~(0xffffffffu >> (j0 - 20)));
+    }
+
+  return x;
+}
+libm_hidden_def(trunc)

Modified: branches/uClibc-nptl/libm/w_drem.c
===================================================================
--- branches/uClibc-nptl/libm/w_drem.c	2008-06-18 15:25:40 UTC (rev 22425)
+++ branches/uClibc-nptl/libm/w_drem.c	2008-06-18 15:28:29 UTC (rev 22426)
@@ -9,9 +9,7 @@
 
 libm_hidden_proto(remainder)
 
-double
-drem(x, y)
-	double x, y;
+double drem(double x, double y)
 {
 	return remainder(x, y);
 }




More information about the uClibc-cvs mailing list