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]
Other format: [Raw text]

Re: [PATCH] Fix PR 37782, Stage2 ada compiler miscompiled


On Fri, Oct 31, 2008 at 2:48 AM, Andrew Pinski
<Andrew_Pinski@playstation.sony.com> wrote:
> Hi,
>  The problem here is that in some cases doloop_modify will do the
> addition in the wrong mode, causing to get the wrong answer; this only
> happens if zero_extend_p is true which was added by me to that removes
> an addition in some cases.  This fixes the problem by adding an
> argument to doloop_modify which says the original mode of count and
> does the addition in that mode.
>
> OK?  Bootstrapped and tested on powerpc64-linux-gnu with no
> regressions (but no Ada).  Also tested by Andreas Schwab on
> powerpc64-linux-gnu with no regressions for Ada.

Hum, why use the mode of the counter register inside the comparison and
not simply the mode of count which you increment?  Thus

  if (increment_count)
    count = simplify_gen_binary (PLUS, GET_MODE (count), count, const1_rtx);

IMHO that more obviously matches and removes the need for the extra parameter?

Richard.

> Thanks,
> Andrew Pinski
>
> ChangeLog:
> * loop-doloop.c (doloop_modify): Add from_mode argument that says what
> mode count is in.
> (doloop_optimize): Update call to doloop_modify.
>


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