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.

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]