* config/tc-mips.c (macro_build): Refine code to check if an
authorJeff Law <law@redhat.com>
Fri, 11 Jul 1997 16:40:14 +0000 (16:40 +0000)
committerJeff Law <law@redhat.com>
Fri, 11 Jul 1997 16:40:14 +0000 (16:40 +0000)
        instruction is available on a particular cpu variant.
        (mips_ip): Likewise.
toshiba 5900 stuff

gas/ChangeLog
gas/config/tc-mips.c

index 8d59d29a58ee92f351de74d5015adf571a38c1d3..2060e9c9ed77355538864df88249521458452ad1 100644 (file)
@@ -1,3 +1,9 @@
+Fri Jul 11 10:18:47 1997  Jeffrey A Law  (law@cygnus.com)
+
+       * config/tc-mips.c (macro_build): Refine code to check if an
+       instruction is available on a particular cpu variant.
+       (mips_ip): Likewise.
+
 Mon Jul  7 22:53:08 1997  Ian Lance Taylor  <ian@cygnus.com>
 
        * config/tc-i386.c (tc_i386_fix_adjustable): Change ifndef
index 5e92c7334bf22b90844ca6e6e39c2bcedcc97c97..5a71412c14d41524880b678d376f0f3d86a90dea 100644 (file)
@@ -2327,6 +2327,7 @@ macro_build (place, counter, ep, name, fmt, va_alist)
   struct mips_cl_insn insn;
   bfd_reloc_code_real_type r;
   va_list args;
+  int insn_isa;
 
 #ifdef USE_STDARG
   va_start (args, fmt);
@@ -2357,32 +2358,50 @@ macro_build (place, counter, ep, name, fmt, va_alist)
   assert (insn.insn_mo);
   assert (strcmp (name, insn.insn_mo->name) == 0);
 
-  while (strcmp (fmt, insn.insn_mo->args) != 0
-        || insn.insn_mo->pinfo == INSN_MACRO
-        || ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA2
-            && mips_opts.isa < 2)
-        || ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA3
-            && mips_opts.isa < 3)
-        || ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA4
-            && mips_opts.isa < 4)
-         || ((insn.insn_mo->membership & INSN_ISA) == INSN_3900
-            && ! mips_3900)
-         || ((insn.insn_mo->membership & INSN_ISA) == INSN_4650
-            && ! mips_4650)
-        || ((insn.insn_mo->membership & INSN_ISA) == INSN_4010
-            && ! mips_4010)
-        || ((insn.insn_mo->membership & INSN_ISA) == INSN_4100
-            && ! mips_4100)
-        /* start-sanitize-r5900 */
-         || ((insn.insn_mo->membership & INSN_ISA) == INSN_5900
-            && ! mips_5900)
-         /* end-sanitize-r5900 */
-         )
+
+  /* Search until we get a match for NAME.  */
+  while (1)
     {
-      ++insn.insn_mo;
-      assert (insn.insn_mo->name);
-      assert (strcmp (name, insn.insn_mo->name) == 0);
+      if (insn.insn_mo->pinfo == INSN_MACRO)
+       insn_isa = insn.insn_mo->match;
+      else if ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA1)
+       insn_isa = 1;
+      else if ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA2)
+       insn_isa = 2;
+      else if ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA3)
+       insn_isa = 3;
+      else if ((insn.insn_mo->membership & INSN_ISA) == INSN_ISA4)
+       insn_isa = 4;
+      else
+       insn_isa = 15;
+
+      if (insn_isa > mips_opts.isa
+         && (insn.insn_mo->pinfo != INSN_MACRO
+             && ((mips_4650
+                  && (insn.insn_mo->membership & INSN_4650) != INSN_4650)
+                 || (mips_4650 && (insn.insn_mo->pinfo & FP_D))
+                 || (mips_4010
+                     && (insn.insn_mo->membership & INSN_4010) != INSN_4010)
+                 || (mips_4100
+                     && (insn.insn_mo->membership & INSN_4100) != INSN_4100)
+                 /* start-sanitize-r5900 */
+                 || (mips_5900
+                     && (insn.insn_mo->membership & INSN_5900) != INSN_5900)
+                 || (mips_5900 && (insn.insn_mo->pinfo & FP_D))
+                 /* end-sanitize-r5900 */
+                 || (mips_3900
+                     && (insn.insn_mo->membership & INSN_3900) != INSN_3900))))
+       {
+         ++insn.insn_mo;
+         assert (insn.insn_mo->name);
+         assert (strcmp (name, insn.insn_mo->name) == 0);
+         continue;
+       }
+
+      /* We got a successful match.  */
+      break;
     }
+
   insn.insn_opcode = insn.insn_mo->match;
   for (;;)
     {
@@ -6557,6 +6576,8 @@ mips_ip (str, ip)
 
       if (insn->pinfo == INSN_MACRO)
        insn_isa = insn->match;
+      else if ((insn->membership & INSN_ISA) == INSN_ISA1)
+       insn_isa = 1;
       else if ((insn->membership & INSN_ISA) == INSN_ISA2)
        insn_isa = 2;
       else if ((insn->membership & INSN_ISA) == INSN_ISA3)
@@ -6564,23 +6585,24 @@ mips_ip (str, ip)
       else if ((insn->membership & INSN_ISA) == INSN_ISA4)
        insn_isa = 4;
       else
-       insn_isa = 1;
+       insn_isa = 15;
 
       if (insn_isa > mips_opts.isa
-         || (insn->pinfo != INSN_MACRO
-             && (((insn->membership & INSN_ISA) == INSN_4650
-                   && ! mips_4650)
-                 || ((insn->membership & INSN_ISA) == INSN_4010
-                     && ! mips_4010)
-                 || ((insn->membership & INSN_ISA) == INSN_4100
-                     && ! mips_4100)
+         && (insn->pinfo != INSN_MACRO
+             && ((mips_4650
+                  && (insn->membership & INSN_4650) != INSN_4650)
+                 || (mips_4650 && (insn->pinfo & FP_D))
+                 || (mips_4010
+                     && (insn->membership & INSN_4010) != INSN_4010)
+                 || (mips_4100
+                     && (insn->membership & INSN_4100) != INSN_4100)
                  /* start-sanitize-r5900 */
-                 || ((insn->membership & INSN_ISA) == INSN_5900
-                     && ! mips_5900)
+                 || (mips_5900
+                     && (insn->membership & INSN_5900) != INSN_5900)
+                 || (mips_5900 && (insn->pinfo & FP_D))
                  /* end-sanitize-r5900 */
-                  || ((insn->membership & INSN_ISA) == INSN_3900
-                     && ! mips_3900)
-                  )))
+                 || (mips_3900
+                     && (insn->membership & INSN_3900) != INSN_3900))))
        {
          if (insn + 1 < &mips_opcodes[NUMOPCODES]
              && strcmp (insn->name, insn[1].name) == 0)