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]

[PATCH] Fix testsuite/gcc.c-torture/execute/ieee/920810-1.c on i686, sparc64 and other platforms


Hi!

This patch fixes testsuite/gcc.c-torture/execute/ieee/920810-1.c on
platforms with conditional move instructions. We cannot optimize
a == b ? b : a into a if it is a float comparison.
Ok to commit?

2000-09-04  Jakub Jelinek  <jakub@redhat.com>

	* combine.c (simplify_if_then_else): Don't convert a == b ? b : a
	to a if the comparison is floating mode and not -ffast-math.
	* simplify-rtx.c (simplify_ternary_operation): Likewise.

--- gcc/combine.c.jj	Mon Aug 21 08:43:38 2000
+++ gcc/combine.c	Mon Sep  4 14:40:59 2000
@@ -4664,10 +4664,12 @@ simplify_if_then_else (x)
 
   /* Convert a == b ? b : a to "a".  */
   if (true_code == EQ && ! side_effects_p (cond)
+      && (! FLOAT_MODE_P (mode) || flag_fast_math)
       && rtx_equal_p (XEXP (cond, 0), false)
       && rtx_equal_p (XEXP (cond, 1), true))
     return false;
   else if (true_code == NE && ! side_effects_p (cond)
+	   && (! FLOAT_MODE_P (mode) || flag_fast_math)
 	   && rtx_equal_p (XEXP (cond, 0), true)
 	   && rtx_equal_p (XEXP (cond, 1), false))
     return true;
--- gcc/simplify-rtx.c.jj	Fri Aug 25 14:22:22 2000
+++ gcc/simplify-rtx.c	Mon Sep  4 14:41:52 2000
@@ -1976,10 +1976,12 @@ simplify_ternary_operation (code, mode, 
 
       /* Convert a == b ? b : a to "a".  */
       if (GET_CODE (op0) == NE && ! side_effects_p (op0)
+	  && (! FLOAT_MODE_P (mode) || flag_fast_math)
 	  && rtx_equal_p (XEXP (op0, 0), op1)
 	  && rtx_equal_p (XEXP (op0, 1), op2))
 	return op1;
       else if (GET_CODE (op0) == EQ && ! side_effects_p (op0)
+	  && (! FLOAT_MODE_P (mode) || flag_fast_math)
 	  && rtx_equal_p (XEXP (op0, 1), op1)
 	  && rtx_equal_p (XEXP (op0, 0), op2))
 	return op2;

	Jakub

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