This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

change to real_value_to_decimal


The format argument hasn't been used since we stopped using host
floating point, and thus printf.  The following patch changes
things slightly so that the caller has control of the number of
significant digits generated, as well as a more sensible default.


r~


	* real.c (ereal_to_decimal): Add digits parameter.
	* real.h (REAL_VALUE_TO_DECIMAL): Remove format; add digits parameter.
	* c-pretty-print.c (pp_c_real_literal): Update call.
	* print-rtl.c (print_rtx): Likewise.
	* print-tree.c (print_node_brief, print_node): Likewise.
	* sched-vis.c (print_value): Likewise.
	* config/arc/arc.c (arc_print_operand): Likewise.
	* config/c4x/c4x.c (c4x_print_operand): Likewise.
	* config/i370/i370.h (PRINT_OPERAND): Likewise.
	* config/i386/i386.c (print_operand): Likewise.
	* config/i960/i960.c (i960_print_operand): Likewise.
	* config/ip2k/ip2k.c (asm_output_float): Likewise.
	* config/m32r/m32r.c (m32r_print_operand): Likewise.
	* config/m68hc11/m68hc11.c (print_operand): Likewise.
	* config/m68k/hp320.h (PRINT_OPERAND, ASM_OUTPUT_FLOAT_OPERAND,
	ASM_OUTPUT_DOUBLE_OPERAND, ASM_OUTPUT_LONG_DOUBLE_OPERAND): Likewise.
	* config/m68k/m68k.h (ASM_OUTPUT_FLOAT_OPERAND, 
	ASM_OUTPUT_DOUBLE_OPERAND, ASM_OUTPUT_LONG_DOUBLE_OPERAND): Likewise.
	* config/m68k/sun2o4.h (ASM_OUTPUT_FLOAT_OPERAND,
	ASM_OUTPUT_DOUBLE_OPERAND): Likewise.
	* config/m68k/sun3.h (ASM_OUTPUT_FLOAT_OPERAND,
	ASM_OUTPUT_DOUBLE_OPERAND): Likewise.
	* config/mips/mips.c (print_operand): Likewise.
	* config/ns32k/ns32k.c (print_operand): Likewise.
	* config/pdp11/pdp11.h (PRINT_OPERAND): Likewise.
	* config/vax/vax.h (PRINT_OPERAND): Likewise.
	* doc/tm.texi (REAL_VALUE_TO_DECIMAL): Update docs.

        * f/target.h (ffetarget_print_real1, ffetarget_print_real2): Update
        call to REAL_VALUE_TO_DECIMAL.

Index: gcc/c-pretty-print.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pretty-print.c,v
retrieving revision 1.9
diff -c -p -d -u -r1.9 c-pretty-print.c
--- gcc/c-pretty-print.c	22 Aug 2002 23:22:51 -0000	1.9
+++ gcc/c-pretty-print.c	4 Sep 2002 16:11:13 -0000
@@ -469,8 +469,7 @@ pp_c_real_literal (ppi, r)
      c_pretty_printer ppi;
      tree r;
 {
-  REAL_VALUE_TO_DECIMAL (TREE_REAL_CST (r), "%.16g",
-			 pp_buffer (ppi)->digit_buffer);
+  REAL_VALUE_TO_DECIMAL (TREE_REAL_CST (r), pp_buffer (ppi)->digit_buffer, -1);
   pp_identifier (ppi, pp_buffer(ppi)->digit_buffer);
 }
 
Index: gcc/print-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/print-rtl.c,v
retrieving revision 1.86
diff -c -p -d -u -r1.86 print-rtl.c
--- gcc/print-rtl.c	22 Jul 2002 00:23:47 -0000	1.86
+++ gcc/print-rtl.c	4 Sep 2002 16:11:13 -0000
@@ -524,7 +524,7 @@ print_rtx (in_rtx)
 	  char s[30];
 
 	  REAL_VALUE_FROM_CONST_DOUBLE (val, in_rtx);
