public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SH, 4.7] Backport Fix sh64-elf build failure [1/3]
@ 2012-05-31 20:56 Oleg Endo
  2012-05-31 22:06 ` Kaz Kojima
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Endo @ 2012-05-31 20:56 UTC (permalink / raw)
  To: gcc-patches

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

Original patch:
http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00208.html

'Tested' with..

../gcc-4_7-branch/configure --target=sh-elf --prefix=/usr/local
--enable-languages=c,c++ --enable-multilib --disable-libssp
--disable-nls --disable-werror --enable-lto --with-newlib --with-gnu-as
--with-gnu-ld --with-system-zlib

make all

OK for 4.7 branch?

ChangeLog:

	Backport from mainline
	2012-03-03  Kaz Kojima  <kkojima@gcc.gnu.org>
	* config/sh/sh.c (shiftcosts): Return MAX_COST when the first
	operand is CONST_INT.  Take COSTS_N_INSNS into account.
	(sh_rtx_costs): Don't apply COSTS_N_INSNS to the return value
	of shiftcosts.

[-- Attachment #2: 2012-03-msg00208.patch --]
[-- Type: text/x-patch, Size: 1615 bytes --]

Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c	(revision 188026)
+++ gcc/config/sh/sh.c	(working copy)
@@ -2811,22 +2811,26 @@
 {
   int value;
 
+  /* There is no pattern for constant first operand.  */
+  if (CONST_INT_P (XEXP (x, 0)))
+    return MAX_COST;
+
   if (TARGET_SHMEDIA)
-    return 1;
+    return COSTS_N_INSNS (1);
 
   if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
     {
       if (GET_MODE (x) == DImode
 	  && CONST_INT_P (XEXP (x, 1))
 	  && INTVAL (XEXP (x, 1)) == 1)
-	return 2;
+	return COSTS_N_INSNS (2);
 
       /* Everything else is invalid, because there is no pattern for it.  */
       return MAX_COST;
     }
   /* If shift by a non constant, then this will be expensive.  */
   if (!CONST_INT_P (XEXP (x, 1)))
-    return SH_DYNAMIC_SHIFT_COST;
+    return COSTS_N_INSNS (SH_DYNAMIC_SHIFT_COST);
 
   /* Otherwise, return the true cost in instructions.  Cope with out of range
      shift counts more or less arbitrarily.  */
@@ -2838,10 +2842,10 @@
       /* If SH3, then we put the constant in a reg and use shad.  */
       if (cost > 1 + SH_DYNAMIC_SHIFT_COST)
 	cost = 1 + SH_DYNAMIC_SHIFT_COST;
-      return cost;
+      return COSTS_N_INSNS (cost);
     }
   else
-    return shift_insns[value];
+    return COSTS_N_INSNS (shift_insns[value]);
 }
 
 /* Return the cost of an AND/XOR/IOR operation.  */
@@ -3074,7 +3078,7 @@
     case ASHIFT:
     case ASHIFTRT:
     case LSHIFTRT:
-      *total = COSTS_N_INSNS (shiftcosts (x));
+      *total = shiftcosts (x);
       return true;
 
     case DIV:

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

* Re: [SH, 4.7] Backport Fix sh64-elf build failure [1/3]
  2012-05-31 20:56 [SH, 4.7] Backport Fix sh64-elf build failure [1/3] Oleg Endo
@ 2012-05-31 22:06 ` Kaz Kojima
  0 siblings, 0 replies; 2+ messages in thread
From: Kaz Kojima @ 2012-05-31 22:06 UTC (permalink / raw)
  To: oleg.endo; +Cc: gcc-patches

Oleg Endo <oleg.endo@t-online.de> wrote:
> Original patch:
> http://gcc.gnu.org/ml/gcc-patches/2012-03/msg00208.html
> 
> 'Tested' with..
> 
> ../gcc-4_7-branch/configure --target=sh-elf --prefix=/usr/local
> --enable-languages=c,c++ --enable-multilib --disable-libssp
> --disable-nls --disable-werror --enable-lto --with-newlib --with-gnu-as
> --with-gnu-ld --with-system-zlib
> 
> make all
> 
> OK for 4.7 branch?
> 
> ChangeLog:
> 
> 	Backport from mainline
> 	2012-03-03  Kaz Kojima  <kkojima@gcc.gnu.org>
> 	* config/sh/sh.c (shiftcosts): Return MAX_COST when the first
> 	operand is CONST_INT.  Take COSTS_N_INSNS into account.
> 	(sh_rtx_costs): Don't apply COSTS_N_INSNS to the return value
> 	of shiftcosts.

OK as the fix for a regression from 4.6.

Regards,
	kaz

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

end of thread, other threads:[~2012-05-31 22:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-31 20:56 [SH, 4.7] Backport Fix sh64-elf build failure [1/3] Oleg Endo
2012-05-31 22:06 ` Kaz Kojima

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