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]

Small update to reversed_comparison_code


Hi
This patch makes reversed_comparison_code smarter - it allows reversals
like LT->UNGE, since they are safe - the resulting comparison may not trap.
Also allows the oposite direction of reversals for -ffast-math mode.

This patch is needed to make ifcvt match some cmoves on i386 w/o -ffast-math.

Honza

Tue Feb 27 17:52:14 CET 2001  Jan Hubicka  <jh@suse.cz>
	* jump.c (reversed_comparison_code_parts): Allow reversal of
	unordered compares in -ffast-math mode; reverse ordered compares
	for FP even w/o -ffast-math.

Index: jump.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/jump.c,v
retrieving revision 1.155
diff -c -3 -p -r1.155 jump.c
*** jump.c	2001/02/18 23:51:21	1.155
--- jump.c	2001/02/27 16:50:38
*************** reversed_comparison_code_parts (code, ar
*** 1782,1788 ****
        case UNLE:
        case UNGT:
        case UNGE:
! 	/* We don't have safe way to reverse these yet.  */
  	return UNKNOWN;
        default:
  	break;
--- 1782,1792 ----
        case UNLE:
        case UNGT:
        case UNGE:
! 	/* We don't have safe way to reverse these yet - we would need
! 	   rdered compares that may not trap.  */
! 	if (TARGET_FLOAT_FORMAT != IEEE_FLOAT_FORMAT
! 	    || flag_fast_math)
! 	  return reverse_condition_maybe_unordered (code);
  	return UNKNOWN;
        default:
  	break;
*************** reversed_comparison_code_parts (code, ar
*** 1840,1845 ****
--- 1844,1855 ----
  	    return UNKNOWN;
  	}
      }
+ 
+   /* In case of floating point modes, we may reverse here, since
+      we will be always converting an ordered compare to unordered.
+      The unsafe code has been caught earlier.  */
+   if (FLOAT_MODE_P (mode))
+     return reverse_condition_maybe_unordered (code);
  
    /* An integer condition.  */
    if (GET_CODE (arg0) == CONST_INT


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