* config/tc-m68k.c (m68k_float_copnum): New static variable.
authorIan Lance Taylor <ian@airs.com>
Wed, 9 Aug 1995 19:32:49 +0000 (19:32 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 9 Aug 1995 19:32:49 +0000 (19:32 +0000)
(md_pseudo_table): Add fopt and mask2.
(m68k_ip): Use m68k_float_copnum, not COPNUM, when setting
coprocessor register to use.  In case 'I' when checking operands,
correct coprocessor register numbers.  In case 'I' when setting
operands, don't add 1.
(s_fopt): New static function.
* config/m68k-parse.h (COPNUM): Don't define.

gas/config/m68k-parse.h
gas/config/tc-m68k.c

index 128944c..95a1cd8 100644 (file)
@@ -38,7 +38,6 @@
 #define DATA DATA0
 #define ADDR ADDR0
 #define SP ADDR7
-#define COPNUM  COP0
 #define BAD BAD0
 #define BAC BAC0
 
@@ -71,10 +70,7 @@ enum m68k_register
   FP6,
   FP7,
 
-  /* Note that COP0==processor #1 -- COP0+7==#8, which stores as 000 */
-  /* I think. . .  */
-
-  COP0,                                /* Co-processor #1-#8 */
+  COP0,                                /* Co-processor #0-#7 */
   COP1,
   COP2,
   COP3,
index 046b44c..6412a5d 100644 (file)
@@ -73,6 +73,9 @@ int flag_reg_prefix_optional = REGISTER_PREFIX_OPTIONAL;
 int flag_reg_prefix_optional;
 #endif
 
+/* The floating point coprocessor to use by default.  */
+static enum m68k_register m68k_float_copnum = COP1;
+
 /* Its an arbitrary name:  This means I don't approve of it */
 /* See flames below */
 static struct obstack robyn;
@@ -276,6 +279,7 @@ static void s_even PARAMS ((int));
 static void s_proc PARAMS ((int));
 static void mri_chip PARAMS ((void));
 static void s_chip PARAMS ((int));
+static void s_fopt PARAMS ((int));
 
 static int current_architecture;
 
@@ -404,6 +408,8 @@ CONST pseudo_typeS md_pseudo_table[] =
   /* The following pseudo-ops are supported for MRI compatibility.  */
   {"chip", s_chip, 0},
   {"comline", s_space, 1},
+  {"fopt", s_fopt, 0},
+  {"mask2", s_ignore, 0},
 
   {0, 0, 0}
 };
@@ -670,7 +676,7 @@ m68k_ip (instring)
       memset ((char *) (&the_ins.operands[0]), '\0',
              sizeof (the_ins.operands[0]));
       the_ins.operands[0].mode = CONTROL;
-      the_ins.operands[0].reg = COPNUM;        /* COP #1 */
+      the_ins.operands[0].reg = m68k_float_copnum;
       opsfound++;
     }
 
@@ -953,8 +959,8 @@ m68k_ip (instring)
 
                case 'I':
                  if (opP->mode != CONTROL
-                     || opP->reg < COPNUM
-                     || opP->reg >= COPNUM + 7)
+                     || opP->reg < COP0
+                     || opP->reg > COP7)
                    losing++;
                  break;
 
@@ -1927,9 +1933,7 @@ m68k_ip (instring)
          break;
 
        case 'I':
-         tmpreg = 1 + opP->reg - COPNUM;
-         if (tmpreg == 8)
-           tmpreg = 0;
+         tmpreg = opP->reg - COP0;
          install_operand (s[1], tmpreg);
          break;
 
@@ -4034,6 +4038,35 @@ s_chip (ignore)
   mri_chip ();
   demand_empty_rest_of_line ();
 }
+
+/* The MRI FOPT pseudo-op.  */
+
+static void
+s_fopt (ignore)
+     int ignore;
+{
+  SKIP_WHITESPACE ();
+
+  if (strncasecmp (input_line_pointer, "ID=", 3) == 0)
+    {
+      int temp;
+
+      input_line_pointer += 3;
+      temp = get_absolute_expression ();
+      if (temp < 0 || temp > 7)
+       as_bad ("bad coprocessor id");
+      else
+       m68k_float_copnum = COP0 + temp;
+    }
+  else
+    {
+      as_bad ("unrecognized fopt option");
+      ignore_rest_of_line ();
+      return;
+    }
+
+  demand_empty_rest_of_line ();
+}
 \f
 /*
  * md_parse_option