summaryrefslogtreecommitdiffstats
path: root/gas/config
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-10-17 16:45:56 +0000
committerNick Clifton <nickc@redhat.com>2007-10-17 16:45:56 +0000
commit499ac353610f24006acf82c32503d8d15d0f278c (patch)
treea85388693f1bb562345a7f7a28875fd962bd16f0 /gas/config
parent25b07cd9c40077c076d68f9e7d5a113828fbebbf (diff)
downloadppe42-binutils-499ac353610f24006acf82c32503d8d15d0f278c.tar.gz
ppe42-binutils-499ac353610f24006acf82c32503d8d15d0f278c.zip
Remove duplicate definitions of the md_atof() function
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/atof-ieee.c117
-rw-r--r--gas/config/atof-vax.c8
-rw-r--r--gas/config/tc-alpha.c47
-rw-r--r--gas/config/tc-arc.c42
-rw-r--r--gas/config/tc-arm.c26
-rw-r--r--gas/config/tc-avr.c38
-rw-r--r--gas/config/tc-bfin.c53
-rw-r--r--gas/config/tc-cr16.c50
-rw-r--r--gas/config/tc-crx.c50
-rw-r--r--gas/config/tc-d10v.c36
-rw-r--r--gas/config/tc-d30v.c36
-rw-r--r--gas/config/tc-dlx.c62
-rw-r--r--gas/config/tc-fr30.c50
-rw-r--r--gas/config/tc-frv.c55
-rw-r--r--gas/config/tc-h8300.c56
-rw-r--r--gas/config/tc-hppa.c57
-rw-r--r--gas/config/tc-i370.c46
-rw-r--r--gas/config/tc-i386.c54
-rw-r--r--gas/config/tc-i860.c54
-rw-r--r--gas/config/tc-i960.c59
-rw-r--r--gas/config/tc-ia64.c9
-rw-r--r--gas/config/tc-ip2k.c51
-rw-r--r--gas/config/tc-iq2000.c51
-rw-r--r--gas/config/tc-m32c.c42
-rw-r--r--gas/config/tc-m32r.c55
-rw-r--r--gas/config/tc-m68hc11.c54
-rw-r--r--gas/config/tc-m68k.c55
-rw-r--r--gas/config/tc-maxq.c46
-rw-r--r--gas/config/tc-mcore.c70
-rw-r--r--gas/config/tc-mep.c50
-rw-r--r--gas/config/tc-mips.c50
-rw-r--r--gas/config/tc-mmix.c44
-rw-r--r--gas/config/tc-mn10200.c34
-rw-r--r--gas/config/tc-mn10300.c39
-rw-r--r--gas/config/tc-msp430.c38
-rw-r--r--gas/config/tc-mt.c55
-rw-r--r--gas/config/tc-ns32k.c36
-rw-r--r--gas/config/tc-openrisc.c42
-rw-r--r--gas/config/tc-or32.c61
-rw-r--r--gas/config/tc-pdp11.c6
-rw-r--r--gas/config/tc-pj.c50
-rw-r--r--gas/config/tc-ppc.c50
-rw-r--r--gas/config/tc-s390.c44
-rw-r--r--gas/config/tc-score.c72
-rw-r--r--gas/config/tc-sh.c52
-rw-r--r--gas/config/tc-sparc.c77
-rw-r--r--gas/config/tc-spu.c53
-rw-r--r--gas/config/tc-tic30.c4
-rw-r--r--gas/config/tc-tic4x.c33
-rw-r--r--gas/config/tc-tic54x.c25
-rw-r--r--gas/config/tc-v850.c34
-rw-r--r--gas/config/tc-vax.c6
-rw-r--r--gas/config/tc-xc16x.c51
-rw-r--r--gas/config/tc-xstormy16.c48
-rw-r--r--gas/config/tc-xtensa.c38
-rw-r--r--gas/config/tc-z8k.c54
56 files changed, 244 insertions, 2331 deletions
diff --git a/gas/config/atof-ieee.c b/gas/config/atof-ieee.c
index 5b1cbb5034..d901f318ee 100644
--- a/gas/config/atof-ieee.c
+++ b/gas/config/atof-ieee.c
@@ -160,7 +160,7 @@ make_invalid_floating_point_number (LITTLENUM_TYPE *words)
char *
atof_ieee (char *str, /* Text to convert to binary. */
- int what_kind, /* 'd', 'f', 'g', 'h'. */
+ int what_kind, /* 'd', 'f', 'x', 'p'. */
LITTLENUM_TYPE *words) /* Build the binary here. */
{
/* Extra bits for zeroed low-order bits.
@@ -218,7 +218,6 @@ atof_ieee (char *str, /* Text to convert to binary. */
case 'p':
case 'P':
-
precision = P_PRECISION;
exponent_bits = -1;
break;
@@ -696,5 +695,119 @@ print_gen (gen)
return (sbuf);
}
+#endif
+
+extern const char FLT_CHARS[];
+#define MAX_LITTLENUMS 6
+
+/* This is a utility function called from various tc-*.c files. It
+ is here in order to reduce code duplication.
+
+ Turn a string at input_line_pointer into a floating point constant
+ of type TYPE (a character found in the FLT_CHARS macro), and store
+ it as LITTLENUMS in the bytes buffer LITP. The number of chars
+ emitted is stored in *SIZEP. BIG_WORDIAN is TRUE if the littlenums
+ should be emitted most significant littlenum first.
+
+ An error message is returned, or a NULL pointer if everything went OK. */
+
+char *
+ieee_md_atof (int type,
+ char *litP,
+ int *sizeP,
+ bfd_boolean big_wordian)
+{
+ LITTLENUM_TYPE words[MAX_LITTLENUMS];
+ LITTLENUM_TYPE *wordP;
+ char *t;
+ int prec = 0;
+ if (strchr (FLT_CHARS, type) != NULL)
+ {
+ switch (type)
+ {
+ case 'f':
+ case 'F':
+ case 's':
+ case 'S':
+ prec = F_PRECISION;
+ break;
+
+ case 'd':
+ case 'D':
+ case 'r':
+ case 'R':
+ prec = D_PRECISION;
+ break;
+
+ case 't':
+ case 'T':
+ prec = X_PRECISION;
+ type = 'x'; /* This is what atof_ieee() understands. */
+ break;
+
+ case 'x':
+ case 'X':
+ case 'p':
+ case 'P':
+#ifdef TC_M68K
+ /* Note: on the m68k there is a gap of 16 bits (one littlenum)
+ between the exponent and mantissa. Hence the precision is
+ 6 and not 5. */
+ prec = P_PRECISION + 1;
+#else
+ prec = P_PRECISION;
#endif
+ break;
+
+ default:
+ break;
+ }
+ }
+ /* The 'f' and 'd' types are always recognised, even if the target has
+ not put them into the FLT_CHARS macro. This is because the 'f' type
+ can come from the .dc.s, .dcb.s, .float or .single pseudo-ops and the
+ 'd' type from the .dc.d, .dbc.d or .double pseudo-ops.
+
+ The 'x' type is not implicitly recongised however, even though it can
+ be generated by the .dc.x and .dbc.x pseudo-ops because not all targets
+ can support floating point values that big. ie the target has to
+ explicitly allow them by putting them into FLT_CHARS. */
+ else if (type == 'f')
+ prec = F_PRECISION;
+ else if (type == 'd')
+ prec = D_PRECISION;
+
+ if (prec == 0)
+ {
+ *sizeP = 0;
+ return _("Unrecognized or unsupported floating point constant");
+ }
+
+ assert (prec <= MAX_LITTLENUMS);
+
+ t = atof_ieee (input_line_pointer, type, words);
+ if (t)
+ input_line_pointer = t;
+
+ *sizeP = prec * sizeof (LITTLENUM_TYPE);
+
+ if (big_wordian)
+ {
+ for (wordP = words; prec --;)
+ {
+ md_number_to_chars (litP, (valueT) (* wordP ++), sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
+ }
+ }
+ else
+ {
+ for (wordP = words + prec; prec --;)
+ {
+ md_number_to_chars (litP, (valueT) (* -- wordP), sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
+ }
+ }
+
+ return NULL;
+}
diff --git a/gas/config/atof-vax.c b/gas/config/atof-vax.c
index fbae8ca491..e012526861 100644
--- a/gas/config/atof-vax.c
+++ b/gas/config/atof-vax.c
@@ -389,9 +389,9 @@ flonum_gen2vax (int format_letter, /* One of 'd' 'f' 'g' 'h'. */
#define MAXIMUM_NUMBER_OF_LITTLENUMS 8 /* For .hfloats. */
char *
-md_atof (int what_statement_type,
- char *literalP,
- int *sizeP)
+vax_md_atof (int what_statement_type,
+ char *literalP,
+ int *sizeP)
{
LITTLENUM_TYPE words[MAXIMUM_NUMBER_OF_LITTLENUMS];
char kind_of_float;
@@ -447,5 +447,5 @@ md_atof (int what_statement_type,
number_of_chars = 0;
*sizeP = number_of_chars;
- return kind_of_float ? NULL : _("Bad call to md_atof()");
+ return kind_of_float ? NULL : _("Unrecognized or unsupported floating point constant");
}
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 2b3cb6deeb..2d0407847a 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -5020,64 +5020,24 @@ md_section_align (segT seg, valueT size)
of LITTLENUMS emitted is stored in *SIZEP. An error message is
returned, or NULL on OK. */
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
-extern char *vax_md_atof (int, char *, int *);
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
+ extern char *vax_md_atof (int, char *, int *);
switch (type)
{
/* VAX floats. */
case 'G':
- /* VAX md_atof doesn't like "G" for some reason. */
+ /* vax_md_atof() doesn't like "G" for some reason. */
type = 'g';
case 'F':
case 'D':
return vax_md_atof (type, litP, sizeP);
- /* IEEE floats. */
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (wordP = words + prec - 1; prec--;)
- {
- md_number_to_chars (litP, (long) (*wordP--), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
}
/* Take care of the target-specific command-line options. */
@@ -5709,5 +5669,4 @@ alpha_frob_file_before_adjust (void)
/* The Alpha has support for some VAX floating point types, as well as for
IEEE floating point. We consider IEEE to be the primary floating point
format, and sneak in the VAX floating point support here. */
-#define md_atof vax_md_atof
#include "config/atof-vax.c"
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index ab41b20bae..0594aaac77 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -999,50 +999,10 @@ arc_option (int ignore ATTRIBUTE_UNUSED)
ignore_rest_of_line ();
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- prec = 4;
- break;
-
- default:
- *sizeP = 0;
- return "bad call to md_atof";
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
/* Write a value out to the object file, using the appropriate
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index daba10104e..8c8b9bdb1a 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -906,30 +906,30 @@ md_atof (int type, char * litP, int * sizeP)
case 'x':
case 'X':
- prec = 6;
+ prec = 5;
break;
case 'p':
case 'P':
- prec = 6;
+ prec = 5;
break;
default:
*sizeP = 0;
- return _("bad call to MD_ATOF()");
+ return _("Unrecognized or unsupported floating point constant");
}
t = atof_ieee (input_line_pointer, type, words);
if (t)
input_line_pointer = t;
- *sizeP = prec * 2;
+ *sizeP = prec * sizeof (LITTLENUM_TYPE);
if (target_big_endian)
{
for (i = 0; i < prec; i++)
{
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
+ md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
}
}
else
@@ -937,21 +937,23 @@ md_atof (int type, char * litP, int * sizeP)
if (ARM_CPU_HAS_FEATURE (cpu_variant, fpu_endian_pure))
for (i = prec - 1; i >= 0; i--)
{
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
+ md_number_to_chars (litP, (valueT) words[i], sizeof (LITTLENUM_TYPE));
+ litP += sizeof (LITTLENUM_TYPE);
}
else
/* For a 4 byte float the order of elements in `words' is 1 0.
For an 8 byte float the order is 1 0 3 2. */
for (i = 0; i < prec; i += 2)
{
- md_number_to_chars (litP, (valueT) words[i + 1], 2);
- md_number_to_chars (litP + 2, (valueT) words[i], 2);
- litP += 4;
+ md_number_to_chars (litP, (valueT) words[i + 1],
+ sizeof (LITTLENUM_TYPE));
+ md_number_to_chars (litP + sizeof (LITTLENUM_TYPE),
+ (valueT) words[i], sizeof (LITTLENUM_TYPE));
+ litP += 2 * sizeof (LITTLENUM_TYPE);
}
}
- return 0;
+ return NULL;
}
/* We handle all bad expressions here, so that we can report the faulty
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index a7d401606d..c73b94879a 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -414,46 +414,10 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
return NULL;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
- case 'd':
- prec = 4;
- break;
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- /* This loop outputs the LITTLENUMs in REVERSE order. */
- for (wordP = words + prec - 1; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
void
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index 4f42c8145d..515019898d 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -690,59 +690,10 @@ md_section_align (segment, size)
}
-/* Turn a string in input_line_pointer into a floating point
- constant of type type, and store the appropriate bytes in
- *litP. The number of LITTLENUMS emitted is stored in *sizeP.
- An error message is returned, or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
char *
-md_atof (type, litP, sizeP)
- char type;
- char * litP;
- int * sizeP;
+md_atof (int type, char * litP, int * sizeP)
{
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- *sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- /* This loops outputs the LITTLENUMs in REVERSE order; in accord with
- the littleendianness of the processor. */
- for (wordP = words + prec - 1; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c
index cb09473832..7fec21507f 100644
--- a/gas/config/tc-cr16.c
+++ b/gas/config/tc-cr16.c
@@ -671,58 +671,10 @@ md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
return;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- int i;
- LITTLENUM_TYPE words[4];
- char *t;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- if (! target_big_endian)
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
- else
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
/* Apply a fixS (fixup of an instruction or data that we didn't have
diff --git a/gas/config/tc-crx.c b/gas/config/tc-crx.c
index 08656f9768..2306290b79 100644
--- a/gas/config/tc-crx.c
+++ b/gas/config/tc-crx.c
@@ -463,58 +463,10 @@ md_show_usage (FILE *stream ATTRIBUTE_UNUSED)
return;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- if (! target_big_endian)
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
- else
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
/* Apply a fixS (fixup of an instruction or data that we didn't have
diff --git a/gas/config/tc-d10v.c b/gas/config/tc-d10v.c
index 336d9a8453..9d5a92b83f 100644
--- a/gas/config/tc-d10v.c
+++ b/gas/config/tc-d10v.c
@@ -251,44 +251,10 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
return 0;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
- case 'd':
- prec = 4;
- break;
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
void
diff --git a/gas/config/tc-d30v.c b/gas/config/tc-d30v.c
index 4a2efd6dc5..e257f75a3a 100644
--- a/gas/config/tc-d30v.c
+++ b/gas/config/tc-d30v.c
@@ -285,44 +285,10 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
return 0;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
- case 'd':
- prec = 4;
- break;
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
void
diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c
index fc4b210930..19539bf268 100644
--- a/gas/config/tc-dlx.c
+++ b/gas/config/tc-dlx.c
@@ -975,69 +975,13 @@ md_assemble (char *str)
}
/* This is identical to the md_atof in m68k.c. I think this is right,
- but I'm not sure.
-
- Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-/* Dlx will not use it anyway, so I just leave it here for now. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
+ but I'm not sure. Dlx will not use it anyway, so I just leave it
+ here for now. */
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
/* Write out big-endian. */
diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c
index 8aa6940cb7..e947f69153 100644
--- a/gas/config/tc-fr30.c
+++ b/gas/config/tc-fr30.c
@@ -318,58 +318,10 @@ md_number_to_chars (char * buf, valueT val, int n)
number_to_chars_bigendian (buf, val, n);
}
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message is returned, or NULL on OK.
-*/
-
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char * litP, int * sizeP)
{
- int i;
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- * sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
/* Worker function for fr30_is_colon_insn(). */
diff --git a/gas/config/tc-frv.c b/gas/config/tc-frv.c
index dd55c468c7..acf71ed21d 100644
--- a/gas/config/tc-frv.c
+++ b/gas/config/tc-frv.c
@@ -1558,61 +1558,10 @@ frv_md_number_to_chars (buf, val, n)
number_to_chars_bigendian (buf, val, n);
}
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message is returned, or NULL on OK.
-*/
-
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
char *
-md_atof (type, litP, sizeP)
- char type;
- char * litP;
- int * sizeP;
+md_atof (int type, char * litP, int * sizeP)
{
- int i;
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- * sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
bfd_boolean
diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c
index 74735d6564..d0a7554c03 100644
--- a/gas/config/tc-h8300.c
+++ b/gas/config/tc-h8300.c
@@ -2005,64 +2005,12 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
return 0;
}
-/* Various routines to kill one day */
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
+/* Various routines to kill one day. */
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
const char *md_shortopts = "";
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index 996c0027cf..09581ac16d 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -583,8 +583,8 @@ const char EXP_CHARS[] = "eE";
As in 0f12.456 or 0d1.2345e12.
Be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
- changed in read.c. Ideally it shouldn't hae to know abou it at
- all, but nothing is ideal around here. */
+ changed in read.c. Ideally it shouldn't have to know about it
+ at all, but nothing is ideal around here. */
const char FLT_CHARS[] = "rRsSfFdDxXpP";
static struct pa_it the_insn;
@@ -1335,61 +1335,10 @@ pa_parse_nullif (char **s)
return nullif;
}
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message or NULL is returned. */
-
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
-
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
/* Write out big-endian. */
diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c
index c6bedb7cc2..af3b2841e8 100644
--- a/gas/config/tc-i370.c
+++ b/gas/config/tc-i370.c
@@ -958,6 +958,7 @@ i370_dc (int unused ATTRIBUTE_UNUSED)
emit_expr (&exp, nbytes);
break;
case 'E': /* 32-bit */
+ type = 'f';
case 'D': /* 64-bit */
md_atof (type, tmp, &nbytes);
p = frag_more (nbytes);
@@ -2355,53 +2356,12 @@ i370_tc (int ignore ATTRIBUTE_UNUSED)
}
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litp, int *sizep)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- case 'E':
- type = 'f';
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- type = 'd';
- prec = 4;
- break;
-
- default:
- *sizep = 0;
- return "bad call to md_atof";
- }
-
/* 360/370/390 have two float formats: an old, funky 360 single-precision
- * format, and the ieee format. Support only the ieee format. */
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizep = prec * 2;
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litp, (valueT) words[i], 2);
- litp += 2;
- }
-
- return NULL;
+ format, and the ieee format. Support only the ieee format. */
+ return ieee_md_atof (type, litp, sizep, TRUE);
}
/* Write a value out to the object file, using the appropriate
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 0c430eab74..ec6ff47bb3 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -6790,58 +6790,12 @@ md_apply_fix (fixP, valP, seg)
md_number_to_chars (p, value, fixP->fx_size);
}
-#define MAX_LITTLENUMS 6
-
-/* Turn the string pointed to by litP into a floating point constant
- of type TYPE, and emit the appropriate bytes. The number of
- LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
-md_atof (type, litP, sizeP)
- int type;
- char *litP;
- int *sizeP;
+md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 5;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to md_atof ()");
- }
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- /* This loops outputs the LITTLENUMs in REVERSE order; in accord with
- the bigendian 386. */
- for (wordP = words + prec - 1; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- return 0;
+ /* This outputs the LITTLENUMs in REVERSE order;
+ in accord with the bigendian 386. */
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
static char output_invalid_buf[sizeof (unsigned char) * 2 + 6];
diff --git a/gas/config/tc-i860.c b/gas/config/tc-i860.c
index 6358066192..0d927dec08 100644
--- a/gas/config/tc-i860.c
+++ b/gas/config/tc-i860.c
@@ -1010,62 +1010,10 @@ i860_get_expression (char *str)
return 0;
}
-/* Turn a string in input_line_pointer into a floating point constant of
- type TYPE, and store the appropriate bytes in *LITP. The number of
- LITTLENUMS emitted is stored in *SIZEP. An error message is returned,
- or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
/* Write out in current endian mode. */
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index d28d909ab5..6fd611bdd7 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -1710,67 +1710,10 @@ md_number_to_chars (char *buf,
number_to_chars_littleendian (buf, value, n);
}
-#define MAX_LITTLENUMS 6
-#define LNUM_SIZE sizeof (LITTLENUM_TYPE)
-
-/* md_atof: convert ascii to floating point
-
- Turn a string at input_line_pointer into a floating point constant of type
- 'type', and store the appropriate bytes at *litP. The number of LITTLENUMS
- emitted is returned at 'sizeP'. An error message is returned, or a pointer
- to an empty message if OK.
-
- Note we call the i386 floating point routine, rather than complicating
- things with more files or symbolic links. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- int prec;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- prec = 4;
- break;
-
- case 't':
- case 'T':
- prec = 5;
- type = 'x'; /* That's what atof_ieee() understands. */
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * LNUM_SIZE;
-
- /* Output the LITTLENUMs in REVERSE order in accord with i80960
- word-order. (Dunno why atof_ieee doesn't do it in the right
- order in the first place -- probably because it's a hack of
- atof_m68k.) */
- for (wordP = words + prec - 1; prec--;)
- {
- md_number_to_chars (litP, (long) (*wordP--), LNUM_SIZE);
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
static void
diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index b0d92b79b0..92c8ea9875 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -11686,10 +11686,7 @@ tc_gen_reloc (sec, fixp)
#define MAX_LITTLENUMS 5
char *
-md_atof (type, lit, size)
- int type;
- char *lit;
- int *size;
+md_atof (int type, char *lit, int *size)
{
LITTLENUM_TYPE words[MAX_LITTLENUMS];
char *t;
@@ -11721,7 +11718,7 @@ md_atof (type, lit, size)
default:
*size = 0;
- return "Bad call to MD_ATOF()";
+ return _("Unrecognized or unsupported floating point constant");
}
t = atof_ieee (input_line_pointer, type, words);
if (t)
@@ -11738,7 +11735,7 @@ md_atof (type, lit, size)
else
*size = prec * sizeof (LITTLENUM_TYPE);
- return 0;
+ return NULL;
}
/* Handle ia64 specific semantics of the align directive. */
diff --git a/gas/config/tc-ip2k.c b/gas/config/tc-ip2k.c
index 9e322271ba..37e1211186 100644
--- a/gas/config/tc-ip2k.c
+++ b/gas/config/tc-ip2k.c
@@ -332,59 +332,10 @@ md_number_to_chars (char * buf, valueT val, int n)
number_to_chars_bigendian (buf, val, n);
}
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message is returned, or NULL on
- OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char * litP, int * sizeP)
{
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- * sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- /* This loops outputs the LITTLENUMs in REVERSE order; in accord with
- the ip2k endianness. */
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c
index acfbae34fd..4c709980fa 100644
--- a/gas/config/tc-iq2000.c
+++ b/gas/config/tc-iq2000.c
@@ -725,61 +725,12 @@ md_operand (expressionS * exp)
gas_cgen_md_operand (exp);
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type type, and store the appropriate bytes in *litP. The number
- of LITTLENUMS emitted is stored in *sizeP . An error message is
- returned, or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char * litP, int * sizeP)
{
- int i;
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- * sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
-
bfd_boolean
iq2000_fix_adjustable (fixS * fixP)
{
diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c
index 08237ee8a4..2d13a6661c 100644
--- a/gas/config/tc-m32c.c
+++ b/gas/config/tc-m32c.c
@@ -1208,47 +1208,7 @@ md_number_to_chars (char * buf, valueT val, int n)
char *
md_atof (int type, char * litP, int * sizeP)
{
- int i;
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- * sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
bfd_boolean
diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c
index cd0d9e9b6f..8b2f4394b1 100644
--- a/gas/config/tc-m32r.c
+++ b/gas/config/tc-m32r.c
@@ -2113,60 +2113,7 @@ md_number_to_chars (char *buf, valueT val, int n)
char *
md_atof (int type, char *litP, int *sizeP)
{
- int i;
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes
- here. */
-
- default:
- *sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- if (target_big_endian)
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- }
- else
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
void
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index b228ea569d..dde6a37b56 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -514,62 +514,10 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
return 0;
}
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
valueT
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 78f6a9aa63..11a86b9598 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -4681,63 +4681,10 @@ m68k_mri_mode_change (int on)
}
}
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
void
diff --git a/gas/config/tc-maxq.c b/gas/config/tc-maxq.c
index 4cf72ebdd9..58c5c300a3 100644
--- a/gas/config/tc-maxq.c
+++ b/gas/config/tc-maxq.c
@@ -379,51 +379,13 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
return 0;
}
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant of type
- TYPE, and store the appropriate bytes in *LITP. The number of LITTLENUMS
- emitted is stored in *SIZEP. An error message is returned, or NULL on OK. */
-
char *
md_atof (int type, char * litP, int * sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 2;
- /* The size of Double has been changed to 2 words ie 32 bits. */
- /* prec = 4; */
- break;
-
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
-
- return NULL;
+ if (type == 'd')
+ /* The size of Double has been changed to 2 words ie 32 bits. */
+ type = 'f';
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
void
diff --git a/gas/config/tc-mcore.c b/gas/config/tc-mcore.c
index 0604ad9042..73307b13e1 100644
--- a/gas/config/tc-mcore.c
+++ b/gas/config/tc-mcore.c
@@ -1616,77 +1616,11 @@ md_mcore_end (void)
}
/* Various routines to kill one day. */
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP. An error message is returned, or NULL on OK. */
char *
-md_atof (int type, char * litP, int * sizeP)
+md_atof (int type, char * litP, int * sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- int i;
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_NTOF()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
-
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- if (! target_big_endian)
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- }
- else
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
const char * md_shortopts = "";
diff --git a/gas/config/tc-mep.c b/gas/config/tc-mep.c
index 09acbc8fc7..26080192c9 100644
--- a/gas/config/tc-mep.c
+++ b/gas/config/tc-mep.c
@@ -1676,60 +1676,12 @@ md_number_to_chars (char *buf, valueT val, int n)
number_to_chars_littleendian (buf, val, n);
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type type, and store the appropriate bytes in *litP. The number
- of LITTLENUMS emitted is stored in *sizeP . An error message is
- returned, or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int i;
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
- default:
- *sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
-
bfd_boolean
mep_fix_adjustable (fixS *fixP)
{
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 49e02ebd34..722c47ec48 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -10761,58 +10761,10 @@ my_getExpression (expressionS *ep, char *str)
S_SET_VALUE (ep->X_add_symbol, val + 1);
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- if (! target_big_endian)
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, words[i], 2);
- litP += 2;
- }
- }
- else
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, words[i], 2);
- litP += 2;
- }
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
void
diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c
index b3b04586ff..056298b7ce 100644
--- a/gas/config/tc-mmix.c
+++ b/gas/config/tc-mmix.c
@@ -2239,42 +2239,14 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- /* FIXME: Having 'f' in mmix_flt_chars (and here) makes it
- problematic to also have a forward reference in an expression.
- The testsuite wants it, and it's customary.
- We'll deal with the real problems when they come; we share the
- problem with most other ports. */
- case 'f':
- case 'r':
- prec = 2;
- break;
- case 'd':
- prec = 4;
- break;
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- return NULL;
+ if (type == 'r')
+ type = 'f';
+ /* FIXME: Having 'f' in mmix_flt_chars (and here) makes it
+ problematic to also have a forward reference in an expression.
+ The testsuite wants it, and it's customary.
+ We'll deal with the real problems when they come; we share the
+ problem with most other ports. */
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
/* Convert variable-sized frags into one or more fixups. */
diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c
index 3be5298ae3..fa78d53da3 100644
--- a/gas/config/tc-mn10200.c
+++ b/gas/config/tc-mn10200.c
@@ -321,39 +321,7 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
char *
md_atof (int type, char *litp, int *sizep)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizep = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizep = prec * 2;
-
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litp, (valueT) words[i], 2);
- litp += 2;
- }
-
- return NULL;
+ return ieee_md_atof (type, litp, sizep, FALSE);
}
void
diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c
index 64d1f6dd38..9b2441fa73 100644
--- a/gas/config/tc-mn10300.c
+++ b/gas/config/tc-mn10300.c
@@ -711,44 +711,9 @@ md_undefined_symbol (name)
}
char *
-md_atof (type, litp, sizep)
- int type;
- char *litp;
- int *sizep;
+md_atof (int type, char *litp, int *sizep)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizep = 0;
- return "bad call to md_atof";
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizep = prec * 2;
-
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litp, (valueT) words[i], 2);
- litp += 2;
- }
-
- return NULL;
+ return ieee_md_atof (type, litp, sizep, FALSE);
}
void
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index 27cbe38ecb..75e7eab9c0 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -842,46 +842,10 @@ extract_cmd (char * from, char * to, int limit)
return from;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char * litP, int * sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
- case 'd':
- prec = 4;
- break;
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- /* This loop outputs the LITTLENUMs in REVERSE order. */
- for (wordP = words + prec - 1; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
void
diff --git a/gas/config/tc-mt.c b/gas/config/tc-mt.c
index 2c9055b05a..3583b76019 100644
--- a/gas/config/tc-mt.c
+++ b/gas/config/tc-mt.c
@@ -432,61 +432,10 @@ md_number_to_chars (char * buf, valueT val, int n)
number_to_chars_bigendian (buf, val, n);
}
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message is returned, or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
char *
-md_atof (type, litP, sizeP)
- char type;
- char * litP;
- int * sizeP;
+md_atof (int type, char * litP, int * sizeP)
{
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- LITTLENUM_TYPE * wordP;
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- * sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- /* This loops outputs the LITTLENUMs in REVERSE order;
- in accord with the mt endianness. */
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
/* See whether we need to force a relocation into the output file. */
diff --git a/gas/config/tc-ns32k.c b/gas/config/tc-ns32k.c
index a1e6955470..66aeae8717 100644
--- a/gas/config/tc-ns32k.c
+++ b/gas/config/tc-ns32k.c
@@ -1913,9 +1913,6 @@ md_begin (void)
freeptr_static = (char *) malloc (PRIVATE_SIZE);
}
-/* Must be equal to MAX_PRECISON in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
/* Turn the string pointed to by litP into a floating point constant
of type TYPE, and emit the appropriate bytes. The number of
LITTLENUMS emitted is stored in *SIZEP. An error message is
@@ -1924,38 +1921,7 @@ md_begin (void)
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (wordP = words + prec; prec--;)
- {
- md_number_to_chars (litP, (long) (*--wordP), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
int
diff --git a/gas/config/tc-openrisc.c b/gas/config/tc-openrisc.c
index f8ec684458..49189386d2 100644
--- a/gas/config/tc-openrisc.c
+++ b/gas/config/tc-openrisc.c
@@ -347,47 +347,7 @@ md_number_to_chars (char * buf, valueT val, int n)
char *
md_atof (int type, char * litP, int * sizeP)
{
- int i;
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- * sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
bfd_boolean
diff --git a/gas/config/tc-or32.c b/gas/config/tc-or32.c
index 3d8d39c0e0..d91faf90ca 100644
--- a/gas/config/tc-or32.c
+++ b/gas/config/tc-or32.c
@@ -530,69 +530,10 @@ machine_ip (char *str)
}
}
-/* This is identical to the md_atof in m68k.c. I think this is right,
- but I'm not sure.
-
- Turn a string in input_line_pointer into a floating point constant
- of type type, and store the appropriate bytes in *litP. The number
- of LITTLENUMS emitted is stored in *sizeP . An error message is
- returned, or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char * litP, int * sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
/* Write out big-endian. */
diff --git a/gas/config/tc-pdp11.c b/gas/config/tc-pdp11.c
index 7624f60d52..64e162b75b 100644
--- a/gas/config/tc-pdp11.c
+++ b/gas/config/tc-pdp11.c
@@ -1451,3 +1451,9 @@ pseudo_even (int c ATTRIBUTE_UNUSED)
frag_align (alignment, 0, 1);
record_alignment (now_seg, alignment);
}
+
+char *
+md_atof (int type, char * litP, int * sizeP)
+{
+ return vax_md_atof (type, litP, sizeP);
+}
diff --git a/gas/config/tc-pj.c b/gas/config/tc-pj.c
index 1cbd83ed8c..05e19d770d 100644
--- a/gas/config/tc-pj.c
+++ b/gas/config/tc-pj.c
@@ -313,58 +313,10 @@ md_assemble (char *str)
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type type, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP . An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- if (!target_big_endian)
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
- else
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
const char *md_shortopts = "";
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index fc8b9a07cc..713d25be8f 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5220,58 +5220,10 @@ ppc_frob_section (asection *sec)
#endif /* OBJ_XCOFF */
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
char *
md_atof (int type, char *litp, int *sizep)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizep = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizep = prec * 2;
-
- if (target_big_endian)
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litp, (valueT) words[i], 2);
- litp += 2;
- }
- }
- else
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litp, (valueT) words[i], 2);
- litp += 2;
- }
- }
-
- return NULL;
+ return ieee_md_atof (type, litp, sizep, target_big_endian);
}
/* Write a value out to the object file, using the appropriate
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index deb7307dbe..ac93faf6c5 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -1769,50 +1769,10 @@ s390_literals (ignore)
lpe_count = 0;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type type, and store the appropriate bytes in *litp. The number
- of LITTLENUMS emitted is stored in *sizep . An error message is
- returned, or NULL on OK. */
-
char *
-md_atof (type, litp, sizep)
- int type;
- char *litp;
- int *sizep;
+md_atof (int type, char *litp, int *sizep)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizep = 0;
- return "bad call to md_atof";
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizep = prec * 2;
-
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litp, (valueT) words[i], 2);
- litp += 2;
- }
-
- return NULL;
+ return ieee_md_atof (type, litp, sizep, TRUE);
}
/* Align a section (I don't know why this is machine dependent). */
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index 15cc625c65..5c12bd5672 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -181,11 +181,6 @@ struct score_it dependency_vector[SCORE7_PIPELINE];
/* Relax will need some padding for alignment. */
#define RELAX_PAD_BYTE 3
-/* Number of littlenums required to hold an extended precision number. For md_atof. */
-#define NUM_FLOAT_VALS 8
-#define MAX_LITTLENUMS 6
-LITTLENUM_TYPE fp_values[NUM_FLOAT_VALS][MAX_LITTLENUMS];
-
/* Structure for a hash table entry for a register. */
struct reg_entry
{
@@ -4704,75 +4699,10 @@ md_chars_to_number (char *buf, int n)
return result;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK.
-
- Note that fp constants aren't represent in the normal way on the ARM.
- In big endian mode, things are as expected. However, in little endian
- mode fp constants are big-endian word-wise, and little-endian byte-wise
- within the words. For example, (double) 1.1 in big endian mode is
- the byte sequence 3f f1 99 99 99 99 99 9a, and in little endian mode is
- the byte sequence 99 99 f1 3f 9a 99 99 99. */
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
- case 'x':
- case 'X':
- case 'p':
- case 'P':
- prec = 6;
- break;
- default:
- *sizeP = 0;
- return _("bad call to MD_ATOF()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * 2;
-
- if (target_big_endian)
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
- else
- {
- for (i = 0; i < prec; i += 2)
- {
- md_number_to_chars (litP, (valueT) words[i + 1], 2);
- md_number_to_chars (litP + 2, (valueT) words[i], 2);
- litP += 4;
- }
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
/* Return true if the given symbol should be considered local for PIC. */
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index 677d1c0aea..0d098d2115 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -3045,61 +3045,11 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
}
/* Various routines to kill one day. */
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP . An error message is
- returned, or NULL on OK. */
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizeP = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- if (! target_big_endian)
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
- else
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i], 2);
- litP += 2;
- }
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
/* Handle the .uses pseudo-op. This pseudo-op is used just before a
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 3b07fecfd8..e81b1f0865 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -2946,83 +2946,10 @@ output_insn (insn, the_insn)
#endif
}
-/* This is identical to the md_atof in m68k.c. I think this is right,
- but I'm not sure.
-
- Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
char *
-md_atof (type, litP, sizeP)
- char type;
- char *litP;
- int *sizeP;
+md_atof (int type, char *litP, int *sizeP)
{
- int i, prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- if (target_big_endian)
- {
- for (i = 0; i < prec; i++)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- }
- else
- {
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
/* Write a value out to the object file, using the appropriate
diff --git a/gas/config/tc-spu.c b/gas/config/tc-spu.c
index 924c6fc20f..c5a44cedb9 100644
--- a/gas/config/tc-spu.c
+++ b/gas/config/tc-spu.c
@@ -699,61 +699,10 @@ get_imm (const char *param, struct spu_insn *insn, int arg)
return param;
}
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message is returned, or NULL on OK.
- */
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
#ifndef WORKING_DOT_WORD
diff --git a/gas/config/tc-tic30.c b/gas/config/tc-tic30.c
index a86ade0353..a4b88bd5a2 100644
--- a/gas/config/tc-tic30.c
+++ b/gas/config/tc-tic30.c
@@ -1258,7 +1258,7 @@ md_atof (int what_statement_type,
default:
*sizeP = 0;
- return "Bad call to MD_ATOF()";
+ return _("Unrecognized or unsupported floating point constant");
}
if (float_value == 0.0)
@@ -1349,7 +1349,7 @@ md_atof (int what_statement_type,
}
md_number_to_chars (literalP, value, prec);
*sizeP = prec;
- return 0;
+ return NULL;
}
void
diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c
index 5898702f96..3edabc2485 100644
--- a/gas/config/tc-tic4x.c
+++ b/gas/config/tc-tic4x.c
@@ -2660,14 +2660,11 @@ tic4x_cleanup ()
/* Turn a string in input_line_pointer into a floating point constant
of type type, and store the appropriate bytes in *litP. The number
- of LITTLENUMS emitted is stored in *sizeP. An error message is
+ of chars emitted is stored in *sizeP. An error message is
returned, or NULL on OK. */
char *
-md_atof (type, litP, sizeP)
- int type;
- char *litP;
- int *sizeP;
+md_atof (int type, char *litP, int *sizeP)
{
int prec;
int ieee;
@@ -2677,36 +2674,36 @@ md_atof (type, litP, sizeP)
switch (type)
{
- case 's': /* .single */
+ case 's': /* .single */
case 'S':
ieee = 0;
prec = 1;
break;
- case 'd': /* .double */
+ case 'd': /* .double */
case 'D':
- case 'f': /* .float or .single */
+ case 'f': /* .float */
case 'F':
ieee = 0;
- prec = 2; /* 1 32-bit word */
+ prec = 2; /* 1 32-bit word */
break;
- case 'i': /* .ieee */
+ case 'i': /* .ieee */
case 'I':
prec = 2;
ieee = 1;
- type = 'f'; /* Rewrite type to be usable by atof_ieee() */
+ type = 'f'; /* Rewrite type to be usable by atof_ieee(). */
break;
- case 'e': /* .ldouble */
+ case 'e': /* .ldouble */
case 'E':
- prec = 4; /* 2 32-bit words */
+ prec = 4; /* 2 32-bit words */
ieee = 0;
break;
default:
*sizeP = 0;
- return "Bad call to md_atof()";
+ return _("Unrecognized or unsupported floating point constant");
}
if (ieee)
@@ -2721,10 +2718,10 @@ md_atof (type, litP, sizeP)
little endian byte order. */
/* SES: However it is required to put the words (32-bits) out in the
correct order, hence we write 2 and 2 littlenums in little endian
- order, while we keep the original order on successive words. */
- for(wordP = words; wordP<(words+prec) ; wordP+=2)
+ order, while we keep the original order on successive words. */
+ for (wordP = words; wordP<(words+prec) ; wordP+=2)
{
- if (wordP<(words+prec-1)) /* Dump wordP[1] (if we have one) */
+ if (wordP < (words + prec - 1)) /* Dump wordP[1] (if we have one). */
{
md_number_to_chars (litP, (valueT) (wordP[1]),
sizeof (LITTLENUM_TYPE));
@@ -2736,7 +2733,7 @@ md_atof (type, litP, sizeP)
sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE);
}
- return 0;
+ return NULL;
}
void
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index 0fe8159a05..f7cf042654 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -5383,30 +5383,11 @@ tic54x_parse_name (name, exp)
}
char *
-md_atof (type, literalP, sizeP)
- int type;
- char *literalP;
- int *sizeP;
-{
-#define MAX_LITTLENUMS 2
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *word;
- /* Only one precision on the c54x. */
- int prec = 2;
- char *t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = 4;
-
+md_atof (int type, char *literalP, int *sizeP)
+{
/* Target data is little-endian, but floats are stored
big-"word"ian. ugh. */
- for (word = words; prec--;)
- {
- md_number_to_chars (literalP, (long) (*word++), sizeof (LITTLENUM_TYPE));
- literalP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, literalP, sizeP, TRUE);
}
arelent *
diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c
index 5817800381..a99bad9d9c 100644
--- a/gas/config/tc-v850.c
+++ b/gas/config/tc-v850.c
@@ -1178,39 +1178,7 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
char *
md_atof (int type, char *litp, int *sizep)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizep = 0;
- return _("bad call to md_atof");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizep = prec * 2;
-
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litp, (valueT) words[i], 2);
- litp += 2;
- }
-
- return NULL;
+ return ieee_md_atof (type, litp, sizep, FALSE);
}
/* Very gross. */
diff --git a/gas/config/tc-vax.c b/gas/config/tc-vax.c
index 924f659ef8..980f759927 100644
--- a/gas/config/tc-vax.c
+++ b/gas/config/tc-vax.c
@@ -3405,3 +3405,9 @@ vax_cons_fix_new (fragS *frag, int where, unsigned int nbytes, expressionS *exp)
fix_new_exp (frag, where, (int) nbytes, exp, 0, r);
vax_cons_special_reloc = NULL;
}
+
+char *
+md_atof (int type, char * litP, int * sizeP)
+{
+ return vax_md_atof (type, litP, sizeP);
+}
diff --git a/gas/config/tc-xc16x.c b/gas/config/tc-xc16x.c
index 6869375f3e..9224f5c16f 100644
--- a/gas/config/tc-xc16x.c
+++ b/gas/config/tc-xc16x.c
@@ -218,59 +218,10 @@ md_parse_option (int c ATTRIBUTE_UNUSED,
return 0;
}
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
-
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char *litP, int *sizeP)
{
- int i;
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes
- here. */
-
- default:
- *sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- for (i = prec - 1; i >= 0; i--)
- {
- md_number_to_chars (litP, (valueT) words[i],
- sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
valueT
diff --git a/gas/config/tc-xstormy16.c b/gas/config/tc-xstormy16.c
index cc09df9320..6e96584aec 100644
--- a/gas/config/tc-xstormy16.c
+++ b/gas/config/tc-xstormy16.c
@@ -596,54 +596,8 @@ md_number_to_chars (char * buf, valueT val, int n)
number_to_chars_littleendian (buf, val, n);
}
-/* Turn a string in input_line_pointer into a floating point constant of type
- type, and store the appropriate bytes in *litP. The number of LITTLENUMS
- emitted is stored in *sizeP . An error message is returned, or NULL on OK.
-*/
-
-/* Equal to MAX_PRECISION in atof-ieee.c */
-#define MAX_LITTLENUMS 6
-
char *
md_atof (int type, char * litP, int * sizeP)
{
- int prec;
- LITTLENUM_TYPE words [MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char * t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- prec = 4;
- break;
-
- /* FIXME: Some targets allow other format chars for bigger sizes here. */
-
- default:
- * sizeP = 0;
- return _("Bad call to md_atof()");
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
- * sizeP = prec * sizeof (LITTLENUM_TYPE);
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- /* This loops outputs the LITTLENUMs in REVERSE order; in accord with
- the littleendianness of the processor. */
- for (wordP = words + prec - 1; prec--;)
- {
- md_number_to_chars (litP, (valueT) (*wordP--), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
-
- return 0;
+ return ieee_md_atof (type, litP, sizeP, FALSE);
}
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index aef5fc9702..1882572a1a 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -5738,43 +5738,7 @@ md_apply_fix (fixS *fixP, valueT *valP, segT seg)
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[4];
- char *t;
- int i;
-
- switch (type)
- {
- case 'f':
- prec = 2;
- break;
-
- case 'd':
- prec = 4;
- break;
-
- default:
- *sizeP = 0;
- return "bad call to md_atof";
- }
-
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * 2;
-
- for (i = prec - 1; i >= 0; i--)
- {
- int idx = i;
- if (target_big_endian)
- idx = (prec - 1 - i);
-
- md_number_to_chars (litP, (valueT) words[idx], 2);
- litP += 2;
- }
-
- return NULL;
+ return ieee_md_atof (type, litP, sizeP, target_big_endian);
}
diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c
index 2b00f3409f..ee314023e6 100644
--- a/gas/config/tc-z8k.c
+++ b/gas/config/tc-z8k.c
@@ -1285,63 +1285,11 @@ md_undefined_symbol (char *name ATTRIBUTE_UNUSED)
}
/* Various routines to kill one day. */
-/* Equal to MAX_PRECISION in atof-ieee.c. */
-#define MAX_LITTLENUMS 6
-
-/* Turn a string in input_line_pointer into a floating point constant
- of type TYPE, and store the appropriate bytes in *LITP. The number
- of LITTLENUMS emitted is stored in *SIZEP. An error message is
- returned, or NULL on OK. */
char *
md_atof (int type, char *litP, int *sizeP)
{
- int prec;
- LITTLENUM_TYPE words[MAX_LITTLENUMS];
- LITTLENUM_TYPE *wordP;
- char *t;
-
- switch (type)
- {
- case 'f':
- case 'F':
- case 's':
- case 'S':
- prec = 2;
- break;
-
- case 'd':
- case 'D':
- case 'r':
- case 'R':
- prec = 4;
- break;
-
- case 'x':
- case 'X':
- prec = 6;
- break;
-
- case 'p':
- case 'P':
- prec = 6;
- break;
-
- default:
- *sizeP = 0;
- return _("Bad call to MD_ATOF()");
- }
- t = atof_ieee (input_line_pointer, type, words);
- if (t)
- input_line_pointer = t;
-
- *sizeP = prec * sizeof (LITTLENUM_TYPE);
- for (wordP = words; prec--;)
- {
- md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
- litP += sizeof (LITTLENUM_TYPE);
- }
- return 0;
+ return ieee_md_atof (type, litP, sizeP, TRUE);
}
const char *md_shortopts = "z:";
OpenPOWER on IntegriCloud