OSDN Git Service

PR c++/39866
[pf3gnuchains/gcc-fork.git] / gcc / reload.c
index a7e9309..1435945 100644 (file)
@@ -112,6 +112,7 @@ a register with any other reload.  */
 #include "params.h"
 #include "target.h"
 #include "df.h"
+#include "ira.h"
 
 /* True if X is a constant that can be forced into the constant pool.  */
 #define CONST_POOL_OK_P(X)                     \
@@ -363,7 +364,7 @@ push_secondary_reload (int in_p, rtx x, int opnum, int optional,
   sri.icode = CODE_FOR_nothing;
   sri.prev_sri = prev_sri;
   rclass = targetm.secondary_reload (in_p, x, reload_class, reload_mode, &sri);
-  icode = sri.icode;
+  icode = (enum insn_code) sri.icode;
 
   /* If we don't need any secondary registers, done.  */
   if (rclass == NO_REGS && icode == CODE_FOR_nothing)
@@ -525,7 +526,7 @@ secondary_reload_class (bool in_p, enum reg_class rclass,
   sri.icode = CODE_FOR_nothing;
   sri.prev_sri = NULL;
   rclass = targetm.secondary_reload (in_p, x, rclass, mode, &sri);
-  icode = sri.icode;
+  icode = (enum insn_code) sri.icode;
 
   /* If there are no secondary reloads at all, we return NO_REGS.
      If an intermediate register is needed, we return its class.  */
@@ -685,15 +686,16 @@ find_valid_class (enum machine_mode outer ATTRIBUTE_UNUSED,
 
       if (bad || !good)
        continue;
-      cost = REGISTER_MOVE_COST (outer, rclass, dest_class);
+      cost = REGISTER_MOVE_COST (outer, (enum reg_class) rclass, dest_class);
 
       if ((reg_class_size[rclass] > best_size
           && (best_cost < 0 || best_cost >= cost))
          || best_cost > cost)
        {
-         best_class = rclass;
+         best_class = (enum reg_class) rclass;
          best_size = reg_class_size[rclass];
-         best_cost = REGISTER_MOVE_COST (outer, rclass, dest_class);
+         best_cost = REGISTER_MOVE_COST (outer, (enum reg_class) rclass,
+                                         dest_class);
        }
     }
 
@@ -1516,7 +1518,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
         value for the incoming operand (same as outgoing one).  */
       if (rld[i].reg_rtx == out
          && (REG_P (in) || CONSTANT_P (in))
-         && 0 != find_equiv_reg (in, this_insn, 0, REGNO (out),
+         && 0 != find_equiv_reg (in, this_insn, NO_REGS, REGNO (out),
                                  static_reload_reg_p, i, inmode))
        rld[i].in = out;
     }
@@ -2134,11 +2136,15 @@ hard_reg_set_here_p (unsigned int beg_regno, unsigned int end_regno, rtx x)
 int
 strict_memory_address_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx addr)
 {
+#ifdef GO_IF_LEGITIMATE_ADDRESS
   GO_IF_LEGITIMATE_ADDRESS (mode, addr, win);
   return 0;
 
  win:
   return 1;
+#else
+  return targetm.legitimate_address_p (mode, addr, 1);
+#endif
 }
 \f
 /* Like rtx_equal_p except that it allows a REG and a SUBREG to match
@@ -2388,12 +2394,12 @@ decompose (rtx x)
          offset = XEXP (offset, 0);
        if (GET_CODE (offset) == PLUS)
          {
-           if (GET_CODE (XEXP (offset, 0)) == CONST_INT)
+           if (CONST_INT_P (XEXP (offset, 0)))
              {
                base = gen_rtx_PLUS (GET_MODE (base), base, XEXP (offset, 1));
                offset = XEXP (offset, 0);
              }
-           else if (GET_CODE (XEXP (offset, 1)) == CONST_INT)
+           else if (CONST_INT_P (XEXP (offset, 1)))
              {
                base = gen_rtx_PLUS (GET_MODE (base), base, XEXP (offset, 0));
                offset = XEXP (offset, 1);
@@ -2404,7 +2410,7 @@ decompose (rtx x)
                offset = const0_rtx;
              }
          }
-       else if (GET_CODE (offset) != CONST_INT)
+       else if (!CONST_INT_P (offset))
          {
            base = gen_rtx_PLUS (GET_MODE (base), base, offset);
            offset = const0_rtx;
@@ -2413,7 +2419,7 @@ decompose (rtx x)
        if (all_const && GET_CODE (base) == PLUS)
          base = gen_rtx_CONST (GET_MODE (base), base);
        
-       gcc_assert (GET_CODE (offset) == CONST_INT);
+       gcc_assert (CONST_INT_P (offset));
        
        val.start = INTVAL (offset);
        val.end = val.start + GET_MODE_SIZE (GET_MODE (x));
@@ -2565,7 +2571,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
   enum reload_usage { RELOAD_READ, RELOAD_READ_WRITE, RELOAD_WRITE } modified[MAX_RECOG_OPERANDS];
   int no_input_reloads = 0, no_output_reloads = 0;
   int n_alternatives;
-  int this_alternative[MAX_RECOG_OPERANDS];
+  enum reg_class this_alternative[MAX_RECOG_OPERANDS];
   char this_alternative_match_win[MAX_RECOG_OPERANDS];
   char this_alternative_win[MAX_RECOG_OPERANDS];
   char this_alternative_offmemok[MAX_RECOG_OPERANDS];
@@ -2584,6 +2590,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
   char goal_alternative_earlyclobber[MAX_RECOG_OPERANDS];
   int goal_alternative_swapped;
   int best;
+  int best_small_class_operands_num;
   int commutative;
   char operands_match[MAX_RECOG_OPERANDS][MAX_RECOG_OPERANDS];
   rtx substed_operand[MAX_RECOG_OPERANDS];
@@ -2909,6 +2916,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
      all the operands together against the register constraints.  */
 
   best = MAX_RECOG_OPERANDS * 2 + 600;
+  best_small_class_operands_num = 0;
 
   swapped = 0;
   goal_alternative_swapped = 0;
@@ -3059,7 +3067,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                force_reload = 1;
            }
 
