Venkatesh Srinivas <[email protected]> added the comment:

Hi,

This is an improved version of the patch that corrects my silly jz mistake and 
adds ffsl and flsl. It also implements both for x86_64. The x86-64 version is 
branchless, using cmov.

This alternate snippet may be better and would allow for a branchless f?f(l) on 
i386, except bsr and bsf are defined differently on Intel and AMD x86 machines. 
It may be better on x86_64 than the cmov-based version:
        xorl    %eax, %eax
        xorl    %ecx, %ecx
        bsrl    4(%esp), %eax
        setnz   %cl
        addl    %ecx, %eax
        ret

Thanks,
-- vs

_____________________________________________________
DragonFly issue tracker <[email protected]>
<http://bugs.dragonflybsd.org/issue1770>
_____________________________________________________

Attachment: 0001-libc-Add-assembler-ffs-fls-ffsl-flsl-to-i386-and.patch
Description: Binary data

Reply via email to