public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SH] Replace hi_const with satisfies_constraint_I16
@ 2012-04-05 18:35 Oleg Endo
  2012-04-05 22:42 ` Kaz Kojima
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Endo @ 2012-04-05 18:35 UTC (permalink / raw)
  To: gcc-patches

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

Hi,

The attached patch removes the hi_const function and replaces its use
with satisfies_constraint_I16.

Tested against rev 185893 with...
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a-single/-mb,
-m4-single/-ml,-m4-single/-mb,
-m4a-single/-ml,-m4a-single/-mb}"

...and no new failures.

OK?

Cheers,
Oleg

ChangeLog:

	* config/sh/sh.c (hi_const): Remove.
	(find_barrier, sh_reorg): Use satisfies_constraint_I16 instead
	of hi_const.


[-- Attachment #2: 02_sh_rm_hi_const.patch --]
[-- Type: text/x-patch, Size: 1563 bytes --]

Index: gcc/config/sh/sh.c
===================================================================
--- gcc/config/sh/sh.c	(revision 185894)
+++ gcc/config/sh/sh.c	(working copy)
@@ -174,7 +174,6 @@
 static void print_slot (rtx);
 static rtx add_constant (rtx, enum machine_mode, rtx);
 static void dump_table (rtx, rtx);
-static int hi_const (rtx);
 static int broken_move (rtx);
 static int mova_p (rtx);
 static rtx find_barrier (int, rtx, rtx);
@@ -4293,17 +4292,6 @@
   pool_window_last = 0;
 }
 
-/* Return nonzero if constant would be an ok source for a
-   mov.w instead of a mov.l.  */
-
-static int
-hi_const (rtx src)
-{
-  return (CONST_INT_P (src)
-	  && INTVAL (src) >= -32768
-	  && INTVAL (src) <= 32767);
-}
-
 #define MOVA_LABELREF(mova) XVECEXP (SET_SRC (PATTERN (mova)), 0, 0)
 
 /* Nonzero if the insn is a move instruction which needs to be fixed.  */
@@ -4583,7 +4571,8 @@
 	     front end will generate code to load unsigned constants into
 	     HImode targets without properly sign extending them.  */
 	  if (mode == HImode
-	      || (mode == SImode && hi_const (src) && REGNO (dst) != FPUL_REG))
+	      || (mode == SImode && satisfies_constraint_I16 (src)
+		  && REGNO (dst) != FPUL_REG))
 	    {
 	      found_hi += 2;
 	      /* We put the short constants before the long constants, so
@@ -5726,7 +5715,7 @@
 		  dst = SET_DEST (pat);
 		  mode = GET_MODE (dst);
 
-		  if (mode == SImode && hi_const (src)
+		  if (mode == SImode && satisfies_constraint_I16 (src)
 		      && REGNO (dst) != FPUL_REG)
 		    {
 		      int offset = 0;

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

* Re: [SH] Replace hi_const with satisfies_constraint_I16
  2012-04-05 18:35 [SH] Replace hi_const with satisfies_constraint_I16 Oleg Endo
@ 2012-04-05 22:42 ` Kaz Kojima
  0 siblings, 0 replies; 2+ messages in thread
From: Kaz Kojima @ 2012-04-05 22:42 UTC (permalink / raw)
  To: oleg.endo; +Cc: gcc-patches

Oleg Endo <oleg.endo@t-online.de> wrote:
> The attached patch removes the hi_const function and replaces its use
> with satisfies_constraint_I16.

OK.

Regards,
	kaz

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-05 18:35 [SH] Replace hi_const with satisfies_constraint_I16 Oleg Endo
2012-04-05 22:42 ` 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).