public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Fixes for alpha problems Joseph noticed
@ 2012-06-15 19:20 Richard Henderson
  2012-06-15 19:21 ` [PATCH 2/7] alpha: Remove some __GNUC_PREREQs that are too old Richard Henderson
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Richard Henderson @ 2012-06-15 19:20 UTC (permalink / raw)
  To: libc-ports

<quote>
* alpha: out of date in the following ways:

  (a) There are __GNUC_PREREQ conditionals in various non-installed
  files that should be removed because the versions in question are
  older than the minimum 4.3 version accepted for configuring GCC:
  sysdeps/alpha/fpu/cfloat-compat.h sysdeps/alpha/fpu/s_fabs.c
  sysdeps/alpha/fpu/s_fabsf.c sysdeps/unix/sysv/linux/alpha/sysconf.c.

  (b) bits/mathdef.h should be updated in line with my 2012-01-31 libc
  change so that float_t is always float rather than depending on
  __GNUC__.

  (c) sysdeps/alpha/soft-fp/sfp-machine.h is missing a definition of
  FP_TRAPPING_EXCEPTIONS.

  (d) sysdeps/unix/sysv/linux/alpha/bits/resource.h is missing
  RLIMIT_RTTIME.

  (e) sysdeps/unix/sysv/linux/alpha/bits/resource.h has a possible
  trailing comma in an enum outside __USE_GNU where the generic code
  has it inside __USE_GNU.

  (f) sysdeps/unix/sysv/linux/alpha/bits/resource.h is missing the
  prlimit and prlimit64 declarations.

  (g) sysdeps/unix/sysv/linux/alpha/bits/shm.h is missing SHM_EXEC.

  (h) sysdeps/unix/sysv/linux/alpha/bits/stat.h has a conditional "#if
  defined __USE_ATFILE || defined __USE_GNU" where other versions use
  "#ifdef __USE_ATFILE".
</quote>

All fixed except (c), as I don't quite know what that means.


r~


Richard Henderson (7):
  alpha: Fix float_t in bits/mathdef.h
  alpha: Remove some __GNUC_PREREQs that are too old
  alpha: Add missing definitions in resource.h, shm.h
  alpha: Fix protection on UTIME_NOW
  alpha: Use builtins for copysign
  [BZ #13848] alpha: Fix s_nearbyint implementation.
  alpha: Always handle inexact in rint implementations

 ChangeLog.alpha                               |   30 +++++++++++++++++
 sysdeps/alpha/bits/mathdef.h                  |   16 ++--------
 sysdeps/alpha/fpu/cfloat-compat.h             |   21 ++----------
 sysdeps/alpha/fpu/s_copysign.c                |    5 +--
 sysdeps/alpha/fpu/s_copysignf.c               |    5 +--
 sysdeps/alpha/fpu/s_fabs.c                    |    7 +---
 sysdeps/alpha/fpu/s_fabsf.c                   |    7 +---
 sysdeps/alpha/fpu/s_nearbyint.c               |   31 +++++++++---------
 sysdeps/alpha/fpu/s_nearbyintf.c              |   35 ++++++++++++--------
 sysdeps/alpha/fpu/s_rint.c                    |    9 +----
 sysdeps/alpha/fpu/s_rintf.c                   |    6 +---
 sysdeps/unix/sysv/linux/alpha/bits/resource.h |   42 ++++++++++++++++++++++--
 sysdeps/unix/sysv/linux/alpha/bits/shm.h      |    4 +-
 sysdeps/unix/sysv/linux/alpha/bits/stat.h     |    6 +--
 sysdeps/unix/sysv/linux/alpha/sysconf.c       |   28 +---------------
 15 files changed, 126 insertions(+), 126 deletions(-)

-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/7] alpha: Remove some __GNUC_PREREQs that are too old
  2012-06-15 19:20 [PATCH 0/7] Fixes for alpha problems Joseph noticed Richard Henderson
@ 2012-06-15 19:21 ` Richard Henderson
  2012-06-15 19:21 ` [PATCH 4/7] alpha: Fix protection on UTIME_NOW Richard Henderson
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2012-06-15 19:21 UTC (permalink / raw)
  To: libc-ports

---
 sysdeps/alpha/fpu/cfloat-compat.h       |   21 +++------------------
 sysdeps/alpha/fpu/s_fabs.c              |    7 +------
 sysdeps/alpha/fpu/s_fabsf.c             |    7 +------
 sysdeps/unix/sysv/linux/alpha/sysconf.c |   28 ++--------------------------
 4 files changed, 7 insertions(+), 56 deletions(-)

diff --git a/sysdeps/alpha/fpu/cfloat-compat.h b/sysdeps/alpha/fpu/cfloat-compat.h
index f75bb9b..35542e6 100644
--- a/sysdeps/alpha/fpu/cfloat-compat.h
+++ b/sysdeps/alpha/fpu/cfloat-compat.h
@@ -1,5 +1,5 @@
 /* Compatibility macros for old and new Alpha complex float ABI.
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,35 +25,20 @@
    follow the official Tru64 ABI, which passes the components of a complex
    as separate parameters.  */
 
-#if __GNUC_PREREQ(3,4)
-  typedef union { double d; _Complex float cf; } c1_compat;
+typedef union { double d; _Complex float cf; } c1_compat;
 # define c1_cfloat_decl(x)	double x
 # define c1_cfloat_real(x)	__real__ c1_cfloat_value (x)
 # define c1_cfloat_imag(x)	__imag__ c1_cfloat_value (x)
 # define c1_cfloat_value(x)	(((c1_compat *)(void *)&x)->cf)
 # define c1_cfloat_rettype	double
 # define c1_cfloat_return(x)	({ c1_compat _; _.cf = (x); _.d; })
+
 # define c2_cfloat_decl(x)	_Complex float x
 # define c2_cfloat_real(x)	__real__ x
 # define c2_cfloat_imag(x)	__imag__ x
 # define c2_cfloat_value(x)	x
 # define c2_cfloat_rettype	_Complex float
 # define c2_cfloat_return(x)	x
-#else
-# define c1_cfloat_decl(x)	_Complex float x
-# define c1_cfloat_real(x)	__real__ x
-# define c1_cfloat_imag(x)	__imag__ x
-# define c1_cfloat_value(x)	x
-# define c1_cfloat_rettype	_Complex float
-# define c1_cfloat_return(x)	x
-# define c2_cfloat_decl(x)	float x ## r, float x ## i
-# define c2_cfloat_real(x)	x ## r
-# define c2_cfloat_imag(x)	x ## i
-# define c2_cfloat_value(x) \
-    ({ _Complex float _; __real__ _ = x##r; __imag__ _ = x##i; _; })
-# define c2_cfloat_rettype	double _Complex
-# define c2_cfloat_return(x)	x
-#endif
 
 /* Get the proper symbol versions defined for each function.  */
 
diff --git a/sysdeps/alpha/fpu/s_fabs.c b/sysdeps/alpha/fpu/s_fabs.c
index 0105162..f970acd 100644
--- a/sysdeps/alpha/fpu/s_fabs.c
+++ b/sysdeps/alpha/fpu/s_fabs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2006, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -22,12 +22,7 @@
 double
 __fabs (double x)
 {
-#if __GNUC_PREREQ (2, 8)
   return __builtin_fabs (x);
-#else
-  __asm ("cpys $f31, %1, %0" : "=f" (x) : "f" (x));
-  return x;
-#endif
 }
 
 weak_alias (__fabs, fabs)
diff --git a/sysdeps/alpha/fpu/s_fabsf.c b/sysdeps/alpha/fpu/s_fabsf.c
index 05f776e..5c80ae8 100644
--- a/sysdeps/alpha/fpu/s_fabsf.c
+++ b/sysdeps/alpha/fpu/s_fabsf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -21,12 +21,7 @@
 float
 __fabsf (float x)
 {
-#if __GNUC_PREREQ (2, 8)
   return __builtin_fabsf (x);
-#else
-  __asm ("cpys $f31, %1, %0" : "=f" (x) : "f" (x));
-  return x;
-#endif
 }
 
 weak_alias (__fabsf, fabsf)
diff --git a/sysdeps/unix/sysv/linux/alpha/sysconf.c b/sysdeps/unix/sysv/linux/alpha/sysconf.c
index afb7aa6..603157e 100644
--- a/sysdeps/unix/sysv/linux/alpha/sysconf.c
+++ b/sysdeps/unix/sysv/linux/alpha/sysconf.c
@@ -28,30 +28,6 @@ static long int linux_sysconf (int name);
 
 extern long __libc_alpha_cache_shape[4];
 
-static inline unsigned long
-implver (void)
-{
-  unsigned long i;
-#if __GNUC_PREREQ(3,3)
-  i = __builtin_alpha_implver ();
-#else
-  asm ("implver %0" : "=r" (i));
-#endif
-  return i;
-}
-
-static inline unsigned long
-amask (unsigned long x)
-{
-  unsigned long r;
-#if __GNUC_PREREQ(3,3)
-  r = __builtin_alpha_amask (x);
-#else
-  asm ("amask %1,%0" : "=r"(r) : "Ir"(x));
-#endif
-  return r;
-}
-
 /* Get the value of the system variable NAME.  */
 long int
 __sysconf (int name)
@@ -79,7 +55,7 @@ __sysconf (int name)
 	 pages or have the kernel do the timings from KSEG.  Fortunately,
 	 kernels beginning with 2.6.5 will pass us this info in auxvec.  */
 
-      switch (implver())
+      switch (__builtin_alpha_implver ())
 	{
 	case 0: /* EV4 */
 	  /* EV4/LCA45 had 8k L1 caches; EV45 had 16k L1 caches.  */
@@ -89,7 +65,7 @@ __sysconf (int name)
 	  break;
 
 	case 1: /* EV5 */
-	  if (amask (1 << 8))
+	  if (__builtin_alpha_amask (1 << 8))
 	    {
 	      /* MAX insns not present; either EV5 or EV56.  */
 	      shape_l1i = shape_l1d = CSHAPE(8*1024, 5, 1);
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/7] alpha: Use builtins for copysign
  2012-06-15 19:20 [PATCH 0/7] Fixes for alpha problems Joseph noticed Richard Henderson
                   ` (3 preceding siblings ...)
  2012-06-15 19:21 ` [PATCH 1/7] alpha: Fix float_t in bits/mathdef.h Richard Henderson
@ 2012-06-15 19:21 ` Richard Henderson
  2012-06-15 19:27 ` [PATCH 6/7] [BZ #13848] alpha: Fix s_nearbyint implementation Richard Henderson
  2012-06-15 19:28 ` [PATCH 7/7] alpha: Always handle inexact in rint implementations Richard Henderson
  6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2012-06-15 19:21 UTC (permalink / raw)
  To: libc-ports

