optimize i386 ___tls_get_addr asm
authorRich Felker <dalias@aerifal.cx>
Thu, 19 Jun 2014 06:48:45 +0000 (02:48 -0400)
committerRich Felker <dalias@aerifal.cx>
Thu, 19 Jun 2014 06:48:45 +0000 (02:48 -0400)
src/thread/i386/tls.s

index e1f22629a9096a2b730ce0d2459bf3769e63bdac..6e01adf244a4c8da74decab12d8f433de9ebfbed 100644 (file)
@@ -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