[01/30] Changes to machine independent code
diff mbox series

Message ID c54061279e11a6274d656eb0d12cbb4ab65aa264.1561408899.git.acsawdey@linux.ibm.com
State New
Headers show
Series
  • Rename movmem pattern to cpymem
Related show

Commit Message

Aaron Sawdey June 25, 2019, 8:22 p.m. UTC
From: Aaron Sawdey <acsawdey@linux.ibm.com>

	* builtins.c (get_memory_rtx): Fix comment.
	* optabs.def (movmem_optab): Change to cpymem_optab.
	* expr.c (emit_block_move_via_cpymem): Change movmem to cpymem.
	(emit_block_move_hints): Change movmem to cpymem.
	* defaults.h: Change movmem to cpymem.
	* targhooks.c (get_move_ratio): Change movmem to cpymem.
	(default_use_by_pieces_infrastructure_p): Ditto.
---
 gcc/builtins.c  |  2 +-
 gcc/defaults.h  |  6 +++---
 gcc/expr.c      | 10 +++++-----
 gcc/optabs.def  |  2 +-
 gcc/targhooks.c |  6 +++---
 5 files changed, 13 insertions(+), 13 deletions(-)

Comments

Jeff Law June 25, 2019, 9:43 p.m. UTC | #1
On 6/25/19 2:22 PM, acsawdey@linux.ibm.com wrote:
> From: Aaron Sawdey <acsawdey@linux.ibm.com>
> 
> 	* builtins.c (get_memory_rtx): Fix comment.
> 	* optabs.def (movmem_optab): Change to cpymem_optab.
> 	* expr.c (emit_block_move_via_cpymem): Change movmem to cpymem.
> 	(emit_block_move_hints): Change movmem to cpymem.
> 	* defaults.h: Change movmem to cpymem.
> 	* targhooks.c (get_move_ratio): Change movmem to cpymem.
> 	(default_use_by_pieces_infrastructure_p): Ditto.
So I think you're missing an update to the RTL/MD documentation.  This
is also likely to cause problems for any out-of-tree ports, so it's
probably worth a mention in the gcc-10 changes, which will need to be
created (in CVS no less, ugh).

I think the stuff posted to-date is fine, but it shouldn't go in without
the corresponding docs and gcc-10 changes updates.

jeff
Richard Sandiford June 26, 2019, 8:36 a.m. UTC | #2
Jeff Law <law@redhat.com> writes:
> On 6/25/19 2:22 PM, acsawdey@linux.ibm.com wrote:
>> From: Aaron Sawdey <acsawdey@linux.ibm.com>
>> 
>> 	* builtins.c (get_memory_rtx): Fix comment.
>> 	* optabs.def (movmem_optab): Change to cpymem_optab.
>> 	* expr.c (emit_block_move_via_cpymem): Change movmem to cpymem.
>> 	(emit_block_move_hints): Change movmem to cpymem.
>> 	* defaults.h: Change movmem to cpymem.
>> 	* targhooks.c (get_move_ratio): Change movmem to cpymem.
>> 	(default_use_by_pieces_infrastructure_p): Ditto.
> So I think you're missing an update to the RTL/MD documentation.  This
> is also likely to cause problems for any out-of-tree ports, so it's
> probably worth a mention in the gcc-10 changes, which will need to be
> created (in CVS no less, ugh).

Mentioning changes like this could give a false sense that the release
notes are the best place to look.  I can think of quite a few changes
in this line that don't get mentioned in release notes. :-)

Diffing the texi files is probably more reliable (but would still miss
things like Wilco's recent buitin_setjmp/longjmp change, which could
also be relevant to out-of-tree ports).

Richard
Richard Earnshaw June 26, 2019, 8:58 a.m. UTC | #3
On 26/06/2019 09:36, Richard Sandiford wrote:
> Jeff Law <law@redhat.com> writes:
>> On 6/25/19 2:22 PM, acsawdey@linux.ibm.com wrote:
>>> From: Aaron Sawdey <acsawdey@linux.ibm.com>
>>>
>>> 	* builtins.c (get_memory_rtx): Fix comment.
>>> 	* optabs.def (movmem_optab): Change to cpymem_optab.
>>> 	* expr.c (emit_block_move_via_cpymem): Change movmem to cpymem.
>>> 	(emit_block_move_hints): Change movmem to cpymem.
>>> 	* defaults.h: Change movmem to cpymem.
>>> 	* targhooks.c (get_move_ratio): Change movmem to cpymem.
>>> 	(default_use_by_pieces_infrastructure_p): Ditto.
>> So I think you're missing an update to the RTL/MD documentation.  This
>> is also likely to cause problems for any out-of-tree ports, so it's
>> probably worth a mention in the gcc-10 changes, which will need to be
>> created (in CVS no less, ugh).
> 
> Mentioning changes like this could give a false sense that the release
> notes are the best place to look.  I can think of quite a few changes
> in this line that don't get mentioned in release notes. :-)
> 
> Diffing the texi files is probably more reliable (but would still miss
> things like Wilco's recent buitin_setjmp/longjmp change, which could
> also be relevant to out-of-tree ports).
> 
> Richard
> 

