On Sat, Sep 27, 2014 at 08:45:18PM +0200, Oleg Endo wrote:
> On Sat, 2014-09-27 at 11:10 -0700, Andi Kleen wrote:
> > From: Andi Kleen <a...@linux.intel.com>
> > 
> > In my tests the optimized glibc out of line strcmp is always faster than
> > using inline rep ; cmpsb, even for small strings. The Intel optimization 
> > manual
> > also recommends to not use it. So remove the cmpstrnsi instruction.
> > 
> > Tested on Sandy Bridge, Westmere Intel CPUs.
> > 
> > gcc/:
> > 
> > 2014-09-27  Andi Kleen      <a...@linux.intel.com>
> > 
> >     * config/i386/i386.md (cmpstrnsi, cmpintqi): Remove expanders.
> 
> This has been mentioned a while ago, e.g.
> https://gcc.gnu.org/ml/gcc/2002-10/msg01616.html
> https://gcc.gnu.org/ml/gcc/2003-04/msg00166.html
> 
> Instead of just completely removing it, how about disabling it for newer
> CPU types if not optimizing for size?

I believe it was slow even on old CPUs. But back then glibc may have
been even slower. Not sure it is worth keeping it for -Os, especially
given that parts of it have already bitrotted.

-Andi

Reply via email to