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]
Other format: [Raw text]

Define REVERSIBLE_CC_MODE for rs6000


'isel' wasn't being used without -ffast-math because combine couldn't
invert the appropriate condition.  The fix would have been really easy
but for the latent bugs it exposed...

Will commit after a final bootstrap & test on powerpc-darwin.

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

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

	* config/rs6000/rs6000.h (REVERSIBLE_CC_MODE): Define.
	(REVERSE_CONDITION): Define.

Index: testsuite/ChangeLog
2003-05-02  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/ppc-isel-1.c: New test.

Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.268
diff -u -p -u -p -r1.268 rs6000.h
--- config/rs6000/rs6000.h	22 Apr 2003 15:01:18 -0000	1.268
+++ config/rs6000/rs6000.h	3 May 2003 20:43:17 -0000
@@ -2366,9 +2366,16 @@ do {									     \
    : (((OP) == EQ || (OP) == NE) && GET_RTX_CLASS (GET_CODE (X)) == '<'   \
       ? CCEQmode : CCmode))
 
+/* Can the condition code MODE be safely reversed?  This is safe in
+   all cases on this port, because at present it doesn't use the
+   trapping FP comparisons (fcmpo).  */
+#define REVERSIBLE_CC_MODE(MODE) 1
+
+/* Given a condition code and a mode, return the inverse condition.  */
+#define REVERSE_CONDITION(CODE, MODE) rs6000_reverse_condition (MODE, CODE)
+
 /* Define the information needed to generate branch and scc insns.  This is
-   stored from the compare operation.  Note that we can't use "rtx" here
-   since it hasn't been defined!  */
+   stored from the compare operation.  */
 
 extern GTY(()) rtx rs6000_compare_op0;
 extern GTY(()) rtx rs6000_compare_op1;
Index: testsuite/gcc.dg/ppc-isel-1.c
===================================================================
RCS file: testsuite/gcc.dg/ppc-isel-1.c
diff -N testsuite/gcc.dg/ppc-isel-1.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/ppc-isel-1.c	3 May 2003 20:43:18 -0000
@@ -0,0 +1,10 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-options "-O -mpowerpc-gfxopt" } */
+/* { dg-final { scan-assembler "fsel" } } */
+
+/* Check that fsel can be generated even without -ffast-math.  */
+
+double foo(double a, double b, double c, double d)
+{
+  return a < b ? c : d;
+}
============================================================


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