diff mbox

[2/6,s390] Deprecate MOVE_BY_PIECES_P, move to hookized version

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

Commit Message

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

This patch moves s390 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 s390
maintainers wants to pick it up and test it, that would be much
appreciated.

Ok?

James

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

	* config/s390/s390.c (s390_move_by_pieces_profitable_p): New.
	(TARGET_MOVE_BY_PIECES_PROFITABLE_P): Likewise.
	* config/s390/s390.h (MOVE_BY_PIECES_P): Remove.

Comments

Jeff Law Oct. 29, 2014, 9:07 p.m. UTC | #1
On 10/29/14 04:46, James Greenhalgh wrote:
>
> Hi,
>
> This patch moves s390 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 s390
> maintainers wants to pick it up and test it, that would be much
> appreciated.
>
> Ok?
>
> James
>
> ---
> 2014-10-29  James Greenhalgh  <james.greenhalgh@arm.com>
>
> 	* config/s390/s390.c (s390_move_by_pieces_profitable_p): New.
> 	(TARGET_MOVE_BY_PIECES_PROFITABLE_P): Likewise.
> 	* config/s390/s390.h (MOVE_BY_PIECES_P): Remove.
This will be fine once patch #1 is approved (my understanding is you'll 
be resubmitting patch #1 after some minor fixes).

jeff
diff mbox

Patch

diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 1b10805..f531e12 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -12043,6 +12043,17 @@  s390_option_override (void)
   register_pass (&insert_pass_s390_early_mach);
 }
 
+/* Implement TARGET_MOVE_BY_PIECES_PROFITABLE_P.  */
+
+static bool
+s390_move_by_pieces_profitable_p (unsigned int size,
+				  unsigned int align ATTRIBUTE_UNUSED,
+				  bool speed_p ATTRIBUTE_UNUSED)
+{
+  return (size == 1 || size == 2
+	  || size == 4 || (TARGET_ZARCH && size == 8));
+}
+
 /* Initialize GCC target structure.  */
 
 #undef  TARGET_ASM_ALIGNED_HI_OP
@@ -12228,6 +12239,9 @@  s390_option_override (void)
 #undef TARGET_SET_UP_BY_PROLOGUE
 #define TARGET_SET_UP_BY_PROLOGUE s300_set_up_by_prologue
 
+#undef TARGET_MOVE_BY_PIECES_PROFITABLE_P
+#define TARGET_MOVE_BY_PIECES_PROFITABLE_P s390_move_by_pieces_profitable_p
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-s390.h"
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index c5edace..688c2fb 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -744,11 +744,6 @@  do {									\
 #define MOVE_MAX_PIECES (TARGET_ZARCH ? 8 : 4)
 #define MAX_MOVE_MAX 16
 
-/* Determine whether to use move_by_pieces or block move insn.  */
-#define MOVE_BY_PIECES_P(SIZE, ALIGN)		\
-  ( (SIZE) == 1 || (SIZE) == 2 || (SIZE) == 4	\
-    || (TARGET_ZARCH && (SIZE) == 8) )
-
 /* Determine whether to use clear_by_pieces or block clear insn.  */
 #define CLEAR_BY_PIECES_P(SIZE, ALIGN)		\
   ( (SIZE) == 1 || (SIZE) == 2 || (SIZE) == 4	\
@@ -756,7 +751,9 @@  do {									\
 
 /* This macro is used to determine whether store_by_pieces should be
    called to "memcpy" storage when the source is a constant string.  */
-#define STORE_BY_PIECES_P(SIZE, ALIGN) MOVE_BY_PIECES_P (SIZE, ALIGN)
+#define STORE_BY_PIECES_P(SIZE, ALIGN) \
+  targetm.move_by_pieces_profitable_p \
+    (SIZE, ALIGN, optimize_function_for_size_p (cfun))
 
 /* Likewise to decide whether to "memset" storage with byte values
    other than zero.  */