about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-06-19 02:48:45 -0400
committerRich Felker <dalias@aerifal.cx>2014-06-19 02:48:45 -0400
commit880c479f0e3a798d826c1c91b38d33e2b3e36580 (patch)
tree01e20f0464d08918fdba0149e535cfbb7df60e77
parente75b16cf93ebbc1ce758d3ea6b2923e8b2457c68 (diff)
downloadmusl-880c479f0e3a798d826c1c91b38d33e2b3e36580.tar.gz
musl-880c479f0e3a798d826c1c91b38d33e2b3e36580.tar.xz
musl-880c479f0e3a798d826c1c91b38d33e2b3e36580.zip
optimize i386 ___tls_get_addr asm
-rw-r--r--src/thread/i386/tls.s9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/thread/i386/tls.s b/src/thread/i386/tls.s
index e1f22629..6e01adf2 100644
--- a/src/thread/i386/tls.s
+++ b/src/thread/i386/tls.s
@@ -2,7 +2,14 @@
 .global ___tls_get_addr
 .type ___tls_get_addr,@function
 ___tls_get_addr:
-	push %eax
+	mov %gs:4,%edx
+	mov (%eax),%ecx
+	cmp %ecx,(%edx)
+	jc 1f
+	mov 4(%eax),%eax
+	add (%edx,%ecx,4),%eax
+	ret
+1:	push %eax
 	call __tls_get_addr
 	pop %edx
 	ret