-         this_alternative[i] = (int) NO_REGS;
+         this_alternative[i] = NO_REGS;
          this_alternative_win[i] = 0;
          this_alternative_match_win[i] = 0;
          this_alternative_offmemok[i] = 0;
@@ -3146,7 +3154,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                       this combination, because we can't reload it.  */
                    if (this_alternative_offmemok[m]
                        && MEM_P (recog_data.operand[m])
-                       && this_alternative[m] == (int) NO_REGS
+                       && this_alternative[m] == NO_REGS
                        && ! this_alternative_win[m])
                      bad = 1;
 
@@ -3162,7 +3170,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                    if (this_alternative_win[m])
                      losers++;
                    this_alternative_win[m] = 0;
-                   if (this_alternative[m] == (int) NO_REGS)
+                   if (this_alternative[m] == NO_REGS)
                      bad = 1;
                    /* But count the pair only once in the total badness of
                       this alternative, if the pair can be a dummy reload.
@@ -3211,8 +3219,8 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
              case 'p':
                /* All necessary reloads for an address_operand
                   were handled in find_reloads_address.  */
-               this_alternative[i]
-                 = (int) base_reg_class (VOIDmode, ADDRESS, SCRATCH);
+               this_alternative[i] = base_reg_class (VOIDmode, ADDRESS,
+                                                     SCRATCH);
                win = 1;
                badop = 0;
                break;
@@ -3317,7 +3325,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                break;
 
              case 's':
