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] REG_EQUAL notes on cond_jumps.


> Hi Roger,
>
> > For example, pa.md doesn't support comparison with large immediate
> > constants in a single instruction.  As a result code such as the
> > following (reduced from 20010119-1.c) was failing to be optimized:
> >
> > void foo()
> > {
> >   int a = 10;
> >   int b = 20000;
> >   if (a > b)
> >     link_error();
> > }
>
> This is an over simplification of the problem.

I apologise.  The above test case is indeed an over simplification.
I was just trying to explain that simple comparisons cannot be
optimized by GCSE, they can however be optimized by other passes.

A more accurate example is:

void foo()
{
  int a = 10;
  int b = 20000;
  int c;

  for(c=0; c<1000; c++)
    if (a < b)
      link_error();
}


By forcing the constants definitions and uses into different basic
blocks, CSE is no longer able to perform the simplification, but
alas GCSE can't *yet* do it either.


I apologise if my over simplification of the issues was confusing.
One of the main points I was trying to show was that this failure
is unrelated to __builtin_constant_p, but instead a generic failing
of GCC's GCSE pass.

Roger
--


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