public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Yangfei (Felix)" <felix.yang@huawei.com>
To: "augustine.sterling@gmail.com" <augustine.sterling@gmail.com>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Felix Yang <fei.yang0953@gmail.com>
Subject: Re: [PATCH] Add zero-overhead looping for xtensa backend
Date: Wed, 22 Oct 2014 05:20:00 -0000	[thread overview]
Message-ID: <DA41BE1DDCA941489001C7FBD7A8820E5554B367@szxema507-mbx.china.huawei.com> (raw)
In-Reply-To: <CAGSvup9g0Wu1JNRVF-GOVJPYiM9wj3s5xsHcug=Bt4-_+uFv8g@mail.gmail.com>

If the tripcount spill issue is not handled in the pattern, ICE may happen then. 
Here reload is trying to spill pseudo 173, but a memory operand is not allowed in zero_cost_loop_end pattern. 
And this is what I am trying to solve. 

pr44023.c:48:1: error: unable to generate reloads for:
 }
 ^
(jump_insn 136 113 116 4 (parallel [
            (set (pc)
                (if_then_else (ne (reg:SI 173)
                        (const_int 1 [0x1]))
                    (label_ref:SI 114)
                    (pc)))
            (set (reg:SI 173)
                (plus:SI (reg:SI 173)
                    (const_int -1 [0xffffffffffffffff])))
            (unspec [
                    (const_int 0 [0])
                ] 13)
        ]) pr44023.c:46 48 {zero_cost_loop_end}
     (int_list:REG_BR_PROB 9100 (nil))
 -> 114)
pr44023.c:48:1: internal compiler error: in find_reloads, at reload.c:3833
0x989383 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
        ../../trunk/gcc/rtl-error.c:110
0x9777cb find_reloads(rtx_insn*, int, int, int, short*)
        ../../trunk/gcc/reload.c:3833
0x9875f1 calculate_needs_all_insns
        ../../trunk/gcc/reload1.c:1515
0x9875f1 reload(rtx_insn*, int)
        ../../trunk/gcc/reload1.c:1003
0x86a8a7 do_reload
        ../../trunk/gcc/ira.c:5323
0x86acd8 execute
        ../../trunk/gcc/ira.c:5470


> 
> Hi Sterling,
> 
>     Attached please find the testcase for the spill issue. Try it out with the
> patch :-)
> 
> 
> >
> > On Wed, Oct 15, 2014 at 7:10 PM, Yangfei (Felix)
> > <felix.yang@huawei.com>
> > wrote:
> > > Hi Sterling,
> > >
> > >     Since the patch is delayed for a long time, I'm kind of pushing
> > > it. Sorry for
> > that.
> > >     Yeah, you are right. We have some performance issue here as GCC
> > > may
> > use one more general register in some cases with this patch.
> > >     Take the following arraysum testcase for example. In doloop
> > > optimization,
> > GCC figures out that the number of iterations is 1024 and creates a
> > new pseudo
> > 79 as the new trip count register.
> > >     The pseudo 79 is live throughout the loop, this makes the
> > > register
> > pressure in the loop higher. And it's possible that this new pseudo is
> > spilled by reload when the register pressure is very high.
> > >     I know that the xtensa loop instruction copies the trip count
> > > register into
> > the LCOUNT special register. And we need describe this hardware
> > feature in GCC in order to free the trip count register.
> > >     But I find it difficult to do. Do you have any good suggestions on this?
> >
> > There are two issues related to the trip count, one I would like you
> > to solve now, one later.
> >
> > 1. Later: The trip count doesn't need to be updated at all inside
> > these loops, once the loop instruction executes. The code below relates to this
> case.
> >
> > 2. Now: You should be able to use a loop instruction regardless of
> > whether the trip count is spilled. If you have an example where that
> > wouldn't work, I would love to see it.
> >

  parent reply	other threads:[~2014-10-22  2:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 16:27 Felix Yang
2014-01-08 16:49 ` Sterling Augustine
2014-01-09 15:08   ` Felix Yang
2014-01-09 23:51     ` Felix Yang
2014-01-10  3:49       ` Yangfei (Felix)
2014-01-13 17:24         ` Sterling Augustine
2014-10-09 11:04           ` Felix Yang
2014-10-10 14:01             ` Felix Yang
2014-10-11  9:32               ` [PING] [PATCH, xtensa] " Yangfei (Felix)
2014-10-13 16:09               ` [PATCH] " augustine.sterling
2014-10-13 16:30                 ` Felix Yang
2014-10-14 15:43                   ` Felix Yang
2014-10-15 19:51                     ` augustine.sterling
2014-10-16  4:52                       ` Yangfei (Felix)
2014-10-21 14:57                         ` augustine.sterling
2014-10-22  2:20                           ` Yangfei (Felix)
2014-10-22  5:20                           ` Yangfei (Felix) [this message]
2014-10-23 17:51                             ` augustine.sterling
2014-10-24  1:49                               ` Yangfei (Felix)
2014-10-24  4:32                               ` Yangfei (Felix)
2014-10-24  6:28                                 ` augustine.sterling
2014-10-24  6:33                                   ` Yangfei (Felix)
2014-10-24  6:40                                     ` augustine.sterling
2014-10-24  6:43                                       ` Yangfei (Felix)
2014-10-24  6:49                                         ` augustine.sterling
2014-10-24  6:53                                           ` Yangfei (Felix)
2014-10-24  7:15                                             ` Andrew Pinski
2014-10-28 12:24                                               ` Yangfei (Felix)
2014-10-30 22:02                                                 ` augustine.sterling

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=DA41BE1DDCA941489001C7FBD7A8820E5554B367@szxema507-mbx.china.huawei.com \
    --to=felix.yang@huawei.com \
    --cc=augustine.sterling@gmail.com \
    --cc=fei.yang0953@gmail.com \
    --cc=gcc-patches@gcc.gnu.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).