This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 3/3] Add i386 memset and memcpy assembly functions
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 27 Aug 2015 08:52:50 -0700
- Subject: Re: [PATCH 3/3] Add i386 memset and memcpy assembly functions
- Authentication-results: sourceware.org; auth=none
- References: <20150826134631 dot GC19484 at gmail dot com> <20150826142924 dot GC13215 at domone> <CAMe9rOrceRyZnYA2qdhni=nNUPswXCNVgVMhtaqVf74XMgyL5g at mail dot gmail dot com> <20150826151556 dot GA21092 at domone> <CAMe9rOrGJtSp3FPntkyYH_gg-s4eR_8PdkKtBQi5MazzcBD3yg at mail dot gmail dot com> <20150827114631 dot GA14077 at domone> <CAMe9rOq7JX9TtQxXQzp8Jx9URaM9LkV8fT9s1unbOAwbt1gAFw at mail dot gmail dot com>
On Thu, Aug 27, 2015 at 5:37 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 27, 2015 at 4:46 AM, OndÅej BÃlka <neleai@seznam.cz> wrote:
>> On Wed, Aug 26, 2015 at 08:31:30AM -0700, H.J. Lu wrote:
>>> 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.
>>>
>> I could accept that if we decide that we dont care about performance in
>> these cases. As 1. user already doesn't care as we need to use very slow
>> implementations with --disable-multi-arch.
>>
>> As for 2 its about if we care about performance of old machines or not.
>> I would be for not optimizing for machines without sse2 as we don't have
>> these to test that.
>>
>> With these arguments a change would be acceptable but of course I would
>> prefer one that is better on sandy bridge with disable-multiarch.
>
> If people want better performance on Sandy Bridge, they shouldn't
> configure glibc as i486 with --disable-multi-arch :-(.
>
> --
> H.J.
I am checking it in now.
--
H.J.