diff options
author | Aaron Sawdey <acsawdey@gcc.gnu.org> | 2019-07-02 13:51:23 -0500 |
---|---|---|
committer | Aaron Sawdey <acsawdey@gcc.gnu.org> | 2019-07-02 13:51:23 -0500 |
commit | 02e3025e174e6e93ab2675f49baf4df617e59c68 (patch) | |
tree | c79681510df7cbcd20b98df7ae78edcb01870382 | |
parent | e2790e1eab7bfaae5a733ed742a59a518253a645 (diff) | |
download | gcc-02e3025e174e6e93ab2675f49baf4df617e59c68.zip gcc-02e3025e174e6e93ab2675f49baf4df617e59c68.tar.gz gcc-02e3025e174e6e93ab2675f49baf4df617e59c68.tar.bz2 |
optabs.def (movmem_optab): Add movmem back for memmove().
2019-07-02 Aaron Sawdey <acsawdey@linux.ibm.com>
* optabs.def (movmem_optab): Add movmem back for memmove().
* doc/md.texi: Add description of movmem pattern for overlapping move.
From-SVN: r272946
-rw-r--r-- | gcc/doc/md.texi | 36 | ||||
-rw-r--r-- | gcc/optabs.def | 1 |
2 files changed, 37 insertions, 0 deletions
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi index 3f9d545..b1fcc38 100644 --- a/gcc/doc/md.texi +++ b/gcc/doc/md.texi @@ -6237,6 +6237,42 @@ to the possibility that the source and destination strings might overlap. These patterns are used to do inline expansion of @code{__builtin_memcpy}. +@cindex @code{movmem@var{m}} instruction pattern +@item @samp{movmem@var{m}} +Block move instruction. The destination and source blocks of memory +are the first two operands, and both are @code{mem:BLK}s with an +address in mode @code{Pmode}. + +The number of bytes to copy is the third operand, in mode @var{m}. +Usually, you specify @code{Pmode} for @var{m}. However, if you can +generate better code knowing the range of valid lengths is smaller than +those representable in a full Pmode pointer, you should provide +a pattern with a +mode corresponding to the range of values you can handle efficiently +(e.g., @code{QImode} for values in the range 0--127; note we avoid numbers +that appear negative) and also a pattern with @code{Pmode}. + +The fourth operand is the known shared alignment of the source and +destination, in the form of a @code{const_int} rtx. Thus, if the +compiler knows that both source and destination are word-aligned, +it may provide the value 4 for this operand. + +Optional operands 5 and 6 specify expected alignment and size of block +respectively. The expected alignment differs from alignment in operand 4 +in a way that the blocks are not required to be aligned according to it in +all cases. This expected alignment is also in bytes, just like operand 4. +Expected size, when unknown, is set to @code{(const_int -1)}. + +Descriptions of multiple @code{movmem@var{m}} patterns can only be +beneficial if the patterns for smaller modes have fewer restrictions +on their first, second and fourth operands. Note that the mode @var{m} +in @code{movmem@var{m}} does not impose any restriction on the mode of +individually copied data units in the block. + +The @code{movmem@var{m}} patterns must correctly handle the case where +the source and destination strings overlap. These patterns are used to +do inline expansion of @code{__builtin_memmove}. + @cindex @code{movstr} instruction pattern @item @samp{movstr} String copy instruction, with @code{stpcpy} semantics. Operand 0 is diff --git a/gcc/optabs.def b/gcc/optabs.def index 03a08da..4ffd0f3 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -257,6 +257,7 @@ OPTAB_D (cmpmem_optab, "cmpmem$a") OPTAB_D (cmpstr_optab, "cmpstr$a") OPTAB_D (cmpstrn_optab, "cmpstrn$a") OPTAB_D (cpymem_optab, "cpymem$a") +OPTAB_D (movmem_optab, "movmem$a") OPTAB_D (setmem_optab, "setmem$a") OPTAB_D (strlen_optab, "strlen$a") |