-	  REAL_VALUE_TO_DECIMAL (val, "%.16g", s);
+	  REAL_VALUE_TO_DECIMAL (val, s, -1);
 	  fprintf (outfile, " [%s]", s);
 	}
       break;
Index: gcc/print-tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/print-tree.c,v
retrieving revision 1.60
diff -c -p -d -u -r1.60 print-tree.c
--- gcc/print-tree.c	4 Aug 2002 22:45:19 -0000	1.60
+++ gcc/print-tree.c	4 Sep 2002 16:11:13 -0000
@@ -133,7 +133,7 @@ print_node_brief (file, prefix, node, in
 	{
 	  char string[100];
 
-	  REAL_VALUE_TO_DECIMAL (d, "%e", string);
+	  REAL_VALUE_TO_DECIMAL (d, string, -1);
 	  fprintf (file, " %s", string);
 	}
     }
@@ -683,7 +683,7 @@ print_node (file, prefix, node, indent)
 	      {
 		char string[100];
 
-		REAL_VALUE_TO_DECIMAL (d, "%e", string);
+		REAL_VALUE_TO_DECIMAL (d, string, -1);
 		fprintf (file, " %s", string);
 	      }
 	  }
Index: gcc/real.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.c,v
retrieving revision 1.75
diff -c -p -d -u -r1.75 real.c
--- gcc/real.c	12 Aug 2002 15:50:43 -0000	1.75
+++ gcc/real.c	4 Sep 2002 16:11:13 -0000
@@ -1295,7 +1295,7 @@ debug_real (r)
 {
   char dstr[30];
 
-  REAL_VALUE_TO_DECIMAL (r, "%.20g", dstr);
+  REAL_VALUE_TO_DECIMAL (r, dstr, -1);
   fprintf (stderr, "%s", dstr);
 }
 
@@ -1380,17 +1380,70 @@ etarsingle (r)
 /* Convert X to a decimal ASCII string S for output to an assembly
    language file.  Note, there is no standard way to spell infinity or
    a NaN, so these values may require special treatment in the tm.h
-   macros.  */
+   macros. 
+
+   The argument DIGITS is the number of decimal digits to print,
+   or -1 to indicate "enough", i.e. DECIMAL_DIG for for the target.  */
 
 void
-ereal_to_decimal (x, s)
+ereal_to_decimal (x, s, digits)
      REAL_VALUE_TYPE x;
      char *s;
