[PATCH]: Expand finite() as inline i386 asm

Jan Hubicka hubicka@ucw.cz
Fri Jan 26 00:44:00 GMT 2007


Uros,
>        subl    $12, %esp
>        movl    $-1048577, %eax
>        movsd   .LC0, %xmm0
>        addsd   16(%esp), %xmm0
>        movsd   %xmm0, (%esp)
>        movl    4(%esp), %edx

I believe that this is going to block store to load forwarding on most
chips, so result in many cycles of delay that is not needed.  The libm
finite seems to be implemented fully in SSE:

   1a4d0:       c7 44 24 fc 00 00 00    movl   $0x0,0xfffffffffffffffc(%rsp)
   1a4d7:       00 
   1a4d8:       f2 0f 10 0d 28 e0 01    movsd  122920(%rip),%xmm1        # 38508
 <_fini+0x3f0>
   1a4df:       00 
   1a4e0:       66 0f 54 c1             andpd  %xmm1,%xmm0
   1a4e4:       66 0f 2f c1             comisd %xmm1,%xmm0
   1a4e8:       0f 95 44 24 fc          setne  0xfffffffffffffffc(%rsp)
   1a4ed:       8b 44 24 fc             mov    0xfffffffffffffffc(%rsp),%eax
   1a4f1:       c3                      retq 

Modulo the fancy RSP manipulation this seems like better alternative.

Honza



More information about the Gcc-patches mailing list