(pthread_barrier_wait): Don't save, load, and restore %esi for last thread.
[kopensolaris-gnu/glibc.git] / nptl / sysdeps / unix / sysv / linux / i386 / i486 / pthread_rwlock_unlock.S
index bb5f8d1..c51c148 100644 (file)
        .align  16
 __pthread_rwlock_unlock:
        pushl   %ebx
-       pushl   %esi
        pushl   %edi
 
-       movl    16(%esp), %edi
+       movl    12(%esp), %edi
 
        /* Get the lock.  */
        movl    $1, %eax
@@ -76,10 +75,23 @@ __pthread_rwlock_unlock:
        leal    READERS_WAKEUP(%edi), %ebx
 
 0:     incl    (%ebx)
-       xorl    %esi, %esi
-       movl    $SYS_futex, %eax
+       LOCK
+#if MUTEX == 0
+       decl    (%edi)
+#else
+       decl    MUTEX(%edi)
+#endif
+       jne     7f
+
+8:     movl    $SYS_futex, %eax
        ENTER_KERNEL
 
+       xorl    %eax, %eax
+       popl    %edi
+       popl    %ebx
+       ret
+
+       .align  16
 6:     LOCK
 #if MUTEX == 0
        decl    (%edi)
@@ -90,7 +102,6 @@ __pthread_rwlock_unlock:
 
 4:     xorl    %eax, %eax
        popl    %edi
-       popl    %esi
        popl    %ebx
        ret
 
@@ -112,6 +123,15 @@ __pthread_rwlock_unlock:
        call    __lll_mutex_unlock_wake
        jmp     4b
 
+7:
+#if MUTEX == 0
+       movl    %edi, %eax
+#else
+       leal    MUTEX(%edx), %eax
+#endif
+       call    __lll_mutex_unlock_wake
+       jmp     8b
+
        .size   __pthread_rwlock_unlock,.-__pthread_rwlock_unlock
 
        .globl  pthread_rwlock_unlock