summaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-18 12:00:20 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-18 12:00:20 +0000
commit16d6b8e40280dfe7bec4376860ad7099e4235d3b (patch)
tree3ff478ceec1d56183aae95bb81a5d30776bd1ff4 /libgfortran/intrinsics
parentd1743da1fffc7986bd0d6dfd363f1ee840f89629 (diff)
downloadgcc-16d6b8e40280dfe7bec4376860ad7099e4235d3b.tar.gz
* runtime/select.c: Moved content to select_inc.c. Include it.
Add macros for different character types. * runtime/select_inc.c: New file. * runtime/convert_char.c: New file. * intrinsics/pack_generic.c (pack_char4, pack_s_char4): New functions. * intrinsics/transpose_generic.c (transpose_char4): New function. * intrinsics/spread_generic.c (spread_char4, spread_char4_scalar): New functions. * intrinsics/unpack_generic.c (unpack1_char4, unpack0_char4): New functions. * intrinsics/reshape_generic.c (reshape_char): Use gfc_charlen_type as type for length variables. (reshape_char4): New function. * gfortran.map (GFORTRAN_1.1): Add _gfortran_select_string_char4, _gfortran_convert_char1_to_char4, _gfortran_convert_char4_to_char1, _gfortran_transpose_char4, _gfortran_spread_char4, _gfortran_spread_char4_scalar, _gfortran_reshape_char4, _gfortran_pack_char4, _gfortran_pack_s_char4, _gfortran_unpack0_char4 and _gfortran_unpack1_char4. * Makefile.am: Add runtime/convert_char.c. * Makefile.in: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@135496 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r--libgfortran/intrinsics/pack_generic.c37
-rw-r--r--libgfortran/intrinsics/reshape_generic.c29
-rw-r--r--libgfortran/intrinsics/spread_generic.c36
-rw-r--r--libgfortran/intrinsics/transpose_generic.c15
-rw-r--r--libgfortran/intrinsics/unpack_generic.c44
5 files changed, 155 insertions, 6 deletions
diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c
index bb4abaeae4b..8f1e08cc2df 100644
--- a/libgfortran/intrinsics/pack_generic.c
+++ b/libgfortran/intrinsics/pack_generic.c
@@ -457,6 +457,7 @@ pack (gfc_array_char *ret, const gfc_array_char *array,
pack_internal (ret, array, mask, vector, size);
}
+
extern void pack_char (gfc_array_char *, GFC_INTEGER_4, const gfc_array_char *,
const gfc_array_l1 *, const gfc_array_char *,
GFC_INTEGER_4, GFC_INTEGER_4);
@@ -472,6 +473,23 @@ pack_char (gfc_array_char *ret,
pack_internal (ret, array, mask, vector, array_length);
}
+
+extern void pack_char4 (gfc_array_char *, GFC_INTEGER_4, const gfc_array_char *,
+ const gfc_array_l1 *, const gfc_array_char *,
+ GFC_INTEGER_4, GFC_INTEGER_4);
+export_proto(pack_char4);
+
+void
+pack_char4 (gfc_array_char *ret,
+ GFC_INTEGER_4 ret_length __attribute__((unused)),
+ const gfc_array_char *array, const gfc_array_l1 *mask,
+ const gfc_array_char *vector, GFC_INTEGER_4 array_length,
+ GFC_INTEGER_4 vector_length __attribute__((unused)))
+{
+ pack_internal (ret, array, mask, vector, array_length * sizeof (gfc_char4_t));
+}
+
+
static void
pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
const GFC_LOGICAL_4 *mask, const gfc_array_char *vector,
@@ -641,6 +659,7 @@ pack_s (gfc_array_char *ret, const gfc_array_char *array,
pack_s_internal (ret, array, mask, vector, GFC_DESCRIPTOR_SIZE (array));
}
+
extern void pack_s_char (gfc_array_char *ret, GFC_INTEGER_4,
const gfc_array_char *array, const GFC_LOGICAL_4 *,
const gfc_array_char *, GFC_INTEGER_4,
@@ -656,3 +675,21 @@ pack_s_char (gfc_array_char *ret,
{
pack_s_internal (ret, array, mask, vector, array_length);
}
+
+
+extern void pack_s_char4 (gfc_array_char *ret, GFC_INTEGER_4,
+ const gfc_array_char *array, const GFC_LOGICAL_4 *,
+ const gfc_array_char *, GFC_INTEGER_4,
+ GFC_INTEGER_4);
+export_proto(pack_s_char4);
+
+void
+pack_s_char4 (gfc_array_char *ret,
+ GFC_INTEGER_4 ret_length __attribute__((unused)),
+ const gfc_array_char *array, const GFC_LOGICAL_4 *mask,
+ const gfc_array_char *vector, GFC_INTEGER_4 array_length,
+ GFC_INTEGER_4 vector_length __attribute__((unused)))
+{
+ pack_s_internal (ret, array, mask, vector,
+ array_length * sizeof (gfc_char4_t));
+}
diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c
index e28ed69feba..ad823513ec4 100644
--- a/libgfortran/intrinsics/reshape_generic.c
+++ b/libgfortran/intrinsics/reshape_generic.c
@@ -298,16 +298,33 @@ reshape (parray *ret, parray *source, shape_type *shape, parray *pad,
GFC_DESCRIPTOR_SIZE (source));
}
-extern void reshape_char (parray *, GFC_INTEGER_4, parray *, shape_type *,
- parray *, shape_type *, GFC_INTEGER_4,
- GFC_INTEGER_4);
+
+extern void reshape_char (parray *, gfc_charlen_type, parray *, shape_type *,
+ parray *, shape_type *, gfc_charlen_type,
+ gfc_charlen_type);
export_proto(reshape_char);
void
-reshape_char (parray *ret, GFC_INTEGER_4 ret_length __attribute__((unused)),
+reshape_char (parray *ret, gfc_charlen_type ret_length __attribute__((unused)),
parray *source, shape_type *shape, parray *pad,
- shape_type *order, GFC_INTEGER_4 source_length,
- GFC_INTEGER_4 pad_length __attribute__((unused)))
+ shape_type *order, gfc_charlen_type source_length,
+ gfc_charlen_type pad_length __attribute__((unused)))
{
reshape_internal (ret, source, shape, pad, order, source_length);
}
+
+
+extern void reshape_char4 (parray *, gfc_charlen_type, parray *, shape_type *,
+ parray *, shape_type *, gfc_charlen_type,
+ gfc_charlen_type);
+export_proto(reshape_char4);
+
+void
+reshape_char4 (parray *ret, gfc_charlen_type ret_length __attribute__((unused)),
+ parray *source, shape_type *shape, parray *pad,
+ shape_type *order, gfc_charlen_type source_length,
+ gfc_charlen_type pad_length __attribute__((unused)))
+{
+ reshape_internal (ret, source, shape, pad, order,
+ source_length * sizeof (gfc_char4_t));
+}
diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c
index e37b6e10bbc..68ea6b169c4 100644
--- a/libgfortran/intrinsics/spread_generic.c
+++ b/libgfortran/intrinsics/spread_generic.c
@@ -408,6 +408,7 @@ spread (gfc_array_char *ret, const gfc_array_char *source,
spread_internal (ret, source, along, pncopies, GFC_DESCRIPTOR_SIZE (source));
}
+
extern void spread_char (gfc_array_char *, GFC_INTEGER_4,
const gfc_array_char *, const index_type *,
const index_type *, GFC_INTEGER_4);
@@ -422,6 +423,23 @@ spread_char (gfc_array_char *ret,
spread_internal (ret, source, along, pncopies, source_length);
}
+
+extern void spread_char4 (gfc_array_char *, GFC_INTEGER_4,
+ const gfc_array_char *, const index_type *,
+ const index_type *, GFC_INTEGER_4);
+export_proto(spread_char4);
+
+void
+spread_char4 (gfc_array_char *ret,
+ GFC_INTEGER_4 ret_length __attribute__((unused)),
+ const gfc_array_char *source, const index_type *along,
+ const index_type *pncopies, GFC_INTEGER_4 source_length)
+{
+ spread_internal (ret, source, along, pncopies,
+ source_length * sizeof (gfc_char4_t));
+}
+
+
/* The following are the prototypes for the versions of spread with a
scalar source. */
@@ -584,3 +602,21 @@ spread_char_scalar (gfc_array_char *ret,
spread_internal_scalar (ret, source, along, pncopies, source_length);
}
+
+extern void spread_char4_scalar (gfc_array_char *, GFC_INTEGER_4,
+ const char *, const index_type *,
+ const index_type *, GFC_INTEGER_4);
+export_proto(spread_char4_scalar);
+
+void
+spread_char4_scalar (gfc_array_char *ret,
+ GFC_INTEGER_4 ret_length __attribute__((unused)),
+ const char *source, const index_type *along,
+ const index_type *pncopies, GFC_INTEGER_4 source_length)
+{
+ if (!ret->dtype)
+ runtime_error ("return array missing descriptor in spread()");
+ spread_internal_scalar (ret, source, along, pncopies,
+ source_length * sizeof (gfc_char4_t));
+}
+
diff --git a/libgfortran/intrinsics/transpose_generic.c b/libgfortran/intrinsics/transpose_generic.c
index 97b97133698..5b1929ca55d 100644
--- a/libgfortran/intrinsics/transpose_generic.c
+++ b/libgfortran/intrinsics/transpose_generic.c
@@ -94,6 +94,7 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source,
}
}
+
extern void transpose (gfc_array_char *, gfc_array_char *);
export_proto(transpose);
@@ -103,6 +104,7 @@ transpose (gfc_array_char *ret, gfc_array_char *source)
transpose_internal (ret, source, GFC_DESCRIPTOR_SIZE (source));
}
+
extern void transpose_char (gfc_array_char *, GFC_INTEGER_4,
gfc_array_char *, GFC_INTEGER_4);
export_proto(transpose_char);
@@ -114,3 +116,16 @@ transpose_char (gfc_array_char *ret,
{
transpose_internal (ret, source, source_length);
}
+
+
+extern void transpose_char4 (gfc_array_char *, GFC_INTEGER_4,
+ gfc_array_char *, GFC_INTEGER_4);
+export_proto(transpose_char4);
+
+void
+transpose_char4 (gfc_array_char *ret,
+ GFC_INTEGER_4 ret_length __attribute__((unused)),
+ gfc_array_char *source, GFC_INTEGER_4 source_length)
+{
+ transpose_internal (ret, source, source_length * sizeof (gfc_char4_t));
+}
diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c
index 82607bd5897..86cef6725d2 100644
--- a/libgfortran/intrinsics/unpack_generic.c
+++ b/libgfortran/intrinsics/unpack_generic.c
@@ -335,6 +335,7 @@ unpack1 (gfc_array_char *ret, const gfc_array_char *vector,
GFC_DESCRIPTOR_SIZE (field));
}
+
extern void unpack1_char (gfc_array_char *, GFC_INTEGER_4,
const gfc_array_char *, const gfc_array_l1 *,
const gfc_array_char *, GFC_INTEGER_4,
@@ -351,6 +352,26 @@ unpack1_char (gfc_array_char *ret,
unpack_internal (ret, vector, mask, field, vector_length, field_length);
}
+
+extern void unpack1_char4 (gfc_array_char *, GFC_INTEGER_4,
+ const gfc_array_char *, const gfc_array_l1 *,
+ const gfc_array_char *, GFC_INTEGER_4,
+ GFC_INTEGER_4);
+export_proto(unpack1_char4);
+
+void
+unpack1_char4 (gfc_array_char *ret,
+ GFC_INTEGER_4 ret_length __attribute__((unused)),
+ const gfc_array_char *vector, const gfc_array_l1 *mask,
+ const gfc_array_char *field, GFC_INTEGER_4 vector_length,
+ GFC_INTEGER_4 field_length)
+{
+ unpack_internal (ret, vector, mask, field,
+ vector_length * sizeof (gfc_char4_t),
+ field_length * sizeof (gfc_char4_t));
+}
+
+
extern void unpack0 (gfc_array_char *, const gfc_array_char *,
const gfc_array_l1 *, char *);
export_proto(unpack0);
@@ -500,6 +521,7 @@ unpack0 (gfc_array_char *ret, const gfc_array_char *vector,
unpack_internal (ret, vector, mask, &tmp, GFC_DESCRIPTOR_SIZE (vector), 0);
}
+
extern void unpack0_char (gfc_array_char *, GFC_INTEGER_4,
const gfc_array_char *, const gfc_array_l1 *,
char *, GFC_INTEGER_4, GFC_INTEGER_4);
@@ -519,3 +541,25 @@ unpack0_char (gfc_array_char *ret,
tmp.data = field;
unpack_internal (ret, vector, mask, &tmp, vector_length, 0);
}
+
+
+extern void unpack0_char4 (gfc_array_char *, GFC_INTEGER_4,
+ const gfc_array_char *, const gfc_array_l1 *,
+ char *, GFC_INTEGER_4, GFC_INTEGER_4);
+export_proto(unpack0_char4);
+
+void
+unpack0_char4 (gfc_array_char *ret,
+ GFC_INTEGER_4 ret_length __attribute__((unused)),
+ const gfc_array_char *vector, const gfc_array_l1 *mask,
+ char *field, GFC_INTEGER_4 vector_length,
+ GFC_INTEGER_4 field_length __attribute__((unused)))
+{
+ gfc_array_char tmp;
+
+ memset (&tmp, 0, sizeof (tmp));
+ tmp.dtype = 0;
+ tmp.data = field;
+ unpack_internal (ret, vector, mask, &tmp,
+ vector_length * sizeof (gfc_char4_t), 0);
+}