]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
real.c (ereal_to_decimal): Add digits parameter.
authorRichard Henderson <rth@redhat.com>
Wed, 4 Sep 2002 16:24:24 +0000 (09:24 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 4 Sep 2002 16:24:24 +0000 (09:24 -0700)
* 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.

From-SVN: r56798

26 files changed:
gcc/ChangeLog
gcc/c-pretty-print.c
gcc/config/arc/arc.c
gcc/config/c4x/c4x.c
gcc/config/i370/i370.h
gcc/config/i386/i386.c
gcc/config/i960/i960.c
gcc/config/ip2k/ip2k.c
gcc/config/m32r/m32r.c
gcc/config/m68hc11/m68hc11.c
gcc/config/m68k/hp320.h
gcc/config/m68k/m68k.h
gcc/config/m68k/sun2o4.h
gcc/config/m68k/sun3.h
gcc/config/mips/mips.c
gcc/config/ns32k/ns32k.c
gcc/config/pdp11/pdp11.h
gcc/config/vax/vax.h
gcc/doc/tm.texi
gcc/f/ChangeLog
gcc/f/target.h
gcc/print-rtl.c
gcc/print-tree.c
gcc/real.c
gcc/real.h
gcc/sched-vis.c

index dc248d883521d0cd266a8422314db2e1dc9596d3..a289e8aff3214e2b29128b6bcbddb130895af442 100644 (file)
@@ -1,3 +1,33 @@
+2002-09-04  Richard Henderson  <rth@redhat.com>
+
+       * 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.
+
 2002-09-04  Bob Wilson  <bob.wilson@acm.org>
 
        * config/xtensa/elf.h (TARGET_SECTION_TYPE_FLAGS): Define to
index 1ab0569b6a4fd7a8c5e00398644797c573226f82..5d9151691cde3f3365af45d43b9a00170f736d14 100644 (file)
@@ -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 426cc89d8f029e9bcc7d4e043fa89525595903c8..a8de317726d3cb760ba20cffa6edd986142a7d2d 100644 (file)
@@ -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 2ed42bee36290994ae951fb24d970db499ff1357..79096657da49357c5a1b535377126a91043547b4 100644 (file)
@@ -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 7bcbdf893a1beb44cace247335c8432c62b48dfe..d4c29399da279ba6d664a2c5787b406ddd2dca72 100644 (file)
@@ -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 730bd3d78e28267c929bc923361ff08c4a370c4d..4e0da606f92e3897a843cdadb10750b5d94f1904 100644 (file)
@@ -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 6aec8c50239e9a7f8b8a81f827eee2b5952983dc..ae857112801f585ae781304f95e1de93f4f275bf 100644 (file)
@@ -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 bcbed3f08d86d2ae2d4adcba7ad344cc7bd6cef9..f4c9daf5fff08c99c32184dd2c689b53e2fd3dcf 100644 (file)
@@ -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 c4814317a1dad23ed9dbc6f011acb243e5aad004..09099175093798bc22f153e202476f1bdb0fd4e9 100644 (file)
@@ -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 169381f7681058731df4d8728cebba64649499f6..c17c3f10301972a801bf28a119f45b4c7b52b7e5 100644 (file)
@@ -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 7a18c52256a80ef0136af81c1d65367102774750..17dcb69afc5a009bf94665aab7ce562d23211046 100644 (file)
@@ -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 d04b1add5335a3dd0bc8ce56e86721550044264b..bf70352d5a65ee113581c14085cdacba55b4adeb 100644 (file)
@@ -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 b3564c233358fef90241c50e0987e4c97a178c7d..5b09262513b229093bbd10238a037061072cee60 100644 (file)
@@ -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 e3749eed6c879bbbb474a46844ee275279a7409b..3dcb85a798e918162d7e938e90fb7b0e2970eb8e 100644 (file)
@@ -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 f67c5454c0c947124cb604f7958cd86dd87075a0..2044cbffc54f94e12df55fa6fefb50985a4d327a 100644 (file)
@@ -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 5c5252cbf025aab7326335ef17dcb4be27de77ed..b94e7042c537b7d32a0fcb74f175f781c93bcf90 100644 (file)
@@ -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 12230781d81f47f1db19e0fa85e46d632e2bfd8e..f4e40b37a1763bb5fee0379d24d96f6da6e2130f 100644 (file)
@@ -1128,7 +1128,7 @@ fprintf (FILE, "$help$: . = .+8 ; space for tmp moves!\n")        \
     { 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); }}
 \f
index 702125da6a061404d54e3be90822c28128058436..3d9767847b37676e623cec5a12306c4bc951945d 100644 (file)
@@ -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 770faefbacc91328042b2084b9515c8e848ba0f3..766167f85694033c90374044e76eca672ae88fef 100644 (file)
@@ -6313,15 +6313,16 @@ The array element values are designed so that you can print them out
 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 9caccf23fd3c91d439f961ec8a609e1f225b9f69..56e33aa67f75b4a8e3e38c2f175e1afe485b1ac3 100644 (file)
@@ -1,3 +1,8 @@
+2002-09-04  Richard Henderson  <rth@redhat.com>
+
+       * target.h (ffetarget_print_real1, ffetarget_print_real2): Update
+       call to REAL_VALUE_TO_DECIMAL.
+
 2002-08-31  Toon Moene  <toon@moene.indiv.nluug.nl>
 
        * com.c: Don't set flag_finite_math_only by default.
index a8c7c58989a61d8ed196a1cb9b4bc2dc62e5d9f8..0601c4a468bb7dc5a4331a4b577a6a2b80507177 100644 (file)
@@ -1493,13 +1493,13 @@ void *ffetarget_memcpy_ (void *dst, void *src, size_t len);
 #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 25704eb39a0da10ab51ec5bce2610b131828e870..eb59587ed69c511879dd71a3471051ee7e30b778 100644 (file)
@@ -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 3104f1be214820fc8d33ad05e1f17ea8e8f97bb0..949b7f51be0929b641360a3246ce52082e290c0f 100644 (file)
@@ -133,7 +133,7 @@ print_node_brief (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);
        }
     }
@@ -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 d2e0a8d85c5f6ec41ee6a491f097be2ee040be17..019821df4085dd8022f951168ef8168696fc6e7b 100644 (file)
@@ -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 174d2c46abff1d6e64b0e593114231196f54ad2b..cf5fdf21aebeaf5621a8377dc7182653ab992b92 100644 (file)
@@ -154,7 +154,7 @@ extern void etartdouble             PARAMS ((REAL_VALUE_TYPE, long *));
 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 ((enum machine_mode,
 #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 **** */
 \f
index e44c28a08cca7206b90acff770147b555b4825dd..571c4ce13058843154d7ad0b5e02fdc435ad0b97 100644 (file)
@@ -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));