This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/78809] Inline strcmp with small constant strings


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78809

--- Comment #31 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Qing Zhao from comment #30)
> (in reply to Wilco from comment #29)
> > 
> > The new test is better, however it uses i % 15 which means an expensive
> > division by constant every loop iteration. It's best to change to i & 15. Also
> > using an array of string pointers means you get something like:
> > 
> > result += strcmp (p[i & 15], "abc");
> > 
> > Using this I get ~80% speedup for n=3 on AArch64, similar to your set 2.
> I will try with these modification. 
> > 
> > As for benchmarking, I'm not so sure that SPEC2006 or SPEC2017 call strcmp with
> > constant strings.
> do you have any suggestion on other real applications?

Not really - I haven't seen strcmp with a constant string in a benchmark other
than Dhrystone (and that has a long string). What I typically do is get traces
from running various benchmarks and create a microbenchmark that mimicks the
behaviour, but that's probably overkill for this optimization.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]