OSDN Git Service

* expmed.c (expand_mult_add): Remove.
[pf3gnuchains/gcc-fork.git] / gcc / combine.c
index ee8d98d..b7199ad 100644 (file)
@@ -457,6 +457,9 @@ static rtx gen_lowpart_or_truncate (enum machine_mode, rtx);
 #undef RTL_HOOKS_REG_NUM_SIGN_BIT_COPIES
 #define RTL_HOOKS_REG_NUM_SIGN_BIT_COPIES  reg_num_sign_bit_copies_for_combine
 
+#undef RTL_HOOKS_REG_TRUNCATED_TO_MODE
+#define RTL_HOOKS_REG_TRUNCATED_TO_MODE    reg_truncated_to_mode
+
 static const struct rtl_hooks combine_rtl_hooks = RTL_HOOKS_INITIALIZER;
 
 \f
@@ -503,7 +506,7 @@ do_SUBST (rtx *into, rtx newval)
   if (undobuf.frees)
     buf = undobuf.frees, undobuf.frees = buf->next;
   else
-    buf = xmalloc (sizeof (struct undo));
+    buf = XNEW (struct undo);
 
   buf->kind = UNDO_RTX;
   buf->where.r = into;
@@ -531,7 +534,7 @@ do_SUBST_INT (int *into, int newval)
   if (undobuf.frees)
     buf = undobuf.frees, undobuf.frees = buf->next;
   else
-    buf = xmalloc (sizeof (struct undo));
+    buf = XNEW (struct undo);
 
   buf->kind = UNDO_INT;
   buf->where.i = into;
@@ -560,7 +563,7 @@ do_SUBST_MODE (rtx *into, enum machine_mode newval)
   if (undobuf.frees)
     buf = undobuf.frees, undobuf.frees = buf->next;
   else
-    buf = xmalloc (sizeof (struct undo));
+    buf = XNEW (struct undo);
 
   buf->kind = UNDO_MODE;
   buf->where.r = into;
@@ -708,7 +711,7 @@ combine_instructions (rtx f, unsigned int nregs)
 
   rtl_hooks = combine_rtl_hooks;
 
-  reg_stat = xcalloc (nregs, sizeof (struct reg_stat));
+  reg_stat = XCNEWVEC (struct reg_stat, nregs);
 
   init_recog_no_volatile ();
 
@@ -718,7 +721,7 @@ combine_instructions (rtx f, unsigned int nregs)
     if (INSN_UID (insn) > i)
       i = INSN_UID (insn);
 
-  uid_cuid = xmalloc ((i + 1) * sizeof (int));
+  uid_cuid = XNEWVEC (int, i + 1);
   max_uid_cuid = i;
 
   nonzero_bits_mode = mode_for_size (HOST_BITS_PER_WIDE_INT, MODE_INT, 0);
@@ -747,7 +750,7 @@ combine_instructions (rtx f, unsigned int nregs)
   sbitmap_zero (refresh_blocks);
 
   /* Allocate array of current insn_rtx_costs.  */
-  uid_insn_cost = xcalloc (max_uid_cuid + 1, sizeof (int));
+  uid_insn_cost = XCNEWVEC (int, max_uid_cuid + 1);
   last_insn_cost = max_uid_cuid;
 
   for (insn = f, i = 0; insn; insn = NEXT_INSN (insn))
@@ -3123,7 +3126,8 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
     if (i3_subst_into_i2)
       {
        for (i = 0; i < XVECLEN (PATTERN (i2), 0); i++)
-         if (GET_CODE (XVECEXP (PATTERN (i2), 0, i)) != USE
+         if ((GET_CODE (XVECEXP (PATTERN (i2), 0, i)) == SET
+              || GET_CODE (XVECEXP (PATTERN (i2), 0, i)) == CLOBBER)
              && REG_P (SET_DEST (XVECEXP (PATTERN (i2), 0, i)))
              && SET_DEST (XVECEXP (PATTERN (i2), 0, i)) != i2dest
              && ! find_reg_note (i2, REG_UNUSED,
@@ -6249,6 +6253,9 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
              || orig_pos + len > GET_MODE_BITSIZE (wanted_inner_mode)))
        return 0;
 
+      if (orig_pos < 0)
+       return 0;
+
       inner = force_to_mode (inner, wanted_inner_mode,
                             pos_rtx
                             || len + orig_pos >= HOST_BITS_PER_WIDE_INT
@@ -6773,7 +6780,7 @@ gen_lowpart_or_truncate (enum machine_mode mode, rtx x)
       || (REG_P (x) && reg_truncated_to_mode (mode, x)))
     return gen_lowpart (mode, x);
   else
-    return gen_rtx_TRUNCATE (mode, x);
+    return simplify_gen_unary (TRUNCATE, mode, x, GET_MODE (x));
 }
 
 /* See if X can be simplified knowing that we will only refer to it in
@@ -8734,7 +8741,8 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode,
              && INTVAL (XEXP (varop, 1)) >= 0
              && INTVAL (XEXP (varop, 1)) < GET_MODE_BITSIZE (GET_MODE (varop))
              && GET_MODE_BITSIZE (result_mode) <= HOST_BITS_PER_WIDE_INT
-             && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)
+             && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT
+             && !VECTOR_MODE_P (result_mode))
            {
              enum rtx_code first_code = GET_CODE (varop);
              unsigned int first_count = INTVAL (XEXP (varop, 1));
@@ -12570,7 +12578,7 @@ gate_handle_combine (void)
 }
 
 /* Try combining insns through substitution.  */
-static void
+static unsigned int
 rest_of_handle_combine (void)
 {
   int rebuild_jump_labels_after_combine
@@ -12588,6 +12596,7 @@ rest_of_handle_combine (void)
       delete_dead_jumptables ();
       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE);
     }
+  return 0;
 }
 
 struct tree_opt_pass pass_combine =