public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: dj@redhat.com
Cc: gcc-patches@gcc.gnu.org
Subject: RFA: RL78: Fix multiply costs when optimizing for size
Date: Wed, 05 Aug 2015 13:52:00 -0000	[thread overview]
Message-ID: <87io8tj10f.fsf@redhat.com> (raw)

Hi DJ,

  The patch below fixes a small problem with the RL78 backend.  When
  optimizing for size it is better to use a slow multiply instruction
  than a faster, but larger, shift sequence.  So the patch tweaks the
  rtx costs for MULT insns when speed is not a priority.

  Tested with no regressions on an rl78-elf toolchain.

  OK to apply ?

Cheers
  Nick

gcc/ChangeLog
2015-08-05  Nick Clifton  <nickc@redhat.com>

	* config/rl78/rl78.c (rl78_rtx_costs): Treat MULT insns as cheap
	if optimizing for size.

Index: gcc/config/rl78/rl78.c
===================================================================
RCS file: /cvs/cvsfiles/gnupro/gcc/config/rl78/rl78.c,v
retrieving revision 1.12.6.15
diff -u -3 -p -r1.12.6.15 rl78.c
--- gcc/config/rl78/rl78.c	29 Jul 2015 12:24:04 -0000	1.12.6.15
+++ gcc/config/rl78/rl78.c	30 Jul 2015 15:20:10 -0000
@@ -4161,7 +4161,9 @@ static bool rl78_rtx_costs (rtx   x,
       switch (code)
 	{
 	case MULT:
-	  if (RL78_MUL_G14)
+	  if (! speed)
+	    * total = COSTS_N_INSNS (5);
+	  else if (RL78_MUL_G14)
 	    *total = COSTS_N_INSNS (14);
 	  else if (RL78_MUL_G13)
 	    *total = COSTS_N_INSNS (29);

             reply	other threads:[~2015-08-05 13:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 13:52 Nick Clifton [this message]
2015-08-05 17:10 ` DJ Delorie

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=87io8tj10f.fsf@redhat.com \
    --to=nickc@redhat.com \
    --cc=dj@redhat.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).