This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Improve code generated by cmpstrsi patterns
On Sat, Jul 15, 2000 at 10:35:23PM +0200, Toon Moene wrote:
> Zack Weinberg wrote:
>
> > This patch improves the code generated by one specific construction -
> > but a common one. Whenever memcmp or strcmp is used in conditional
> > context, on a platform with a cmpstrsi pattern,
>
> I tested your patch against gcc version 2.96 20000713 (experimental) on
> alphaev6-unknown-linux-gnu - a standard configure and make bootstrap
> completed normally. This target doesn't have a cmpstrsi pattern, but at
> least it shows that you didn't hose anything else.
That's good to know, thanks.
[clever trick]
> Obviates the need to call strcmp in 96+ % of the cases [ of course, this
> only works if you can evaluate p and q twice, but you can work around
> that limitation with a GNU extension or two ] ...
glibc has lots of this sort of thing in its <bits/string2.h>. Which
doesn't work very well, but...
Something I'd like to see done (read: I'd do it but I have many more
important things on my plate) is to teach GCC all the tricks in there,
and get them *right*. The only effect I've ever seen bits/string2.h
have is to increase the size of executables - in pathological cases,
it might double their size. And to weed out bugs in cpp by inflicting
100,000-token nested macro expansions on it, but that's another story.
zw