re PR target/8972 ([arc-7-elf] the c code ' x << i' causes infinite loop when i = 0)
authorSaurabh Verma <saurabh.verma@codito.com>
Tue, 6 Sep 2005 22:26:59 +0000 (22:26 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Tue, 6 Sep 2005 22:26:59 +0000 (15:26 -0700)
2005-09-06  Saurabh Verma  <saurabh.verma@codito.com>

        PR target/8972
        * config/arc/arc.c (output_shift): Add check for loop count when
        optimizing.

From-SVN: r103971

gcc/ChangeLog
gcc/config/arc/arc.c

index c0eb165dfbbeb6b678934db6203d5dfd437cd5e8..96d6d60c762b2a2f1df418083e0a88794c6a510d 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-06  Saurabh Verma  <saurabh.verma@codito.com>
+
+       PR target/8972
+       * config/arc/arc.c (output_shift): Add check for loop count when
+       optimizing.
+
 2005-09-06  Steven Bosscher  <stevenb@suse.de>
 
        * tree-ssa-phiopt.c (conditional_replacement): Construct proper SSA
index 2adf01d0d6176196dbb5f3db2d145e75d7eecde5..6d8666e4c8fdfc083f49ebbb06b6a7229c9c807a 100644 (file)
@@ -1494,7 +1494,11 @@ output_shift (rtx *operands)
   if (GET_CODE (operands[2]) != CONST_INT)
     {
       if (optimize)
-       output_asm_insn ("mov lp_count,%2", operands);
+       {
+         output_asm_insn ("sub.f 0,%2,0", operands);
+         output_asm_insn ("mov lp_count,%2", operands);
+         output_asm_insn ("bz 2f", operands);
+       }
       else
        output_asm_insn ("mov %4,%2", operands);
       goto shiftloop;
@@ -1568,6 +1572,8 @@ output_shift (rtx *operands)
                fprintf (asm_out_file, "1:\t%s single insn loop\n",
                         ASM_COMMENT_START);
              output_asm_insn (shift_one, operands);
+             fprintf (asm_out_file, "2:\t%s end single insn loop\n",
+                      ASM_COMMENT_START);
            }
          else 
            {