diff mbox

[4/6,sh] Deprecate MOVE_BY_PIECES_P, move to hookized version

Message ID 1414579747-22666-1-git-send-email-james.greenhalgh@arm.com
State New
Headers show

Commit Message

James Greenhalgh Oct. 29, 2014, 10:49 a.m. UTC
Hi,

This patch moves sh to TARGET_MOVE_BY_PIECES_PROFITABLE_P.

I tried building a compiler and there were no fires, but otherwise,
I have no reasonable way to test this patch. If one of the sh
maintainers wants to pick it up and test it, that would be much
appreciated.

Thanks,
James

---
gcc/

2014-10-28  James Greenhalgh  <james.greenhalgh@arm.com>

	* config/sh/sh.c (TARGET_MOVE_BY_PIECES_PROFITABLE_P): New.
	(sh_move_by_pieces_profitable_p): Likewise.
	* config/sh/sh.h (MOVE_BY_PIECES_P): Remove.

Comments

Jeff Law Oct. 29, 2014, 9:09 p.m. UTC | #1
On 10/29/14 04:49, James Greenhalgh wrote:
>
> Hi,
>
> This patch moves sh to TARGET_MOVE_BY_PIECES_PROFITABLE_P.
>
> I tried building a compiler and there were no fires, but otherwise,
> I have no reasonable way to test this patch. If one of the sh
> maintainers wants to pick it up and test it, that would be much
> appreciated.
>
> Thanks,
> James
>
> ---
> gcc/
>
> 2014-10-28  James Greenhalgh  <james.greenhalgh@arm.com>
>
> 	* config/sh/sh.c (TARGET_MOVE_BY_PIECES_PROFITABLE_P): New.
> 	(sh_move_by_pieces_profitable_p): Likewise.
> 	* config/sh/sh.h (MOVE_BY_PIECES_P): Remove.
OK.
jeff
Kaz Kojima Oct. 29, 2014, 11:57 p.m. UTC | #2
James Greenhalgh <james.greenhalgh@arm.com> wrote:
> This patch moves sh to TARGET_MOVE_BY_PIECES_PROFITABLE_P.
> 
> I tried building a compiler and there were no fires, but otherwise,
> I have no reasonable way to test this patch. If one of the sh
> maintainers wants to pick it up and test it, that would be much
> appreciated.

FYI, I've tested the patch with the top level "make -k check" on
sh4-unknown-linux-gnu with no new failures.

Regards,
        kaz
diff mbox

Patch

diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 1662b55..0b907b9 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -338,6 +338,9 @@  static void sh_conditional_register_usage (void);
 static bool sh_legitimate_constant_p (enum machine_mode, rtx);
 static int mov_insn_size (enum machine_mode, bool);
 static int mov_insn_alignment_mask (enum machine_mode, bool);
+static bool sh_move_by_pieces_profitable_p (unsigned int size,
+					    unsigned int align,
+					    bool speed_p);
 static bool sequence_insn_p (rtx_insn *);
 static void sh_canonicalize_comparison (int *, rtx *, rtx *, bool);
 static void sh_canonicalize_comparison (enum rtx_code&, rtx&, rtx&,
@@ -640,6 +643,9 @@  static const struct attribute_spec sh_attribute_table[] =
 #undef TARGET_FIXED_CONDITION_CODE_REGS
 #define TARGET_FIXED_CONDITION_CODE_REGS sh_fixed_condition_code_regs
 
+#undef TARGET_MOVE_BY_PIECES_PROFITABLE_P
+#define TARGET_MOVE_BY_PIECES_PROFITABLE_P sh_move_by_pieces_profitable_p
+
 /* Machine-specific symbol_ref flags.  */
 #define SYMBOL_FLAG_FUNCVEC_FUNCTION	(SYMBOL_FLAG_MACH_DEP << 0)
 
@@ -13674,4 +13680,15 @@  sh_mode_priority (int entity ATTRIBUTE_UNUSED, int n)
   return ((TARGET_FPU_SINGLE != 0) ^ (n) ? FP_MODE_SINGLE : FP_MODE_DOUBLE);
 }
 
+/* Implement TARGET_MOVE_BY_PIECES_PROFITABLE_P.  */
+
+static bool
+sh_move_by_pieces_profitable_p (unsigned int size,
+				unsigned int align,
+				bool speed_p)
+{
+  return move_by_pieces_ninsns (size, align, MOVE_MAX_PIECES + 1)
+	 < (!speed_p ? 2 : (align >= 32) ? 16 : 2);
+}
+
 #include "gt-sh.h"
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 5b8b4a1..e115b1e 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1591,10 +1591,6 @@  struct sh_args {
 #define USE_STORE_PRE_DECREMENT(mode)    ((mode == SImode || mode == DImode) \
 					  ? 0 : TARGET_SH1)
 
-#define MOVE_BY_PIECES_P(SIZE, ALIGN) \
-  (move_by_pieces_ninsns (SIZE, ALIGN, MOVE_MAX_PIECES + 1) \
-   < (optimize_size ? 2 : ((ALIGN >= 32) ? 16 : 2)))
-
 #define STORE_BY_PIECES_P(SIZE, ALIGN) \
   (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
    < (optimize_size ? 2 : ((ALIGN >= 32) ? 16 : 2)))