public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: James Bowman <james.bowman@ftdichip.com>,
	       Segher Boessenkool <segher@kernel.crashing.org>
Cc: Joseph Myers <joseph@codesourcery.com>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH, FT32] initial support
Date: Thu, 14 May 2015 18:31:00 -0000	[thread overview]
Message-ID: <5554E988.2010601@redhat.com> (raw)
In-Reply-To: <CA9BBF0458F83C4F9051448B941B57D117BA023B@glaexch3>

On 05/14/2015 09:20 AM, James Bowman wrote:
>
>> On Thu, May 14, 2015 at 07:54:02AM -0500, Segher Boessenkool wrote:
>>> I cannot reproduce this with your testcase.  Please post the *exact*
>>> testcase (nothing snipped) and the command line you used?
>>
>> Making the array volatile and using optimisation helped.  Kaboom.
>>
>> It wants to reload pretty much everything.  Looking at your code,
>> it seems you use the ancient interfaces instead of
>> TARGET_LEGITIMATE_ADDRESS_P, I don't think LRA works with that?
>
> The FT32 target uses TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
> (ft32.c line 856).
> The FT32 itself is a Harvard architecture, and the ft32 port uses
> address spaces to distinguish between program and data memory.
>
> Of the ports that currently support LRA (arc, mips, rs6000, s380, sh) none
> use address spaces.
> Perhaps this port's use of address spaces is causing the problem?
I don't think so, it feels like something else to me.  But I do have a 
larger concern that if LRA hasn't been used much, if at all, on targets 
that have multiple address spaces, then we may have other lurking issues.

Anyway:

In .ira we have:

(insn 11 7 12 2 (set (reg:SI 51)
         (const_int -900 [0xfffffffffffffc7c])) j.c:7 25 {*movsi}
      (expr_list:REG_EQUIV (const_int -900 [0xfffffffffffffc7c])
         (nil)))
(insn 12 11 18 2 (set (reg/f:SI 50)
         (plus:SI (reg/f:SI 0 $fp)
             (reg:SI 51))) j.c:7 2 {addsi3}
      (expr_list:REG_DEAD (reg:SI 51)
         (expr_list:REG_EQUIV (plus:SI (reg/f:SI 0 $fp)
                 (const_int -900 [0xfffffffffffffc7c]))
             (nil))))

Where r51 will get a hard reg, but r50 will not.  This is confirmed by 
looking at the coloring dump in .ira:

  Loop 0 (parent -1, header bb2, depth 0)
     bbs: 4 3 2
     all: 0r45 1r54 2r50 3r51 4r48 5r44 10r52 11r43
     modified regnos: 43 44 45 48 50 51 52 54
     border:
     Pressure: GENERAL_REGS=6
     Hard reg set forest:
       0:( 2-29)@0
         1:( 2-6 8-29)@87680
       Spill a2(r50,l0)

So r50 gets spilled to memory.  That's going to cause insn 12 to have an 
output reload because it can't store into memory directly.

         Choosing alt 1 in insn 12:  (0) r  (1) r  (2) r {addsi3}
       Creating newreg=55 from oldreg=50, assigning class GENERAL_REGS 
to r55
    12: r55:SI=$fp:SI+r51:SI
       REG_DEAD r51:SI
       REG_EQUIV $fp:SI-0x384
     Inserting insn reload after:
    32: r50:SI=r55:SI


So we're going to use r55 to hold the result of the arithmetic, then 
shove it into the stack slot allocated for r50.  That all seems normal.

But for some reason things blow up after that, it's almost as if LRA 
doesn't like the trival reg-reg copy emitted to handle the output reload.

At this point I'd recommend committing the port as-is and attacking LRA 
as a follow-up.

jeff


      parent reply	other threads:[~2015-05-14 18:29 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03  5:18 James Bowman
2015-02-03  6:05 ` Andrew Pinski
2015-02-03 14:44   ` Paolo Bonzini
2015-02-04  2:26     ` James Bowman
2015-02-03 22:51 ` Joseph Myers
2015-02-11  3:42   ` James Bowman
2015-02-11 17:04     ` Joseph Myers
2015-02-11 23:58       ` James Bowman
2015-02-12 12:39         ` Joseph Myers
2015-02-16 10:00       ` James Bowman
2015-02-16 18:07         ` Joseph Myers
2015-02-16 22:36           ` James Bowman
2015-03-10 15:49           ` James Bowman
2015-03-19 15:29           ` James Bowman
2015-04-29  7:41             ` Jeff Law
     [not found]               ` <CA9BBF0458F83C4F9051448B941B57D117B98521@glaexch3>
2015-05-11 20:35                 ` Jeff Law
2015-05-12 22:36                   ` James Bowman
2015-05-12 22:54                     ` Jeff Law
2015-05-12 23:10                       ` Mike Stump
2015-05-13  1:07                     ` Segher Boessenkool
2015-05-14  1:58                       ` James Bowman
2015-05-14 11:40                         ` Segher Boessenkool
2015-05-14 12:58                         ` Segher Boessenkool
2015-05-14 13:11                           ` Segher Boessenkool
2015-05-14 15:30                             ` James Bowman
2015-05-14 17:42                               ` Segher Boessenkool
2015-05-14 18:48                                 ` Jeff Law
2015-05-14 19:51                                   ` Segher Boessenkool
2015-05-14 20:06                                     ` Jeff Law
2015-05-15  3:01                                       ` James Bowman
2015-05-15  6:41                                         ` Jeff Law
2015-05-28 22:35                                         ` Eric Botcazou
2015-06-03 13:56                                           ` Jeff Law
2015-05-14 18:31                               ` Jeff Law [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5554E988.2010601@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=james.bowman@ftdichip.com \
    --cc=joseph@codesourcery.com \
    --cc=segher@kernel.crashing.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).