This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cc register usage on i386/2.96
> On Tue, Aug 29, 2000 at 11:57:51AM +0200, Jan Hubicka wrote:
> > Not always - you need to take care for overflows.
> > Gcc does the converison for != 0, but not for > 0
>
> Oh, ok. Though we should really be doing it for the signed
> comparisons, since overflow is undefined there. But your
> patterns would still match for the unsigneds, so go ahead.
For unsignets I guess it is useless too - since you can only test for
(in)equality of zero, that is converted to compare (overflow doesn't matter)
So you do say, that I should teach combine to do the coverison for all compare
codes independently on the signedness? - currently gcc take care to eliminate
the signed codes for the overflow reasons.
The relevant piece of code is:
/* We used to optimize signed comparisons against zero, but that
was incorrect. Unsigned comparisons against zero (GTU, LEU)
arrive here as equality comparisons, or (GEU, LTU) are
optimized away. No need to special-case them. */
/* (eq (minus A B) C) -> (eq A (plus B C)) or
(eq B (minus A C)), whichever simplifies. We can only do
this for equality comparisons due to pathological cases involving
overflows. */
if (equality_comparison_p
&& 0 != (tem = simplify_binary_operation (PLUS, mode,
XEXP (op0, 1), op1)))
{
op0 = XEXP (op0, 0);
op1 = tem;
continue;
}
And it seems to me that the comment says that the optimization was peroformed
but for some purpose disabled.
Honza
>
>
> r~