public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch,avr] Fix PR60300: Minor prologue improvement.
@ 2016-11-22 12:42 Georg-Johann Lay
  2016-11-22 18:23 ` Denis Chertykov
  0 siblings, 1 reply; 2+ messages in thread
From: Georg-Johann Lay @ 2016-11-22 12:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: Denis Chertykov

[-- Attachment #1: Type: text/plain, Size: 650 bytes --]

This patch is a minor improvement of prologue length.  It now allows 
frame sizes of up to 11 to be allocated by RCALL + PUSH 0 sequences but 
limits the number of RCALLs to 3.

The PR has some discussion on size vs. speed consideration w.r. to using 
RCALL in prologues, and following that I picked the rather arbitrary 
upper bound of 3 RCALLs.  The prior maximal frame size opt to such 
sequences was 6 which also never produced more than 3 RCALLs.

Ok for trunk?


Johann

gcc/
	PR target/60300
	* config/avr/constraints.md (Csp): Widen range to [-11..6].
	* config/avr/avr.c (avr_prologue_setup_frame): Limit number
	of RCALLs in prologue to 3.

[-- Attachment #2: pr60300-rcall-prolo.diff --]
[-- Type: text/x-patch, Size: 1374 bytes --]

Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 242672)
+++ config/avr/avr.c	(working copy)
@@ -1687,7 +1687,11 @@ avr_prologue_setup_frame (HOST_WIDE_INT
           /* Stack adjustment by means of RCALL . and/or PUSH __TMP_REG__
              can only handle specific offsets.  */
 
-          if (avr_sp_immediate_operand (gen_int_mode (-size, HImode), HImode))
+          int n_rcall = size / (AVR_3_BYTE_PC ? 3 : 2);
+
+          if (avr_sp_immediate_operand (gen_int_mode (-size, HImode), HImode)
+              // Don't use more than 3 RCALLs.
+              && n_rcall <= 3)
             {
               rtx_insn *sp_plus_insns;
 
Index: config/avr/constraints.md
===================================================================
--- config/avr/constraints.md	(revision 242671)
+++ config/avr/constraints.md	(working copy)
@@ -189,9 +189,9 @@ (define_constraint "Cx4"
        (match_test "avr_popcount_each_byte (op, 4, (1<<0) | (1<<8))")))
 
 (define_constraint "Csp"
-  "Integer constant in the range -6 @dots{} 6."
+  "Integer constant in the range -11 @dots{} 6."
   (and (match_code "const_int")
-       (match_test "IN_RANGE (ival, -6, 6)")))
+       (match_test "IN_RANGE (ival, -11, 6)")))
 
 (define_constraint "Cxf"
   "32-bit integer constant where at least one nibble is 0xf."

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

* Re: [patch,avr] Fix PR60300: Minor prologue improvement.
  2016-11-22 12:42 [patch,avr] Fix PR60300: Minor prologue improvement Georg-Johann Lay
@ 2016-11-22 18:23 ` Denis Chertykov
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Chertykov @ 2016-11-22 18:23 UTC (permalink / raw)
  To: Georg-Johann Lay; +Cc: gcc-patches

2016-11-22 15:41 GMT+03:00 Georg-Johann Lay <avr@gjlay.de>:
> This patch is a minor improvement of prologue length.  It now allows frame
> sizes of up to 11 to be allocated by RCALL + PUSH 0 sequences but limits the
> number of RCALLs to 3.
>
> The PR has some discussion on size vs. speed consideration w.r. to using
> RCALL in prologues, and following that I picked the rather arbitrary upper
> bound of 3 RCALLs.  The prior maximal frame size opt to such sequences was 6
> which also never produced more than 3 RCALLs.
>
> Ok for trunk?
>
>
> Johann
>
> gcc/
>         PR target/60300
>         * config/avr/constraints.md (Csp): Widen range to [-11..6].
>         * config/avr/avr.c (avr_prologue_setup_frame): Limit number
>         of RCALLs in prologue to 3.

Approved.

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

end of thread, other threads:[~2016-11-22 18:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-22 12:42 [patch,avr] Fix PR60300: Minor prologue improvement Georg-Johann Lay
2016-11-22 18:23 ` 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).