Handle fabs(x) UNGE 0.0

Geoffrey Keating gkeating@apple.com
Sat May 3 21:13:00 GMT 2003


rs6000-iselslowmath.patch caused gcc.c-torture/execute/20020720-1.c to
fail, because the patch was correctly negating LT into UNGE but
simplify-rtx only knew about GE (and then only under fast-math).

It also makes the GE case use const_true_rtx rather than const1_rtx.

Bootstrap & test in progress on powerpc-darwin.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-fabsunge.patch========================
2003-05-03  Geoffrey Keating  <geoffk@apple.com>

	* simplify-rtx.c (simplify_relational_operation): Add case for
	! (fabs(x) < 0.0).

Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.140
diff -u -p -u -p -r1.140 simplify-rtx.c
--- simplify-rtx.c	5 Apr 2003 20:06:37 -0000	1.140
+++ simplify-rtx.c	3 May 2003 21:05:22 -0000
@@ -2381,10 +2381,21 @@ simplify_relational_operation (code, mod
 	      tem = GET_CODE (trueop0) == FLOAT_EXTEND ? XEXP (trueop0, 0)
 						       : trueop0;
 	      if (GET_CODE (tem) == ABS)
-		return const1_rtx;
+		return const_true_rtx;
 	    }
 	  break;
 
+	case UNGE:
+	  /* Optimize ! (abs(x) < 0.0).  */
+	  if (trueop1 == CONST0_RTX (mode))
+	    {
+	      tem = GET_CODE (trueop0) == FLOAT_EXTEND ? XEXP (trueop0, 0)
+						       : trueop0;
+	      if (GET_CODE (tem) == ABS)
+		return const_true_rtx;
+	    }
+	  break;
+	  
 	default:
 	  break;
 	}
============================================================



More information about the Gcc-patches mailing list