From: Jakub Jelinek <jakub@redhat.com>
To: Roland McGrath <roland@redhat.com>, Ulrich Drepper <drepper@redhat.com>
Cc: Glibc hackers <libc-hacker@sources.redhat.com>
Subject: Re: architectures, please report on trunk status
Date: Wed, 01 Mar 2006 16:39:00 -0000 [thread overview]
Message-ID: <20060301163934.GJ30252@sunsite.mff.cuni.cz> (raw)
In-Reply-To: <20060228202100.516FD180B1C@magilla.sf.frob.com>
On Tue, Feb 28, 2006 at 12:21:00PM -0800, Roland McGrath wrote:
> People responsible for the architectures in the main source tree, and
> people who build and test on them, please report ASAP on their status.
> The architectures I get reports on in the next few days are the ones that
> will be mentioned in the 2.4 release announcement as known to work.
And here is what I needed to use on sparc (non-v9).
Robust futexes on 32-bit CPUs will work this way only when not pshared,
but ATM we don't support pshared robust futexes on any arch, so that's
not a big deal.
2006-03-01 Jakub Jelinek <jakub@redhat.com>
* sysdeps/sparc/sparc32/fpu/libm-test-ulps: Update.
* sysdeps/sparc/fpu/fraiseexcpt.c (__feraiseexcept): Use
inline asm to make sure the compiler doesn't optimize insns
out.
nptl/
* sysdeps/unix/sysv/linux/sparc/lowlevellock.h (lll_robust_mutex_dead,
lll_robust_mutex_trylock, lll_robust_mutex_lock,
lll_robust_mutex_cond_lock, lll_robust_mutex_timedlock,
lll_robust_mutex_unlock): Define.
(__lll_robust_lock_wait, __lll_robust_timedlock_wait): New prototypes.
--- libc/sysdeps/sparc/sparc32/fpu/libm-test-ulps.jj 2006-01-15 12:59:38.000000000 -0500
+++ libc/sysdeps/sparc/sparc32/fpu/libm-test-ulps 2006-03-01 10:20:59.000000000 -0500
@@ -465,6 +465,11 @@ ifloat: 2
ildouble: 1
ldouble: 1
+# exp2
+Test "exp2 (10) == 1024":
+ildouble: 2
+ldouble: 2
+
# expm1
Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
double: 1
@@ -1192,6 +1197,10 @@ ifloat: 2
ildouble: 1
ldouble: 1
+Function: "exp2":
+ildouble: 2
+ldouble: 2
+
Function: "expm1":
double: 1
float: 1
--- libc/sysdeps/sparc/fpu/fraiseexcpt.c.jj 2002-09-09 21:26:37.000000000 -0400
+++ libc/sysdeps/sparc/fpu/fraiseexcpt.c 2006-03-01 11:11:49.000000000 -0500
@@ -25,12 +25,12 @@
int
__feraiseexcept (int excepts)
{
- static volatile double sink;
static const struct {
double zero, one, max, min, sixteen, pi;
} c = {
0.0, 1.0, DBL_MAX, DBL_MIN, 16.0, M_PI
};
+ double d;
/* Raise exceptions represented by EXPECTS. But we must raise only
one signal at a time. It is important the if the overflow/underflow
@@ -39,24 +39,44 @@ __feraiseexcept (int excepts)
/* First: invalid exception. */
if ((FE_INVALID & excepts) != 0)
- /* One example of a invalid operation is 0/0. */
- sink = c.zero / c.zero;
+ {
+ /* One example of a invalid operation is 0/0. */
+ __asm ("" : "=e" (d) : "0" (c.zero));
+ d /= c.zero;
+ __asm __volatile ("" : : "e" (d));
+ }
/* Next: division by zero. */
if ((FE_DIVBYZERO & excepts) != 0)
- sink = c.one / c.zero;
+ {
+ __asm ("" : "=e" (d) : "0" (c.one));
+ d /= c.zero;
+ __asm __volatile ("" : : "e" (d));
+ }
/* Next: overflow. */
if ((FE_OVERFLOW & excepts) != 0)
- sink = c.max * c.max;
+ {
+ __asm ("" : "=e" (d) : "0" (c.max));
+ d *= d;
+ __asm __volatile ("" : : "e" (d));
+ }
/* Next: underflow. */
if ((FE_UNDERFLOW & excepts) != 0)
- sink = c.min / c.sixteen;
+ {
+ __asm ("" : "=e" (d) : "0" (c.min));
+ d /= c.sixteen;
+ __asm __volatile ("" : : "e" (d));
+ }
/* Last: inexact. */
if ((FE_INEXACT & excepts) != 0)
- sink = c.one / c.pi;
+ {
+ __asm ("" : "=e" (d) : "0" (c.one));
+ d /= c.pi;
+ __asm __volatile ("" : : "e" (d));
+ }
/* Success. */
return 0;
--- libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h.jj 2006-01-06 06:01:26.000000000 +0100
+++ libc/nptl/sysdeps/unix/sysv/linux/sparc/lowlevellock.h 2006-03-01 08:44:24.000000000 +0100
@@ -78,6 +78,15 @@
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
+#define lll_robust_mutex_dead(futexv) \
+ do \
+ { \
+ int *__futexp = &(futexv); \
+ atomic_or (__futexp, FUTEX_OWNER_DIED); \
+ lll_futex_wake (__futexp, 1); \
+ } \
+ while (0)
+
/* Returns non-zero if error happened, zero if success. */
#ifdef __sparc32_atomic_do_lock
/* Avoid FUTEX_WAKE_OP if supporting pre-v9 CPUs. */
@@ -112,9 +121,18 @@ __lll_mutex_cond_trylock (int *futex)
}
#define lll_mutex_cond_trylock(futex) __lll_mutex_cond_trylock (&(futex))
+static inline int
+__attribute__ ((always_inline))
+__lll_robust_mutex_trylock (int *futex, int id)
+{
+ return atomic_compare_and_exchange_val_acq (futex, id, 0) != 0;
+}
+#define lll_robust_mutex_trylock(futex, id) \
+ __lll_robust_mutex_trylock (&(futex), id)
+
extern void __lll_lock_wait (int *futex) attribute_hidden;
-
+extern int __lll_robust_lock_wait (int *futex) attribute_hidden;
static inline void
__attribute__ ((always_inline))
@@ -127,6 +145,17 @@ __lll_mutex_lock (int *futex)
}
#define lll_mutex_lock(futex) __lll_mutex_lock (&(futex))
+static inline int
+__attribute__ ((always_inline))
+__lll_robust_mutex_lock (int *futex, int id)
+{
+ int result = 0;
+ if (atomic_compare_and_exchange_bool_acq (futex, id, 0) != 0)
+ result = __lll_robust_lock_wait (futex);
+ return result;
+}
+#define lll_robust_mutex_lock(futex, id) \
+ __lll_robust_mutex_lock (&(futex), id)
static inline void
__attribute__ ((always_inline))
@@ -139,10 +168,14 @@ __lll_mutex_cond_lock (int *futex)
}
#define lll_mutex_cond_lock(futex) __lll_mutex_cond_lock (&(futex))
+#define lll_robust_mutex_cond_lock(futex, id) \
+ __lll_robust_mutex_lock (&(futex), (id) | FUTEX_WAITERS)
+
extern int __lll_timedlock_wait (int *futex, const struct timespec *)
attribute_hidden;
-
+extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *)
+ attribute_hidden;
static inline int
__attribute__ ((always_inline))
@@ -158,6 +191,19 @@ __lll_mutex_timedlock (int *futex, const
#define lll_mutex_timedlock(futex, abstime) \
__lll_mutex_timedlock (&(futex), abstime)
+static inline int
+__attribute__ ((always_inline))
+__lll_robust_mutex_timedlock (int *futex, const struct timespec *abstime,
+ int id)
+{
+ int result = 0;
+ if (atomic_compare_and_exchange_bool_acq (futex, id, 0) != 0)
+ result = __lll_robust_timedlock_wait (futex, abstime);
+ return result;
+}
+#define lll_robust_mutex_timedlock(futex, abstime, id) \
+ __lll_robust_mutex_timedlock (&(futex), abstime, id)
+
#define lll_mutex_unlock(lock) \
((void) ({ \
int *__futex = &(lock); \
@@ -166,6 +212,14 @@ __lll_mutex_timedlock (int *futex, const
lll_futex_wake (__futex, 1); \
}))
+#define lll_robust_mutex_unlock(lock) \
+ ((void) ({ \
+ int *__futex = &(lock); \
+ int __val = atomic_exchange_rel (__futex, 0); \
+ if (__builtin_expect (__val & FUTEX_WAITERS, 0)) \
+ lll_futex_wake (__futex, 1); \
+ }))
+
#define lll_mutex_unlock_force(lock) \
((void) ({ \
int *__futex = &(lock); \
Jakub
parent reply other threads:[~2006-03-01 16:39 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20060228202100.516FD180B1C@magilla.sf.frob.com>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060301163934.GJ30252@sunsite.mff.cuni.cz \
--to=jakub@redhat.com \
--cc=drepper@redhat.com \
--cc=libc-hacker@sources.redhat.com \
--cc=roland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).