---
 sysdeps/alpha/fpu/s_copysign.c  |    5 ++---
 sysdeps/alpha/fpu/s_copysignf.c |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/sysdeps/alpha/fpu/s_copysign.c b/sysdeps/alpha/fpu/s_copysign.c
index 51a5c64..b012027 100644
--- a/sysdeps/alpha/fpu/s_copysign.c
+++ b/sysdeps/alpha/fpu/s_copysign.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2006, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -22,8 +22,7 @@
 double
 __copysign (double x, double y)
 {
-  __asm ("cpys %1, %2, %0" : "=f" (x) : "f" (y), "f" (x));
-  return x;
+  return __builtin_copysign (x, y);
 }
 
 weak_alias (__copysign, copysign)
diff --git a/sysdeps/alpha/fpu/s_copysignf.c b/sysdeps/alpha/fpu/s_copysignf.c
index 2ccd52e..c304949 100644
--- a/sysdeps/alpha/fpu/s_copysignf.c
+++ b/sysdeps/alpha/fpu/s_copysignf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -21,8 +21,7 @@
 float
 __copysignf (float x, float y)
 {
-  __asm ("cpys %1, %2, %0" : "=f" (x) : "f" (y), "f" (x));
-  return x;
+  return __builtin_copysignf (x, y);
 }
 
 weak_alias (__copysignf, copysignf)
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/7] alpha: Fix float_t in bits/mathdef.h
  2012-06-15 19:20 [PATCH 0/7] Fixes for alpha problems Joseph noticed Richard Henderson
                   ` (2 preceding siblings ...)
  2012-06-15 19:21 ` [PATCH 3/7] alpha: Add missing definitions in resource.h, shm.h Richard Henderson
