This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch to fix loop REG_NONNEG note generation



  In message <200006121758.NAA27009@jwlab.FEITH.COM>you write:
  > The documentation for REG_NONNEG says:
  > 
  >   The register @var{op} is known to have a nonnegative value when this
  >   insn is reached.  This is used so that decrement and branch until zero
  >   instructions, such as the m68k dbra, can be matched.
  > 
  > Compiling:
  > 
  >   int
  >   func (int a, int b)
  >     {
  >     int c;
  >     int d;
  >     int i;
  > 
  >     c = a;
  >     d = 0;
  > 
  >     for (i = 1000; i >= 0; i -= 1)
  >       {
  >         d += c + i;
  >         subr ();
  >       }
  > 
  >    return d;
  >    }
  > 
  > on x86 with -O2 -dL without this patch generates:
  > 
  >   ...
  > 
  >   (jump_insn 24 23 49 (set (pc)
  >           (if_then_else (ge (reg:CCNO 17 flags)
  >                   (const_int 0 [0x0]))
  >               (label_ref 27)
  >               (pc))) -1 (nil)
  >       (expr_list:REG_NONNEG (nil)
  >           (expr_list:REG_NONNEG (nil)
  >               (nil))))
  > 
  > and with this patch:
  > 
  >   ...
  > 
  >   (jump_insn 24 23 49 (set (pc)
  >           (if_then_else (ge (reg:CCNO 17 flags)
  >                   (const_int 0 [0x0]))
  >               (label_ref 27)
  >               (pc))) -1 (nil)
  >       (expr_list:REG_NONNEG (reg/v:SI 30)
  >           (nil)))
  > 
  > This patch passes make bootstrap and make check on FreeBSD-3.4 x86.
  > 
  > ChangeLog:
  > 
  > Mon Jun 12 01:33:11 EDT 2000  John Wehle  (john@feith.com)
  > 
  > 	* loop.c (check_dbra_loop): Specify the register when
  > 	generating REG_NONNEG notes and don't generate duplicates.
This is fine.  Please install this patch.

Thanks,
jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]