]> gcc.gnu.org Git - gcc.git/commitdiff
re PR target/60884 ([SH] improve inlined strlen-like builtin functions)
authorOleg Endo <olegendo@gcc.gnu.org>
Wed, 7 May 2014 20:08:23 +0000 (20:08 +0000)
committerOleg Endo <olegendo@gcc.gnu.org>
Wed, 7 May 2014 20:08:23 +0000 (20:08 +0000)
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

gcc/ChangeLog
gcc/config/sh/sh-mem.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/sh/pr53976-1.c

index 67d5a9d691e43253b55c7cbaad431319216b7742..2dde4fb1b66c48bd03d52ddf2dc6e64405659303 100644 (file)
@@ -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
index 0e38913b929b5bc15f7847c587a3228de8b7e209..d3110f2351f31d13647abec231ec364ec5f4a4fb 100644 (file)
@@ -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;
index 5b4ef30a8d1e2916ac6d8c95d58cf363195639a2..123a02f0378ceeb791cf790f4b5a0354d99505c5 100644 (file)
@@ -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
index 4893b0668a5ec1f0a27ac7609d20f18d7d3c9997..68f8cdcc430746fad07477ad9b27bfff63023514 100644 (file)
@@ -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)
This page took 0.082256 seconds and 5 git commands to generate.