-               if (GET_CODE (operand) == CONST_INT
+               if (CONST_INT_P (operand)
                    || (GET_CODE (operand) == CONST_DOUBLE
                        && GET_MODE (operand) == VOIDmode))
                  break;
@@ -3328,7 +3336,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                break;
 
              case 'n':
-               if (GET_CODE (operand) == CONST_INT
+               if (CONST_INT_P (operand)
                    || (GET_CODE (operand) == CONST_DOUBLE
                        && GET_MODE (operand) == VOIDmode))
                  win = 1;
@@ -3342,7 +3350,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
              case 'N':
              case 'O':
              case 'P':
-               if (GET_CODE (operand) == CONST_INT
+               if (CONST_INT_P (operand)
                    && CONST_OK_FOR_CONSTRAINT_P (INTVAL (operand), c, p))
                  win = 1;
                break;
@@ -3371,7 +3379,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
 
              case 'r':
                this_alternative[i]
-                 = (int) reg_class_subunion[this_alternative[i]][(int) GENERAL_REGS];
+                 = reg_class_subunion[this_alternative[i]][(int) GENERAL_REGS];
                goto reg;
 
              default:
@@ -3417,8 +3425,9 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
 
                        /* If we didn't already win, we can reload
                           the address into a base register.  */
-                       this_alternative[i]
-                         = (int) base_reg_class (VOIDmode, ADDRESS, SCRATCH);
+                       this_alternative[i] = base_reg_class (VOIDmode,
+                                                             ADDRESS,
+                                                             SCRATCH);
                        badop = 0;
                        break;
                      }
@@ -3430,9 +3439,9 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                  }
 
                this_alternative[i]
-                 = (int) (reg_class_subunion
-                          [this_alternative[i]]
-                          [(int) REG_CLASS_FROM_CONSTRAINT (c, p)]);
+                 = (reg_class_subunion
+                    [this_alternative[i]]
+                    [(int) REG_CLASS_FROM_CONSTRAINT (c, p)]);
              reg:
                if (GET_MODE (operand) == BLKmode)
                  break;
@@ -3449,7 +3458,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
 
          /* If this operand could be handled with a reg,
             and some reg is allowed, then this operand can be handled.  */
-         if (winreg && this_alternative[i] != (int) NO_REGS)
+         if (winreg && this_alternative[i] != NO_REGS)
            badop = 0;
 
          /* Record which operands fit this alternative.  */
@@ -3468,7 +3477,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                bad = 1;
              /* Alternative loses if it has no regs for a reg operand.  */
              if (REG_P (operand)
-                 && this_alternative[i] == (int) NO_REGS
+                 && this_alternative[i] == NO_REGS
                  && this_alternative_matches[i] < 0)
                bad = 1;
 
@@ -3481,14 +3490,13 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                 precisely the same as in the code below that calls
                 force_const_mem.  */
              if (CONST_POOL_OK_P (operand)
-                 && ((PREFERRED_RELOAD_CLASS (operand,
-                                              (enum reg_class) this_alternative[i])
+                 && ((PREFERRED_RELOAD_CLASS (operand, this_alternative[i])
                       == NO_REGS)
                      || no_input_reloads)
                  && operand_mode[i] != VOIDmode)
                {
                  const_to_mem = 1;
-                 if (this_alternative[i] != (int) NO_REGS)
+                 if (this_alternative[i] != NO_REGS)
                    losers++;
                }
 
@@ -3508,19 +3516,17 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                 LIMIT_RELOAD_CLASS, but we don't check that
                 here.  */
 
-             if (! CONSTANT_P (operand)
-                 && (enum reg_class) this_alternative[i] != NO_REGS)
+             if (! CONSTANT_P (operand) && this_alternative[i] != NO_REGS)
                {
-                 if (PREFERRED_RELOAD_CLASS
-                       (operand, (enum reg_class) this_alternative[i])
+                 if (PREFERRED_RELOAD_CLASS (operand, this_alternative[i])
                      == NO_REGS)
                    reject = 600;
 
 #ifdef PREFERRED_OUTPUT_RELOAD_CLASS
                  if (operand_type[i] == RELOAD_FOR_OUTPUT
-                     && PREFERRED_OUTPUT_RELOAD_CLASS
-                          (operand, (enum reg_class) this_alternative[i])
-                        == NO_REGS)
+                     && (PREFERRED_OUTPUT_RELOAD_CLASS (operand,
+                                                       this_alternative[i])
+                         == NO_REGS))
                    reject = 600;
 #endif
                }
@@ -3568,7 +3574,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
             because we might otherwise exhaust the class.  */
 
          if (! win && ! did_match
-             && this_alternative[i] != (int) NO_REGS
+             && this_alternative[i] != NO_REGS
              && GET_MODE_SIZE (operand_mode[i]) <= UNITS_PER_WORD
              && reg_class_size [(int) preferred_class[i]] > 0
              && ! SMALL_REGISTER_CLASS_P (preferred_class[i]))
@@ -3582,7 +3588,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
                     common case anyway.  */
                  if (reg_class_subset_p (preferred_class[i],
                                          this_alternative[i]))
-                   this_alternative[i] = (int) preferred_class[i];
+                   this_alternative[i] = preferred_class[i];
                  else
                    reject += (2 + 2 * pref_or_nothing[i]);
                }
@@ -3694,22 +3700,48 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
       /* If this alternative can be made to work by reloading,
         and it needs less reloading than the others checked so far,
         record it as the chosen goal for reloading.  */
-      if (! bad && best > losers)
+      if (! bad)
        {
-         for (i = 0; i < noperands; i++)
+         bool change_p = false;
+         int small_class_operands_num = 0;
+
+         if (best >= losers)
            {
-             goal_alternative[i] = this_alternative[i];
-             goal_alternative_win[i] = this_alternative_win[i];
-             goal_alternative_match_win[i] = this_alternative_match_win[i];
-             goal_alternative_offmemok[i] = this_alternative_offmemok[i];
-             goal_alternative_matches[i] = this_alternative_matches[i];
-             goal_alternative_earlyclobber[i]
-               = this_alternative_earlyclobber[i];
+             for (i = 0; i < noperands; i++)
+               small_class_operands_num
+                 += SMALL_REGISTER_CLASS_P (this_alternative[i]) ? 1 : 0;
+             if (best > losers
+                 || (best == losers
+                     /* If the cost of the reloads is the same,
+                        prefer alternative which requires minimal
+                        number of small register classes for the
+                        operands.  This improves chances of reloads
+                        for insn requiring small register
+                        classes.  */
+                     && (small_class_operands_num
+                         < best_small_class_operands_num)))
+               change_p = true;
+           }
+         if (change_p)
+           {
+             for (i = 0; i < noperands; i++)
+               {
+                 goal_alternative[i] = this_alternative[i];
+                 goal_alternative_win[i] = this_alternative_win[i];
+                 goal_alternative_match_win[i]
+                   = this_alternative_match_win[i];
+                 goal_alternative_offmemok[i]
+                   = this_alternative_offmemok[i];
+                 goal_alternative_matches[i] = this_alternative_matches[i];
+                 goal_alternative_earlyclobber[i]
+                   = this_alternative_earlyclobber[i];
+               }
+             goal_alternative_swapped = swapped;
+             best = losers;
+             best_small_class_operands_num = small_class_operands_num;
+             goal_alternative_number = this_alternative_number;
+             goal_earlyclobber = this_earlyclobber;
            }
-         goal_alternative_swapped = swapped;
-         best = losers;
-         goal_alternative_number = this_alternative_number;
-         goal_earlyclobber = this_earlyclobber;
        }
     }
 
@@ -4230,7 +4262,7 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
   /* If we detected error and replaced asm instruction by USE, forget about the
      reloads.  */
   if (GET_CODE (PATTERN (insn)) == USE
-      && GET_CODE (XEXP (PATTERN (insn), 0)) == CONST_INT)
+      && CONST_INT_P (XEXP (PATTERN (insn), 0)))
     n_reloads = 0;
 
   /* Perhaps an output reload can be combined with another
@@ -4557,7 +4589,8 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known,
    is null.  */
 
 static bool
-alternative_allows_const_pool_ref (rtx mem, const char *constraint, int altnum)
+alternative_allows_const_pool_ref (rtx mem ATTRIBUTE_UNUSED,
+                                  const char *constraint, int altnum)
 {
   int c;
 
@@ -4767,7 +4800,8 @@ make_memloc (rtx ad, int regno)
   /* We must rerun eliminate_regs, in case the elimination
      offsets have changed.  */
   rtx tem
-    = XEXP (eliminate_regs (reg_equiv_memory_loc[regno], 0, NULL_RTX), 0);
+    = XEXP (eliminate_regs (reg_equiv_memory_loc[regno], VOIDmode, NULL_RTX),
+           0);
 
   /* If TEM might contain a pseudo, we must copy it to avoid
      modifying it when we do the substitution for the reload.  */
@@ -4930,7 +4964,7 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad,
 
       /* But first quickly dispose of a common case.  */
       if (GET_CODE (ad) == PLUS
-         && GET_CODE (XEXP (ad, 1)) == CONST_INT
+         && CONST_INT_P (XEXP (ad, 1))
          && REG_P (XEXP (ad, 0))
          && reg_equiv_constant[REGNO (XEXP (ad, 0))] == 0)
        return 0;
@@ -5010,7 +5044,7 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad,
          || ! (REG_P (XEXP (tem, 0))
                || (GET_CODE (XEXP (tem, 0)) == PLUS
                    && REG_P (XEXP (XEXP (tem, 0), 0))
-                   && GET_CODE (XEXP (XEXP (tem, 0), 1)) == CONST_INT)))
+                   && CONST_INT_P (XEXP (XEXP (tem, 0), 1)))))
        {
          /* Must use TEM here, not AD, since it is the one that will
             have any subexpressions reloaded, if needed.  */
@@ -5032,7 +5066,7 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad,
   else if (GET_CODE (ad) == PLUS
           && REG_P (XEXP (ad, 0))
           && REGNO (XEXP (ad, 0)) < FIRST_PSEUDO_REGISTER
-          && GET_CODE (XEXP (ad, 1)) == CONST_INT
+          && CONST_INT_P (XEXP (ad, 1))
           && regno_ok_for_base_p (REGNO (XEXP (ad, 0)), mode, PLUS,
                                   CONST_INT))
 
@@ -5106,7 +5140,7 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad,
 
       inner_code = GET_CODE (XEXP (ad, 0));
       if (!(GET_CODE (ad) == PLUS 
-           && GET_CODE (XEXP (ad, 1)) == CONST_INT
+           && CONST_INT_P (XEXP (ad, 1))
            && (inner_code == PLUS || inner_code == LO_SUM)))
        continue;
 
@@ -5262,7 +5296,7 @@ subst_reg_equivs (rtx ad, rtx insn)
     case PLUS:
       /* Quickly dispose of a common case.  */
       if (XEXP (ad, 0) == frame_pointer_rtx
-         && GET_CODE (XEXP (ad, 1)) == CONST_INT)
+         && CONST_INT_P (XEXP (ad, 1)))
        return ad;
       break;
 
