This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, SH] Add support for inlined builtin-strcmp (2/2)
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Christian Bruel <christian dot bruel at st dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- Date: Fri, 18 Oct 2013 01:05:19 +0200
- Subject: Re: [PATCH, SH] Add support for inlined builtin-strcmp (2/2)
- Authentication-results: sourceware.org; auth=none
- References: <525FF0F9 dot 4010704 at st dot com>
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