+     int digits;
 {
   UEMUSHORT e[NE];
-
   GET_REAL (&x, e);
-  etoasc (e, s, 20);
+
+  /* Find DECIMAL_DIG for the target.  */
+  if (digits < 0)
+    switch (TARGET_FLOAT_FORMAT)
+      {
+      case IEEE_FLOAT_FORMAT:
+	switch (LONG_DOUBLE_TYPE_SIZE)
+	  {
+	  case 32:
+	    digits = 9;
+	    break;
+	  case 64:
+	    digits = 17;
+	    break;
+	  case 128:
+	    if (!INTEL_EXTENDED_IEEE_FORMAT)
+	      {
+		digits = 36;
+		break;
+	      }
+	    /* FALLTHRU */
+	  case 96:
+	    digits = 21;
+	    break;
+
+	  default:
+	    abort ();
+	  }
+	break;
+
+      case VAX_FLOAT_FORMAT:
+	digits = 18; /* D_FLOAT */
+	break;
+
+      case IBM_FLOAT_FORMAT:
+	digits = 18;
+	break;
+
+      case C4X_FLOAT_FORMAT:
+	digits = 11;
+	break;
+
+      default:
+	abort ();
+      }
+	      
+  /* etoasc interprets digits as places after the decimal point.
+     We interpret digits as total decimal digits, which IMO is
+     more useful.  Since the output will have one digit before
+     the point, subtract one.  */
+  etoasc (e, s, digits - 1);
 }
 
 /* Compare X and Y.  Return 1 if X > Y, 0 if X == Y, -1 if X < Y,
Index: gcc/real.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.h,v
retrieving revision 1.44
diff -c -p -d -u -r1.44 real.h
--- gcc/real.h	4 Jun 2002 07:07:51 -0000	1.44
+++ gcc/real.h	4 Sep 2002 16:11:13 -0000
@@ -154,7 +154,7 @@ extern void etartdouble		PARAMS ((REAL_V
 extern void etarldouble		PARAMS ((REAL_VALUE_TYPE, long *));
 extern void etardouble		PARAMS ((REAL_VALUE_TYPE, long *));
 extern long etarsingle		PARAMS ((REAL_VALUE_TYPE));
-extern void ereal_to_decimal	PARAMS ((REAL_VALUE_TYPE, char *));
+extern void ereal_to_decimal	PARAMS ((REAL_VALUE_TYPE, char *, int));
 extern int ereal_cmp		PARAMS ((REAL_VALUE_TYPE, REAL_VALUE_TYPE));
 extern int ereal_isneg		PARAMS ((REAL_VALUE_TYPE));
 extern REAL_VALUE_TYPE ereal_unto_float PARAMS ((long));
@@ -253,7 +253,7 @@ extern bool exact_real_truncate PARAMS (
 #define REAL_VALUE_FROM_TARGET_SINGLE(f)  (ereal_from_float (f))
 
 /* Conversions to decimal ASCII string.  */
-#define REAL_VALUE_TO_DECIMAL(r, fmt, s) (ereal_to_decimal (r, s))
+#define REAL_VALUE_TO_DECIMAL(r, s, dig) (ereal_to_decimal (r, s, dig))
 
 /* **** End of software floating point emulator interface macros **** */
 
Index: gcc/sched-vis.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/sched-vis.c,v
retrieving revision 1.22
diff -c -p -d -u -r1.22 sched-vis.c
--- gcc/sched-vis.c	11 Jun 2002 12:22:04 -0000	1.22
+++ gcc/sched-vis.c	4 Sep 2002 16:11:13 -0000
@@ -566,7 +566,7 @@ print_value (buf, x, verbose)
 	  REAL_VALUE_TYPE r;
 
 	  REAL_VALUE_FROM_CONST_DOUBLE (r, x);
-	  REAL_VALUE_TO_DECIMAL(r, "%.6e", t);
+	  REAL_VALUE_TO_DECIMAL(r, t, 6);
 	}
       else
 	sprintf (t, "<0x%lx,0x%lx>", (long) XWINT (x, 2), (long) XWINT (x, 3));
Index: gcc/config/arc/arc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arc/arc.c,v
retrieving revision 1.33
diff -c -p -d -u -r1.33 arc.c
--- gcc/config/arc/arc.c	20 Aug 2002 23:26:59 -0000	1.33
+++ gcc/config/arc/arc.c	4 Sep 2002 16:11:13 -0000
@@ -1748,7 +1748,7 @@ arc_print_operand (file, x, code)
 	    || GET_MODE_CLASS (GET_MODE (x)) != MODE_FLOAT)
 	  abort ();
 	REAL_VALUE_FROM_CONST_DOUBLE (d, x);
-	REAL_VALUE_TO_DECIMAL (d, "%.20e", str);
+	REAL_VALUE_TO_DECIMAL (d, str, -1);
 	fprintf (file, "%s", str);
 	return;
       }
Index: gcc/config/c4x/c4x.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/c4x/c4x.c,v
retrieving revision 1.110
diff -c -p -d -u -r1.110 c4x.c
--- gcc/config/c4x/c4x.c	21 Aug 2002 02:41:46 -0000	1.110
+++ gcc/config/c4x/c4x.c	4 Sep 2002 16:11:13 -0000
@@ -1958,7 +1958,7 @@ c4x_print_operand (file, op, letter)
 	REAL_VALUE_TYPE r;
 	
 	REAL_VALUE_FROM_CONST_DOUBLE (r, op);