Simply renaming an API is generally fine.  Out of tree ports will fail
to build and the fixes are generally simple at that point.

Adding a new API with the old name is where the problem usually lies,
since now the OOT port will still build but have changed semantics.

R.
Aaron Sawdey June 27, 2019, 6:39 p.m. UTC | #4
On 6/25/19 4:43 PM, Jeff Law wrote:
> On 6/25/19 2:22 PM, acsawdey@linux.ibm.com wrote:
>> From: Aaron Sawdey <acsawdey@linux.ibm.com>
>>
>> 	* builtins.c (get_memory_rtx): Fix comment.
>> 	* optabs.def (movmem_optab): Change to cpymem_optab.
>> 	* expr.c (emit_block_move_via_cpymem): Change movmem to cpymem.
>> 	(emit_block_move_hints): Change movmem to cpymem.
>> 	* defaults.h: Change movmem to cpymem.
>> 	* targhooks.c (get_move_ratio): Change movmem to cpymem.
>> 	(default_use_by_pieces_infrastructure_p): Ditto.
> So I think you're missing an update to the RTL/MD documentation.  This
> is also likely to cause problems for any out-of-tree ports, so it's
> probably worth a mention in the gcc-10 changes, which will need to be
> created (in CVS no less, ugh).
> 
> I think the stuff posted to-date is fine, but it shouldn't go in without
> the corresponding docs and gcc-10 changes updates.

Here is the corresponding documentation change for gcc-10/changes.html.

OK for trunk?

Thanks,
    Aaron




Index: changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-10/changes.html,v
retrieving revision 1.4
diff -r1.4 changes.html
139c139,149
< <!-- <h2>Other significant improvements</h2> -->
---
> <h2>Other significant improvements</h2>
> <ul>
>   <li>
>     To allow inline expansion of both <code>memcpy</code>
>     and <code>memmove</code>, the existing <code>movmem</code> instruction
>     patterns used for non-overlapping memory copies have been renamed to
>     <code>cpymem</code>. The <code>movmem</code> name is now used
>     for overlapping memory moves, consistent with the
>     library functions <code>memcpy</code> and <code>memmove</code>.
>   </li>
> </ul>
Jeff Law June 28, 2019, 9:33 p.m. UTC | #5
On 6/27/19 12:39 PM, Aaron Sawdey wrote:
> On 6/25/19 4:43 PM, Jeff Law wrote:
>> On 6/25/19 2:22 PM, acsawdey@linux.ibm.com wrote:
>>> From: Aaron Sawdey <acsawdey@linux.ibm.com>
>>>
>>> 	* builtins.c (get_memory_rtx): Fix comment.
>>> 	* optabs.def (movmem_optab): Change to cpymem_optab.
>>> 	* expr.c (emit_block_move_via_cpymem): Change movmem to cpymem.
>>> 	(emit_block_move_hints): Change movmem to cpymem.
>>> 	* defaults.h: Change movmem to cpymem.
>>> 	* targhooks.c (get_move_ratio): Change movmem to cpymem.
>>> 	(default_use_by_pieces_infrastructure_p): Ditto.
>> So I think you're missing an update to the RTL/MD documentation.  This
>> is also likely to cause problems for any out-of-tree ports, so it's
>> probably worth a mention in the gcc-10 changes, which will need to be
>> created (in CVS no less, ugh).
>>
>> I think the stuff posted to-date is fine, but it shouldn't go in without
>> the corresponding docs and gcc-10 changes updates.
> 
> Here is the corresponding documentation change for gcc-10/changes.html.
> 
> OK for trunk?
OK
jeff

Patch
diff mbox series

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 4ecfd49..40afd03 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1416,7 +1416,7 @@  expand_builtin_prefetch (tree exp)
 }
 
 /* Get a MEM rtx for expression EXP which is the address of an operand
-   to be used in a string instruction (cmpstrsi, movmemsi, ..).  LEN is
+   to be used in a string instruction (cmpstrsi, cpymemsi, ..).  LEN is
    the maximum length of the block of memory that might be accessed or
    NULL if unknown.  */
 
diff --git a/gcc/defaults.h b/gcc/defaults.h
index b753425..af7ea18 100644
--- a/gcc/defaults.h
+++ b/gcc/defaults.h
@@ -1318,10 +1318,10 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #endif
 
 /* If a memory-to-memory move would take MOVE_RATIO or more simple
-   move-instruction sequences, we will do a movmem or libcall instead.  */
+   move-instruction sequences, we will do a cpymem or libcall instead.  */
 
 #ifndef MOVE_RATIO
-#if defined (HAVE_movmemqi) || defined (HAVE_movmemhi) || defined (HAVE_movmemsi) || defined (HAVE_movmemdi) || defined (HAVE_movmemti)
+#if defined (HAVE_cpymemqi) || defined (HAVE_cpymemhi) || defined (HAVE_cpymemsi) || defined (HAVE_cpymemdi) || defined (HAVE_cpymemti)
 #define MOVE_RATIO(speed) 2
 #else
 /* If we are optimizing for space (-Os), cut down the default move ratio.  */
