This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Do not multiply by zero in bzero.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 26 Mar 2013 12:47:30 +0100
- Subject: Re: [PATCH] Do not multiply by zero in bzero.
- References: <20130321162026 dot GA16603 at domone dot kolej dot mff dot cuni dot cz> <514B7045 dot 5 at redhat dot com>
On Thu, Mar 21, 2013 at 04:40:37PM -0400, Carlos O'Donell wrote:
> On 03/21/2013 12:20 PM, OndÅej BÃlka wrote:
> > Hello,
> >
> > I noticed that bzero jumps directly at memset. Memset then computes mask
> > by 64bit multiplication. This is suboptimal in bzero case as mask iz
> > zero.
> >
> > I emulating first few instructions of memset and simplified it.
> >
> > Related question is that we first check if n==1. In my profile this
> > happens only with 2% of cases. Is there special reason to keep it?
>
> I agree that it seems odd to have a special case for n==1 with
> no comment or indication why that might be better.
>
> Please post as distinct patch with that change to remove the
> n==1 check and provide some performance numbers if it actually
> makes a difference. If it doesn't then at least it's a code size
> win, which is usually a performance win by reducing cache size.
>
I also replaced computed jump there and I posted incomplete new implementation in
http://sourceware.org/ml/libc-alpha/2013-03/msg00546.html
Now I am at phase collect real world data,
I cannot compare it directly as memset is used in linker. I plan record
inputs.
> > Passes test on x86-64. OK to commit?
> >
>
> Richard has already commented on the assembly.
>
> Post a follow-up version.
>
posted, is follow-up ok?
> Cheers,
> Carlos.
Ondra