@ 2012-06-15 19:21 ` Richard Henderson
  2012-06-15 19:21 ` [PATCH 5/7] alpha: Use builtins for copysign Richard Henderson
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2012-06-15 19:21 UTC (permalink / raw)
  To: libc-ports

---
 sysdeps/alpha/bits/mathdef.h |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/sysdeps/alpha/bits/mathdef.h b/sysdeps/alpha/bits/mathdef.h
index ae0049a..393547c 100644
--- a/sysdeps/alpha/bits/mathdef.h
+++ b/sysdeps/alpha/bits/mathdef.h
@@ -25,19 +25,9 @@
 #if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
 # define _MATH_H_MATHDEF	1
 
-# ifdef __GNUC__
-
-/* In GNU or ANSI mode, gcc leaves `float' expressions as-is.  */
-typedef float float_t;
-typedef double double_t;
-
-# else
-
-/* Wild guess at types for float_t and double_t. */
-typedef double float_t;
-typedef double double_t;
-
-# endif
+/* Alpha has "float" and "double" operations.  */
+typedef float float_t;    /* float expressions are evaluated as float.  */
+typedef double double_t;  /* double expressions are evaluated as double.  */
 
 /* The values returned by `ilogb' for 0 and NaN respectively.  */
 # define FP_ILOGB0     (-2147483647)
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/7] alpha: Add missing definitions in resource.h, shm.h
  2012-06-15 19:20 [PATCH 0/7] Fixes for alpha problems Joseph noticed Richard Henderson
  2012-06-15 19:21 ` [PATCH 2/7] alpha: Remove some __GNUC_PREREQs that are too old Richard Henderson
  2012-06-15 19:21 ` [PATCH 4/7] alpha: Fix protection on UTIME_NOW Richard Henderson
