aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorOleg Endo <olegendo@gcc.gnu.org>2014-05-07 20:08:23 +0000
committerOleg Endo <olegendo@gcc.gnu.org>2014-05-07 20:08:23 +0000
commit36dc9ae8cdee7cb96bb5f04c07c73c4dd5dc13e0 (patch)
treeb890d505b7aa4e51f44300ca2288196c2d5ea43f /gcc
parent9bbf45f692c7f45b0bdbeffb6eb837790433e676 (diff)
downloadgcc-36dc9ae8cdee7cb96bb5f04c07c73c4dd5dc13e0.zip
gcc-36dc9ae8cdee7cb96bb5f04c07c73c4dd5dc13e0.tar.gz
gcc-36dc9ae8cdee7cb96bb5f04c07c73c4dd5dc13e0.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/sh/sh-mem.cc35
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.target/sh/pr53976-1.c9
4 files changed, 23 insertions, 33 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 67d5a9d..2dde4fb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/config/sh/sh-mem.cc b/gcc/config/sh/sh-mem.cc
index 0e38913..d3110f2 100644
--- a/gcc/config/sh/sh-mem.cc
+++ b/gcc/config/sh/sh-mem.cc
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5b4ef30..123a02f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/testsuite/gcc.target/sh/pr53976-1.c b/gcc/testsuite/gcc.target/sh/pr53976-1.c
index 4893b06..68f8cdc 100644
--- a/gcc/testsuite/gcc.target/sh/pr53976-1.c
+++ b/gcc/testsuite/gcc.target/sh/pr53976-1.c
@@ -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)