diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2017-07-09 19:09:33 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2017-07-09 19:09:33 +0000 |
commit | ba71a2a62c63f77f4a21c460738dc8795b0f6eac (patch) | |
tree | 2caab511caafff148913ed01787320db240010f9 /libgfortran/generated | |
parent | 35c95658180e67503f9de96567ab4d6e71b10a6e (diff) | |
download | gcc-ba71a2a62c63f77f4a21c460738dc8795b0f6eac.zip gcc-ba71a2a62c63f77f4a21c460738dc8795b0f6eac.tar.gz gcc-ba71a2a62c63f77f4a21c460738dc8795b0f6eac.tar.bz2 |
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')
-rw-r--r-- | libgfortran/generated/eoshift1_16.c | 23 | ||||
-rw-r--r-- | libgfortran/generated/eoshift1_4.c | 23 | ||||
-rw-r--r-- | libgfortran/generated/eoshift1_8.c | 23 | ||||
-rw-r--r-- | libgfortran/generated/eoshift3_16.c | 24 | ||||
-rw-r--r-- | libgfortran/generated/eoshift3_4.c | 24 | ||||
-rw-r--r-- | libgfortran/generated/eoshift3_8.c | 24 |
6 files changed, 105 insertions, 36 deletions
diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c index 0905949..fe2e8ef 100644 --- a/libgfortran/generated/eoshift1_16.c +++ b/libgfortran/generated/eoshift1_16.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; diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c index 1be4932..a90fc21 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; diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c index 51968e5..8be1e05 100644 --- a/libgfortran/generated/eoshift1_8.c +++ b/libgfortran/generated/eoshift1_8.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; diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c index 8040b1e..621fd6f 100644 --- a/libgfortran/generated/eoshift3_16.c +++ b/libgfortran/generated/eoshift3_16.c @@ -198,12 +198,24 @@ eoshift3 (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; diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c index be5827e..ac4fd67 100644 --- a/libgfortran/generated/eoshift3_4.c +++ b/libgfortran/generated/eoshift3_4.c @@ -198,12 +198,24 @@ eoshift3 (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; diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c index b3aff0f..7e9d8b4 100644 --- a/libgfortran/generated/eoshift3_8.c +++ b/libgfortran/generated/eoshift3_8.c @@ -198,12 +198,24 @@ eoshift3 (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; |