-	REAL_VALUE_TO_DECIMAL (r, "%20f", str);
+	REAL_VALUE_TO_DECIMAL (r, str, -1);
 	fprintf (file, "%s", str);
       }
       break;
Index: gcc/config/i370/i370.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i370/i370.h,v
retrieving revision 1.50
diff -c -p -d -u -r1.50 i370.h
--- gcc/config/i370/i370.h	21 Aug 2002 02:41:47 -0000	1.50
+++ gcc/config/i370/i370.h	4 Sep 2002 16:11:13 -0000
@@ -1371,7 +1371,7 @@ enum reg_class
             char buf[50];						\
             REAL_VALUE_TYPE rval;					\
             REAL_VALUE_FROM_CONST_DOUBLE(rval, XV);			\
-            REAL_VALUE_TO_DECIMAL (rval, HOST_WIDE_INT_PRINT_DEC, buf);	\
+            REAL_VALUE_TO_DECIMAL (rval, buf, -1);			\
 	    if (GET_MODE (XV) == SFmode)				\
 	      {								\
 		mvs_page_lit += 4;					\
@@ -1665,7 +1665,7 @@ enum reg_class
             char buf[50];						\
             REAL_VALUE_TYPE rval;					\
             REAL_VALUE_FROM_CONST_DOUBLE(rval, XV);			\
-            REAL_VALUE_TO_DECIMAL (rval, HOST_WIDE_INT_PRINT_DEC, buf);	\
+            REAL_VALUE_TO_DECIMAL (rval, buf, -1);			\
 	    if (GET_MODE (XV) == SFmode)				\
 	      {								\
 		mvs_page_lit += 4;					\
Index: gcc/config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.450
diff -c -p -d -u -r1.450 i386.c
--- gcc/config/i386/i386.c	27 Aug 2002 17:52:41 -0000	1.450
+++ gcc/config/i386/i386.c	4 Sep 2002 16:11:14 -0000
@@ -6610,7 +6610,7 @@ print_operand (file, x, code)
       char dstr[30];
 
       REAL_VALUE_FROM_CONST_DOUBLE (r, x);
-      REAL_VALUE_TO_DECIMAL (r, "%.22e", dstr);
+      REAL_VALUE_TO_DECIMAL (r, dstr, -1);
       fprintf (file, "%s", dstr);
     }
 
@@ -6621,7 +6621,7 @@ print_operand (file, x, code)
       char dstr[30];
 
       REAL_VALUE_FROM_CONST_DOUBLE (r, x);
-      REAL_VALUE_TO_DECIMAL (r, "%.22e", dstr);
+      REAL_VALUE_TO_DECIMAL (r, dstr, -1);
       fprintf (file, "%s", dstr);
     }
 
Index: gcc/config/i960/i960.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i960/i960.c,v
retrieving revision 1.39
diff -c -p -d -u -r1.39 i960.c
--- gcc/config/i960/i960.c	16 Jul 2002 20:58:59 -0000	1.39
+++ gcc/config/i960/i960.c	4 Sep 2002 16:11:14 -0000
@@ -1761,7 +1761,7 @@ i960_print_operand (file, x, code)
 	}
 
       REAL_VALUE_FROM_CONST_DOUBLE (d, x);
-      REAL_VALUE_TO_DECIMAL (d, "%#g", dstr);
+      REAL_VALUE_TO_DECIMAL (d, dstr, -1);
       fprintf (file, "0f%s", dstr);
       return;
     }
Index: gcc/config/ip2k/ip2k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ip2k/ip2k.c,v
retrieving revision 1.7
diff -c -p -d -u -r1.7 ip2k.c
--- gcc/config/ip2k/ip2k.c	30 Aug 2002 18:31:44 -0000	1.7
+++ gcc/config/ip2k/ip2k.c	4 Sep 2002 16:11:14 -0000
@@ -3058,7 +3058,7 @@ asm_output_float (file, n)
   char dstr[100];
   
   REAL_VALUE_TO_TARGET_SINGLE (n, val);