@ 2012-06-15 19:21 ` Richard Henderson
  2012-06-15 19:21 ` [PATCH 1/7] alpha: Fix float_t in bits/mathdef.h Richard Henderson
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2012-06-15 19:21 UTC (permalink / raw)
  To: libc-ports

---
 sysdeps/unix/sysv/linux/alpha/bits/resource.h |   42 ++++++++++++++++++++++--
 sysdeps/unix/sysv/linux/alpha/bits/shm.h      |    4 +-
 2 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/bits/resource.h b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
index da7b5a4..4df082c 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/resource.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/resource.h
@@ -1,6 +1,5 @@
 /* Bit values & structures for resource limits.  Alpha/Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005
-   Free Software Foundation, Inc.
+   Copyright (C) 1994-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -99,7 +98,13 @@ enum __rlimit_resource
   __RLIMIT_RTPRIO = 14,
 #define RLIMIT_RTPRIO __RLIMIT_RTPRIO
 
-  __RLIMIT_NLIMITS = 15,
+  /* Maximum CPU time in µs that a process scheduled under a real-time
+     scheduling policy may consume without making a blocking system
+     call before being forcibly descheduled.  */
+  __RLIMIT_RTTIME = 15,
+#define RLIMIT_RTTIME __RLIMIT_RTTIME
+
+  __RLIMIT_NLIMITS = 16,
   __RLIM_NLIMITS = __RLIMIT_NLIMITS
 #define RLIMIT_NLIMITS __RLIMIT_NLIMITS
 #define RLIM_NLIMITS __RLIM_NLIMITS
@@ -157,10 +162,11 @@ enum __rusage_who
 #define RUSAGE_SELF RUSAGE_SELF
 
   /* All of its terminated child processes.  */
-  RUSAGE_CHILDREN = -1,
+  RUSAGE_CHILDREN = -1
 #define RUSAGE_CHILDREN RUSAGE_CHILDREN
 
 #ifdef __USE_GNU
+  ,
   /* The calling thread.  */
   RUSAGE_THREAD = 1
 # define RUSAGE_THREAD RUSAGE_THREAD
@@ -230,3 +236,31 @@ enum __priority_which
   PRIO_USER = 2			/* WHO is a user ID.  */
 #define PRIO_USER PRIO_USER
 };
