OSDN Git Service

(call patterns): Use %. in cror.
[pf3gnuchains/gcc-fork.git] / gcc / jump.c
index be7cd71..9773ce6 100644 (file)
@@ -1,5 +1,5 @@
 /* Optimize jump instructions, for GNU compiler.
-   Copyright (C) 1987, 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1987, 88, 89, 91, 92, 1993 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -346,10 +346,10 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
                           && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx))
                      break;
                    pushes++;
-                   if (total_pushed + GET_MODE_SIZE (SET_DEST (pbody))
+                   if (total_pushed + GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)))
                        > stack_adjust_amount)
                      break;
-                   total_pushed += GET_MODE_SIZE (SET_DEST (pbody));
+                   total_pushed += GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)));
                  }
 
                /* Discard the amount pushed from the stack adjust;
@@ -379,7 +379,7 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
                           && GET_CODE (XEXP (dest, 0)) == POST_INC
                           && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx))
                      break;
-                   total_pushed -= GET_MODE_SIZE (SET_DEST (pbody));
+                   total_pushed -= GET_MODE_SIZE (GET_MODE (SET_DEST (pbody)));
                    /* If this push doesn't fully fit in the space
                       of the stack adjust that we deleted,
                       make another stack adjust here for what we
@@ -1016,6 +1016,9 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
                  || (temp3 = temp1,
                      ((BRANCH_COST >= 2
                        && temp2 == const0_rtx)
+#ifdef HAVE_conditional_move
+                      || 1
+#endif
                       || BRANCH_COST >= 3)))
              /* INSN must either branch to the insn after TEMP or the insn
                 after TEMP must branch to the same place as INSN.  */
@@ -1043,6 +1046,9 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
                          || ((INTVAL (temp2) & INTVAL (temp3)) == INTVAL (temp3)
                              && (reversep = can_reverse_comparison_p (temp4,
                                                                       insn)))))
+#ifdef HAVE_conditional_move
+                 || 1
+#endif
                  || BRANCH_COST >= 3)
 #ifdef HAVE_cc0
              /* If the previous insn sets CC0 and something else, we can't
@@ -1149,10 +1155,22 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
                                             1, OPTAB_WIDEN);
                    }
                  else if (normalizep != 1)
-                   target = expand_and (uval, target,
-                                        (GET_CODE (target) == REG
-                                         && ! preserve_subexpressions_p ()
-                                         ? target : NULL_RTX));
+                   {
+                     /* We know that either CVAL or UVAL is zero.  If
+                        UVAL is zero, negate TARGET and `and' with CVAL.
+                        Otherwise, `and' with UVAL.  */
+                     if (uval == const0_rtx)
+                       {
+                         target = expand_unop (GET_MODE (var), one_cmpl_optab,
+                                               target, NULL_RTX, 0);
+                         uval = cval;
+                       }
+
+                     target = expand_and (uval, target,
+                                          (GET_CODE (target) == REG
+                                           && ! preserve_subexpressions_p ()
+                                           ? target : NULL_RTX));
+                   }
                  
                  emit_move_insn (var, target);
                  seq = get_insns ();
@@ -1192,8 +1210,10 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
             TEMP4 to the earliest insn used to find the condition.  */
 
          if ((BRANCH_COST >= 2
-#if defined (HAVE_incscc) || defined (HAVE_decscc)
+#ifdef HAVE_incscc
               || HAVE_incscc
+#endif
+#ifdef HAVE_decscc
               || HAVE_decscc
 #endif
              )
@@ -3853,7 +3873,7 @@ true_regnum (x)
    pending equivalences.  If nonzero, the expressions really aren't the
    same.  */
 
-static short *same_regs;
+static int *same_regs;
 
 static int num_same_regs;
 
@@ -3916,12 +3936,12 @@ thread_jumps (f, max_reg, verbose)
   rtx b1op0, b1op1, b2op0, b2op1;
   int changed = 1;
   int i;
-  short *all_reset;
+  int *all_reset;
 
   /* Allocate register tables and quick-reset table.  */
   modified_regs = (char *) alloca (max_reg * sizeof (char));
-  same_regs = (short *) alloca (max_reg * sizeof (short));
-  all_reset = (short *) alloca (max_reg * sizeof (short));
+  same_regs = (int *) alloca (max_reg * sizeof (int));
+  all_reset = (int *) alloca (max_reg * sizeof (int));
   for (i = 0; i < max_reg; i++)
     all_reset[i] = -1;
     
@@ -3940,7 +3960,7 @@ thread_jumps (f, max_reg, verbose)
          bzero (modified_regs, max_reg * sizeof (char));
          modified_mem = 0;
 
-         bcopy (all_reset, same_regs, max_reg * sizeof (short));
+         bcopy (all_reset, same_regs, max_reg * sizeof (int));
          num_same_regs = 0;
 
          label = JUMP_LABEL (b1);