public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mohamed Shafi <shafitvm@gmail.com>
To: GCC <gcc@gcc.gnu.org>
Subject: Re: Reloading going wrong. Bug in GCC?
Date: Tue, 20 Mar 2012 10:35:00 -0000	[thread overview]
Message-ID: <CAEsx6gm1hwDJtwwizg=G559aLV0tmnfNmD5OdP=TF5i2jx71Og@mail.gmail.com> (raw)
In-Reply-To: <CAEsx6gmNj6g0MxxOzNOdb8gCG-eKKKa8_ueOzn52Q3F8tDiEQw@mail.gmail.com>

ping !!!. Any help on http://gcc.gnu.org/ml/gcc/2011-09/msg00150.html

shafi

On 14 September 2011 15:07, Mohamed Shafi <shafitvm@gmail.com> wrote:
> Hi,
>
> I am working on a 32bit private target which has the following restriction
>
> 1. store/load can happen only through a general purpose register (GP_REGS)
> 2. base register should be an address register (AD_REGS)
> 3. moves between GP_REGS and AD_REGS can happen only through PT_REGS
>
> In a PRE_MODIFY instruction when both the base register and the output
> register gets spilled the reloading is going wrong.
>
> befor IRA pass
> ~~~~~~~~~~~
> (insn 259 336 317 2 ../rld_bug.c:94 (set (reg:QI 234 [+1 ])
>        (mem/s/j/c:QI (pre_modify:PQI (reg/f:PQI 233)
>                (plus:PQI (reg/f:PQI 233)
>                    (const_int 1 [0x1]))) [0+1 S1 A32])) 7 {movqi_op}
> (expr_list:REG_INC (reg/f:PQI 233)
>        (nil)))
>
> after IRA pass
> ~~~~~~~~~~~
> Reloads for insn # 259
> Reload 0: GP_REGS, RELOAD_FOR_OPADDR_ADDR (opnum = 1), can't combine,
> secondary_reload_p
>        reload_reg_rtx: (reg:PQI 11 g11)
> Reload 1: PT_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 1), can't
> combine, secondary_reload_p
>        reload_reg_rtx: (reg:PQI 12 as0)
>        secondary_in_reload = 0
> Reload 2: GP_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 1), can't
> combine, secondary_reload_p
>        reload_reg_rtx: (reg:PQI 11 g11)
> Reload 3: PT_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 1), can't
> combine, secondary_reload_p
>        reload_reg_rtx: (reg:PQI 13 as1)
>        secondary_out_reload = 2
>
> Reload 4: reload_in (PQI) = (reg/f:PQI 233)
>        reload_out (PQI) = (reg/f:PQI 233)
>        AD_REGS, RELOAD_OTHER (opnum = 1)
>        reload_in_reg: (reg/f:PQI 233)
>        reload_out_reg: (reg/f:PQI 233)
>        reload_reg_rtx: (reg:PQI 31 a3)
>        secondary_in_reload = 1, secondary_out_reload = 3
>
> Reload 5: reload_out (QI) = (reg:QI 234 [+1 ])
>        GP_REGS, RELOAD_FOR_OUTPUT (opnum = 0)
>        reload_out_reg: (reg:QI 234 [+1 ])
>        reload_reg_rtx: (reg:QI 11 g11)
>
>
> (insn 744 336 745 2 ../rld_bug.c:94 (set (reg:PQI 11 g11)
>        (mem/c:PQI (plus:PQI (reg/f:PQI 32 sp)
>                (const_int -24 [0xffffffffffffffe8])) [99 %sfp+8 S1
> A32])) 9 {movpqi_op} (nil))
>
> (insn 745 744 746 2 ../rld_bug.c:94 (set (reg:PQI 12 as0)
>        (reg:PQI 11 g11)) 9 {movpqi_op} (nil))
>
> (insn 746 745 259 2 ../rld_bug.c:94 (set (reg:PQI 31 a3)
>        (reg:PQI 12 as0)) 9 {movpqi_op} (nil))
>
> (insn 259 746 747 2 ../rld_bug.c:94 (set (reg:QI 11 g11)
>        (mem/s/j/c:QI (pre_modify:PQI (reg:PQI 31 a3)
>                (plus:PQI (reg:PQI 31 a3)
>                    (const_int 1 [0x1]))) [0+1 S1 A32])) 7 {movqi_op}
> (expr_list:REG_INC (reg:PQI 31 a3)
>        (nil)))
>
> (insn 747 259 748 2 ../rld_bug.c:94 (set (reg:PQI 13 as1)
>        (reg:PQI 31 a3)) 9 {movpqi_op} (nil))
>
> (insn 748 747 749 2 ../rld_bug.c:94 (set (reg:PQI 11 g11)
>        (reg:PQI 13 as1)) 9 {movpqi_op} (nil))
>
> (insn 749 748 750 2 ../rld_bug.c:94 (set (mem/c:PQI (plus:PQI (reg/f:PQI 32 sp)
>                (const_int -24 [0xffffffffffffffe8])) [99 %sfp+8 S1 A32])
>        (reg:PQI 11 g11)) 9 {movpqi_op} (nil))
>
> (insn 750 749 751 2 ../rld_bug.c:94 (set (mem/c:QI (plus:PQI (reg/f:PQI 32 sp)
>                (const_int -29 [0xffffffffffffffe3])) [99 %sfp+3 S1 A32])
>        (reg:QI 11 g11)) 7 {movqi_op} (nil))
>
>
> After IRA pass for insn 259 1st the modified address is stored into
> its spilled location and then the modified value is stored. As you can
> see from the instructions same register (g11) is used for Reload 5 and
> 2, and hence the modified value is getting corrupted and hence the
> modified address gets stored instead of modified value (insn 749 and
> insn 750). I am not able to figure out where this is going wrong in
> the reload phase. I suspect that this is a GCC issue.
>
> Can some one give me some pointers to resolve this issue?
>
> Regards,
> Shafi

      reply	other threads:[~2012-03-20 10:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-14  9:38 Mohamed Shafi
2012-03-20 10:35 ` Mohamed Shafi [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='CAEsx6gm1hwDJtwwizg=G559aLV0tmnfNmD5OdP=TF5i2jx71Og@mail.gmail.com' \
    --to=shafitvm@gmail.com \
    --cc=gcc@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).