summaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-13 20:15:58 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2008-04-13 20:15:58 +0000
commited3634f6081c293b5b93fdc8a90f5e45b70445d8 (patch)
treee022b93b7ac1c858cd02bc0f837fdaae49b136ff /libgfortran/intrinsics
parent5207e7191fb89a5bc8f1a710d6a0be83bfb890ca (diff)
downloadgcc-ed3634f6081c293b5b93fdc8a90f5e45b70445d8.tar.gz
2008-04-13 Thomas Koenig <tkoenig@gcc.gnu.org>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> PR libfortran/32972 PR libfortran/32512 configure.ac: Add test for uintptr_t. configure: Regenerated. config.h.in: Regenerated. * libgfortran.h: GFC_DTYPE_DERIVED_1: New macro. GFC_DTYPE_DERIVED_2: New macro. GFC_DTYPE_DERIVED_4: New macro. GFC_DTYPE_DERIVED_8: New macro. GFC_DTYPE_DERIVED_16: New macro. GFC_UNALIGNED_2: New macro. GFC_UNALIGNED_4: New macro. GFC_UNALIGNED_8: New macro. GFC_UNALIGNED_16: New macro. intptr_t: Define if we don't have it. uintptr_t: Likewise. * runtime/backtrace.c (show_backtrace): Use intptr_t. * intrinsics/signal.c (signal_sub): Likewise. (signal_sub_int): Likewise. (alarm_sub_int_i4): Likewise. * intrinsics/spread_generic.c (spread): Use the integer routines for handling derived types of sizes 1, 2, 4, 8 and 16 if the alignment of all pointers is correct. (spread_scalar): Likewise. * intrinsics/pack_generic.c (pack): Likewise. Use GFD_DTYPE_TYPE_SIZE to avoid nested switch statements. * intrinsics/unpack_generic.c (unpack1): Likewise. (unpack0): Likewise. * runtime/in_pack_generic.c (internal_pack): Likewise. * runtime/in_unpack_generic.c (internal_unpack): Likewise. 2008-04-13 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/32972 PR libfortran/32512 * gfortran.dg/internal_pack_1.f90: Add test for derived type. * gfortran.dg/intrinsic_spread_1.f90: Likewise. * gfortran.dg/intrinsic_pack_1.f90: Likewise. * gfortran.dg/intrinsic_unpack_1.f90: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134245 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r--libgfortran/intrinsics/pack_generic.c182
-rw-r--r--libgfortran/intrinsics/signal.c22
-rw-r--r--libgfortran/intrinsics/spread_generic.c84
-rw-r--r--libgfortran/intrinsics/unpack_generic.c356
4 files changed, 422 insertions, 222 deletions
diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c
index 2bd09913f00..e282c916502 100644
--- a/libgfortran/intrinsics/pack_generic.c
+++ b/libgfortran/intrinsics/pack_generic.c
@@ -313,101 +313,147 @@ void
pack (gfc_array_char *ret, const gfc_array_char *array,
const gfc_array_l1 *mask, const gfc_array_char *vector)
{
- int type;
+ index_type type_size;
index_type size;
- type = GFC_DESCRIPTOR_TYPE (array);
- size = GFC_DESCRIPTOR_SIZE (array);
+ type_size = GFC_DTYPE_TYPE_SIZE(array);
- switch(type)
+ switch(type_size)
{
- case GFC_DTYPE_INTEGER:
- case GFC_DTYPE_LOGICAL:
- switch(size)
- {
- case sizeof (GFC_INTEGER_1):
- pack_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) array,
- (gfc_array_l1 *) mask, (gfc_array_i1 *) vector);
- return;
+ case GFC_DTYPE_LOGICAL_1:
+ case GFC_DTYPE_INTEGER_1:
+ case GFC_DTYPE_DERIVED_1:
+ pack_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i1 *) vector);
+ return;
- case sizeof (GFC_INTEGER_2):
- pack_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array,
- (gfc_array_l1 *) mask, (gfc_array_i2 *) vector);
- return;
+ case GFC_DTYPE_LOGICAL_2:
+ case GFC_DTYPE_INTEGER_2:
+ pack_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i2 *) vector);
+ return;
- case sizeof (GFC_INTEGER_4):
- pack_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) array,
- (gfc_array_l1 *) mask, (gfc_array_i4 *) vector);
- return;
+ case GFC_DTYPE_LOGICAL_4:
+ case GFC_DTYPE_INTEGER_4:
- case sizeof (GFC_INTEGER_8):
- pack_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) array,
- (gfc_array_l1 *) mask, (gfc_array_i8 *) vector);
- return;
+ pack_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i4 *) vector);
+ return;
+
+ case GFC_DTYPE_LOGICAL_8:
+ case GFC_DTYPE_INTEGER_8:
+
+ pack_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i8 *) vector);
+ return;
#ifdef HAVE_GFC_INTEGER_16
- case sizeof (GFC_INTEGER_16):
- pack_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array,
- (gfc_array_l1 *) mask, (gfc_array_i16 *) vector);
- return;
+ case GFC_DTYPE_LOGICAL_16:
+ case GFC_DTYPE_INTEGER_16:
+
+ pack_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i16 *) vector);
+ return;
#endif
- }
- case GFC_DTYPE_REAL:
- switch(size)
- {
- case sizeof (GFC_REAL_4):
- pack_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) array,
- (gfc_array_l1 *) mask, (gfc_array_r4 *) vector);
- return;
+ case GFC_DTYPE_REAL_4:
+ pack_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_r4 *) vector);
+ return;
- case sizeof (GFC_REAL_8):
- pack_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) array,
- (gfc_array_l1 *) mask, (gfc_array_r8 *) vector);
- return;
+ case GFC_DTYPE_REAL_8:
+ pack_r8 ((gfc_array_r8 *) ret, (gfc_array_r8 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_r8 *) vector);
+ return;
#ifdef HAVE_GFC_REAL_10
- case sizeof (GFC_REAL_10):
- pack_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) array,
- (gfc_array_l1 *) mask, (gfc_array_r10 *) vector);
- return;
+ case GFC_DTYPE_REAL_10:
+ pack_r10 ((gfc_array_r10 *) ret, (gfc_array_r10 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_r10 *) vector);
+ return;
#endif
#ifdef HAVE_GFC_REAL_16
- case sizeof (GFC_REAL_16):
- pack_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) array,
- (gfc_array_l1 *) mask, (gfc_array_r16 *) vector);
- return;
+ case GFC_DTYPE_REAL_16:
+ pack_r16 ((gfc_array_r16 *) ret, (gfc_array_r16 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_r16 *) vector);
+ return;
#endif
- }
- case GFC_DTYPE_COMPLEX:
- switch(size)
- {
- case sizeof (GFC_COMPLEX_4):
- pack_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) array,
- (gfc_array_l1 *) mask, (gfc_array_c4 *) vector);
- return;
+ case GFC_DTYPE_COMPLEX_4:
+ pack_c4 ((gfc_array_c4 *) ret, (gfc_array_c4 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_c4 *) vector);
+ return;
- case sizeof (GFC_COMPLEX_8):
- pack_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array,
- (gfc_array_l1 *) mask, (gfc_array_c8 *) vector);
- return;
+ case GFC_DTYPE_COMPLEX_8:
+ pack_c8 ((gfc_array_c8 *) ret, (gfc_array_c8 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_c8 *) vector);
+ return;
#ifdef HAVE_GFC_COMPLEX_10
- case sizeof (GFC_COMPLEX_10):
- pack_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) array,
- (gfc_array_l1 *) mask, (gfc_array_c10 *) vector);
- return;
+ case GFC_DTYPE_COMPLEX_10:
+ pack_c10 ((gfc_array_c10 *) ret, (gfc_array_c10 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_c10 *) vector);
+ return;
#endif
#ifdef HAVE_GFC_COMPLEX_16
- case sizeof (GFC_COMPLEX_16):
- pack_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) array,
- (gfc_array_l1 *) mask, (gfc_array_c16 *) vector);
- return;
+ case GFC_DTYPE_COMPLEX_16:
+ pack_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_c16 *) vector);
+ return;
#endif
+ /* For derived types, let's check the actual alignment of the
+ data pointers. If they are aligned, we can safely call
+ the unpack functions. */
+
+ case GFC_DTYPE_DERIVED_2:
+ if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(array->data)
+ || GFC_UNALIGNED_2(vector->data))
+ break;
+ else
+ {
+ pack_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i2 *) vector);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_4:
+ if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(array->data)
+ || GFC_UNALIGNED_4(vector->data))
+ break;
+ else
+ {
+ pack_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i4 *) vector);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_8:
+ if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(array->data)
+ || GFC_UNALIGNED_8(vector->data))
+ break;
+ else
+ {
+ pack_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i8 *) vector);
}
+
+#ifdef HAVE_GFC_INTEGER_16
+ case GFC_DTYPE_DERIVED_16:
+ if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(array->data)
+ || GFC_UNALIGNED_16(vector->data))
+ break;
+ else
+ {
+ pack_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) array,
+ (gfc_array_l1 *) mask, (gfc_array_i16 *) vector);
+ return;
+ }
+#endif
+
}
+
+ size = GFC_DESCRIPTOR_SIZE (array);
pack_internal (ret, array, mask, vector, size);
}
diff --git a/libgfortran/intrinsics/signal.c b/libgfortran/intrinsics/signal.c
index 27d6222cf4e..bd03f6d1afe 100644
--- a/libgfortran/intrinsics/signal.c
+++ b/libgfortran/intrinsics/signal.c
@@ -44,12 +44,6 @@ Boston, MA 02110-1301, USA. */
#include <errno.h>
-#ifdef HAVE_INTPTR_T
-# define INTPTR_T intptr_t
-#else
-# define INTPTR_T int
-#endif
-
/* SIGNAL subroutine with PROCEDURE as handler */
extern void signal_sub (int *, void (*)(int), int *);
iexport_proto(signal_sub);
@@ -58,11 +52,11 @@ void
signal_sub (int *number, void (*handler)(int), int *status)
{
#ifdef HAVE_SIGNAL
- INTPTR_T ret;
+ intptr_t ret;
if (status != NULL)
{
- ret = (INTPTR_T) signal (*number, handler);
+ ret = (intptr_t) signal (*number, handler);
*status = (int) ret;
}
else
@@ -84,11 +78,11 @@ void
signal_sub_int (int *number, int *handler, int *status)
{
#ifdef HAVE_SIGNAL
- INTPTR_T ptr = *handler, ret;
+ intptr_t ptr = *handler, ret;
if (status != NULL)
{
- ret = (INTPTR_T) signal (*number, (void (*)(int)) ptr);
+ ret = (intptr_t) signal (*number, (void (*)(int)) ptr);
*status = (int) ret;
}
else
@@ -204,14 +198,14 @@ alarm_sub_int_i4 (int *seconds __attribute__ ((unused)),
#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL)
if (status != NULL)
{
- if (signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler) == SIG_ERR)
+ if (signal (SIGALRM, (void (*)(int)) (intptr_t) *handler) == SIG_ERR)
*status = -1;
else
*status = alarm (*seconds);
}
else
{
- signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler);
+ signal (SIGALRM, (void (*)(int)) (intptr_t) *handler);
alarm (*seconds);
}
#else
@@ -234,14 +228,14 @@ alarm_sub_int_i8 (int *seconds __attribute__ ((unused)),
#if defined (SIGALRM) && defined (HAVE_ALARM) && defined (HAVE_SIGNAL)
if (status != NULL)
{
- if (signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler) == SIG_ERR)
+ if (signal (SIGALRM, (void (*)(int)) (intptr_t) *handler) == SIG_ERR)
*status = -1;
else
*status = alarm (*seconds);
}
else
{
- signal (SIGALRM, (void (*)(int)) (INTPTR_T) *handler);
+ signal (SIGALRM, (void (*)(int)) (intptr_t) *handler);
alarm (*seconds);
}
#else
diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c
index 16578f788fc..e50598a97c3 100644
--- a/libgfortran/intrinsics/spread_generic.c
+++ b/libgfortran/intrinsics/spread_generic.c
@@ -281,6 +281,7 @@ spread (gfc_array_char *ret, const gfc_array_char *source,
type_size = GFC_DTYPE_TYPE_SIZE(ret);
switch(type_size)
{
+ case GFC_DTYPE_DERIVED_1:
case GFC_DTYPE_LOGICAL_1:
case GFC_DTYPE_INTEGER_1:
spread_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) source,
@@ -361,7 +362,49 @@ spread (gfc_array_char *ret, const gfc_array_char *source,
return;
#endif
+ case GFC_DTYPE_DERIVED_2:
+ if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(source->data))
+ break;
+ else
+ {
+ spread_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) source,
+ *along, *pncopies);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_4:
+ if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(source->data))
+ break;
+ else
+ {
+ spread_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) source,
+ *along, *pncopies);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_8:
+ if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(source->data))
+ break;
+ else
+ {
+ spread_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) source,
+ *along, *pncopies);
+ return;
+ }
+
+#ifdef HAVE_GFC_INTEGER_16
+ case GFC_DTYPE_DERIVED_16:
+ if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(source->data))
+ break;
+ else
+ {
+ spread_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) source,
+ *along, *pncopies);
+ return;
+ }
+#endif
}
+
spread_internal (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (source));
}
@@ -398,6 +441,7 @@ spread_scalar (gfc_array_char *ret, const char *source,
type_size = GFC_DTYPE_TYPE_SIZE(ret);
switch(type_size)
{
+ case GFC_DTYPE_DERIVED_1:
case GFC_DTYPE_LOGICAL_1:
case GFC_DTYPE_INTEGER_1:
spread_scalar_i1 ((gfc_array_i1 *) ret, (GFC_INTEGER_1 *) source,
@@ -478,6 +522,46 @@ spread_scalar (gfc_array_char *ret, const char *source,
return;
#endif
+ case GFC_DTYPE_DERIVED_2:
+ if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(source))
+ break;
+ else
+ {
+ spread_scalar_i2 ((gfc_array_i2 *) ret, (GFC_INTEGER_2 *) source,
+ *along, *pncopies);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_4:
+ if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(source))
+ break;
+ else
+ {
+ spread_scalar_i4 ((gfc_array_i4 *) ret, (GFC_INTEGER_4 *) source,
+ *along, *pncopies);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_8:
+ if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(source))
+ break;
+ else
+ {
+ spread_scalar_i8 ((gfc_array_i8 *) ret, (GFC_INTEGER_8 *) source,
+ *along, *pncopies);
+ return;
+ }
+#ifdef HAVE_GFC_INTEGER_16
+ case GFC_DTYPE_DERIVED_16:
+ if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(source))
+ break;
+ else
+ {
+ spread_scalar_i16 ((gfc_array_i16 *) ret, (GFC_INTEGER_16 *) source,
+ *along, *pncopies);
+ return;
+ }
+#endif
}
spread_internal_scalar (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (ret));
diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c
index 145dd350568..82607bd5897 100644
--- a/libgfortran/intrinsics/unpack_generic.c
+++ b/libgfortran/intrinsics/unpack_generic.c
@@ -196,102 +196,141 @@ void
unpack1 (gfc_array_char *ret, const gfc_array_char *vector,
const gfc_array_l1 *mask, const gfc_array_char *field)
{
- int type;
+ index_type type_size;
index_type size;
- type = GFC_DESCRIPTOR_TYPE (vector);
+ type_size = GFC_DTYPE_TYPE_SIZE (vector);
size = GFC_DESCRIPTOR_SIZE (vector);
- switch(type)
+ switch(type_size)
{
- 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;
+ case GFC_DTYPE_LOGICAL_1:
+ case GFC_DTYPE_INTEGER_1:
+ case GFC_DTYPE_DERIVED_1:
+ unpack1_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) vector,
+ mask, (gfc_array_i1 *) field);
+ return;
+
+ case GFC_DTYPE_LOGICAL_2:
+ case GFC_DTYPE_INTEGER_2:
+ unpack1_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector,
+ mask, (gfc_array_i2 *) field);
+ return;
+
+ case GFC_DTYPE_LOGICAL_4:
+ case GFC_DTYPE_INTEGER_4:
+ unpack1_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector,
+ mask, (gfc_array_i4 *) field);
+ return;
+
+ case GFC_DTYPE_LOGICAL_8:
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_LOGICAL_16:
+ case GFC_DTYPE_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 GFC_DTYPE_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;
+ case GFC_DTYPE_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);
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_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 GFC_DTYPE_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;
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_COMPLEX_16:
+ unpack1_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector,
+ mask, (gfc_array_c16 *) field);
+ return;
#endif
+
+ case GFC_DTYPE_DERIVED_2:
+ if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(vector->data)
+ || GFC_UNALIGNED_2(field->data))
+ break;
+ else
+ {
+ unpack1_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector,
+ mask, (gfc_array_i2 *) field);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_4:
+ if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(vector->data)
+ || GFC_UNALIGNED_4(field->data))
+ break;
+ else
+ {
+ unpack1_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector,
+ mask, (gfc_array_i4 *) field);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_8:
+ if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(vector->data)
+ || GFC_UNALIGNED_8(field->data))
+ break;
+ else
+ {
+ unpack1_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector,
+ mask, (gfc_array_i8 *) field);
+ return;
}
+#ifdef HAVE_GFC_INTEGER_16
+ case GFC_DTYPE_DERIVED_16:
+ if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(vector->data)
+ || GFC_UNALIGNED_16(field->data))
+ break;
+ else
+ {
+ unpack1_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector,
+ mask, (gfc_array_i16 *) field);
+ return;
+ }
+#endif
}
+
unpack_internal (ret, vector, mask, field, size,
GFC_DESCRIPTOR_SIZE (field));
}
@@ -322,102 +361,139 @@ unpack0 (gfc_array_char *ret, const gfc_array_char *vector,
{
gfc_array_char tmp;
- int type;
+ index_type type_size;
index_type size;
- type = GFC_DESCRIPTOR_TYPE (vector);
+ type_size = GFC_DTYPE_TYPE_SIZE (vector);
size = GFC_DESCRIPTOR_SIZE (vector);
- switch(type)
+ switch(type_size)
{
- 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;
+ case GFC_DTYPE_LOGICAL_1:
+ case GFC_DTYPE_INTEGER_1:
+ case GFC_DTYPE_DERIVED_1:
+ unpack0_i1 ((gfc_array_i1 *) ret, (gfc_array_i1 *) vector,
+ mask, (GFC_INTEGER_1 *) field);
+ return;
+
+ case GFC_DTYPE_LOGICAL_2:
+ case GFC_DTYPE_INTEGER_2:
+ unpack0_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector,
+ mask, (GFC_INTEGER_2 *) field);
+ return;
+
+ case GFC_DTYPE_LOGICAL_4:
+ case GFC_DTYPE_INTEGER_4:
+ unpack0_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector,
+ mask, (GFC_INTEGER_4 *) field);
+ return;
+
+ case GFC_DTYPE_LOGICAL_8:
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_LOGICAL_16:
+ case GFC_DTYPE_INTEGER_16:
+ unpack0_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector,
+ mask, (GFC_INTEGER_16 *) field);
+ return;
#endif
- }
+ case GFC_DTYPE_REAL_4:
+ unpack0_r4 ((gfc_array_r4 *) ret, (gfc_array_r4 *) vector,
+ mask, (GFC_REAL_4 *) field);
+ return;
- 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;
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_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 GFC_DTYPE_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;
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_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;
+ case GFC_DTYPE_COMPLEX_16:
+ unpack0_c16 ((gfc_array_c16 *) ret, (gfc_array_c16 *) vector,
+ mask, (GFC_COMPLEX_16 *) field);
+ return;
#endif
+ case GFC_DTYPE_DERIVED_2:
+ if (GFC_UNALIGNED_2(ret->data) || GFC_UNALIGNED_2(vector->data)
+ || GFC_UNALIGNED_2(field))
+ break;
+ else
+ {
+ unpack0_i2 ((gfc_array_i2 *) ret, (gfc_array_i2 *) vector,
+ mask, (GFC_INTEGER_2 *) field);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_4:
+ if (GFC_UNALIGNED_4(ret->data) || GFC_UNALIGNED_4(vector->data)
+ || GFC_UNALIGNED_4(field))
+ break;
+ else
+ {
+ unpack0_i4 ((gfc_array_i4 *) ret, (gfc_array_i4 *) vector,
+ mask, (GFC_INTEGER_4 *) field);
+ return;
+ }
+
+ case GFC_DTYPE_DERIVED_8:
+ if (GFC_UNALIGNED_8(ret->data) || GFC_UNALIGNED_8(vector->data)
+ || GFC_UNALIGNED_8(field))
+ break;
+ else
+ {
+ unpack0_i8 ((gfc_array_i8 *) ret, (gfc_array_i8 *) vector,
+ mask, (GFC_INTEGER_8 *) field);
+ return;
+ }
+#ifdef HAVE_GFC_INTEGER_16
+ case GFC_DTYPE_DERIVED_16:
+ if (GFC_UNALIGNED_16(ret->data) || GFC_UNALIGNED_16(vector->data)
+ || GFC_UNALIGNED_16(field))
+ break;
+ else
+ {
+ unpack0_i16 ((gfc_array_i16 *) ret, (gfc_array_i16 *) vector,
+ mask, (GFC_INTEGER_16 *) field);
+ return;
}
+#endif
}
+
memset (&tmp, 0, sizeof (tmp));
tmp.dtype = 0;
tmp.data = field;