@@ -1342,7 +1342,7 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #endif
 
 /* If a memory set (to value other than zero) operation would take
-   SET_RATIO or more simple move-instruction sequences, we will do a movmem
+   SET_RATIO or more simple move-instruction sequences, we will do a setmem
    or libcall instead.  */
 #ifndef SET_RATIO
 #define SET_RATIO(speed) MOVE_RATIO (speed)
diff --git a/gcc/expr.c b/gcc/expr.c
index c78bc74..4d39569 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -73,7 +73,7 @@  along with GCC; see the file COPYING3.  If not see
 int cse_not_expected;
 
 static bool block_move_libcall_safe_for_call_parm (void);
-static bool emit_block_move_via_movmem (rtx, rtx, rtx, unsigned, unsigned, HOST_WIDE_INT,
+static bool emit_block_move_via_cpymem (rtx, rtx, rtx, unsigned, unsigned, HOST_WIDE_INT,
 					unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT,
 					unsigned HOST_WIDE_INT);
 static void emit_block_move_via_loop (rtx, rtx, rtx, unsigned);
@@ -1624,7 +1624,7 @@  emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method,
 
   if (CONST_INT_P (size) && can_move_by_pieces (INTVAL (size), align))
     move_by_pieces (x, y, INTVAL (size), align, RETURN_BEGIN);
-  else if (emit_block_move_via_movmem (x, y, size, align,
+  else if (emit_block_move_via_cpymem (x, y, size, align,
 				       expected_align, expected_size,
 				       min_size, max_size, probable_max_size))
     ;
@@ -1722,11 +1722,11 @@  block_move_libcall_safe_for_call_parm (void)
   return true;
 }
 
-/* A subroutine of emit_block_move.  Expand a movmem pattern;
+/* A subroutine of emit_block_move.  Expand a cpymem pattern;
    return true if successful.  */
 
 static bool
-emit_block_move_via_movmem (rtx x, rtx y, rtx size, unsigned int align,
+emit_block_move_via_cpymem (rtx x, rtx y, rtx size, unsigned int align,
 			    unsigned int expected_align, HOST_WIDE_INT expected_size,
 			    unsigned HOST_WIDE_INT min_size,
 			    unsigned HOST_WIDE_INT max_size,
@@ -1755,7 +1755,7 @@  emit_block_move_via_movmem (rtx x, rtx y, rtx size, unsigned int align,
   FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT)
     {
       scalar_int_mode mode = mode_iter.require ();
-      enum insn_code code = direct_optab_handler (movmem_optab, mode);
+      enum insn_code code = direct_optab_handler (cpymem_optab, mode);
 
       if (code != CODE_FOR_nothing
 	  /* We don't need MODE to be narrower than BITS_PER_HOST_WIDE_INT
diff --git a/gcc/optabs.def b/gcc/optabs.def
index feee96f..03a08da 100644
--- a/gcc/optabs.def
+++ b/gcc/optabs.def
@@ -256,7 +256,7 @@  OPTAB_D (umul_highpart_optab, "umul$a3_highpart")
 OPTAB_D (cmpmem_optab, "cmpmem$a")
 OPTAB_D (cmpstr_optab, "cmpstr$a")
 OPTAB_D (cmpstrn_optab, "cmpstrn$a")
-OPTAB_D (movmem_optab, "movmem$a")
+OPTAB_D (cpymem_optab, "cpymem$a")
 OPTAB_D (setmem_optab, "setmem$a")
 OPTAB_D (strlen_optab, "strlen$a")
 
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 0da885e..676885b 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1746,9 +1746,9 @@  get_move_ratio (bool speed_p ATTRIBUTE_UNUSED)
 #ifdef MOVE_RATIO
   move_ratio = (unsigned int) MOVE_RATIO (speed_p);
 #else
-#if defined (HAVE_movmemqi) || defined (HAVE_movmemhi) || defined (HAVE_movmemsi) || defined (HAVE_movmemdi) || defined (HAVE_movmemti)
+#if defined (HAVE_cpymemqi) || defined (HAVE_cpymemhi) || defined (HAVE_cpymemsi) || defined (HAVE_cpymemdi) || defined (HAVE_cpymemti)
   move_ratio = 2;
-#else /* No movmem patterns, pick a default.  */
+#else /* No cpymem patterns, pick a default.  */
   move_ratio = ((speed_p) ? 15 : 3);
 #endif
 #endif
@@ -1756,7 +1756,7 @@  get_move_ratio (bool speed_p ATTRIBUTE_UNUSED)
 }
 
 /* Return TRUE if the move_by_pieces/set_by_pieces infrastructure should be
-   used; return FALSE if the movmem/setmem optab should be expanded, or
+   used; return FALSE if the cpymem/setmem optab should be expanded, or
    a call to memcpy emitted.  */
 
 bool