Patchwork RFA: enable LRA for rs6000

login
register
mail settings
Submitter Vladimir Makarov
Date April 28, 2013, 5:07 p.m.
Message ID <1175915374.3986899.1367168858024.JavaMail.root@redhat.com>
Download mbox | patch
Permalink /patch/240263/
State New
Headers show

Comments

Vladimir Makarov - April 28, 2013, 5:07 p.m.
----- Original Message -----
From: "Michael Meissner" <meissner@linux.vnet.ibm.com>
To: "Vladimir Makarov" <vmakarov@redhat.com>
Cc: "Michael Meissner" <meissner@linux.vnet.ibm.com>, "David Edelsohn" <dje.gcc@gmail.com>, "gcc-patches" <gcc-patches@gcc.gnu.org>, "Peter Bergner" <bergner@vnet.ibm.com>, aavrunin@redhat.com
Sent: Friday, April 26, 2013 7:13:55 PM
Subject: Re: RFA: enable LRA for rs6000

On Fri, Apr 26, 2013 at 07:00:37PM -0400, Vladimir Makarov wrote:
> 2013-04-26  Vladimir Makarov  <vmakarov@redhat.com>
> 
>         * lra.c (setup_operand_alternative): Ignore '?'.
>         * lra-constraints.c (process_alt_operands): Print cost dump for
>         alternatives.  Check only moves for cycling.
>         (curr_insn_transform): Print insn name.

I'm not sure I'm comfortable with ignoring the '?' altogether.  For example, if
you do something in the GPR unit, instructions run at one cycle, while if you
do it in the vector unit, it runs in two cycles.  In the past, I've seen cases
where it wanted to spill floating point values from the floating point
registers to the CTR.  And if you spill to the LR, it can interfere with the
call cache.

Admitily, when to use '!', '?', and '*' is unclear, and unfortunately it has
changed over time.

-----------

I don't like to change '?' semantics too.  So I found another solution.
I've committed it to the branch although it might be not final solution --
I'd like to see how it affects x86/x86-64.

Mike, could you send me the config file (if it is possible of course) for
spec2006 you are using in order to be in sync.

Thanks, Vlad.


2013-04-28  Vladimir Makarov  <vmakarov@redhat.com>

        * lra.c (setup_operand_alternative): Restore taking into account
        '?'.
        * lra-constraints.c (process_alt_operands): Discourage a bit more using
        memory for pseudos.  Remove printing undefined values.  Modify
        cost values for conflicts with early clobbers.


            {
@@ -2163,7 +2166,10 @@ process_alt_operands (int only_alternati
                }
              curr_alt_win[i] = curr_alt_match_win[i] = false;
              losers++;
-             overall += LRA_LOSER_COST_FACTOR;
+             /* Early clobber was already reflected in REJECT. */
+             lra_assert (reject > 0);
+             reject--;
+             overall += LRA_LOSER_COST_FACTOR - 1;
            }
        }
       small_class_operands_num = 0;

Patch

Index: lra.c
===================================================================
--- lra.c       (revision 198350)
+++ lra.c       (working copy)
@@ -784,6 +784,9 @@  setup_operand_alternative (lra_insn_reco
                  lra_assert (i != nop - 1);
                  break;

+               case '?':
+                 op_alt->reject += LRA_LOSER_COST_FACTOR;
+                 break;
                case '!':
                  op_alt->reject += LRA_MAX_REJECT;
                  break;
Index: lra-constraints.c
===================================================================
--- lra-constraints.c   (revision 198373)
+++ lra-constraints.c   (working copy)
@@ -2007,7 +2007,7 @@  process_alt_operands (int only_alternati
                 although it might takes the same number of
                 reloads.  */
              if (no_regs_p && REG_P (op))
-               reject++;
+               reject += 2;

 #ifdef SECONDARY_MEMORY_NEEDED
              /* If reload requires moving value through secondary
@@ -2040,9 +2040,9 @@  process_alt_operands (int only_alternati
          if ((best_losers == 0 || losers != 0) && best_overall < overall)
            {
              if (lra_dump_file != NULL)
-               fprintf (lra_dump_file, "          alt=%d,overall=%d,losers=%d,"
-                        "small_class_ops=%d,rld_nregs=%d -- reject\n",
-                nalt, overall, losers, small_class_operands_num, reload_nregs);
+               fprintf (lra_dump_file,
+                        "          alt=%d,overall=%d,losers=%d -- reject\n",
+                        nalt, overall, losers);
              goto fail;
            }

@@ -2139,7 +2139,10 @@  process_alt_operands (int only_alternati
              curr_alt_dont_inherit_ops[curr_alt_dont_inherit_ops_num++]
                = last_conflict_j;
              losers++;
-             overall += LRA_LOSER_COST_FACTOR;

+             /* Early clobber was already reflected in REJECT. */
+             lra_assert (reject > 0);
+             reject--;
+             overall += LRA_LOSER_COST_FACTOR - 1;
            }
          else