This is the mail archive of the gcc-patches@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]

Flag for handling inlining of strcmp/memcmp on i386


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

The performance impact can be large for programs handling large
strings that are expected to be equal, though I did not see any
performance change on Spec2006 (less than 1% difference).

This patch introduces the flag -minline-compares that controls
the inlining.

Thanks,
Martin

Attachment: gcc_inline_svn.patch.txt
Description: Text document

Attachment: gcc_inline_svn.changelog.txt
Description: Text document


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