ia64 ieee/fp-cmp-[123].c failures

Richard Henderson rth@cygnus.com
Wed Oct 25 17:26:00 GMT 2000


Since there doesn't appear to be anything else in cse to prevent
such incorrect interpretation of ieee fp comparisons, it surely
must be a generic sort of bug.  I'm not sure why other targets
don't also fail these tests.

The problem was that we decided that since (x < y) was false, 
then clearly (x >= y) must be true.  An interpretation that is
decidedly false when y is NaN.  But it meant that we transformed

	if (x < nan) abort ();
	if (x >= nan) abort ();

into

	if (x < nan) abort ();
	abort ();


r~


        * cse.c (find_comparison_args): Check that we can reverse a
        comparison if needed before accepting the substitution.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cse.c,v
retrieving revision 1.162
diff -c -p -d -r1.162 cse.c
*** cse.c	2000/10/13 06:26:24	1.162
--- cse.c	2000/10/26 00:16:35
*************** find_comparison_args (code, parg1, parg2
*** 3234,3239 ****
--- 3234,3245 ----
        if (x == 0)
  	break;
  
+       /* If we need to reverse the comparison, make sure that that is
+ 	 possible -- we can't necessarily infer the value of GE from LT
+ 	 with floating-point operands.  */
+       if (reverse_code && ! can_reverse_comparison_p (x, NULL_RTX))
+ 	break;
+ 
        arg1 = XEXP (x, 0), arg2 = XEXP (x, 1);
        if (GET_RTX_CLASS (GET_CODE (x)) == '<')
  	code = GET_CODE (x);


More information about the Gcc-patches mailing list