+
+
+__BEGIN_DECLS
+
+#ifdef __USE_GNU
+/* Modify and return resource limits of a process atomically.  */
+# ifndef __USE_FILE_OFFSET64
+extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
+		    const struct rlimit *__new_limit,
+		    struct rlimit *__old_limit) __THROW;
+# else
+#  ifdef __REDIRECT_NTH
+extern int __REDIRECT_NTH (prlimit, (__pid_t __pid,
+				     enum __rlimit_resource __resource,
+				     const struct rlimit *__new_limit,
+				     struct rlimit *__old_limit), prlimit64);
+#  else
+#   define prlimit prlimit64
+#  endif
+# endif
+# ifdef __USE_LARGEFILE64
+extern int prlimit64 (__pid_t __pid, enum __rlimit_resource __resource,
+		      const struct rlimit64 *__new_limit,
+		      struct rlimit64 *__old_limit) __THROW;
+# endif
+#endif
+
+__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/shm.h b/sysdeps/unix/sysv/linux/alpha/bits/shm.h
index a52a266..48f4cb9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/shm.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/shm.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997, 2000, 2002, 2004
-   Free Software Foundation, Inc.
+/* Copyright (C) 1995-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -30,6 +29,7 @@
 #define SHM_RDONLY	010000		/* attach read-only else read-write */
 #define SHM_RND		020000		/* round attach address to SHMLBA */
 #define SHM_REMAP	040000		/* take-over region on attach */
