gas/:
[binutils-gdb.git] / gas / config / tc-i370.c
index 08a665fdf99cc4cc44345241d9cb76015bc5e2aa..af3b2841e892ebee81482ea95cb337b1923116f9 100644 (file)
@@ -1,14 +1,14 @@
 /* tc-i370.c -- Assembler for the IBM 360/370/390 instruction set.
    Loosely based on the ppc files by Linas Vepstas <linas@linas.org> 1998, 99
    Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-   2004, 2005 Free Software Foundation, Inc.
+   2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GAS, the GNU Assembler.
 
    GAS is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2, or (at your option)
+   the Free Software Foundation; either version 3, or (at your option)
    any later version.
 
    GAS is distributed in the hope that it will be useful,
@@ -18,8 +18,8 @@
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 /* This assembler implements a very hacked version of an elf-like thing
    that gcc emits (when gcc is suitably hacked).  To make it behave more
@@ -27,7 +27,6 @@
    similarities between HLASM and the MRI assemblers, such as section
    names, lack of leading . in pseudo-ops, DC and DS, etc.  */
 
-#include <stdio.h>
 #include "as.h"
 #include "safe-ctype.h"
 #include "subsegs.h"
@@ -959,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);
@@ -2102,7 +2102,7 @@ md_assemble (char *str)
 
           if (! register_name (&ex))
            as_bad ("expecting a register for operand %d",
-                   opindex_ptr - opcode->operands + 1);
+                   (int) (opindex_ptr - opcode->operands + 1));
         }
 
       /* Check for an address constant expression.  */
@@ -2232,7 +2232,7 @@ md_assemble (char *str)
      BFD_RELOC_UNUSED plus the operand index.  This lets us easily
      handle fixups for any operand type, although that is admittedly
      not a very exciting feature.  We pick a BFD reloc type in
-     md_apply_fix3.  */
+     md_apply_fix.  */
   for (i = 0; i < fc; i++)
     {
       const struct i370_operand *operand;
@@ -2356,53 +2356,12 @@ i370_tc (int ignore ATTRIBUTE_UNUSED)
     }
 }
 \f
-/* 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
@@ -2476,14 +2435,14 @@ md_pcrel_from_section (fixS *fixp, segT sec ATTRIBUTE_UNUSED)
    going on here.  */
 
 void
-md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
+md_apply_fix (fixS *fixP, valueT * valP, segT seg)
 {
   valueT value = * valP;
 
   if (fixP->fx_addsy != NULL)
     {
 #ifdef DEBUG
-      printf ("\nmd_apply_fix3: symbol %s at 0x%x (%s:%d) val=0x%x addend=0x%x\n",
+      printf ("\nmd_apply_fix: symbol %s at 0x%x (%s:%d) val=0x%x addend=0x%x\n",
              S_GET_NAME (fixP->fx_addsy),
              fixP->fx_frag->fr_address + fixP->fx_where,
              fixP->fx_file, fixP->fx_line,
@@ -2508,7 +2467,7 @@ md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
       operand = &i370_operands[opindex];
 
 #ifdef DEBUG
-      printf ("\nmd_apply_fix3: fixup operand %s at 0x%x in %s:%d addend=0x%x\n",
+      printf ("\nmd_apply_fix: fixup operand %s at 0x%x in %s:%d addend=0x%x\n",
              operand->name,
              fixP->fx_frag->fr_address + fixP->fx_where,
              fixP->fx_file, fixP->fx_line,
@@ -2568,7 +2527,7 @@ md_apply_fix3 (fixS *fixP, valueT * valP, segT seg)
       i370_elf_validate_fix (fixP, seg);
 #endif
 #ifdef DEBUG
-      printf ("md_apply_fix3: reloc case %d in segment  %s %s:%d\n",
+      printf ("md_apply_fix: reloc case %d in segment  %s %s:%d\n",
              fixP->fx_r_type, segment_name (seg), fixP->fx_file, fixP->fx_line);
       printf ("\tcurrent fixup value is 0x%x \n", value);
 #endif