[PATCH] x86-64: Add sinf with FMA

Florian Weimer fweimer@redhat.com
Tue Dec 5 13:44:00 GMT 2017


On 12/04/2017 09:59 PM, Joseph Myers wrote:
> On Mon, 4 Dec 2017, H.J. Lu wrote:
> 
>> Is
>>
>> (*__errno_location ()) = xxx
> If anything I'd expect a direct TLS initial-exec access to errno to be
> faster.

On x86-64, direct TLS access usually results in more machine code than 
calling __errno_location:

   Direct access:    7 bytes for the load of the TLS offset
                     7 bytes for storing a constant to the TLS variable
   __errno_location: 5 bytes for calling __errno_location
                     6 bytes for storing the constant

Since errno is typically accessed on error paths only, direct TLS access 
is not a win because it bloats the code.

Even if stack alignment is required, it is typically possible to d this 
with just a push/pop pair, adding two more bytes to the __errno_location 
approach, so it is still one byte shorter than direct access.

Thanks,
Florian



More information about the Libc-alpha mailing list