+#define SHM_EXEC	0100000		/* execution access */
 
 /* Commands for `shmctl'.  */
 #define SHM_LOCK	11		/* lock segment (root only) */
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/7] alpha: Fix protection on UTIME_NOW
  2012-06-15 19:20 [PATCH 0/7] Fixes for alpha problems Joseph noticed Richard Henderson
  2012-06-15 19:21 ` [PATCH 2/7] alpha: Remove some __GNUC_PREREQs that are too old Richard Henderson
@ 2012-06-15 19:21 ` Richard Henderson
  2012-06-15 19:21 ` [PATCH 3/7] alpha: Add missing definitions in resource.h, shm.h Richard Henderson
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2012-06-15 19:21 UTC (permalink / raw)
  To: libc-ports

---
 sysdeps/unix/sysv/linux/alpha/bits/stat.h |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/bits/stat.h b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
index a958916..68e5989 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/stat.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/stat.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2001,2004,2010,2012
-   Free Software Foundation, Inc.
+/* Copyright (C) 1996-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -153,8 +152,7 @@ struct stat64
 #define	__S_IWRITE	0200	/* Write by owner.  */
 #define	__S_IEXEC	0100	/* Execute by owner.  */
 
-#if defined __USE_ATFILE || defined __USE_GNU
-/* XXX This will change to the macro for the next 2008 POSIX revision.  */
+#ifdef __USE_ATFILE
 # define UTIME_NOW	((1l << 30) - 1l)
 # define UTIME_OMIT	((1l << 30) - 2l)
 #endif
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 6/7] [BZ #13848] alpha: Fix s_nearbyint implementation.
  2012-06-15 19:20 [PATCH 0/7] Fixes for alpha problems Joseph noticed Richard Henderson
                   ` (4 preceding siblings ...)
  2012-06-15 19:21 ` [PATCH 5/7] alpha: Use builtins for copysign Richard Henderson
@ 2012-06-15 19:27 ` Richard Henderson
  2012-06-15 19:28 ` [PATCH 7/7] alpha: Always handle inexact in rint implementations Richard Henderson
  6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2012-06-15 19:27 UTC (permalink / raw)
  To: libc-ports

---
 sysdeps/alpha/fpu/s_nearbyint.c  |   31 ++++++++++++++++---------------
 sysdeps/alpha/fpu/s_nearbyintf.c |   35 +++++++++++++++++++++--------------
 2 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/sysdeps/alpha/fpu/s_nearbyint.c b/sysdeps/alpha/fpu/s_nearbyint.c
index 1f89260..4589bfc 100644
--- a/sysdeps/alpha/fpu/s_nearbyint.c
+++ b/sysdeps/alpha/fpu/s_nearbyint.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -19,22 +19,23 @@
 #include <math.h>
 #include <math_ldbl_opt.h>
 
-#ifdef _IEEE_FP_INEXACT
-#error "Don't compile with -mieee-with-inexact"
-#endif
 
 double
 __nearbyint (double x)
 {
-  double two52 = copysign (0x1.0p52, x);
-  double r;
-  
-  r = x + two52;
-  r = r - two52;
-
-  /* nearbyint(-0.1) == -0, and in general we'll always have the same sign
-     as our input.  */
-  return copysign (r, x);
+  if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
+    {
+      double tmp1, new_x;
+      __asm ("cvttq/svd %2,%1\n\t"
+	     "cvtqt/d %1,%0\n\t"
+	     : "=f"(new_x), "=&f"(tmp1)
+	     : "f"(x));
+
+      /* nearbyint(-0.1) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysign(new_x, x);
+    }
+  return x;
 }
 
 weak_alias (__nearbyint, nearbyint)
@@ -42,6 +43,6 @@ weak_alias (__nearbyint, nearbyint)
 strong_alias (__nearbyint, __nearbyintl)
 weak_alias (__nearbyint, nearbyintl)
 #endif
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_1);
+#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
+compat_symbol (libm, __nearbyint, nearbyintl, GLIBC_2_0);
 #endif
diff --git a/sysdeps/alpha/fpu/s_nearbyintf.c b/sysdeps/alpha/fpu/s_nearbyintf.c
index efea959..871b9f6 100644
--- a/sysdeps/alpha/fpu/s_nearbyintf.c
+++ b/sysdeps/alpha/fpu/s_nearbyintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -18,22 +18,29 @@
 
 #include <math.h>
 
-#ifdef _IEEE_FP_INEXACT
-#error "Don't compile with -mieee-with-inexact"
-#endif
-
 float
 __nearbyintf (float x)
 {
-  float two23 = copysignf (0x1.0p23, x);
-  float r;
-
-  r = x + two23;
-  r = r - two23;
-
-  /* nearbyint(-0.1) == -0, and in general we'll always have the same sign
-     as our input.  */
-  return copysign (r, x);
+  if (isless (fabsf (x), 16777216.0f))	/* 1 << FLT_MANT_DIG */
+    {
+      /* Note that Alpha S_Floating is stored in registers in a
+	 restricted T_Floating format, so we don't even need to
+	 convert back to S_Floating in the end.  The initial
+	 conversion to T_Floating is needed to handle denormals.  */
+
+      float tmp1, tmp2, new_x;
+
+      __asm ("cvtst/s %3,%2\n\t"
+	     "cvttq/svd %2,%1\n\t"
+	     "cvtqt/d %1,%0\n\t"
+	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
+	     : "f"(x));
+
+      /* nearbyintf(-0.1) == -0, and in general we'll always have the same
+	 sign as our input.  */
+      x = copysignf(new_x, x);
+    }
+  return x;
 }
 
 weak_alias (__nearbyintf, nearbyintf)
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 7/7] alpha: Always handle inexact in rint implementations
  2012-06-15 19:20 [PATCH 0/7] Fixes for alpha problems Joseph noticed Richard Henderson
                   ` (5 preceding siblings ...)
  2012-06-15 19:27 ` [PATCH 6/7] [BZ #13848] alpha: Fix s_nearbyint implementation Richard Henderson
@ 2012-06-15 19:28 ` Richard Henderson
  6 siblings, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2012-06-15 19:28 UTC (permalink / raw)
  To: libc-ports

---
 ChangeLog.alpha             |   30 ++++++++++++++++++++++++++++++
 sysdeps/alpha/fpu/s_rint.c  |    9 ++-------
 sysdeps/alpha/fpu/s_rintf.c |    6 +-----
 3 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/ChangeLog.alpha b/ChangeLog.alpha
