Another minor optimization of x86-64 pthread_cond_wait.

This commit is contained in:
Ulrich Drepper 2009-08-08 10:21:46 -07:00
parent 8e436522e1
commit 49eea97b00
2 changed files with 13 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2009-08-08 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
(__pthread_cond_wait): Optimize by avoiding use of callee-safe
register.
2009-08-07 Ulrich Drepper <drepper@redhat.com> 2009-08-07 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Little optimizations * sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Little optimizations

View File

@ -45,9 +45,6 @@ __pthread_cond_wait:
cfi_lsda(DW_EH_PE_udata4, .LexceptSTART) cfi_lsda(DW_EH_PE_udata4, .LexceptSTART)
#endif #endif
pushq %r13
cfi_adjust_cfa_offset(8)
cfi_rel_offset(%r13, 0)
#define FRAME_SIZE 32 #define FRAME_SIZE 32
leaq -FRAME_SIZE(%rsp), %rsp leaq -FRAME_SIZE(%rsp), %rsp
cfi_adjust_cfa_offset(FRAME_SIZE) cfi_adjust_cfa_offset(FRAME_SIZE)
@ -140,7 +137,7 @@ __pthread_cond_wait:
movl $SYS_futex, %eax movl $SYS_futex, %eax
syscall syscall
movl $1, %r13d movl $1, %r8d
#ifdef __ASSUME_REQUEUE_PI #ifdef __ASSUME_REQUEUE_PI
jmp 62f jmp 62f
#else #else
@ -158,7 +155,7 @@ __pthread_cond_wait:
#else #else
orl %fs:PRIVATE_FUTEX, %esi orl %fs:PRIVATE_FUTEX, %esi
#endif #endif
60: xorl %r13d, %r13d 60: xorl %r8d, %r8d
movl $SYS_futex, %eax movl $SYS_futex, %eax
syscall syscall
@ -233,20 +230,18 @@ __pthread_cond_wait:
/* If requeue_pi is used the kernel performs the locking of the /* If requeue_pi is used the kernel performs the locking of the
mutex. */ mutex. */
11: movq 16(%rsp), %rdi 11: movq 16(%rsp), %rdi
testl %r13d, %r13d testl %r8d, %r8d
jnz 18f jnz 18f
callq __pthread_mutex_cond_lock callq __pthread_mutex_cond_lock
14: movq FRAME_SIZE(%rsp), %r13 14: leaq FRAME_SIZE(%rsp), %rsp
leaq FRAME_SIZE+8(%rsp), %rsp cfi_adjust_cfa_offset(-FRAME_SIZE)
cfi_adjust_cfa_offset(-(FRAME_SIZE + 8))
/* We return the result of the mutex_lock operation. */ /* We return the result of the mutex_lock operation. */
retq retq
cfi_adjust_cfa_offset(8 + FRAME_SIZE) cfi_adjust_cfa_offset(FRAME_SIZE)
cfi_rel_offset(%r13, FRAME_SIZE)
18: callq __pthread_mutex_cond_lock_adjust 18: callq __pthread_mutex_cond_lock_adjust
xorl %eax, %eax xorl %eax, %eax
@ -341,9 +336,7 @@ versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
__condvar_cleanup1: __condvar_cleanup1:
/* Stack frame: /* Stack frame:
rsp + 40 rsp + 32
+--------------------------+
rsp + 32 | %r13 |
+--------------------------+ +--------------------------+
rsp + 24 | unused | rsp + 24 | unused |
+--------------------------+ +--------------------------+
@ -465,7 +458,6 @@ __condvar_cleanup1:
callq __pthread_mutex_cond_lock callq __pthread_mutex_cond_lock
movq 24(%rsp), %rdi movq 24(%rsp), %rdi
movq 32(%rsp), %r13
.LcallUR: .LcallUR:
call _Unwind_Resume@PLT call _Unwind_Resume@PLT
hlt hlt