memset() with zeroes (Re: [PATCH] trivial: the memset operation on a automatic array variable should be optimized out by data initialization)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 24, 2007 at 03:15:17PM -0700, Arjan van de Ven wrote:
> 
> > > I think all these benefits are the gcc's __builtin_memset optimization
> > > than the explicit call to memset.
> > 
> > ... or from complex memset() implementation (some chips even didn't do
> > `rep' fast enough somehow). Maybe code like below will be acceptable for
> > both optimizers and maintainers?
> 
> 
> we should just alias our memset to the __builtin one, and then provide a
> generic one from lib/ for the cases gcc needs to do a fallback.

In x86_64 there's infrastructure to check and select right memset().
Therefor it's need, i think.

But if one will took a look at usage, zero memset() optimization becomes
obvious, one argument off -- one reg is free from clobbering.

|-*-
flower-:22-rc4-mm2/arch/x86_64$ grep memset -R . | grep "[ 0,]0," | wc -l
42
flower-:22-rc4-mm2/arch/x86_64$
flower-:22-rc4-mm2/arch/x86_64$ cd ..
flower-:22-rc4-mm2/arch$ grep memset -R . | grep "[ 0,]0," | wc -l
735
flower-:22-rc4-mm2/arch$
flower-:22-rc4-mm2$ grep memset -R . | grep "[ 0,]0," | wc -l
6679
flower-:22-rc4-mm2$  
|-*-
____
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux