public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, avr] Restore base register if not marked dead/unused
@ 2015-05-19 13:32 Sivanupandi, Pitchumani
  2015-05-25 17:53 ` Denis Chertykov
  0 siblings, 1 reply; 2+ messages in thread
From: Sivanupandi, Pitchumani @ 2015-05-19 13:32 UTC (permalink / raw)
  To: GCC Patches; +Cc: Denis Chertykov, Georg-Johann Lay

Test gcc.c-torture/execute/memcpy-bi.c (-O2) failed for attiny40 device.
Cause seems to be in "load from memory" as it is not restoring base
register after load instructions generated.

Function avr_out_load_psi_reg_no_disp_tiny in avr.c:
It returns just after emitting instructions to load from memory to 
registers. It is important to restore the base register if it is 
not marked dead/unused after that insn.

Code to restore base register is present already. Below patch let 
the function do the restore before return.

If OK, could someone commit? I do not have commit access.

diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 4e83de8..b653858 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -4365,9 +4365,9 @@ avr_out_load_psi_reg_no_disp_tiny (rtx insn, rtx *op, int *plen)
     }
   else
     {
-      return avr_asm_len ("ld %A0,%1+"  CR_TAB
-                          "ld %B0,%1+"  CR_TAB
-                          "ld %C0,%1", op, plen, -3);
+      avr_asm_len ("ld %A0,%1+"  CR_TAB
+                   "ld %B0,%1+"  CR_TAB
+                   "ld %C0,%1", op, plen, -3);
 
       if (reg_dest != reg_base - 2 &&
           !reg_unused_after (insn, base))

Regards,
Pitchumani

gcc/ChangeLog
2015-05-19  Pitchumani Sivanupandi  <pitchumani.s@atmel.com>

    * config/avr/avr.c (avr_out_load_psi_reg_no_disp_tiny): Restore base
	register if not marked dead/unused, before return.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, avr] Restore base register if not marked dead/unused
  2015-05-19 13:32 [patch, avr] Restore base register if not marked dead/unused Sivanupandi, Pitchumani
@ 2015-05-25 17:53 ` Denis Chertykov
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Chertykov @ 2015-05-25 17:53 UTC (permalink / raw)
  To: Sivanupandi, Pitchumani; +Cc: GCC Patches, Georg-Johann Lay

2015-05-19 16:04 GMT+03:00 Sivanupandi, Pitchumani
<Pitchumani.Sivanupandi@atmel.com>:
> Test gcc.c-torture/execute/memcpy-bi.c (-O2) failed for attiny40 device.
> Cause seems to be in "load from memory" as it is not restoring base
> register after load instructions generated.
>
> Function avr_out_load_psi_reg_no_disp_tiny in avr.c:
> It returns just after emitting instructions to load from memory to
> registers. It is important to restore the base register if it is
> not marked dead/unused after that insn.
>
> Code to restore base register is present already. Below patch let
> the function do the restore before return.
>
> If OK, could someone commit? I do not have commit access.
>
> diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
> index 4e83de8..b653858 100644
> --- a/gcc/config/avr/avr.c
> +++ b/gcc/config/avr/avr.c
> @@ -4365,9 +4365,9 @@ avr_out_load_psi_reg_no_disp_tiny (rtx insn, rtx *op, int *plen)
>      }
>    else
>      {
> -      return avr_asm_len ("ld %A0,%1+"  CR_TAB
> -                          "ld %B0,%1+"  CR_TAB
> -                          "ld %C0,%1", op, plen, -3);
> +      avr_asm_len ("ld %A0,%1+"  CR_TAB
> +                   "ld %B0,%1+"  CR_TAB
> +                   "ld %C0,%1", op, plen, -3);
>
>        if (reg_dest != reg_base - 2 &&
>            !reg_unused_after (insn, base))
>
> Regards,
> Pitchumani
>
> gcc/ChangeLog
> 2015-05-19  Pitchumani Sivanupandi  <pitchumani.s@atmel.com>
>
>     * config/avr/avr.c (avr_out_load_psi_reg_no_disp_tiny): Restore base
>         register if not marked dead/unused, before return.
>

Committed.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-25 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-19 13:32 [patch, avr] Restore base register if not marked dead/unused Sivanupandi, Pitchumani
2015-05-25 17:53 ` Denis Chertykov

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).