Hi, On Thu, 2013-10-17 at 16:15 +0200, Christian Bruel wrote: > Hello, > > This patch adds support to inline an optimized version of strcmp when > not optimizing for size. The generated code makes use of the cmp/str > instruction to test 4 bytes at a time when correctly aligned. > > note that a new pattern was added to match the cmp/str instruction, but > no attempt was made to catch it from combine. > > This results in general cycles improvements (against both newlib and > glibc implementations), one of which is a 10% cycle improvement for a > famous strcmp-biased "benchmark" starting with a D.... , but still standard.
Nice. > This optimization can be disabled with -fno-builtin-strcmp. > > No regressions on sh4 in big and little endian, and sh2 (sh3, and sh4a > are still running for big and little endian for sanity) > I was wondering, in file sh-mem.c, the new function 'sh4_expand_cmpstr' ... why is it SH4-something? It's a bit confusing, since cmp/str has been around since ever (i.e. since SH1). Maybe just rename it to 'sh_expand_cmpstr' instead? The function always returns 'true', so maybe just make it return 'void'? Also, in the expander ... + [(set (match_operand:SI 0 "register_operand" "") + (compare:SI (match_operand:BLK 1 "memory_operand" "") ... no need to use empty "" constraints. Cheers, Oleg