Flag for handling inlining of strcmp/memcmp on i386

Andrew Pinski pinskia@gmail.com
Tue Sep 29 22:52:00 GMT 2009


On Tue, Sep 29, 2009 at 1:32 PM, Martin Thuresson <martint@google.com> wrote:
> Gcc currently inlines memcmp and strcmp to repz cmpsb during
> optimization.  Since the library call has optimizations, such as
> reading full, aligned words, it turns out that byte-by-byte
> comparison is usually slower than calling the library functions.
>
> The diagrams show performance numbers for the library
> call and the inlined version. The numbers are from a
> microbenchmark that compare buffers, (both equal and not equal
> buffers), of various lengths.
>
> http://www.ce.chalmers.se/~martin/foo/amd_opteron_call_repz.png
> http://www.ce.chalmers.se/~martin/foo/intel_core_call_repz.png

Did these microbenchmarks include aligned and unaligned addresses?
You mention that the out of line version supports aligned accesses
better but I can't tell if you tested the unaligned case.

Thanks,
Andrew Pinski



More information about the Gcc-patches mailing list