This is the mail archive of the gcc@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]

Re: fold_const.c/tree_swap_operands_p change from Oct 11 breaks m68k


On Sat, Oct 25, 2003 at 03:06:19PM -0600, Roger Sayle wrote:
> These have been "#if 0"'d inside m68k.c's notice_update_cc since the
> start of current CVS.  Is there a way of finding out why the special
> casing of these RTX codes was originally disabled?

The old-gcc tree has

date: 1996/04/15 12:21:56;  author: kenner;  state: Exp;  lines: +2 -0
(notice_update_cc, case ASHIFT{,RT}, LSHIFTRT, ROTATE{,RT}): Don't set
CC_NO_OVERFLOW.

Which I can't see how it could possibly be correct.  The comment added
here is exactly correct in that the overflow bit is always cleared. 
Thus it is not useful, and so we cannot elide comparisons with GT/GE/LT/LE.

Untested, but I expect the following will work.


r~



Index: m68k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.c,v
retrieving revision 1.114
diff -u -p -r1.114 m68k.c
--- m68k.c	22 Oct 2003 21:27:27 -0000	1.114
+++ m68k.c	26 Oct 2003 09:49:43 -0000
@@ -2605,12 +2605,17 @@ notice_update_cc (rtx exp, rtx insn)
   if (cc_status.value2 != 0)
     switch (GET_CODE (cc_status.value2))
       {
-      case PLUS: case MINUS: case MULT:
-      case DIV: case UDIV: case MOD: case UMOD: case NEG:
-#if 0 /* These instructions always clear the overflow bit */
       case ASHIFT: case ASHIFTRT: case LSHIFTRT:
       case ROTATE: case ROTATERT:
-#endif
+	/* These instructions always clear the overflow bit, and set
+	   the carry to the bit shifted out.  */
+	/* ??? We don't currently have a way to signal carry not valid,
+	   nor do we check for it in the branch insns.  */
+	CC_STATUS_INIT;
+	break;
+
+      case PLUS: case MINUS: case MULT:
+      case DIV: case UDIV: case MOD: case UMOD: case NEG:
 	if (GET_MODE (cc_status.value2) != VOIDmode)
 	  cc_status.flags |= CC_NO_OVERFLOW;
 	break;


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