summaryrefslogtreecommitdiff
path: root/libgfortran/generated/eoshift1_4.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2017-07-09 19:09:33 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2017-07-09 19:09:33 +0000
commitba71a2a62c63f77f4a21c460738dc8795b0f6eac (patch)
tree2caab511caafff148913ed01787320db240010f9 /libgfortran/generated/eoshift1_4.c
parent35c95658180e67503f9de96567ab4d6e71b10a6e (diff)
downloadgcc-ba71a2a62c63f77f4a21c460738dc8795b0f6eac.tar.gz
eoshift2.c (eoshift2): Use memcpy for innermost copy where possible.
2017-06-09 Thomas Koenig <tkoenig@gcc.gnu.org> * intrinsics/eoshift2.c (eoshift2): Use memcpy for innermost copy where possible. * m4/eoshift1.m4 (eoshift1): Likewise. * m4/eoshift3.m4 (eoshift3): Likewise. * generated/eoshift1_16.c: Regenerated. * generated/eoshift1_4.c: Regenerated. * generated/eoshift1_8.c: Regenerated. * generated/eoshift3_16.c: Regenerated. * generated/eoshift3_4.c: Regenerated. * generated/eoshift3_8.c: Regenerated. 2017-06-09 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/eoshift_4.f90: New test. * gfortran.dg/eoshift_5.f90: New test. * gfortran.dg/eoshift_6.f90: New test. From-SVN: r250085
Diffstat (limited to 'libgfortran/generated/eoshift1_4.c')
-rw-r--r--libgfortran/generated/eoshift1_4.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c
index 1be49325895..a90fc2176de 100644
--- a/libgfortran/generated/eoshift1_4.c
+++ b/libgfortran/generated/eoshift1_4.c
@@ -183,12 +183,23 @@ eoshift1 (gfc_array_char * const restrict ret,
src = sptr;
dest = &rptr[delta * roffset];
}
- for (n = 0; n < len - delta; n++)
- {
- memcpy (dest, src, size);
- dest += roffset;
- src += soffset;
- }
+
+ /* If the elements are contiguous, perform a single block move. */
+ if (soffset == size && roffset == size)
+ {
+ size_t chunk = size * (len - delta);
+ memcpy (dest, src, chunk);
+ dest += chunk;
+ }
+ else
+ {
+ for (n = 0; n < len - delta; n++)
+ {
+ memcpy (dest, src, size);
+ dest += roffset;
+ src += soffset;
+ }
+ }
if (sh < 0)
dest = rptr;
n = delta;