diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-03-19 15:42:55 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-03-19 15:42:55 +0000 |
commit | 8e1d7686de136571f68185066dec9bcb28019a8d (patch) | |
tree | 370b9d6b0738999469c560cab3acf85bde3ceb2d /libgfortran/runtime/in_pack_generic.c | |
parent | cd7e0bd4b185112f64b7b78264b0bfa6eb27d26b (diff) | |
download | gcc-8e1d7686de136571f68185066dec9bcb28019a8d.zip gcc-8e1d7686de136571f68185066dec9bcb28019a8d.tar.gz gcc-8e1d7686de136571f68185066dec9bcb28019a8d.tar.bz2 |
re PR libfortran/32972 (performance of pack/unpack)
2008-03-19 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32972
* Makefile.am (in_pack_c): Add in_pack_i1.c, in_pack_i2.c,
in_pack_r4.c, in_pack_r8.c, in_pack_r10.c and in_pack_r16.c.
(in_unpack_c): Add in_unpack_i1.c, in_unpack_i2.c,
in_unpack_r4.c, in_unpack_r8.c, in_unpack_r10.c and
in_unpack_r16.c.
* Makefile.in: Regenerate.
* libgfortran.h: Add prototypes for internal_pack_1,
internal_pack_2, internal_pack_16, internal_pack_r4,
internal_pack_r8, internal_pack_r10, internal_pack_r16,
internal_pack_c10 and internal_pack_c16. Add prototypes for
internal_unpack_1, internal_unpack_2, internal_unpack_16,
internal_unpack_r4, internal_unpack_r8, internal_unpack_r10,
internal_unpack_r16, internal_unpack_c10 and
internal_unpack_c16.
* runtime/in_pack_generic.c (internal_pack): Use sizeof instead
of hardwired sizes.
Add calls to internal_pack_1, internal_pack_2,
internal_pack_16, internal_pack_r4, internal_pack_r8,
internal_pack_r10, internal_pack_r16, internal_pack_c10 and
internal_pack_c16.
* runtime/in_unpack_generic.c (internal_unpack): Use sizeof
instead of hardwired sizes.
Add calls to internal_unpack_1, internal_unpack_2,
internal_unpack_16, internal_unpack_r4, internal_unpack_r8,
internal_unpack_r10, internal_unpack_r16, internal_unpack_c10
and internal_unpack_c16.
* generated/in_pack_r4.c: New file.
* generated/in_pack_i2.c: New file.
* generated/in_unpack_i1.c: New file.
* generated/in_pack_r10.c: New file.
* generated/in_unpack_r4.c: New file.
* generated/in_unpack_i2.c: New file.
* generated/in_unpack_r16.c: New file.
* generated/in_pack_r8.c: New file.
* generated/in_unpack_r10.c: New file.
* generated/in_unpack_r8.c: New file.
* generated/in_pack_r16.c: New file.
* generated/in_pack_i1.c: New file.
2008-03-19 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32972
* gfortran.dg/internal_pack_1.f90: New test case.
* gfortran.dg/internal_pack_2.f90: New test case.
* gfortran.dg/internal_pack_3.f90: New test case.
From-SVN: r133344
Diffstat (limited to 'libgfortran/runtime/in_pack_generic.c')
-rw-r--r-- | libgfortran/runtime/in_pack_generic.c | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/libgfortran/runtime/in_pack_generic.c b/libgfortran/runtime/in_pack_generic.c index 59205ea..ff02ec1 100644 --- a/libgfortran/runtime/in_pack_generic.c +++ b/libgfortran/runtime/in_pack_generic.c @@ -65,25 +65,65 @@ internal_pack (gfc_array_char * source) { case GFC_DTYPE_INTEGER: case GFC_DTYPE_LOGICAL: - case GFC_DTYPE_REAL: switch (size) { - case 4: - return internal_pack_4 ((gfc_array_i4 *)source); + case sizeof (GFC_INTEGER_1): + return internal_pack_1 ((gfc_array_i1 *) source); + + case sizeof (GFC_INTEGER_2): + return internal_pack_2 ((gfc_array_i2 *) source); + + case sizeof (GFC_INTEGER_4): + return internal_pack_4 ((gfc_array_i4 *) source); - case 8: - return internal_pack_8 ((gfc_array_i8 *)source); + case sizeof (GFC_INTEGER_8): + return internal_pack_8 ((gfc_array_i8 *) source); + +#if defined(HAVE_GFC_INTEGER_16) + case sizeof (GFC_INTEGER_16): + return internal_pack_16 (gfc_array_i16 *) source); +#endif } break; + case GFC_DTYPE_REAL: + switch (size) + { + case sizeof (GFC_REAL_4): + return internal_pack_r4 ((gfc_array_r4 *) source); + + case sizeof (GFC_REAL_8): + return internal_pack_r8 ((gfc_array_r8 *) source); + +#if defined (HAVE_GFC_REAL_10) + case sizeof (GFC_REAL_10): + return internal_pack_r10 ((gfc_array_r10 *) source); +#endif + +#if defined (HAVE_GFC_REAL_16) + case sizeof (GFC_REAL_16): + return internal_pack_r16 ((gfc_array_r16 *) source); +#endif + } case GFC_DTYPE_COMPLEX: switch (size) { - case 8: - return internal_pack_c4 ((gfc_array_c4 *)source); + case sizeof (GFC_COMPLEX_4): + return internal_pack_c4 ((gfc_array_c4 *) source); - case 16: - return internal_pack_c8 ((gfc_array_c8 *)source); + case sizeof (GFC_COMPLEX_8): + return internal_pack_c8 ((gfc_array_c8 *) source); + +#if defined (HAVE_GFC_COMPLEX_10) + case sizeof (GFC_COMPLEX_10): + return internal_pack_c10 ((gfc_array_c10 *) source); +#endif + +#if defined (HAVE_GFC_COMPLEX_16) + case sizeof (GFC_COMPLEX_16): + return internal_pack_c16 ((gfc_array_c16 *) source); +#endif + } break; |