about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nptl/ChangeLog28
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S96
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S76
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S113
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S4
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S4
10 files changed, 299 insertions, 42 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index aff4a915da..04c40c6e24 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,31 @@
+2007-08-14  Kaz Kojima  <kkojima@rr.iij4u.or.jp>
+
+	* sysdeps/unix/sysv/linux/sh/pthread_cond_broadcast.S
+	(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
+	FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
+	Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
+	* sysdeps/unix/sysv/linux/shpthread_cond_signal.S
+	(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
+	FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
+	Use FUTEX_WAKE_OP.
+	* sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Include
+	kernel-features.h and tcb-offsets.h.
+	(__pthread_cond_wait, __condvar_w_cleanup): Pass LLL_PRIVATE to
+	lll_* and or FUTEX_PRIVATE_FLAG into SYS_futex op if cv is
+	process private.
+	* sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S: Include
+	tcb-offsets.h.
+	(__pthread_cond_timedwait, __condvar_tw_cleanup): Pass LLL_PRIVATE
+	to lll_* and or FUTEX_PRIVATE_FLAG into SYS_futex op if cv is
+	process private.
+	* sysdeps/unix/sysv/linux/sh/pthread_once.S: Use #ifdef
+	__ASSUME_PRIVATE_FUTEX instead of #if __ASSUME_PRIVATE_FUTEX.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S: Likewise.
+
 2007-08-14  Jakub Jelinek  <jakub@redhat.com>
 
 	* sysdeps/unix/sysv/linux/lowlevellock.c: Comment fix.
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S
index 3ef2d6ee14..9cb73a233c 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_signal.S
@@ -74,14 +74,63 @@ __pthread_cond_signal:
 	/* Wake up one thread.  */
 	mov	r8, r4
 	add	#cond_futex, r4
-	mov	#FUTEX_WAKE, r5
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bt/s	99f
+	 mov	#FUTEX_WAKE_OP, r5
+#ifdef __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAKE_OP, r0
+	or	r0, r5
+#endif
+99:
 	mov	#1, r6
 	mov	#0, r7
+	mov	r8, r0
+	add	#cond_lock, r0
+	mov.l	.Lfutexop, r1
 	mov	#SYS_futex, r3
 	extu.b	r3, r3
 	trapa	#0x14
 	SYSCALL_INST_PAD
 
+	/* For any kind of error, we try again with WAKE.
+	   The general test also covers running on old kernels.  */
+	mov	r0, r1
+	mov	#-12, r2
+	shad	r2, r1
+	not	r1, r1
+	tst	r1, r1
+	bt	7f
+
+6:
+	mov	#0, r0
+	lds.l	@r15+, pr
+	rts
+	 mov.l	@r15+, r8
+
+#ifndef __ASSUME_PRIVATE_FUTEX
+.Lpfoff:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
+	.align	2
+.Lfutexop:
+	.long	FUTEX_OP_CLEAR_WAKE_IF_GT_ONE
+
+7:
+	/* r5 should be either FUTEX_WAKE_OP or
+	   FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG from the previous syscall.  */
+	mov	#(FUTEX_WAKE ^ FUTEX_WAKE_OP), r0
+	xor	r0, r5
+	trapa	#0x14
+	SYSCALL_INST_PAD
+
 4:
 	/* Unlock.  */
 #if cond_lock != 0
@@ -90,12 +139,26 @@ __pthread_cond_signal:
 	DEC (@r8, r2)
 #endif
 	tst	r2, r2
-	bf	5f
-6:
-	mov	#0, r0
-	lds.l	@r15+, pr
-	rts
-	 mov.l	@r15+, r8
+	bt	6b
+
+5:
+	/* Unlock in loop requires wakeup.  */
+	mov	r8, r4
+#if cond_lock != 0
+	add	#cond_lock, r4
+#endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
+	mov	#LLL_SHARED, r5
+99:	
+	mov.l	.Lwake4, r1
+	bsrf	r1
+	 extu.b	r5, r5
+.Lwake4b:
+	bra	6b
+	 nop
 
 1:
 	/* Initial locking failed.  */
@@ -103,7 +166,12 @@ __pthread_cond_signal:
 #if cond_lock != 0
 	add	#cond_lock, r5
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r6
 	mov	#LLL_SHARED, r6
+99:	
 	extu.b	r6, r6
 	mov.l	.Lwait4, r1
 	bsrf	r1
@@ -112,20 +180,6 @@ __pthread_cond_signal:
 	bra	2b
 	 nop
 
-5:
-	/* Unlock in loop requires wakeup.  */
-	mov	r8, r4
-#if cond_lock != 0
-	add	#cond_lock, r4
-#endif
-	mov	#LLL_SHARED, r5
-	mov.l	.Lwake4, r1
-	bsrf	r1
-	 extu.b	r5, r5
-.Lwake4b:
-	bra	6b
-	 nop
-
 	.align	2
 .Lwait4:
 	.long	__lll_lock_wait-.Lwait4b
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
index fde4f57b2a..4cf0ac45c5 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_timedwait.S
@@ -21,8 +21,9 @@
 #include <lowlevellock.h>
 #include <lowlevelcond.h>
 #include <pthread-errnos.h>
-#include "lowlevel-atomic.h"
 #include <kernel-features.h>
+#include <tcb-offsets.h>
+#include "lowlevel-atomic.h"
 
 	.text
 
@@ -230,7 +231,22 @@ __pthread_cond_timedwait:
 
 	mov	r15, r7
 	add	#16, r7
-	mov	#FUTEX_WAIT, r5
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bt/s	99f
+	 mov	#FUTEX_WAIT, r5
+#ifdef __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_WAIT|FUTEX_PRIVATE_FLAG), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+#endif
+99:	
 	mov.l	@(8,r15), r6
 	mov	r8, r4
 	add	#cond_futex, r4
@@ -339,7 +355,22 @@ __pthread_cond_timedwait:
 
 	mov	r8, r4
 	add	#cond_nwaiters, r4
-	mov	#FUTEX_WAKE, r5
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bt/s	99f
+	 mov	#FUTEX_WAKE, r5
+#ifdef __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAKE, r0
+	or	r0, r5
+#endif
+99:	
 	mov	#1, r6
 	mov	#0, r7
 	mov	#SYS_futex, r3
@@ -379,6 +410,10 @@ __pthread_cond_timedwait:
 	rts
 	 mov.l	@r15+, r8
 
+#ifndef __ASSUME_PRIVATE_FUTEX
+.Lpfoff:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 .L1k:
 	.word	1000
 	.align	2
@@ -399,7 +434,12 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	add	#cond_lock, r5
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r6
 	mov	#LLL_SHARED, r6
+99:	
 	extu.b	r6, r6
 	mov.l	.Lwait2, r1
 	bsrf	r1
@@ -414,7 +454,12 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	add	#cond_lock, r4
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
 	mov	#LLL_SHARED, r5
+99:	
 	mov.l	.Lmwait2, r1
 	bsrf	r1
 	 extu.b	r5, r5
@@ -428,7 +473,12 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	add	#cond_lock, r5
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r6
 	mov	#LLL_SHARED, r6
+99:	
 	extu.b	r6, r6
 	mov.l	.Lwait3, r1
 	bsrf	r1
@@ -443,7 +493,12 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	add	#cond_lock, r4
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
 	mov	#LLL_SHARED, r5
+99:	
 	mov.l	.Lmwait3, r1
 	bsrf	r1
 	 extu.b	r5, r5
@@ -466,7 +521,12 @@ __pthread_cond_timedwait:
 #if cond_lock != 0
 	add	#cond_lock, r4
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
 	mov	#LLL_SHARED, r5
+99:	
 	mov.l	.Lmwait4, r1
 	bsrf	r1
 	 extu.b	r5, r5
@@ -510,7 +570,12 @@ __condvar_tw_cleanup:
 #if cond_lock != 0
 	add	#cond_lock, r5
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r6
 	mov	#LLL_SHARED, r6
+99:	
 	extu.b	r6, r6
 	mov.l	.Lwait5, r1
 	bsrf	r1
@@ -605,7 +670,12 @@ __condvar_tw_cleanup:
 #if cond_lock != 0
 	add	#cond_lock, r4
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
 	mov	#LLL_SHARED, r5
+99:	
 	mov.l	.Lmwait5, r1
 	bsrf	r1
 	 extu.b	r5, r5
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
index 9ca4c35edc..eddf4c95a7 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S
@@ -20,6 +20,8 @@
 #include <shlib-compat.h>
 #include <lowlevellock.h>
 #include <lowlevelcond.h>
+#include <tcb-offsets.h>
+#include <kernel-features.h>
 #include "lowlevel-atomic.h"
 
 	.text
@@ -135,7 +137,22 @@ __pthread_cond_wait:
 	mov.l	r0, @r15
 
 	mov	#0, r7
-	mov	#FUTEX_WAIT, r5
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bt/s	99f
+	 mov	#FUTEX_WAIT, r5
+#ifdef __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_WAIT|FUTEX_PRIVATE_FLAG), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff0, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAIT, r0
+	or	r0, r5
+#endif
+99:	
 	mov.l	@(8,r15), r6
 	mov	r8, r4
 	add	#cond_futex, r4
@@ -213,7 +230,22 @@ __pthread_cond_wait:
 
 	mov	r8, r4
 	add	#cond_nwaiters, r4
-	mov	#FUTEX_WAKE, r5
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bt/s	99f
+	 mov	#FUTEX_WAKE, r5
+#ifdef __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff0, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAKE, r0
+	or	r0, r5
+#endif
+99:	
 	mov	#1, r6
 	mov	#0, r7
 	mov	#SYS_futex, r3
@@ -247,6 +279,10 @@ __pthread_cond_wait:
 	rts
 	 mov.l	@r15+, r8
 
+#ifndef __ASSUME_PRIVATE_FUTEX
+.Lpfoff0:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 	.align	2
 .Lmunlock0:
 	.long	__pthread_mutex_unlock_usercnt-.Lmunlock0b
@@ -263,7 +299,12 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	add	#cond_lock, r5
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r6
 	mov	#LLL_SHARED, r6
+99:	
 	extu.b	r6, r6
 	mov.l	.Lwait0, r1
 	bsrf	r1
@@ -277,7 +318,12 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	add	#cond_lock, r4
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
 	mov	#LLL_SHARED, r5
+99:	
 	mov.l	.Lwake0, r1
 	bsrf	r1
 	 extu.b	r5, r5
@@ -291,7 +337,12 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	add	#cond_lock, r5
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r6
 	mov	#LLL_SHARED, r6
+99:	
 	extu.b	r6, r6
 	mov.l	.Lwait1, r1
 	bsrf	r1
@@ -306,7 +357,12 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	add	#cond_lock, r4
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
 	mov	#LLL_SHARED, r5
+99:	
 	mov.l	.Lwake1, r1
 	bsrf	r1
 	 extu.b	r5, r5
@@ -329,7 +385,12 @@ __pthread_cond_wait:
 #if cond_lock != 0
 	add	#cond_lock, r4
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
 	mov	#LLL_SHARED, r5
+99:	
 	mov.l	.Lwake2, r1
 	bsrf	r1
 	 extu.b	r5, r5
@@ -374,7 +435,12 @@ __condvar_w_cleanup:
 #if cond_lock != 0
 	add	#cond_lock, r5
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r6
 	mov	#LLL_SHARED, r6
+99:	
 	extu.b	r6, r6
 	mov.l	.Lwait3, r1
 	bsrf	r1
@@ -447,7 +513,22 @@ __condvar_w_cleanup:
 
 	mov	r8, r4
 	add	#cond_nwaiters, r4
-	mov	#FUTEX_WAKE, r5
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bt/s	99f
+	 mov	#FUTEX_WAKE, r5
+#ifdef __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff1, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAKE, r0
+	or	r0, r5
+#endif
+99:	
 	mov	#1, r6
 	mov	#0, r7
 	mov	#SYS_futex, r3
@@ -469,7 +550,12 @@ __condvar_w_cleanup:
 #if cond_lock != 0
 	add	#cond_lock, r4
 #endif
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bf/s	99f
+	 mov	#LLL_PRIVATE, r5
 	mov	#LLL_SHARED, r5
+99:	
 	mov.l	.Lwake3, r1
 	bsrf	r1
 	 extu.b	r5, r5
@@ -481,7 +567,22 @@ __condvar_w_cleanup:
 	bf/s	5f
 	 mov	r8, r4
 	add	#cond_futex, r4
-	mov	#FUTEX_WAKE, r5
+	mov.l	@(dep_mutex,r8), r0
+	cmp/eq	#-1, r0
+	bt/s	99f
+	 mov	#FUTEX_WAKE, r5
+#ifdef __ASSUME_PRIVATE_FUTEX
+	mov	#(FUTEX_WAKE|FUTEX_PRIVATE_FLAG), r5
+	extu.b	r5, r5
+#else
+	stc	gbr, r1
+	mov.w	.Lpfoff1, r2
+	add	r2, r1
+	mov.l	@r1, r5
+	mov	#FUTEX_WAKE, r0
+	or	r0, r5
+#endif
+99:	
 	mov	#-1, r6
 	shlr	r6		/* r6 = 0x7fffffff */
 	mov	#0, r7
@@ -505,6 +606,10 @@ __condvar_w_cleanup:
 	 mov	r11, r4
 	sleep
 
+#ifndef __ASSUME_PRIVATE_FUTEX
+.Lpfoff1:
+	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
+#endif
 	.align	2
 .Lwait3:
 	.long   __lll_lock_wait-.Lwait3b
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
index 439907502a..0830cab246 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_once.S
@@ -94,7 +94,7 @@ __pthread_once:
 	bf	3f	/* Different for generation -> run initializer.  */
 
 	/* Somebody else got here first.  Wait.  */
-#if __ASSUME_PRIVATE_FUTEX
+#ifdef __ASSUME_PRIVATE_FUTEX
 	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r5
 	extu.b	r5, r5
 #else
@@ -168,7 +168,7 @@ __pthread_once:
 	INC (@r9, r2)
 	/* Wake up all other threads.  */
 	mov	r9, r4
-#if __ASSUME_PRIVATE_FUTEX
+#ifdef __ASSUME_PRIVATE_FUTEX
 	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r5
 	extu.b	r5, r5
 #else
@@ -213,7 +213,7 @@ __pthread_once:
 	mov	#0, r7
 	mov.l	r7, @r9
 	mov	r9, r4
-#if __ASSUME_PRIVATE_FUTEX
+#ifdef __ASSUME_PRIVATE_FUTEX
 	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r5
 #else
 	stc	gbr, r1
@@ -239,7 +239,7 @@ __pthread_once:
 	sleep
 	cfi_endproc
 
-#if !__ASSUME_PRIVATE_FUTEX
+#ifndef __ASSUME_PRIVATE_FUTEX
 .Lpfoff:
 	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
index 9e4ba959b5..b71be1d974 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_rdlock.S
@@ -74,7 +74,7 @@ __pthread_rwlock_rdlock:
 	tst	r2, r2
 	bf	10f
 11:
-#if __ASSUME_PRIVATE_FUTEX
+#ifdef __ASSUME_PRIVATE_FUTEX
 	mov	#PSHARED, r0
 	mov.b	@(r0,r8), r5
 	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
@@ -142,7 +142,7 @@ __pthread_rwlock_rdlock:
 	rts
 	 mov	r3, r0
 
-#if !__ASSUME_PRIVATE_FUTEX
+#ifndef __ASSUME_PRIVATE_FUTEX
 .Lpfoff:
 	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
index b06fd960cf..e40771de0f 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedrdlock.S
@@ -115,7 +115,7 @@ pthread_rwlock_timedrdlock:
 
 	/* Futex call.  */
 	mov	r15, r7
-#if __ASSUME_PRIVATE_FUTEX
+#ifdef __ASSUME_PRIVATE_FUTEX
 	mov	#PSHARED, r0
 	mov.b	@(r0,r8), r5
 	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
@@ -193,7 +193,7 @@ pthread_rwlock_timedrdlock:
 	rts
 	 mov	r3, r0
 
-#if !__ASSUME_PRIVATE_FUTEX
+#ifndef __ASSUME_PRIVATE_FUTEX
 .Lpfoff:
 	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
index 4591309ecc..dfe137973c 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_timedwrlock.S
@@ -111,7 +111,7 @@ pthread_rwlock_timedwrlock:
 
 	/* Futex call.  */
 	mov	r15, r7
-#if __ASSUME_PRIVATE_FUTEX
+#ifdef __ASSUME_PRIVATE_FUTEX
 	mov	#PSHARED, r0
 	mov.b	@(r0,r8), r5
 	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
@@ -191,7 +191,7 @@ pthread_rwlock_timedwrlock:
 	rts
 	 mov	r3, r0
 
-#if !__ASSUME_PRIVATE_FUTEX
+#ifndef __ASSUME_PRIVATE_FUTEX
 .Lpfoff:
 	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
index 1504c1aed1..045b8b3b33 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_unlock.S
@@ -85,7 +85,7 @@ __pthread_rwlock_unlock:
 	bf	7f
 
 8:
-#if __ASSUME_PRIVATE_FUTEX
+#ifdef __ASSUME_PRIVATE_FUTEX
 	mov	#PSHARED, r0
 	mov.b	@(r0,r8), r5
 	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAKE), r0
@@ -177,7 +177,7 @@ __pthread_rwlock_unlock:
 	bra	8b
 	 mov.l	@r15+, r4
 
-#if !__ASSUME_PRIVATE_FUTEX
+#ifndef __ASSUME_PRIVATE_FUTEX
 .Lpfoff:
 	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
index 25dffe4bf9..6de65cc640 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/pthread_rwlock_wrlock.S
@@ -72,7 +72,7 @@ __pthread_rwlock_wrlock:
 11:
 	mov	r8, r4
 	add	#WRITERS_WAKEUP, r4
-#if __ASSUME_PRIVATE_FUTEX
+#ifdef __ASSUME_PRIVATE_FUTEX
 	mov	#PSHARED, r0
 	mov.b	@(r0,r8), r5
 	mov	#(FUTEX_PRIVATE_FLAG|FUTEX_WAIT), r0
@@ -174,7 +174,7 @@ __pthread_rwlock_wrlock:
 	bra	7b
 	 mov	#0, r3
 
-#if !__ASSUME_PRIVATE_FUTEX
+#ifndef __ASSUME_PRIVATE_FUTEX
 .Lpfoff:
 	.word	PRIVATE_FUTEX - TLS_PRE_TCB_SIZE
 #endif