Commit 36dc9ae8 by Oleg Endo

re PR target/60884 ([SH] improve inlined strlen-like builtin functions)

gcc/
	PR target/60884
	* config/sh/sh-mem.cc (sh_expand_strlen): Use loop when emitting
	unrolled byte insns.  Emit address increments after move insns.

gcc/testsuite/
	PR target/60884
	* gcc.target/sh/pr53976-1.c (test_02): Remove inappropriate test case.
	(test_03): Rename to test_02.

From-SVN: r210187
parent 9bbf45f6
2014-05-07 Oleg Endo <olegendo@gcc.gnu.org>
PR target/60884
* config/sh/sh-mem.cc (sh_expand_strlen): Use loop when emitting
unrolled byte insns. Emit address increments after move insns.
2014-05-07 David Malcolm <dmalcolm@redhat.com>
* gimple.h (gimple_builtin_call_types_compatible_p): Accept a
......
......@@ -568,7 +568,7 @@ sh_expand_strlen (rtx *operands)
addr1 = adjust_automodify_address (addr1, SImode, current_addr, 0);
/*start long loop. */
/* start long loop. */
emit_label (L_loop_long);
/* tmp1 is aligned, OK to load. */
......@@ -589,29 +589,15 @@ sh_expand_strlen (rtx *operands)
addr1 = adjust_address (addr1, QImode, 0);
/* unroll remaining bytes. */
emit_insn (gen_extendqisi2 (tmp1, addr1));
emit_insn (gen_cmpeqsi_t (tmp1, const0_rtx));
jump = emit_jump_insn (gen_branch_true (L_return));
add_int_reg_note (jump, REG_BR_PROB, prob_likely);
emit_move_insn (current_addr, plus_constant (Pmode, current_addr, 1));
emit_insn (gen_extendqisi2 (tmp1, addr1));
emit_insn (gen_cmpeqsi_t (tmp1, const0_rtx));
jump = emit_jump_insn (gen_branch_true (L_return));
add_int_reg_note (jump, REG_BR_PROB, prob_likely);
emit_move_insn (current_addr, plus_constant (Pmode, current_addr, 1));
emit_insn (gen_extendqisi2 (tmp1, addr1));
emit_insn (gen_cmpeqsi_t (tmp1, const0_rtx));
jump = emit_jump_insn (gen_branch_true (L_return));
add_int_reg_note (jump, REG_BR_PROB, prob_likely);
emit_move_insn (current_addr, plus_constant (Pmode, current_addr, 1));
for (int i = 0; i < 4; ++i)
{
emit_insn (gen_extendqisi2 (tmp1, addr1));
emit_move_insn (current_addr, plus_constant (Pmode, current_addr, 1));
emit_insn (gen_cmpeqsi_t (tmp1, const0_rtx));
jump = emit_jump_insn (gen_branch_true (L_return));
add_int_reg_note (jump, REG_BR_PROB, prob_likely);
}
emit_insn (gen_extendqisi2 (tmp1, addr1));
jump = emit_jump_insn (gen_jump_compact (L_return));
emit_barrier_after (jump);
/* start byte loop. */
......@@ -626,10 +612,9 @@ sh_expand_strlen (rtx *operands)
/* end loop. */
emit_insn (gen_addsi3 (start_addr, start_addr, GEN_INT (1)));
emit_label (L_return);
emit_insn (gen_addsi3 (start_addr, start_addr, GEN_INT (1)));
emit_insn (gen_subsi3 (operands[0], current_addr, start_addr));
return true;
......
2014-05-07 Oleg Endo <olegendo@gcc.gnu.org>
PR target/60884
* gcc.target/sh/pr53976-1.c (test_02): Remove inappropriate test case.
(test_03): Rename to test_02.
2014-05-07 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/61083
......
......@@ -24,14 +24,7 @@ test_01 (long long a, long long b)
}
int
test_02 (const char* a)
{
/* Must not see a sett after the inlined strlen. */
return __builtin_strlen (a);
}
int
test_03 (int a, int b, int c, int d)
test_02 (int a, int b, int c, int d)
{
/* One of the blocks should have a sett and the other one should not. */
if (d > 4)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment