]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Make more use of REG_NREGS
authorRichard Sandiford <richard.sandiford@linaro.org>
Tue, 12 Sep 2017 13:28:08 +0000 (13:28 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 12 Sep 2017 13:28:08 +0000 (13:28 +0000)
An upcoming patch will convert hard_regno_nregs into an inline
function, which in turn allows hard_regno_nregs to be used as the
name of a targetm field.  This patch rewrites uses that are more
easily (and efficiently) written as REG_NREGS.

2017-09-12  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* caller-save.c (add_used_regs): Use REG_NREGS instead of
hard_regno_nregs.
* config/aarch64/aarch64.c (aarch64_split_combinev16qi): Likewise.
* config/arm/arm.c (output_move_neon): Likewise.
(arm_attr_length_move_neon): Likewise.
(neon_split_vcombine): Likewise.
* config/c6x/c6x.c (c6x_mark_reg_read): Likewise.
(c6x_mark_reg_written): Likewise.
(c6x_dwarf_register_span): Likewise.
* config/i386/i386.c (ix86_save_reg): Likewise.
* config/ia64/ia64.c (mark_reg_gr_used_mask): Likewise.
(rws_access_reg): Likewise.
* config/s390/s390.c (s390_call_saved_register_used): Likewise.
* mode-switching.c (create_pre_exit): Likewise.
* ree.c (combine_reaching_defs): Likewise.
(add_removable_extension): Likewise.
* regcprop.c (find_oldest_value_reg): Likewise.
(copyprop_hardreg_forward_1): Likewise.
* reload.c (reload_inner_reg_of_subreg): Likewise.
(push_reload): Likewise.
(combine_reloads): Likewise.
(find_dummy_reload): Likewise.
(reload_adjust_reg_for_mode): Likewise.
* reload1.c (find_reload_regs): Likewise.
(forget_old_reloads_1): Likewise.
(reload_reg_free_for_value_p): Likewise.
(reload_adjust_reg_for_temp): Likewise.
(emit_reload_insns): Likewise.
(delete_output_reload): Likewise.
* sel-sched.c (choose_best_reg_1): Likewise.
(choose_best_pseudo_reg): Likewise.

From-SVN: r252010

14 files changed:
gcc/ChangeLog
gcc/caller-save.c
gcc/config/aarch64/aarch64.c
gcc/config/arm/arm.c
gcc/config/c6x/c6x.c
gcc/config/i386/i386.c
gcc/config/ia64/ia64.c
gcc/config/s390/s390.c
gcc/mode-switching.c
gcc/ree.c
gcc/regcprop.c
gcc/reload.c
gcc/reload1.c
gcc/sel-sched.c

index ce59e7a2ba94d2aa796b78ae5e851df7a007155a..2683d7759d03a6a5cdaa4747eec42194497cba4b 100644 (file)
@@ -1,3 +1,37 @@
+2017-09-12  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * caller-save.c (add_used_regs): Use REG_NREGS instead of
+       hard_regno_nregs.
+       * config/aarch64/aarch64.c (aarch64_split_combinev16qi): Likewise.
+       * config/arm/arm.c (output_move_neon): Likewise.
+       (arm_attr_length_move_neon): Likewise.
+       (neon_split_vcombine): Likewise.
+       * config/c6x/c6x.c (c6x_mark_reg_read): Likewise.
+       (c6x_mark_reg_written): Likewise.
+       (c6x_dwarf_register_span): Likewise.
+       * config/i386/i386.c (ix86_save_reg): Likewise.
+       * config/ia64/ia64.c (mark_reg_gr_used_mask): Likewise.
+       (rws_access_reg): Likewise.
+       * config/s390/s390.c (s390_call_saved_register_used): Likewise.
+       * mode-switching.c (create_pre_exit): Likewise.
+       * ree.c (combine_reaching_defs): Likewise.
+       (add_removable_extension): Likewise.
+       * regcprop.c (find_oldest_value_reg): Likewise.
+       (copyprop_hardreg_forward_1): Likewise.
+       * reload.c (reload_inner_reg_of_subreg): Likewise.
+       (push_reload): Likewise.
+       (combine_reloads): Likewise.
+       (find_dummy_reload): Likewise.
+       (reload_adjust_reg_for_mode): Likewise.
+       * reload1.c (find_reload_regs): Likewise.
+       (forget_old_reloads_1): Likewise.
+       (reload_reg_free_for_value_p): Likewise.
+       (reload_adjust_reg_for_temp): Likewise.
+       (emit_reload_insns): Likewise.
+       (delete_output_reload): Likewise.
+       * sel-sched.c (choose_best_reg_1): Likewise.
+       (choose_best_pseudo_reg): Likewise.
+
 2017-09-12  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood <david.sherwood@arm.com>
index 619dac9a6894b0645db89ea9c0d3c7a81eb51c46..2166dcf5b89a3847a1ba9eee22e59af36b7fc53f 100644 (file)
@@ -1354,8 +1354,7 @@ add_used_regs (rtx *loc, void *data)
        {
          unsigned int regno = REGNO (x);
          if (HARD_REGISTER_NUM_P (regno))
-           bitmap_set_range ((regset) data, regno,
-                             hard_regno_nregs[regno][GET_MODE (x)]);
+           bitmap_set_range ((regset) data, regno, REG_NREGS (x));
          else
            gcc_checking_assert (reg_renumber[regno] < 0);
        }
index a2ecd7ac33672a05487efe7f89909372a4b34f5c..64c03da63a782c0fd204bde5fe8b4cac8224c580 100644 (file)
@@ -13106,7 +13106,7 @@ aarch64_split_combinev16qi (rtx operands[3])
   unsigned int src1 = REGNO (operands[1]);
   unsigned int src2 = REGNO (operands[2]);
   machine_mode halfmode = GET_MODE (operands[1]);
-  unsigned int halfregs = HARD_REGNO_NREGS (src1, halfmode);
+  unsigned int halfregs = REG_NREGS (operands[1]);
   rtx destlo, desthi;
 
   gcc_assert (halfmode == V16QImode);
index f0e7788a53f0fe1a0eca781a3bf6fcf31e95846e..7614bc1f86b8d6a4c558180496bf5b8c1aa8acf7 100644 (file)
@@ -18589,7 +18589,7 @@ output_move_neon (rtx *operands)
 
   gcc_assert (REG_P (reg));
   regno = REGNO (reg);
-  nregs = HARD_REGNO_NREGS (regno, mode) / 2;
+  nregs = REG_NREGS (reg) / 2;
   gcc_assert (VFP_REGNO_OK_FOR_DOUBLE (regno)
              || NEON_REGNO_OK_FOR_QUAD (regno));
   gcc_assert (VALID_NEON_DREG_MODE (mode)
@@ -18722,7 +18722,6 @@ arm_attr_length_move_neon (rtx_insn *insn)
 
   gcc_assert (MEM_P (mem));
 
-  mode = GET_MODE (reg);
   addr = XEXP (mem, 0);
 
   /* Strip off const from addresses like (const (plus (...))).  */
@@ -18731,7 +18730,7 @@ arm_attr_length_move_neon (rtx_insn *insn)
 
   if (GET_CODE (addr) == LABEL_REF || GET_CODE (addr) == PLUS)
     {
-      int insns = HARD_REGNO_NREGS (REGNO (reg), mode) / 2;
+      int insns = REG_NREGS (reg) / 2;
       return insns * 4;
     }
   else
@@ -23713,7 +23712,7 @@ neon_split_vcombine (rtx operands[3])
   unsigned int src1 = REGNO (operands[1]);
   unsigned int src2 = REGNO (operands[2]);
   machine_mode halfmode = GET_MODE (operands[1]);
-  unsigned int halfregs = HARD_REGNO_NREGS (src1, halfmode);
+  unsigned int halfregs = REG_NREGS (operands[1]);
   rtx destlo, desthi;
 
   if (src1 == dest && src2 == dest + halfregs)
index c5b1679c5475c52a5addf2139599d189b2549796..e7f684143280dc2e05a9606d9b7625c9d450b61a 100644 (file)
@@ -4025,7 +4025,7 @@ static void
 c6x_mark_reg_read (rtx reg, bool cross)
 {
   unsigned regno = REGNO (reg);
-  unsigned nregs = hard_regno_nregs[regno][GET_MODE (reg)];
+  unsigned nregs = REG_NREGS (reg);
 
   while (nregs-- > 0)
     c6x_mark_regno_read (regno + nregs, cross);
@@ -4037,7 +4037,7 @@ static void
 c6x_mark_reg_written (rtx reg, int cycles)
 {
   unsigned regno = REGNO (reg);
-  unsigned nregs = hard_regno_nregs[regno][GET_MODE (reg)];
+  unsigned nregs = REG_NREGS (reg);
 
   while (nregs-- > 0)
     ss.reg_set_in_cycle[regno + nregs] = cycles;
@@ -6336,7 +6336,7 @@ c6x_dwarf_register_span (rtx rtl)
     rtx p;
 
     regno = REGNO (rtl);
-    nregs = HARD_REGNO_NREGS (regno, GET_MODE (rtl));
+    nregs = REG_NREGS (rtl);
     if (nregs == 1)
       return  NULL_RTX;
 
index 4e93cc1043b0b588106f01063c34f9290506369f..61bca2acb3025c3a377219b662a4a27d89f34424 100644 (file)
@@ -12719,7 +12719,7 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return, bool ignore_outlined)
       if (reg)
        {
          unsigned int i = REGNO (reg);
-         unsigned int nregs = hard_regno_nregs[i][GET_MODE (reg)];
+         unsigned int nregs = REG_NREGS (reg);
          while (nregs-- > 0)
            if ((i + nregs) == regno)
              return false;
@@ -12728,7 +12728,7 @@ ix86_save_reg (unsigned int regno, bool maybe_eh_return, bool ignore_outlined)
          if (reg)
            {
              i = REGNO (reg);
-             nregs = hard_regno_nregs[i][GET_MODE (reg)];
+             nregs = REG_NREGS (reg);
              while (nregs-- > 0)
                if ((i + nregs) == regno)
                  return false;
index 8a3c875cd06885d040206d674ae6c383a0b85f29..426287081aeb9a58b9f37457a6a1fdcf01c4aba9 100644 (file)
@@ -2653,7 +2653,7 @@ mark_reg_gr_used_mask (rtx reg, void *data ATTRIBUTE_UNUSED)
   unsigned int regno = REGNO (reg);
   if (regno < 32)
     {
-      unsigned int i, n = hard_regno_nregs[regno][GET_MODE (reg)];
+      unsigned int i, n = REG_NREGS (reg);
       for (i = 0; i < n; ++i)
        current_frame_info.gr_used_mask |= 1 << (regno + i);
     }
@@ -6399,7 +6399,7 @@ static int
 rws_access_reg (rtx reg, struct reg_flags flags, int pred)
 {
   int regno = REGNO (reg);
-  int n = HARD_REGNO_NREGS (REGNO (reg), GET_MODE (reg));
+  int n = REG_NREGS (reg);
 
   if (n == 1)
     return rws_access_regno (regno, flags, pred);
index 36bc67db1da6308597cb5130830c21597b587b0d..de7f3e577d08385f33522d12ba9bd91878b9b468 100644 (file)
@@ -13241,9 +13241,7 @@ s390_call_saved_register_used (tree call_expr)
 
        if (REG_P (parm_rtx))
         {
-          for (reg = 0;
-               reg < HARD_REGNO_NREGS (REGNO (parm_rtx), GET_MODE (parm_rtx));
-               reg++)
+          for (reg = 0; reg < REG_NREGS (parm_rtx); reg++)
             if (!call_used_regs[reg + REGNO (parm_rtx)])
               return true;
         }
@@ -13258,9 +13256,7 @@ s390_call_saved_register_used (tree call_expr)
 
               gcc_assert (REG_P (r));
 
-              for (reg = 0;
-                   reg < HARD_REGNO_NREGS (REGNO (r), GET_MODE (r));
-                   reg++)
+              for (reg = 0; reg < REG_NREGS (r); reg++)
                 if (!call_used_regs[reg + REGNO (r)])
                   return true;
             }
index 15b813ff6f7e93e0d479e48c2aa991d03409fc50..59e88888b1cfe0fcbe64597bc143fa87926f2f47 100644 (file)
@@ -440,8 +440,7 @@ create_pre_exit (int n_entities, int *entity_map, const int *num_modes)
                        || short_block
                        || !(targetm.class_likely_spilled_p
                             (REGNO_REG_CLASS (ret_start)))
-                       || (nregs
-                           != hard_regno_nregs[ret_start][GET_MODE (ret_reg)])
+                       || nregs != REG_NREGS (ret_reg)
                        /* For multi-hard-register floating point
                           values, sometimes the likely-spilled part
                           is ordinarily copied first, then the other
index 72564de98af8b07b4d3fa3dfaa2828691f34e644..9e04954d35b1e96a22e41d4d2dfbbadbb3e8a0cb 100644 (file)
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -823,8 +823,7 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state)
        return false;
 
       /* Ensure the number of hard registers of the copy match.  */
-      if (HARD_REGNO_NREGS (REGNO (src_reg), dst_mode)
-         != HARD_REGNO_NREGS (REGNO (src_reg), GET_MODE (src_reg)))
+      if (HARD_REGNO_NREGS (REGNO (src_reg), dst_mode) != REG_NREGS (src_reg))
        return false;
 
       /* There's only one reaching def.  */
@@ -1136,8 +1135,7 @@ add_removable_extension (const_rtx expr, rtx_insn *insn,
 
         We allow this when the registers are different because the
         code in combine_reaching_defs will handle that case correctly.  */
-      if ((HARD_REGNO_NREGS (REGNO (dest), mode)
-          != HARD_REGNO_NREGS (REGNO (reg), GET_MODE (reg)))
+      if (HARD_REGNO_NREGS (REGNO (dest), mode) != REG_NREGS (reg)
          && reg_overlap_mentioned_p (dest, reg))
        return;
 
index 1161f157d8e2ff45331984b0820766823b6cea98..39977bec14408a0ab3487ccc59a199a239991a25 100644 (file)
@@ -444,12 +444,9 @@ find_oldest_value_reg (enum reg_class cl, rtx reg, struct value_data *vd)
        (set (reg:SI r10) (...))
        (set (...) (reg:DI r9))
      Replacing r9 with r11 is invalid.  */
-  if (mode != vd->e[regno].mode)
-    {
-      if (hard_regno_nregs[regno][mode]
-         > hard_regno_nregs[regno][vd->e[regno].mode])
-       return NULL_RTX;
-    }
+  if (mode != vd->e[regno].mode
+      && REG_NREGS (reg) > hard_regno_nregs[regno][vd->e[regno].mode])
+    return NULL_RTX;
 
   for (i = vd->e[regno].oldest_regno; i != regno; i = vd->e[i].next_regno)
     {
@@ -871,14 +868,13 @@ copyprop_hardreg_forward_1 (basic_block bb, struct value_data *vd)
             set it in, make sure that the replacement is valid.  */
          if (mode != vd->e[regno].mode)
            {
-             if (hard_regno_nregs[regno][mode]
+             if (REG_NREGS (src)
                  > hard_regno_nregs[regno][vd->e[regno].mode])
                goto no_move_special_case;
 
              /* And likewise, if we are narrowing on big endian the transformation
                 is also invalid.  */
-             if (hard_regno_nregs[regno][mode]
-                 < hard_regno_nregs[regno][vd->e[regno].mode]
+             if (REG_NREGS (src) < hard_regno_nregs[regno][vd->e[regno].mode]
                  && (GET_MODE_SIZE (vd->e[regno].mode) > UNITS_PER_WORD
                      ? WORDS_BIG_ENDIAN : BYTES_BIG_ENDIAN))
                goto no_move_special_case;
index 9d96700209ff0da12146c479edc3e9c2128df6da..eb67db6c951b5b911f6d50c20e91271a79a11f95 100644 (file)
@@ -862,7 +862,7 @@ reload_inner_reg_of_subreg (rtx x, machine_mode mode, bool output)
          && GET_MODE_SIZE (mode) <= UNITS_PER_WORD
          && GET_MODE_SIZE (GET_MODE (inner)) > UNITS_PER_WORD
          && ((GET_MODE_SIZE (GET_MODE (inner)) / UNITS_PER_WORD)
-             != (int) hard_regno_nregs[REGNO (inner)][GET_MODE (inner)]));
+             != REG_NREGS (inner)));
 }
 
 /* Return nonzero if IN can be reloaded into REGNO with mode MODE without
@@ -1086,8 +1086,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
                       > UNITS_PER_WORD)
                   && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
                        / UNITS_PER_WORD)
-                      != (int) hard_regno_nregs[REGNO (SUBREG_REG (in))]
-                                               [GET_MODE (SUBREG_REG (in))]))
+                      != REG_NREGS (SUBREG_REG (in))))
                  || !targetm.hard_regno_mode_ok (subreg_regno (in), inmode)))
          || (secondary_reload_class (1, rclass, inmode, in) != NO_REGS
              && (secondary_reload_class (1, rclass, GET_MODE (SUBREG_REG (in)),
@@ -1597,7 +1596,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
            && (ORIGINAL_REGNO (XEXP (note, 0)) < FIRST_PSEUDO_REGISTER
                || (! bitmap_bit_p (DF_LR_OUT (ENTRY_BLOCK_PTR_FOR_FN (cfun)),
                                    ORIGINAL_REGNO (XEXP (note, 0)))
-                   && hard_regno_nregs[regno][GET_MODE (XEXP (note, 0))] == 1))
+                   && REG_NREGS (XEXP (note, 0)) == 1))
            && ! refers_to_regno_for_reload_p (regno,
                                               end_hard_regno (rel_mode,
                                                               regno),
@@ -1907,7 +1906,7 @@ combine_reloads (void)
        && TEST_HARD_REG_BIT (reg_class_contents[(int) rld[output_reload].rclass],
                              regno)
        && (hard_regno_nregs[regno][rld[output_reload].outmode]
-           <= hard_regno_nregs[regno][GET_MODE (XEXP (note, 0))])
+           <= REG_NREGS (XEXP (note, 0)))
        /* Ensure that a secondary or tertiary reload for this output
           won't want this register.  */
        && ((secondary_out = rld[output_reload].secondary_out_reload) == -1
@@ -1922,7 +1921,7 @@ combine_reloads (void)
        && (ORIGINAL_REGNO (XEXP (note, 0)) < FIRST_PSEUDO_REGISTER
            || (!bitmap_bit_p (DF_LR_OUT (ENTRY_BLOCK_PTR_FOR_FN (cfun)),
                               ORIGINAL_REGNO (XEXP (note, 0)))
-               && hard_regno_nregs[regno][GET_MODE (XEXP (note, 0))] == 1)))
+               && REG_NREGS (XEXP (note, 0)) == 1)))
       {
        rld[output_reload].reg_rtx
          = gen_rtx_REG (rld[output_reload].outmode, regno);
@@ -2088,7 +2087,7 @@ find_dummy_reload (rtx real_in, rtx real_out, rtx *inloc, rtx *outloc,
                 because only another subword of the hardreg is actually
                 used in the insn.  This cannot happen if the pseudo has
                 been assigned exactly one hardreg.  See PR 33732.  */
-             && hard_regno_nregs[REGNO (in)][GET_MODE (in)] == 1)))
+             && REG_NREGS (in) == 1)))
     {
       unsigned int regno = REGNO (in) + in_offset;
       unsigned int nwords = hard_regno_nregs[regno][inmode];
@@ -7254,8 +7253,7 @@ reload_adjust_reg_for_mode (rtx reloadreg, machine_mode mode)
   regno = REGNO (reloadreg);
 
   if (REG_WORDS_BIG_ENDIAN)
-    regno += (int) hard_regno_nregs[regno][GET_MODE (reloadreg)]
-      - (int) hard_regno_nregs[regno][mode];
+    regno += (int) REG_NREGS (reloadreg) - (int) hard_regno_nregs[regno][mode];
 
   return gen_rtx_REG (mode, regno);
 }
index 647a97bb958182e3bfbe29e937dab83a3941b727..092995138a6d4ae5bd62961c9ddefaf16e2638fd 100644 (file)
@@ -1965,10 +1965,8 @@ find_reload_regs (struct insn_chain *chain)
       /* Show whether this reload already has a hard reg.  */
       if (chain->rld[i].reg_rtx)
        {
-         int regno = REGNO (chain->rld[i].reg_rtx);
-         chain->rld[i].regno = regno;
-         chain->rld[i].nregs
-           = hard_regno_nregs[regno][GET_MODE (chain->rld[i].reg_rtx)];
+         chain->rld[i].regno = REGNO (chain->rld[i].reg_rtx);
+         chain->rld[i].nregs = REG_NREGS (chain->rld[i].reg_rtx);
        }
       else
        chain->rld[i].regno = -1;
@@ -4910,7 +4908,7 @@ forget_old_reloads_1 (rtx x, const_rtx ignored ATTRIBUTE_UNUSED,
     {
       unsigned int i;
 
-      nr = hard_regno_nregs[regno][GET_MODE (x)];
+      nr = REG_NREGS (x);
       /* Storing into a spilled-reg invalidates its contents.
         This can happen if a block-local pseudo is allocated to that reg
         and it wasn't spilled because this block's total need is 0.
@@ -5874,8 +5872,7 @@ reload_reg_free_for_value_p (int start_regno, int regno, int opnum,
     {
       rtx reg = rld[i].reg_rtx;
       if (reg && REG_P (reg)
-         && ((unsigned) regno - true_regnum (reg)
-             <= hard_regno_nregs[REGNO (reg)][GET_MODE (reg)] - (unsigned) 1)
+         && (unsigned) regno - true_regnum (reg) < REG_NREGS (reg)
          && i != reloadnum)
        {
          rtx other_input = rld[i].in;
@@ -7155,8 +7152,7 @@ reload_adjust_reg_for_temp (rtx *reload_reg, rtx alt_reload_reg,
        {
          if (!targetm.hard_regno_mode_ok (regno, new_mode))
            continue;
-         if (hard_regno_nregs[regno][new_mode]
-             > hard_regno_nregs[regno][GET_MODE (reg)])
+         if (hard_regno_nregs[regno][new_mode] > REG_NREGS (reg))
            continue;
          reg = reload_adjust_reg_for_mode (reg, new_mode);
        }
@@ -8236,7 +8232,7 @@ emit_reload_insns (struct insn_chain *chain)
                {
                  machine_mode mode = GET_MODE (reg);
                  int regno = REGNO (reg);
-                 int nregs = hard_regno_nregs[regno][mode];
+                 int nregs = REG_NREGS (reg);
                  rtx out = (REG_P (rld[r].out)
                             ? rld[r].out
                             : rld[r].out_reg
@@ -8315,7 +8311,7 @@ emit_reload_insns (struct insn_chain *chain)
 
                  mode = GET_MODE (reg);
                  regno = REGNO (reg);
-                 nregs = hard_regno_nregs[regno][mode];
+                 nregs = REG_NREGS (reg);
                  if (REG_P (rld[r].in)
                      && REGNO (rld[r].in) >= FIRST_PSEUDO_REGISTER)
                    in = rld[r].in;
@@ -8837,10 +8833,7 @@ delete_output_reload (rtx_insn *insn, int j, int last_reload_reg,
     return;
 
   regno = REGNO (reg);
-  if (regno >= FIRST_PSEUDO_REGISTER)
-    nregs = 1;
-  else
-    nregs = hard_regno_nregs[regno][GET_MODE (reg)];
+  nregs = REG_NREGS (reg);
 
   /* If the pseudo-reg we are reloading is no longer referenced
      anywhere between the store into it and here,
index 92c0c6572b6a3725621ff82462749cf489b7cbf6..ce6a8696ebe2b4ae3258bede72d81b052f3cf78c 100644 (file)
@@ -1348,7 +1348,7 @@ choose_best_reg_1 (HARD_REG_SET hard_regs_used,
       gcc_assert (mode == GET_MODE (orig_dest));
 
       regno = REGNO (orig_dest);
-      for (i = 0, n = hard_regno_nregs[regno][mode]; i < n; i++)
+      for (i = 0, n = REG_NREGS (orig_dest); i < n; i++)
         if (TEST_HARD_REG_BIT (hard_regs_used, regno + i))
           break;
 
@@ -1463,7 +1463,7 @@ choose_best_pseudo_reg (regset used_regs,
       if (HARD_REGISTER_NUM_P (orig_regno))
        {
          int j, n;
-         for (j = 0, n = hard_regno_nregs[orig_regno][mode]; j < n; j++)
+         for (j = 0, n = REG_NREGS (dest); j < n; j++)
            if (REGNO_REG_SET_P (used_regs, orig_regno + j))
              break;
          if (j < n)