[PATCH] i586: Use a jump table in strcpy.S {BZ #22353]

H.J. Lu hjl.tools@gmail.com
Mon Oct 30 15:46:00 GMT 2017


On Mon, Oct 30, 2017 at 6:20 AM, Florian Weimer <fweimer@redhat.com> wrote:
> On 10/30/2017 02:12 PM, H.J. Lu wrote:
>
>>> What's the performance impact of the change?  Is it even worth to use a
>>> jump
>>> table here?
>>>
>>
>> I added 2 strcpy implementations to hjl/pr22353/master.  Jump table is
>> faster
>> than other non-SSE strcpy implementations because it can copy up to 4
>> bytes
>> at a time.
>
>
> To clarify, I meant replacing the jump table with conditional branches,
> basically getting rid of Duff's device.
>

I changed:

         BRANCH_TO_JMPTBL_ENTRY (L(SrcTable), %ecx, 4)

          .p2align 4
L(Src0):

to

        cmpb    $2, %cl
        je      L(Src2)
        ja      L(Src3)
        cmpb    $1, %cl
        je      L(Src1)

L(Src0):

Their performances are equivalent on Haswell.

Here is the updated patch I am going to check in.

Thanks.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-i586-Use-conditional-branches-in-strcpy.S-BZ-22353.patch
Type: text/x-patch
Size: 2771 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20171030/8e9f3c12/attachment.bin>


More information about the Libc-alpha mailing list