From 006fa7d4282bf2341c1c0e3162cc2cc70d3706e6 Mon Sep 17 00:00:00 2001 From: Saurabh Verma Date: Tue, 6 Sep 2005 22:26:59 +0000 Subject: [PATCH] re PR target/8972 ([arc-7-elf] the c code ' x << i' causes infinite loop when i = 0) 2005-09-06 Saurabh Verma PR target/8972 * config/arc/arc.c (output_shift): Add check for loop count when optimizing. From-SVN: r103971 --- gcc/ChangeLog | 6 ++++++ gcc/config/arc/arc.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c0eb165dfbb..96d6d60c762 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-09-06 Saurabh Verma + + PR target/8972 + * config/arc/arc.c (output_shift): Add check for loop count when + optimizing. + 2005-09-06 Steven Bosscher * tree-ssa-phiopt.c (conditional_replacement): Construct proper SSA diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 2adf01d0d61..6d8666e4c8f 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -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 { -- 2.30.2