This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/3] Add i386 memset and memcpy assembly functions


On Wed, Aug 26, 2015 at 8:15 AM, OndÅej BÃlka <neleai@seznam.cz> wrote:
> On Wed, Aug 26, 2015 at 07:49:51AM -0700, H.J. Lu wrote:
>> On Wed, Aug 26, 2015 at 7:29 AM, OndÅej BÃlka <neleai@seznam.cz> wrote:
>> > On Wed, Aug 26, 2015 at 06:46:31AM -0700, H.J. Lu wrote:
>> >> Add i386 memset and memcpy assembly functions with REP MOVSB/STOSB
>> >> instructions.  They will be used to implement i386 multi-arch memcpy.
>> >>
>> >> OK for master?
>> >>
>> > No, as rep stosb has terrible performance on most of machines, on ivy
>> > bridge its around six times slower than rep stosq. I wouldn't be
>> >
>>
>> I added them for i386 memcpy family multiarch functions.  We have
>> memcpy for i586 and i686:
>>
>> sysdeps/i386/i586/memcpy.S
>> sysdeps/i386/i686/memcpy.S
>>
>> But we don't have it for i486.  I add them so that I can implement
>> i386 memset and memcpy family multiarch functions for i486,
>> i586 and i686 targets.  i386 memset and memcpy are used only
>> when
>>
>> 1. Building glibc for i486 with --disable-multi-arch.  Or
>> 2. Processor doesn't support i686 nor SSE2.
>>
>> I believe these are a very rare cases.
>>
> While true a existing implementation looked better. So if you need use
> assembly could you pick these files compiled with gcc -S or something
> like that?

We don't know if they are better than REP MOVSB/STOSB in cases of

1. Building glibc for i486 with --disable-multi-arch.  Or
2. Processor doesn't support i686 nor SSE2.

and on Haswell/Skylake, REP MOVSB/STOSB aren't too bad.

-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]