optimization/7120: Run once loop should *always* be unrolled

Richard Henderson rth@twiddle.net
Wed Jun 26 13:45:00 GMT 2002


On Wed, Jun 26, 2002 at 06:02:10PM +0930, Alan Modra wrote:
> +      if (((INTVAL (initial_value) + INTVAL (increment))
> +	   & (((unsigned HOST_WIDE_INT) 1
> +	       << (GET_MODE_BITSIZE (GET_MODE (iteration_var)) - 1)
> +	       << 1) - 1)) == INTVAL (final_value))

Need to use gen_int_mode here and for the final_value calulation.
Suggest something like

  rtx incone = gen_int_mode (INTVAL (initial_value) + INTVAL (increment),
			     GET_MODE (iteration_var));

  if (incone == final_value)
    {
      ...
    }
  else
    {
      loop_info->n_iterations = 1;
      loop_info->final_value = incone;
      loop_info->final_equiv_value = incone;
      return 1;
    }


r~



More information about the Gcc-bugs mailing list