-  REAL_VALUE_TO_DECIMAL (n, "%g", dstr);
+  REAL_VALUE_TO_DECIMAL (n, dstr, -1);
   fprintf (file, "\t.long 0x%08lx\t/* %s */\n",val, dstr);
 }
 
Index: gcc/config/m32r/m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.53
diff -c -p -d -u -r1.53 m32r.c
--- gcc/config/m32r/m32r.c	11 Aug 2002 18:48:51 -0000	1.53
+++ gcc/config/m32r/m32r.c	4 Sep 2002 16:11:14 -0000
@@ -2318,7 +2318,7 @@ m32r_print_operand (file, x, code)
 	    || GET_MODE_CLASS (GET_MODE (x)) != MODE_FLOAT)
 	  fatal_insn ("bad insn for 'A'", x);
 	REAL_VALUE_FROM_CONST_DOUBLE (d, x);
-	REAL_VALUE_TO_DECIMAL (d, "%.20e", str);
+	REAL_VALUE_TO_DECIMAL (d, str, -1);
 	fprintf (file, "%s", str);
 	return;
       }
Index: gcc/config/m68hc11/m68hc11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.c,v
retrieving revision 1.54
diff -c -p -d -u -r1.54 m68hc11.c
--- gcc/config/m68hc11/m68hc11.c	20 Aug 2002 23:27:02 -0000	1.54
+++ gcc/config/m68hc11/m68hc11.c	4 Sep 2002 16:11:14 -0000
@@ -2264,7 +2264,7 @@ print_operand (file, op, letter)
       char dstr[30];
 
       REAL_VALUE_FROM_CONST_DOUBLE (r, op);
-      REAL_VALUE_TO_DECIMAL (r, "%.20g", dstr);
+      REAL_VALUE_TO_DECIMAL (r, dstr, -1);
       asm_fprintf (file, "%I0r%s", dstr);
     }
   else
Index: gcc/config/m68k/hp320.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/hp320.h,v
retrieving revision 1.18
diff -c -p -d -u -r1.18 hp320.h
--- gcc/config/m68k/hp320.h	18 May 2002 19:27:46 -0000	1.18
+++ gcc/config/m68k/hp320.h	4 Sep 2002 16:11:14 -0000
@@ -300,7 +300,7 @@ do {					\
       if (CODE == 'f')						\
         {							\
           char dstr[30];					\
-          REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr);		\
+          REAL_VALUE_TO_DECIMAL (VALUE, dstr, 9);		\
           fprintf ((FILE), "&0f%s", dstr);			\
         }							\
       else							\
@@ -317,7 +317,7 @@ do {					\
 #undef ASM_OUTPUT_DOUBLE_OPERAND
 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)				\
  do { char dstr[30];							\
-      REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);			\
+      REAL_VALUE_TO_DECIMAL (VALUE, dstr, -1);				\
       fprintf (FILE, "&0f%s", dstr);					\
     } while (0)
 
@@ -326,7 +326,7 @@ do {					\
 #undef ASM_OUTPUT_LONG_DOUBLE_OPERAND
 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE)			\
  do { char dstr[30];							\
-      REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);			\
+      REAL_VALUE_TO_DECIMAL (VALUE, dstr, -1);				\
       fprintf (FILE, "&0f%s", dstr);					\
     } while (0)
 