index 824083c..5ec3634 100644
--- a/ChangeLog.alpha
+++ b/ChangeLog.alpha
@@ -1,3 +1,33 @@
+2012-06-15  Richard Henderson  <rth@twiddle.net>
+
+	* sysdeps/alpha/fpu/s_rint.c (__rint): Handle inexact regardless
+	of -mieee-with-inexact.
+	* sysdeps/alpha/fpu/s_rintf.c (__rintf): Likewise.
+
+	[BZ #13848]
+	* sysdeps/alpha/fpu/s_nearbyint.c (__nearbyint): Fix corner cases
+	similar to BZ#5350.
+	* sysdeps/alpha/fpu/s_nearbyintf.c (__nearbyintf): Likewise.
+
+	* sysdeps/alpha/fpu/s_copysign.c (__copysign): Use builtin.
+	* sysdeps/alpha/fpu/s_copysignf.c (__copysignf): Use builtin.
+
+	* sysdeps/unix/sysv/linux/alpha/bits/resource.h (RLIMIT_RTTIME): New.
+	(prlimit, prlimit64): New declarations.
+	* sysdeps/unix/sysv/linux/alpha/bits/shm.h (SHM_EXEC): New.
+	* sysdeps/unix/sysv/linux/alpha/bits/stat.h: Use only __USE_ATFILE
+	to protect UTIME_NOW and UTIME_OMIT.
+
+	* sysdeps/alpha/fpu/cfloat-compat.h: Remove __GNUC_PREREQ check.
+	* sysdeps/alpha/fpu/s_fabs.c (__fabs): Likewise.
+	* sysdeps/alpha/fpu/s_fabsf.c (__fabsf): Likewise.
+	* sysdeps/unix/sysv/linux/alpha/sysconf.c (implver): Remove.
+	(amask): Remove.
+	(__sysconf): Use builtins directly.
+
+	* sysdeps/alpha/bits/mathdef.h (float_t): Define as float
+	regardless of __GNUC__.
+
 2012-06-06  Richard Henderson  <rth@twiddle.net>
 
 	* sysdeps/alpha/strncmp.S: Bound count to LONG_MAX at startup.
diff --git a/sysdeps/alpha/fpu/s_rint.c b/sysdeps/alpha/fpu/s_rint.c
index b58ef81..6ddcc13 100644
--- a/sysdeps/alpha/fpu/s_rint.c
+++ b/sysdeps/alpha/fpu/s_rint.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -26,12 +26,7 @@ __rint (double x)
   if (isless (fabs (x), 9007199254740992.0))	/* 1 << DBL_MANT_DIG */
     {
       double tmp1, new_x;
-      __asm (
-#ifdef _IEEE_FP_INEXACT
-	     "cvttq/svid %2,%1\n\t"
-#else
-	     "cvttq/svd %2,%1\n\t"
-#endif
+      __asm ("cvttq/svid %2,%1\n\t"
 	     "cvtqt/d %1,%0\n\t"
 	     : "=f"(new_x), "=&f"(tmp1)
 	     : "f"(x));
diff --git a/sysdeps/alpha/fpu/s_rintf.c b/sysdeps/alpha/fpu/s_rintf.c
index b17bf8c..226e77e 100644
--- a/sysdeps/alpha/fpu/s_rintf.c
+++ b/sysdeps/alpha/fpu/s_rintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Richard Henderson.
 
@@ -32,11 +32,7 @@ __rintf (float x)
       float tmp1, tmp2, new_x;
 
       __asm ("cvtst/s %3,%2\n\t"
-#ifdef _IEEE_FP_INEXACT
 	     "cvttq/svid %2,%1\n\t"
-#else
-	     "cvttq/svd %2,%1\n\t"
-#endif
 	     "cvtqt/d %1,%0\n\t"
 	     : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
 	     : "f"(x));
-- 
1.7.7.6

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-06-15 19:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-15 19:20 [PATCH 0/7] Fixes for alpha problems Joseph noticed Richard Henderson
2012-06-15 19:21 ` [PATCH 2/7] alpha: Remove some __GNUC_PREREQs that are too old Richard Henderson
2012-06-15 19:21 ` [PATCH 4/7] alpha: Fix protection on UTIME_NOW Richard Henderson
2012-06-15 19:21 ` [PATCH 3/7] alpha: Add missing definitions in resource.h, shm.h Richard Henderson
2012-06-15 19:21 ` [PATCH 1/7] alpha: Fix float_t in bits/mathdef.h Richard Henderson
2012-06-15 19:21 ` [PATCH 5/7] alpha: Use builtins for copysign Richard Henderson
2012-06-15 19:27 ` [PATCH 6/7] [BZ #13848] alpha: Fix s_nearbyint implementation Richard Henderson
2012-06-15 19:28 ` [PATCH 7/7] alpha: Always handle inexact in rint implementations Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).