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: update "optimizer inadequacies"


> On Mon, Aug 27, 2001 at 08:12:51PM -0400, Zack Weinberg wrote:
> > > >         movl    4(%esp), %edx
> > > >         movl    8(%esp), %ecx
> > > >         xorl    %eax, %eax
> > > >         testl   %ecx, %edx
> > > >         setne   %al
> > > 
> > > Um, no.  (a && b) != (a & b).
> > 
> > Um, the whole point of this example is that under certain conditions
> > it's okay to optimize (a && b) into (a & b), and even desirable if
> > testing b is cheaper than a branch.
I do have code for this on my hdd.  It (as I remember) contained some problems
with updating CFG so it bootstrapped, but failed in some testcases and I run
into dificulties to tune it on i386 to produce better code.

It is able to handle converison (a || b) -> (a | b) and some more sophisficated
ones, such as (a==1 && b==2) to !((a^1)|(b^2)).

It is dificult to estimate what branches are dificult to predict.  Such a code
is probably better when dealing with my new superblock framework and better
branch prediction code so I plan to return to it sometime next month (once I
will finish the school project and have more time for gcc development again).

I also guess that IA-64 would benefit more than i386, as IA-64 do have
predicate registers so combining of various codntionals is easy job to do.

So in any case, please mention contact to me on the page.
> 
> Yes, but this isn't one of them.  Consider a = 1, b = 2.
> 
> > and the SETcc instructions set to 0 or 1, not 0 or -1.
> 
> So?  You're not testing the result of a setcc instruction.
> 
> 
> r~


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