@@ -354,12 +354,12 @@ do {					\
   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode)	\
     { REAL_VALUE_TYPE r;  char dstr[30];				\
       REAL_VALUE_FROM_CONST_DOUBLE (r, X);				\
-      REAL_VALUE_TO_DECIMAL (r, "%.20g", dstr);				\
+      REAL_VALUE_TO_DECIMAL (r, dstr, -1);				\
       fprintf (FILE, "&0f%s", dstr); }					\
   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == XFmode)	\
     { REAL_VALUE_TYPE r;  char dstr[30];				\
       REAL_VALUE_FROM_CONST_DOUBLE (r, X);				\
-      REAL_VALUE_TO_DECIMAL (r, "%.20g", dstr);				\
+      REAL_VALUE_TO_DECIMAL (r, dstr, -1);				\
       fprintf (FILE, "&0f%s", dstr); }					\
   else { putc ('&', FILE); output_addr_const (FILE, X); }}
 #endif
Index: gcc/config/m68k/m68k.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.h,v
retrieving revision 1.76
diff -c -p -d -u -r1.76 m68k.h
--- gcc/config/m68k/m68k.h	3 Sep 2002 20:21:35 -0000	1.76
+++ gcc/config/m68k/m68k.h	4 Sep 2002 16:11:14 -0000
@@ -1831,7 +1831,7 @@ __transfer_from_trampoline ()					\
       if (CODE == 'f')						\
         {							\
           char dstr[30];					\
-          REAL_VALUE_TO_DECIMAL (VALUE, "%.9g", dstr);		\
+          REAL_VALUE_TO_DECIMAL (VALUE, dstr, 9);		\
           asm_fprintf ((FILE), "%I0r%s", dstr);			\
         }							\
       else							\
@@ -1846,7 +1846,7 @@ __transfer_from_trampoline ()					\
    This macro is a 68k-specific macro.  */
 #define ASM_OUTPUT_DOUBLE_OPERAND(FILE,VALUE)				\
  do { char dstr[30];							\
-      REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);			\
+      REAL_VALUE_TO_DECIMAL (VALUE, dstr, -1);				\
       asm_fprintf (FILE, "%I0r%s", dstr);				\
     } while (0)
 
@@ -1854,7 +1854,7 @@ __transfer_from_trampoline ()					\
    generated by m68k.md.  */
 #define ASM_OUTPUT_LONG_DOUBLE_OPERAND(FILE,VALUE)			\
  do { char dstr[30];							\
-      REAL_VALUE_TO_DECIMAL (VALUE, "%.20g", dstr);			\
+      REAL_VALUE_TO_DECIMAL (VALUE, dstr, -1);				\
       asm_fprintf (FILE, "%I0r%s", dstr);				\
     } while (0)
 
Index: gcc/config/m68k/sun2o4.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/sun2o4.h,v
retrieving revision 1.4
diff -c -p -d -u -r1.4 sun2o4.h
--- gcc/config/m68k/sun2o4.h	20 Dec 2001 17:36:36 -0000	1.4
+++ gcc/config/m68k/sun2o4.h	4 Sep 2002 16:11:14 -0000
@@ -121,7 +121,7 @@ Boston, MA 02111-1307, USA.  */
         }							\
       else							\
         { char dstr[30];					\
-          REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);	\
+          REAL_VALUE_TO_DECIMAL ((VALUE), dstr, 9);		\
           fprintf (FILE, "#0r%s", dstr);			\
         }							\
     } while (0)
@@ -141,7 +141,7 @@ Boston, MA 02111-1307, USA.  */
         }								\
       else								\
         { char dstr[30];						\
-          REAL_VALUE_TO_DECIMAL ((VALUE), "%.20g", dstr);		\
+          REAL_VALUE_TO_DECIMAL ((VALUE), dstr, -1);			\
           fprintf (FILE, "#0r%s", dstr);				\
         }								\
     } while (0)
