diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-23 22:19:19 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-23 22:19:19 +0000 |
commit | d3a070785376fdc330f9e2fda77daab88255af00 (patch) | |
tree | b07d6c628b5ec47255fa6723cf727cb89ace575e /libgfortran/intrinsics | |
parent | ffc0b1edcad561e7c8304c3f6cb38ec31502b024 (diff) | |
download | gcc-d3a070785376fdc330f9e2fda77daab88255af00.tar.gz |
2007-03-23 Thomas Koenig <tkoenig@gcc.gnu.org
PR libfortran/32972
* Makefile.am: Add new variable, i_unpack_c, containing
unpack_i1.c, unpack_i2.c, unpack_i4.c, unpack_i8.c,
unpack_i16.c, unpack_r4.c, unpack_r8.c, unpack_r10.c,
unpack_r16.c, unpack_c4.c, unpack_c8.c, unpack_c10.c
and unpack_c16.c
Add i_unpack_c to gfor_built_src.
Add rule to generate i_unpack_c from m4/unpack.m4.
* Makefile.in: Regenerated.
* libgfortran.h: Add prototypes for unpack0_i1, unpack0_i2,
unpack0_i4, unpack0_i8, unpack0_i16, unpack0_r4, unpack0_r8,
unpack0_r10, unpack0_r16, unpack0_c4, unpack0_c8, unpack0_c10,
unpack0_c16, unpack1_i1, unpack1_i2, unpack1_i4, unpack1_i8,
unpack1_i16, unpack1_r4, unpack1_r8, unpack1_r10, unpack1_r16,
unpack1_c4, unpack1_c8, unpack1_c10 and unpack1_c16.
* intrinsics/pack_generic.c (unpack1): Add calls to specific
unpack1 functions.
(unpack0): Add calls to specific unpack0 functions.
* m4/unpack.m4: New file.
* generated/unpack_i1.c: New file.
* generated/unpack_i2.c: New file.
* generated/unpack_i4.c: New file.
* generated/unpack_i8.c: New file.
* generated/unpack_i16.c: New file.
* generated/unpack_r4.c: New file.
* generated/unpack_r8.c: New file.
* generated/unpack_r10.c: New file.
* generated/unpack_r16.c: New file.
* generated/unpack_c4.c: New file.
* generated/unpack_c8.c: New file.
* generated/unpack_c10.c: New file.
* generated/unpack_c16.c: New file.
2007-03-23 Thomas Koenig <tkoenig@gcc.gnu.org
PR libfortran/32972
* gfortran.dg/intrinsic_unpack_1.f90: New test case.
* gfortran.dg/intrinsic_unpack_2.f90: New test case.
* gfortran.dg/intrinsic_unpack_3.f90: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133469 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r-- | libgfortran/intrinsics/unpack_generic.c | 195 |
1 files changed, 193 insertions, 2 deletions
diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c index 05141edd959..145dd350568 100644 --- a/libgfortran/intrinsics/unpack_generic.c +++ b/libgfortran/intrinsics/unpack_generic.c @@ -196,8 +196,103 @@ void unpack1 (gfc_array_char *ret, const gfc_array_char *vector, const gfc_array_l1 *mask, const gfc_array_char *field) { - unpack_internal (ret, vector, mask, field, - GFC_DESCRIPTOR_SIZE (vector), + int type; + index_type size; + + type = GFC_DESCRIPTOR_TYPE (vector); + size = GFC_DESCRIPTOR_SIZE (vector); + + switch(type) + { + case GFC_DTYPE_INTEGER: + case GFC_DTYPE_LOGICAL: + switch(size) + { + case sizeof (GFC_INTEGER_1): + unpack1_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) vector, + mask, (gfc_array_i1 *) field); + return; + + case sizeof (GFC_INTEGER_2): + unpack1_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector, + mask, (gfc_array_i2 *) field); + return; + + case sizeof (GFC_INTEGER_4): + unpack1_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector, + mask, (gfc_array_i4 *) field); + return; + + case sizeof (GFC_INTEGER_8): + unpack1_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector, + mask, (gfc_array_i8 *) field); + return; + +#ifdef HAVE_GFC_INTEGER_16 + case sizeof (GFC_INTEGER_16): + unpack1_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector, + mask, (gfc_array_i16 *) field); + return; +#endif + } + case GFC_DTYPE_REAL: + switch (size) + { + case sizeof (GFC_REAL_4): + unpack1_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) vector, + mask, (gfc_array_r4 *) field); + return; + + case sizeof (GFC_REAL_8): + unpack1_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) vector, + mask, (gfc_array_r8 *) field); + return; + +#ifdef HAVE_GFC_REAL_10 + case sizeof (GFC_REAL_10): + unpack1_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) vector, + mask, (gfc_array_r10 *) field); + return; +#endif + +#ifdef HAVE_GFC_REAL_16 + case sizeof (GFC_REAL_16): + unpack1_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector, + mask, (gfc_array_r16 *) field); + return; +#endif + } + + case GFC_DTYPE_COMPLEX: + switch (size) + { + case sizeof (GFC_COMPLEX_4): + unpack1_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) vector, + mask, (gfc_array_c4 *) field); + return; + + case sizeof (GFC_COMPLEX_8): + unpack1_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) vector, + mask, (gfc_array_c8 *) field); + return; + +#ifdef HAVE_GFC_COMPLEX_10 + case sizeof (GFC_COMPLEX_10): + unpack1_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) vector, + mask, (gfc_array_c10 *) field); + return; +#endif + +#ifdef HAVE_GFC_COMPLEX_16 + case sizeof (GFC_COMPLEX_16): + unpack1_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector, + mask, (gfc_array_c16 *) field); + return; +#endif + } + + } + unpack_internal (ret, vector, mask, field, size, GFC_DESCRIPTOR_SIZE (field)); } @@ -227,6 +322,102 @@ unpack0 (gfc_array_char *ret, const gfc_array_char *vector, { gfc_array_char tmp; + int type; + index_type size; + + type = GFC_DESCRIPTOR_TYPE (vector); + size = GFC_DESCRIPTOR_SIZE (vector); + + switch(type) + { + case GFC_DTYPE_INTEGER: + case GFC_DTYPE_LOGICAL: + switch(size) + { + case sizeof (GFC_INTEGER_1): + unpack0_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) vector, + mask, (GFC_INTEGER_1 *) field); + return; + + case sizeof (GFC_INTEGER_2): + unpack0_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector, + mask, (GFC_INTEGER_2 *) field); + return; + + case sizeof (GFC_INTEGER_4): + unpack0_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector, + mask, (GFC_INTEGER_4 *) field); + return; + + case sizeof (GFC_INTEGER_8): + unpack0_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector, + mask, (GFC_INTEGER_8 *) field); + return; + +#ifdef HAVE_GFC_INTEGER_16 + case sizeof (GFC_INTEGER_16): + unpack0_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector, + mask, (GFC_INTEGER_16 *) field); + return; +#endif + } + + case GFC_DTYPE_REAL: + switch(size) + { + case sizeof (GFC_REAL_4): + unpack0_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) vector, + mask, (GFC_REAL_4 *) field); + return; + + case sizeof (GFC_REAL_8): + unpack0_r8 ((gfc_array_r8 *) ret, (gfc_array_r8*) vector, + mask, (GFC_REAL_8 *) field); + return; + +#ifdef HAVE_GFC_REAL_10 + case sizeof (GFC_REAL_10): + unpack0_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) vector, + mask, (GFC_REAL_10 *) field); + return; +#endif + +#ifdef HAVE_GFC_REAL_16 + case sizeof (GFC_REAL_16): + unpack0_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) vector, + mask, (GFC_REAL_16 *) field); + return; +#endif + } + + case GFC_DTYPE_COMPLEX: + switch(size) + { + case sizeof (GFC_COMPLEX_4): + unpack0_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) vector, + mask, (GFC_COMPLEX_4 *) field); + return; + + case sizeof (GFC_COMPLEX_8): + unpack0_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) vector, + mask, (GFC_COMPLEX_8 *) field); + return; + +#ifdef HAVE_GFC_COMPLEX_10 + case sizeof (GFC_COMPLEX_10): + unpack0_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) vector, + mask, (GFC_COMPLEX_10 *) field); + return; +#endif + +#ifdef HAVE_GFC_COMPLEX_16 + case sizeof (GFC_COMPLEX_16): + unpack0_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector, + mask, (GFC_COMPLEX_16 *) field); + return; +#endif + } + } memset (&tmp, 0, sizeof (tmp)); tmp.dtype = 0; tmp.data = field; |