This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Avoid explicit use of machine modes (5/n) Fortran
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 29 Sep 2003 15:17:34 -0700
- Subject: Avoid explicit use of machine modes (5/n) Fortran
f/target.[ch] do horrible things with REAL_VALUE_TYPE quantities which
I am not going to try to clean up. This is the minimal change that
produces the property I care about, viz. that ??mode constants are not
used directly.
If there were a REAL_VALUE_FROM_INT interface equivalent that went
straight to the internal form and didn't take a mode argument (as
there is for real_from_string etc) the calls to get_mode_for_size
would be unnecessary.
zw
f:
* target.c (FFETARGET_ATOF_): Delete.
(ffetarget_real1, ffetarget_real2): Use real_from_string directly.
* target.h (FFETARGET_REAL_VALUE_FROM_INT_,
FFETARGET_REAL_VALUE_FROM_LONGLONG_): Use mode_for_size,
don't refer to SFmode or DFmode directly.
===================================================================
Index: f/target.c
--- f/target.c 19 Jul 2003 16:09:39 -0000 1.23
+++ f/target.c 29 Sep 2003 22:20:30 -0000
@@ -105,11 +105,6 @@ static void ffetarget_print_char_ (FILE
/* Internal macros. */
-#ifdef REAL_VALUE_ATOF
-#define FFETARGET_ATOF_(p,m) REAL_VALUE_ATOF ((p),(m))
-#else
-#define FFETARGET_ATOF_(p,m) atof ((p))
-#endif
/* ffetarget_print_char_ -- Print a single character (in apostrophe context)
@@ -2279,7 +2274,7 @@ ffetarget_real1 (ffetargetReal1 *value,
{
REAL_VALUE_TYPE rv;
- rv = FFETARGET_ATOF_ (ptr, SFmode);
+ real_from_string (&rv, ptr);
ffetarget_make_real1 (value, rv);
}
@@ -2367,7 +2362,7 @@ ffetarget_real2 (ffetargetReal2 *value,
{
REAL_VALUE_TYPE rv;
- rv = FFETARGET_ATOF_ (ptr, DFmode);
+ real_from_string (&rv, ptr);
ffetarget_make_real2 (value, rv);
}
===================================================================
Index: f/target.h
--- f/target.h 8 Jun 2003 12:22:25 -0000 1.24
+++ f/target.h 29 Sep 2003 22:16:48 -0000
@@ -579,13 +579,13 @@ void *ffetarget_memcpy_ (void *dst, void
#define FFETARGET_REAL_VALUE_FROM_INT_(resr, lf, kt) \
REAL_VALUE_FROM_INT (resr, (HOST_WIDE_INT) lf, \
(HOST_WIDE_INT) ((lf < 0) ? -1 : 0), \
- ((kt == 1) ? SFmode : DFmode))
+ mode_for_size (kt == 1 ? 32 : 64, MODE_FLOAT, 0))
#if HOST_BITS_PER_LONGLONG > HOST_BITS_PER_WIDE_INT
#define FFETARGET_REAL_VALUE_FROM_LONGLONG_(resr, lf, kt) \
REAL_VALUE_FROM_INT (resr, (HOST_WIDE_INT) lf, \
(HOST_WIDE_INT) (lf >> HOST_BITS_PER_WIDE_INT), \
- ((kt == 1) ? SFmode : DFmode))
+ mode_for_size (kt == 1 ? 32 : 64, MODE_FLOAT, 0))
#define FFETARGET_LONGLONG_FROM_INTS_(hi, lo) \
(((long long int) hi << HOST_BITS_PER_WIDE_INT) \
| (long long int) ((unsigned HOST_WIDE_INT) lo))