Index: gcc/config/m68k/sun3.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/sun3.h,v
retrieving revision 1.11
diff -c -p -d -u -r1.11 sun3.h
--- gcc/config/m68k/sun3.h	29 Aug 2002 21:40:13 -0000	1.11
+++ gcc/config/m68k/sun3.h	4 Sep 2002 16:11:14 -0000
@@ -208,7 +208,7 @@ Boston, MA 02111-1307, USA.  */
         }							\
       else							\
         { char dstr[30];					\
-          REAL_VALUE_TO_DECIMAL ((VALUE), "%.9g", dstr);	\
+          REAL_VALUE_TO_DECIMAL ((VALUE), dstr, 9);		\
           asm_fprintf (FILE, "%I0r%s", dstr);			\
         }							\
     } while (0)
@@ -228,7 +228,7 @@ Boston, MA 02111-1307, USA.  */
         }								\
       else								\
         { char dstr[30];						\
-          REAL_VALUE_TO_DECIMAL ((VALUE), "%.17g", dstr);		\
+          REAL_VALUE_TO_DECIMAL ((VALUE), dstr, -1);			\
           asm_fprintf (FILE, "%I0r%s", dstr);				\
         }								\
     } while (0)
Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.225
diff -c -p -d -u -r1.225 mips.c
--- gcc/config/mips/mips.c	20 Aug 2002 21:53:28 -0000	1.225
+++ gcc/config/mips/mips.c	4 Sep 2002 16:11:14 -0000
@@ -5888,7 +5888,7 @@ print_operand (file, op, letter)
       char s[30];
 
       REAL_VALUE_FROM_CONST_DOUBLE (d, op);
-      REAL_VALUE_TO_DECIMAL (d, "%.20e", s);
+      REAL_VALUE_TO_DECIMAL (d, s, -1);
       fprintf (file, s);
     }
 
Index: gcc/config/ns32k/ns32k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ns32k/ns32k.c,v
retrieving revision 1.29
diff -c -p -d -u -r1.29 ns32k.c
--- gcc/config/ns32k/ns32k.c	23 Aug 2002 17:35:23 -0000	1.29
+++ gcc/config/ns32k/ns32k.c	4 Sep 2002 16:11:14 -0000
@@ -1134,7 +1134,7 @@ print_operand (file, x, code)
 		   CONST_DOUBLE_HIGH (x), CONST_DOUBLE_LOW (x));
 #else
 	  char s[30];
-	  REAL_VALUE_TO_DECIMAL (r, "%.20e", s);
+	  REAL_VALUE_TO_DECIMAL (r, s, -1);
 #ifdef ENCORE_ASM
 	  fprintf (file, "0f%s", s);
 #else
@@ -1150,7 +1150,7 @@ print_operand (file, x, code)
 	  fprintf (file, "0Fx%08lx", l);
 #else
 	  char s[30];
-	  REAL_VALUE_TO_DECIMAL (r, "%.20e", s);
+	  REAL_VALUE_TO_DECIMAL (r, s, -1);
 	  fprintf (file, "0f%s", s);
 #endif
 	}
Index: gcc/config/pdp11/pdp11.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/pdp11/pdp11.h,v
retrieving revision 1.41
diff -c -p -d -u -r1.41 pdp11.h
--- gcc/config/pdp11/pdp11.h	31 Jul 2002 02:13:33 -0000	1.41
+++ gcc/config/pdp11/pdp11.h	4 Sep 2002 16:11:14 -0000
@@ -1128,7 +1128,7 @@ fprintf (FILE, "$help$: . = .+8 ; space 
     { REAL_VALUE_TYPE r;						\
       char buf[30];							\
       REAL_VALUE_FROM_CONST_DOUBLE (r, X);				\
-      REAL_VALUE_TO_DECIMAL (r, "%.20e", buf);				\
+      REAL_VALUE_TO_DECIMAL (r, buf, -1);				\
       fprintf (FILE, "#%s", buf); }					\
   else { putc ('$', FILE); output_addr_const_pdp11 (FILE, X); }}
 