@@ -5296,9 +5330,9 @@ form_sum (rtx x, rtx y)
   if (mode == VOIDmode)
     mode = Pmode;
 
-  if (GET_CODE (x) == CONST_INT)
+  if (CONST_INT_P (x))
     return plus_constant (y, INTVAL (x));
-  else if (GET_CODE (y) == CONST_INT)
+  else if (CONST_INT_P (y))
     return plus_constant (x, INTVAL (y));
   else if (CONSTANT_P (x))
     tem = x, x = y, y = tem;
@@ -6107,7 +6141,7 @@ find_reloads_subreg_address (rtx x, int force_replace, int opnum,
                  base = XEXP (tem, 0);
                  if (GET_CODE (base) == PLUS)
                    {
-                     if (GET_CODE (XEXP (base, 1)) == CONST_INT
+                     if (CONST_INT_P (XEXP (base, 1))
                          && INTVAL (XEXP (base, 1)) % outer_size != 0)
                        return x;
                      base = XEXP (base, 0);
@@ -6128,18 +6162,26 @@ find_reloads_subreg_address (rtx x, int force_replace, int opnum,
              /* For some processors an address may be valid in the
                 original mode but not in a smaller mode.  For
                 example, ARM accepts a scaled index register in
-                SImode but not in HImode.  Similarly, the address may
-                have been valid before the subreg offset was added,
-                but not afterwards.  find_reloads_address
-                assumes that we pass it a valid address, and doesn't
-                force a reload.  This will probably be fine if
-                find_reloads_address finds some reloads.  But if it
-                doesn't find any, then we may have just converted a
-                valid address into an invalid one.  Check for that
-                here.  */
+                SImode but not in HImode.  Note that this is only
+                a problem if the address in reg_equiv_mem is already
+                invalid in the new mode; other cases would be fixed
+                by find_reloads_address as usual.
+
+                ??? We attempt to handle such cases here by doing an
+                additional reload of the full address after the
+                usual processing by find_reloads_address.  Note that
+                this may not work in the general case, but it seems
+                to cover the cases where this situation currently
+                occurs.  A more general fix might be to reload the
+                *value* instead of the address, but this would not
+                be expected by the callers of this routine as-is.
+
+                If find_reloads_address already completed replaced
+                the address, there is nothing further to do.  */
              if (reloaded == 0
-                 && !strict_memory_address_p (GET_MODE (tem),
-                                              XEXP (tem, 0)))
+                 && reg_equiv_mem[regno] != 0
+                 && !strict_memory_address_p (GET_MODE (x),
+                                              XEXP (reg_equiv_mem[regno], 0)))
                push_reload (XEXP (tem, 0), NULL_RTX, &XEXP (tem, 0), (rtx*) 0,
                             base_reg_class (GET_MODE (tem), MEM, SCRATCH),
                             GET_MODE (XEXP (tem, 0)), VOIDmode, 0, 0,
@@ -6543,7 +6585,7 @@ reg_overlap_mentioned_for_reload_p (rtx x, rtx in)
   /* If either argument is a constant, then modifying X can not affect IN.  */
   if (CONSTANT_P (x) || CONSTANT_P (in))
     return 0;
-  else if (GET_CODE (x) == SUBREG && GET_CODE (SUBREG_REG (x)) == MEM)
+  else if (GET_CODE (x) == SUBREG && MEM_P (SUBREG_REG (x)))
     return refers_to_mem_for_reload_p (in);
   else if (GET_CODE (x) == SUBREG)
     {
@@ -6723,6 +6765,8 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class rclass, int other,
   while (1)
     {
       p = PREV_INSN (p);
+      if (p && DEBUG_INSN_P (p))
+       continue;
       num++;
       if (p == 0 || LABEL_P (p)
          || num > PARAM_VALUE (PARAM_MAX_RELOAD_SEARCH_INSNS))
@@ -6777,7 +6821,7 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class rclass, int other,
                          || (REG_P (SET_DEST (pat))
                              && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
                              && SCALAR_FLOAT_MODE_P (GET_MODE (XEXP (tem, 0)))
-                             && GET_CODE (goal) == CONST_INT
+                             && CONST_INT_P (goal)
                              && 0 != (goaltry
                                       = operand_subword (XEXP (tem, 0), 0, 0,
                                                          VOIDmode))
@@ -6791,7 +6835,7 @@ find_equiv_reg (rtx goal, rtx insn, enum reg_class rclass, int other,
                      && REG_P (SET_DEST (pat))
                      && GET_CODE (XEXP (tem, 0)) == CONST_DOUBLE
                      && SCALAR_FLOAT_MODE_P (GET_MODE (XEXP (tem, 0)))
-                     && GET_CODE (goal) == CONST_INT
+                     && CONST_INT_P (goal)
                      && 0 != (goaltry = operand_subword (XEXP (tem, 0), 1, 0,
                                                          VOIDmode))
                      && rtx_equal_p (goal, goaltry)
@@ -7119,7 +7163,7 @@ find_inc_amount (rtx x, rtx inced)
               && GET_CODE (XEXP (addr, 1)) == PLUS
               && XEXP (addr, 0) == XEXP (XEXP (addr, 1), 0)
               && XEXP (addr, 0) == inced
-              && GET_CODE (XEXP (XEXP (addr, 1), 1)) == CONST_INT)
+              && CONST_INT_P (XEXP (XEXP (addr, 1), 1)))
        {
          i = INTVAL (XEXP (XEXP (addr, 1), 1));
          return i < 0 ? -i : i;