This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PPro patch for egcs
- To: law at cygnus dot com
- Subject: Re: PPro patch for egcs
- From: john at feith dot com (John Wehle)
- Date: Fri, 5 Jun 1998 16:58:07 -0400
- cc: hjl at lucon dot org, egcs-patches at cygnus dot com
> > Does final.c only remove tests / comparisons against zero?
> Nope. It can remove any instruction that sets cc0.
So can the following (contrived) code
set a = 6
set b = 5
set c = MINUS a b sets CC_NO_OVERFLOW
set cc0 = COMPARE a b
set d IF_THEN_ELSE GE ...
get turned into
set a = 6
set b = 5
set c = MINUS a b sets CC_NO_OVERFLOW
set d IF_THEN_ELSE GE ...
resulting in:
cmovns
since CC_NO_OVERFLOW is set?
1) I'm not sure how this can happen since final_scan_insn uses
rtx_equal_p to see if the test is redundant which means the
rtx_code must match. If only redundant tests using the same
rtx_code are eliminated then why should a compare ever need
to be restored?
2) If this can happen then I don't believe that the following
logic is safe:
case GE:
if (cc_prev_status.flags & CC_NO_OVERFLOW)
fputs ("ns", file);
else
fputs ("ge", file);
Consider the case where a = 0x80000000 and b = 1. The
subtraction will result in the sign bit being cleared.
However testing the sign bit results in the wrong answer
since a (when interpreted as an integer) is less than b.
-- John
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------