Index: gcc/config/vax/vax.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/vax/vax.h,v
retrieving revision 1.44
diff -c -p -d -u -r1.44 vax.h
--- gcc/config/vax/vax.h	29 Aug 2002 21:40:18 -0000	1.44
+++ gcc/config/vax/vax.h	4 Sep 2002 16:11:14 -0000
@@ -1207,12 +1207,12 @@ VAX operand formatting codes:
   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == SFmode)	\
     { REAL_VALUE_TYPE r; char dstr[30];					\
       REAL_VALUE_FROM_CONST_DOUBLE (r, X);				\
-      REAL_VALUE_TO_DECIMAL (r, "%.20e", dstr);				\
+      REAL_VALUE_TO_DECIMAL (r, dstr, -1);				\
       fprintf (FILE, "$0f%s", dstr); }					\
   else if (GET_CODE (X) == CONST_DOUBLE && GET_MODE (X) == DFmode)	\
     { REAL_VALUE_TYPE r; char dstr[30];					\
       REAL_VALUE_FROM_CONST_DOUBLE (r, X);				\
-      REAL_VALUE_TO_DECIMAL (r, "%.20e", dstr);				\
+      REAL_VALUE_TO_DECIMAL (r, dstr, -1);				\
       fprintf (FILE, "$0%c%s", ASM_DOUBLE_CHAR, dstr); }		\
   else { putc ('$', FILE); output_addr_const (FILE, X); }}
 
Index: gcc/doc/tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.161
diff -c -p -d -u -r1.161 tm.texi
--- gcc/doc/tm.texi	3 Sep 2002 20:21:35 -0000	1.161
+++ gcc/doc/tm.texi	4 Sep 2002 16:11:15 -0000
@@ -6313,15 +6313,16 @@ The array element values are designed so
 using @code{fprintf} in the order they should appear in the target
 machine's memory.
 
-@item REAL_VALUE_TO_DECIMAL (@var{x}, @var{format}, @var{string})
+@item REAL_VALUE_TO_DECIMAL (@var{x}, @var{string}, @var{digits})
 @findex REAL_VALUE_TO_DECIMAL
 This macro converts @var{x}, of type @code{REAL_VALUE_TYPE}, to a
 decimal number and stores it as a string into @var{string}.
 You must pass, as @var{string}, the address of a long enough block
 of space to hold the result.
 
-The argument @var{format} is a @code{printf}-specification that serves
-as a suggestion for how to format the output string.
+The argument @var{digits} is the number of decimal digits to print,
+or @minus{}1 to indicate ``enough'', i.e. @code{DECIMAL_DIG} for
+for the target.
 @end table
 
 @node Uninitialized Data
Index: gcc/f/target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/f/target.h,v
retrieving revision 1.17
diff -c -p -d -u -r1.17 target.h
--- gcc/f/target.h	30 Aug 2002 00:40:12 -0000	1.17
+++ gcc/f/target.h	4 Sep 2002 16:11:15 -0000
@@ -1493,13 +1493,13 @@ void *ffetarget_memcpy_ (void *dst, void
 #define ffetarget_print_real1(f,l) \
   ({ REAL_VALUE_TYPE lr; \
      lr = ffetarget_cvt_r1_to_rv_ ((l)); \
-     REAL_VALUE_TO_DECIMAL (lr, bad_fmt_val??, ffetarget_string_); \
+     REAL_VALUE_TO_DECIMAL (lr, ffetarget_string_, -1); \
      fputs (ffetarget_string_, (f)); \
    })
 #define ffetarget_print_real2(f,l) \
   ({ REAL_VALUE_TYPE lr; \
      lr = ffetarget_cvt_r2_to_rv_ (&((l).v[0])); \
-     REAL_VALUE_TO_DECIMAL (lr, bad_fmt_val??, ffetarget_string_); \
+     REAL_VALUE_TO_DECIMAL (lr, ffetarget_string_, -1); \
      fputs (ffetarget_string_, (f)); \
    })
 #define ffetarget_real1_one(res) ffetarget_cvt_rv_to_r1_ (dconst1, *(res))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]