This is the mail archive of the gcc@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: Floating point comparison


> From: Ian Dall <ian@beware.dropbear.id.au>
> Date: Fri, 6 Dec 2002 23:55:08 +1030

> Geoff Keating writes:
>  > it didn't switch between GE and LT.  Both branches are LT, it's just
>  > that one of them is reversed.  It is your port that is interpreting a
>  > reversed LT branch as GE, which it shouldn't be doing.
> 
> The problem seems to be in jump.c: invert_exp_1(), which has the following
> code:
> 
> 
>       reversed_code = reversed_comparison_code (comp, insn);
> 
>       if (reversed_code != UNKNOWN)
> 	{
> 	  validate_change (insn, &XEXP (x, 0),
> 			   gen_rtx_fmt_ee (reversed_code,
> 					   GET_MODE (comp), XEXP (comp, 0),
> 					   XEXP (comp, 1)),
> 			   1);
> 	  return;
> 	}
> 
>       tem = XEXP (x, 1);
>       validate_change (insn, &XEXP (x, 1), XEXP (x, 2), 1);
>       validate_change (insn, &XEXP (x, 2), tem, 1);
> 
> 
> reversed_code gets set to UNKNOWN (correctly) but the last three
> instructions above basically go ahead and make the transformation
> anyway, although the changes aren't actually applied until
> apply_change_group() sometime later. The name of validate_change() is
> a bit misleading. Most of the validating is left until
> apply_change_group(), which really only checks that the new
> instruction pattern is recognized. It doesn't check modes of
> comparison arguments etc.

No.  The last three lines do not 'make the transformation anyway'.
They make a different transformation.  You need to go away and think
about how the transformations are different, and why the second
transformation is correct no matter what the situation.

The first paragraph quoted above (which I wrote) should help to
explain why the second transformation is correct and how it differs
from the first transformation.  If you don't understand it, you should
ask questions about the parts you don't understand rather than
ignoring it.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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