This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
PATCH: Use LP_OP(cmp), R*_LP, LP_SIZE and ASM_ADDR
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Tue, 15 May 2012 09:27:38 -0700
- Subject: PATCH: Use LP_OP(cmp), R*_LP, LP_SIZE and ASM_ADDR
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch implements:
1. Use LP_OP(cmp), RSI_LP and R8_LP on dep_mutex pointer.
2. Load __vdso_clock_gettime pointer into RAX_LP.
3. Replace 8-byte data alignment with LP_SIZE alignment.
4. Replace .quad with ASM_ADDR.
Tested on Linux/x86-64. OK to install?
Thanks.
H.J.
---
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Use
LP_OP(cmp), RSI_LP and R8_LP on dep_mutex pointer. Load
__vdso_clock_gettime pointer into RAX_LP.
(__gcc_personality_v0): Replace 8-byte data alignment with
LP_SIZE alignment and .quad with ASM_ADDR.
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index cdc2bf6..79bfecd 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -89,7 +89,7 @@ __pthread_cond_timedwait:
+--------------------------+
*/
- cmpq $-1, dep_mutex(%rdi)
+ LP_OP(cmp) $-1, dep_mutex(%rdi)
/* Prepare structure passed to cancellation handler. */
movq %rdi, 8(%rsp)
@@ -97,7 +97,7 @@ __pthread_cond_timedwait:
movq %rdx, %r13
je 22f
- movq %rsi, dep_mutex(%rdi)
+ mov %RSI_LP, dep_mutex(%rdi)
22:
xorl %r15d, %r15d
@@ -163,10 +163,10 @@ __pthread_cond_timedwait:
movq %r13, %r10
movl $FUTEX_WAIT_BITSET, %esi
- cmpq $-1, dep_mutex(%rdi)
+ LP_OP(cmp) $-1, dep_mutex(%rdi)
je 60f
- movq dep_mutex(%rdi), %r8
+ mov dep_mutex(%rdi), %R8_LP
/* Requeue to a non-robust PI mutex if the PI bit is set and
the robust bit is not set. */
movl MUTEX_KIND(%r8), %eax
@@ -268,7 +268,7 @@ __pthread_cond_timedwait:
jne 55f
addq $cond_nwaiters, %rdi
- cmpq $-1, dep_mutex-cond_nwaiters(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_nwaiters(%rdi)
movl $1, %edx
#ifdef __ASSUME_PRIVATE_FUTEX
movl $FUTEX_WAKE, %eax
@@ -331,7 +331,7 @@ __pthread_cond_timedwait:
#if cond_lock != 0
addq $cond_lock, %rdi
#endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -343,7 +343,7 @@ __pthread_cond_timedwait:
#if cond_lock != 0
addq $cond_lock, %rdi
#endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -355,7 +355,7 @@ __pthread_cond_timedwait:
#if cond_lock != 0
addq $cond_lock, %rdi
#endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -370,7 +370,7 @@ __pthread_cond_timedwait:
#if cond_lock != 0
addq $cond_lock, %rdi
#endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -391,7 +391,7 @@ __pthread_cond_timedwait:
#if cond_lock != 0
addq $cond_lock, %rdi
#endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -446,9 +446,9 @@ __pthread_cond_timedwait:
kernel. */
leaq 32(%rsp), %rsi
# ifdef SHARED
- movq __vdso_clock_gettime@GOTPCREL(%rip), %rax
- movq (%rax), %rax
- PTR_DEMANGLE (%rax)
+ mov __vdso_clock_gettime@GOTPCREL(%rip), %RAX_LP
+ mov (%rax), %RAX_LP
+ PTR_DEMANGLE (%RAX_LP)
call *%rax
# else
movl $__NR_clock_gettime, %eax
@@ -508,7 +508,7 @@ __pthread_cond_timedwait:
movl %eax, (%rsp)
leaq 32(%rsp), %r10
- cmpq $-1, dep_mutex(%rdi)
+ LP_OP(cmp) $-1, dep_mutex(%rdi)
movq %r12, %rdx
# ifdef __ASSUME_PRIVATE_FUTEX
movl $FUTEX_WAIT, %eax
@@ -568,7 +568,7 @@ __pthread_cond_timedwait:
# if cond_lock != 0
addq $cond_lock, %rdi
# endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -580,7 +580,7 @@ __pthread_cond_timedwait:
# if cond_lock != 0
addq $cond_lock, %rdi
# endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -592,7 +592,7 @@ __pthread_cond_timedwait:
# if cond_lock != 0
addq $cond_lock, %rdi
# endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -675,7 +675,7 @@ __condvar_cleanup2:
#if cond_lock != 0
addq $cond_lock, %rdi
#endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -708,7 +708,7 @@ __condvar_cleanup2:
andl $~((1 << nwaiters_shift) - 1), %eax
jne 4f
- cmpq $-1, dep_mutex(%rdi)
+ LP_OP(cmp) $-1, dep_mutex(%rdi)
leaq cond_nwaiters(%rdi), %rdi
movl $1, %edx
#ifdef __ASSUME_PRIVATE_FUTEX
@@ -736,7 +736,7 @@ __condvar_cleanup2:
#if cond_lock != 0
addq $cond_lock, %rdi
#endif
- cmpq $-1, dep_mutex-cond_lock(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_lock(%rdi)
movl $LLL_PRIVATE, %eax
movl $LLL_SHARED, %esi
cmovne %eax, %esi
@@ -746,7 +746,7 @@ __condvar_cleanup2:
2: testq %r12, %r12
jnz 5f
addq $cond_futex, %rdi
- cmpq $-1, dep_mutex-cond_futex(%rdi)
+ LP_OP(cmp) $-1, dep_mutex-cond_futex(%rdi)
movl $0x7fffffff, %edx
#ifdef __ASSUME_PRIVATE_FUTEX
movl $FUTEX_WAKE, %eax
@@ -805,9 +805,9 @@ __condvar_cleanup2:
.hidden DW.ref.__gcc_personality_v0
.weak DW.ref.__gcc_personality_v0
.section .gnu.linkonce.d.DW.ref.__gcc_personality_v0,"aw",@progbits
- .align 8
+ .align LP_SIZE
.type DW.ref.__gcc_personality_v0, @object
- .size DW.ref.__gcc_personality_v0, 8
+ .size DW.ref.__gcc_personality_v0, LP_SIZE
DW.ref.__gcc_personality_v0:
- .quad __gcc_personality_v0
+ ASM_ADDR __gcc_personality_v0
#endif