? gas/testsuite/gas/mips/rol64.d
[deliverable/binutils-gdb.git] / opcodes / arc-opc.c
index 12ee62a263bd480823a41556fd956e32ec814b64..b7afb86ac9275fd4bb168eddb87e63bc56e60842 100644 (file)
@@ -1,7 +1,8 @@
 /* Opcode table for the ARC.
-   Copyright 1994, 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1997, 1998, 2000, 2001
+   Free Software Foundation, Inc.
    Contributed by Doug Evans (dje@cygnus.com).
-   
+
    This program 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)
@@ -16,6 +17,7 @@
    along with this program; if not, write to the Free Software Foundation,
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+#include "sysdep.h"
 #include <stdio.h>
 #include "ansidecl.h"
 #include "opcode/arc.h"
@@ -381,7 +383,7 @@ const struct arc_operand_value arc_reg_names[] =
   { "r59", 59, REG, 0 },
 
   /* Loop count register (24 bits).  */
-  { "lp_count", 60, REG, ARC_REGISTER_READONLY },
+  { "lp_count", 60, REG, 0 },
   /* Short immediate data indicator setting flags.  */
   { "r61", 61, REG, ARC_REGISTER_READONLY },
   /* Long immediate data indicator setting flags.  */
@@ -653,7 +655,7 @@ arc_opcode_init_insert ()
 
 int
 arc_opcode_limm_p (limmp)
-  long *limmp;
+     long *limmp;
 {
   if (limmp)
     *limmp = limm;
@@ -667,12 +669,12 @@ arc_opcode_limm_p (limmp)
 
 static arc_insn
 insert_reg (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods;
-  const struct arc_operand_value *reg;
-  long value;
-  const char **errmsg;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods;
+     const struct arc_operand_value *reg;
+     long value;
+     const char **errmsg;
 {
   static char buf[100];
   enum operand op_type = OP_NONE;
@@ -693,21 +695,21 @@ insert_reg (insn, operand, mods, reg, value, errmsg)
        {
          int marker;
 
-          op_type = OP_SHIMM;
-        /* forget about shimm as dest mlm.  */
+         op_type = OP_SHIMM;
+         /* forget about shimm as dest mlm.  */
 
-         if('a' != operand->fmt)
+         if ('a' != operand->fmt)
            {
              shimm_p = 1;
              shimm = value;
              flagshimm_handled_p = 1;
              marker = flag_p ? ARC_REG_SHIMM_UPDATE : ARC_REG_SHIMM;
            }
-          else
-            {
+         else
+           {
              /* don't request flag setting on shimm as dest.  */
              marker = ARC_REG_SHIMM;
-            }
+           }
          insn |= marker << operand->shift;
          /* insn |= value & 511; - done later.  */
        }
@@ -735,33 +737,33 @@ insert_reg (insn, operand, mods, reg, value, errmsg)
            *errmsg = "auxiliary register not allowed here";
          else
            {
-              if((insn & I(-1)) == I(2)) /* check for use validity.  */
-                 {
-                  if(reg->flags & ARC_REGISTER_READONLY)
-                    *errmsg = "attempt to set readonly register";
-                 }
-               else
-                 {
-                  if(reg->flags & ARC_REGISTER_WRITEONLY)
-                    *errmsg = "attempt to read writeonly register";
-                 }
+             if ((insn & I(-1)) == I(2)) /* check for use validity.  */
+               {
+                 if (reg->flags & ARC_REGISTER_READONLY)
+                   *errmsg = "attempt to set readonly register";
+               }
+             else
+               {
+                 if (reg->flags & ARC_REGISTER_WRITEONLY)
+                   *errmsg = "attempt to read writeonly register";
+               }
              insn |= ARC_REG_SHIMM << operand->shift;
              insn |= reg->value << arc_operands[reg->type].shift;
            }
        }
       else
        {
-      /* check for use validity.  */
-          if('a' == operand->fmt || ((insn & I(-1)) < I(2)))
-            {
-             if(reg->flags & ARC_REGISTER_READONLY)
+         /* check for use validity.  */
+         if ('a' == operand->fmt || ((insn & I(-1)) < I(2)))
+           {
+             if (reg->flags & ARC_REGISTER_READONLY)
                *errmsg = "attempt to set readonly register";
-            }
-          if('a' != operand->fmt)
-            {
-             if(reg->flags & ARC_REGISTER_WRITEONLY)
+           }
+         if ('a' != operand->fmt)
+           {
+             if (reg->flags & ARC_REGISTER_WRITEONLY)
                *errmsg = "attempt to read writeonly register";
-            }
+           }
          /* We should never get an invalid register number here.  */
          if ((unsigned int) reg->value > 60)
            {
@@ -769,23 +771,23 @@ insert_reg (insn, operand, mods, reg, value, errmsg)
              *errmsg = buf;
            }
          insn |= reg->value << operand->shift;
-          op_type = OP_REG;
+         op_type = OP_REG;
        }
     }
 
   switch (operand->fmt)
     {
     case 'a':
-      ls_operand[LS_DEST] = op_type; 
+      ls_operand[LS_DEST] = op_type;
       break;
     case 's':
-      ls_operand[LS_BASE] = op_type; 
+      ls_operand[LS_BASE] = op_type;
       break;
     case 'c':
       if ((insn & I(-1)) == I(2))
-          ls_operand[LS_VALUE] = op_type; 
+       ls_operand[LS_VALUE] = op_type;
       else
-          ls_operand[LS_OFFSET] = op_type;
+       ls_operand[LS_OFFSET] = op_type;
       break;
     case 'o': case 'O':
       ls_operand[LS_OFFSET] = op_type;
@@ -799,12 +801,12 @@ insert_reg (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_flag (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   /* We can't store anything in the insn until we've parsed the registers.
      Just record the fact that we've got this flag.  `insert_reg' will use it
@@ -817,12 +819,12 @@ insert_flag (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_nullify (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   nullify_p = 1;
   insn |= (value & ((1 << operand->bits) - 1)) << operand->shift;
@@ -836,12 +838,12 @@ insert_nullify (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_flagfinish (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   if (flag_p && !flagshimm_handled_p)
     {
@@ -857,12 +859,12 @@ insert_flagfinish (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_cond (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   cond_p = 1;
   insn |= (value & ((1 << operand->bits) - 1)) << operand->shift;
@@ -877,12 +879,12 @@ insert_cond (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_forcelimm (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   cond_p = 1;
   return insn;
@@ -890,12 +892,12 @@ insert_forcelimm (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_addr_wb (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   addrwb_p = 1 << operand->shift;
   return insn;
@@ -903,31 +905,31 @@ insert_addr_wb (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_base (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods;
-  const struct arc_operand_value *reg;
-  long value;
-  const char **errmsg;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods;
+     const struct arc_operand_value *reg;
+     long value;
+     const char **errmsg;
 {
   if (reg != NULL)
     {
       arc_insn myinsn;
       myinsn = insert_reg (0, operand,mods, reg, value, errmsg) >> operand->shift;
       insn |= B(myinsn);
-      ls_operand[LS_BASE] = OP_REG; 
+      ls_operand[LS_BASE] = OP_REG;
     }
   else if (ARC_SHIMM_CONST_P (value) && !cond_p)
     {
       if (shimm_p && value != shimm)
-        {
-          /* convert the previous shimm operand to a limm.  */
-          limm_p = 1;
-          limm = shimm;
-          insn &= ~C(-1); /* we know where the value is in insn.  */
-          insn |= C(ARC_REG_LIMM);
-          ls_operand[LS_VALUE] = OP_LIMM;
-        }
+       {
+         /* convert the previous shimm operand to a limm.  */
+         limm_p = 1;
+         limm = shimm;
+         insn &= ~C(-1); /* we know where the value is in insn.  */
+         insn |= C(ARC_REG_LIMM);
+         ls_operand[LS_VALUE] = OP_LIMM;
+       }
       insn |= ARC_REG_SHIMM << operand->shift;
       shimm_p = 1;
       shimm = value;
@@ -936,10 +938,10 @@ insert_base (insn, operand, mods, reg, value, errmsg)
   else
     {
       if (limm_p && value != limm)
-        {
-          *errmsg = "too many long constants";
-          return insn;
-        }
+       {
+         *errmsg = "too many long constants";
+         return insn;
+       }
       limm_p = 1;
       limm = value;
       insn |= B(ARC_REG_LIMM);
@@ -954,12 +956,12 @@ insert_base (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_offset (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods;
-  const struct arc_operand_value *reg;
-  long value;
-  const char **errmsg;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods;
+     const struct arc_operand_value *reg;
+     long value;
+     const char **errmsg;
 {
   long minval, maxval;
 
@@ -969,8 +971,8 @@ insert_offset (insn, operand, mods, reg, value, errmsg)
       myinsn = insert_reg (0,operand,mods,reg,value,errmsg) >> operand->shift;
       ls_operand[LS_OFFSET] = OP_REG;
       if (operand->flags & ARC_OPERAND_LOAD) /* not if store, catch it later.  */
-          if ((insn & I(-1)) != I(1)) /* not if opcode == 1, catch it later.  */
-              insn |= C(myinsn);
+       if ((insn & I(-1)) != I(1)) /* not if opcode == 1, catch it later.  */
+         insn |= C(myinsn);
     }
   else
     {
@@ -988,26 +990,26 @@ insert_offset (insn, operand, mods, reg, value, errmsg)
        }
       if ((cond_p && !limm_p) || (value < minval || value > maxval))
        {
-        if (limm_p && value != limm)
-          {
-           *errmsg = "too many long constants";
-          }
-        else
-          {
-           limm_p = 1;
-           limm = value;
-           if (operand->flags & ARC_OPERAND_STORE)
-             insn |= B(ARC_REG_LIMM);
-           if (operand->flags & ARC_OPERAND_LOAD)
-             insn |= C(ARC_REG_LIMM);
-           ls_operand[LS_OFFSET] = OP_LIMM;
-          }
+         if (limm_p && value != limm)
+           {
+             *errmsg = "too many long constants";
+           }
+         else
+           {
+             limm_p = 1;
+             limm = value;
+             if (operand->flags & ARC_OPERAND_STORE)
+               insn |= B(ARC_REG_LIMM);
+             if (operand->flags & ARC_OPERAND_LOAD)
+               insn |= C(ARC_REG_LIMM);
+             ls_operand[LS_OFFSET] = OP_LIMM;
+           }
        }
       else
-        {
+       {
          if ((value < minval || value > maxval))
            *errmsg = "need too many limms";
-         else if (shimm_p && value != shimm) 
+         else if (shimm_p && value != shimm)
            {
              /* check for bad operand combinations before we lose info about them.  */
              if ((insn & I(-1)) == I(1))
@@ -1039,7 +1041,7 @@ insert_offset (insn, operand, mods, reg, value, errmsg)
          shimm = value;
          shimm_p = 1;
          ls_operand[LS_OFFSET] = OP_SHIMM;
-        }
+       }
     }
  out:
   return insn;
@@ -1049,24 +1051,25 @@ insert_offset (insn, operand, mods, reg, value, errmsg)
 
 static long
 extract_st_syntax (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
-  int *invalid;
+     arc_insn *insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
+     int *invalid;
 {
 #define ST_SYNTAX(V,B,O) \
 ((ls_operand[LS_VALUE]  == (V) && \
   ls_operand[LS_BASE]   == (B) && \
   ls_operand[LS_OFFSET] == (O)))
-  if (!((ST_SYNTAX(OP_REG,OP_REG,OP_NONE)   && (insn[0] & 511) == 0)
+
+  if (!((ST_SYNTAX(OP_REG,OP_REG,OP_NONE) && (insn[0] & 511) == 0)
        || ST_SYNTAX(OP_REG,OP_LIMM,OP_NONE)
        || (ST_SYNTAX(OP_SHIMM,OP_REG,OP_NONE) && (insn[0] & 511) == 0)
        || (ST_SYNTAX(OP_SHIMM,OP_SHIMM,OP_NONE) && (insn[0] & 511) == 0)
        || ST_SYNTAX(OP_SHIMM,OP_LIMM,OP_NONE)
        || ST_SYNTAX(OP_SHIMM,OP_LIMM,OP_SHIMM)
        || ST_SYNTAX(OP_SHIMM,OP_SHIMM,OP_SHIMM)
-       || (ST_SYNTAX(OP_LIMM,OP_REG,OP_NONE)  && (insn[0] & 511) == 0)
+       || (ST_SYNTAX(OP_LIMM,OP_REG,OP_NONE) && (insn[0] & 511) == 0)
        || ST_SYNTAX(OP_REG,OP_REG,OP_SHIMM)
        || ST_SYNTAX(OP_REG,OP_SHIMM,OP_SHIMM)
        || ST_SYNTAX(OP_SHIMM,OP_REG,OP_SHIMM)
@@ -1079,31 +1082,31 @@ extract_st_syntax (insn, operand, mods, opval, invalid)
 
 int
 arc_limm_fixup_adjust(insn)
-  arc_insn insn;
+     arc_insn insn;
 {
   int retval = 0;
 
   /* check for st shimm,[limm].  */
   if ((insn & (I(-1) | C(-1) | B(-1))) ==
-     (I(2) | C(ARC_REG_SHIMM) | B(ARC_REG_LIMM)))
+      (I(2) | C(ARC_REG_SHIMM) | B(ARC_REG_LIMM)))
     {
       retval = insn & 0x1ff;
       if (retval & 0x100) /* sign extend 9 bit offset.  */
        retval |= ~0x1ff;
     }
-  return(-retval); /* negate offset for return.  */
+  return -retval; /* negate offset for return.  */
 }
 
 /* Used in st insns to do final syntax check.  */
 
 static arc_insn
 insert_st_syntax (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg;
+     arc_insn insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg;
 {
   if (ST_SYNTAX(OP_SHIMM,OP_REG,OP_NONE) && shimm != 0)
     {
@@ -1121,40 +1124,32 @@ insert_st_syntax (insn, operand, mods, reg, value, errmsg)
   if (ST_SYNTAX(OP_REG,OP_SHIMM,OP_NONE) || ST_SYNTAX(OP_LIMM,OP_SHIMM,OP_NONE))
     {
       /* try to salvage this syntax.  */
-    if (shimm & 0x1) /* odd shimms won't work.  */
-      {
-       if (limm_p) /* do we have a limm already?  */
-         {
-           *errmsg = "impossible store";
-         }
-       limm_p = 1;
-       limm = shimm;
-       shimm = 0;
-       shimm_p = 0;
-       insn = insn & ~(B(-1) | 511);
-       insn |= B(ARC_REG_LIMM);
-       ls_operand[LS_BASE] = OP_LIMM;
-      }
-    else
-      {
-       shimm >>= 1;
-       insn = insn & ~511;
-       insn |= shimm;
-       ls_operand[LS_OFFSET] = OP_SHIMM;
-      }
+      if (shimm & 0x1) /* odd shimms won't work.  */
+       {
+         if (limm_p) /* do we have a limm already?  */
+           {
+             *errmsg = "impossible store";
+           }
+         limm_p = 1;
+         limm = shimm;
+         shimm = 0;
+         shimm_p = 0;
+         insn = insn & ~(B(-1) | 511);
+         insn |= B(ARC_REG_LIMM);
+         ls_operand[LS_BASE] = OP_LIMM;
+       }
+      else
+       {
+         shimm >>= 1;
+         insn = insn & ~511;
+         insn |= shimm;
+         ls_operand[LS_OFFSET] = OP_SHIMM;
+       }
     }
   if (ST_SYNTAX(OP_SHIMM,OP_LIMM,OP_NONE))
     {
       limm += arc_limm_fixup_adjust(insn);
     }
-  if (ST_SYNTAX(OP_LIMM,OP_SHIMM,OP_SHIMM) && (shimm * 2 == limm))
-    {
-      insn &= ~C(-1);
-      limm_p = 0;
-      limm = 0;
-      insn |= C(ARC_REG_SHIMM);
-      ls_operand[LS_VALUE] = OP_SHIMM;
-    }
   if (!(ST_SYNTAX(OP_REG,OP_REG,OP_NONE)
        || ST_SYNTAX(OP_REG,OP_LIMM,OP_NONE)
        || ST_SYNTAX(OP_REG,OP_REG,OP_SHIMM)
@@ -1165,7 +1160,7 @@ insert_st_syntax (insn, operand, mods, reg, value, errmsg)
        || ST_SYNTAX(OP_SHIMM,OP_REG,OP_SHIMM)
        || ST_SYNTAX(OP_SHIMM,OP_SHIMM,OP_SHIMM)
        || ST_SYNTAX(OP_LIMM,OP_SHIMM,OP_SHIMM)
-       || ST_SYNTAX(OP_LIMM,OP_REG,OP_NONE) 
+       || ST_SYNTAX(OP_LIMM,OP_REG,OP_NONE)
        || ST_SYNTAX(OP_LIMM,OP_REG,OP_SHIMM)))
     *errmsg = "st operand error";
   if (addrwb_p)
@@ -1183,12 +1178,12 @@ insert_st_syntax (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_ld_syntax (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg;
+     arc_insn insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg;
 {
 #define LD_SYNTAX(D,B,O) \
 ((ls_operand[LS_DEST]  == (D) && \
@@ -1198,19 +1193,19 @@ insert_ld_syntax (insn, operand, mods, reg, value, errmsg)
   int test = insn & I(-1);
 
   if (!(test == I(1)))
-   {
-     if ((ls_operand[LS_DEST] == OP_SHIMM || ls_operand[LS_BASE] == OP_SHIMM
-         || ls_operand[LS_OFFSET] == OP_SHIMM))
-       *errmsg = "invalid load/shimm insn";
-   }
+    {
+      if ((ls_operand[LS_DEST] == OP_SHIMM || ls_operand[LS_BASE] == OP_SHIMM
+          || ls_operand[LS_OFFSET] == OP_SHIMM))
+       *errmsg = "invalid load/shimm insn";
+    }
   if (!(LD_SYNTAX(OP_REG,OP_REG,OP_NONE)
        || LD_SYNTAX(OP_REG,OP_REG,OP_REG)
        || LD_SYNTAX(OP_REG,OP_REG,OP_SHIMM)
        || (LD_SYNTAX(OP_REG,OP_LIMM,OP_REG) && !(test == I(1)))
        || (LD_SYNTAX(OP_REG,OP_REG,OP_LIMM) && !(test == I(1)))
-       || LD_SYNTAX(OP_REG,OP_SHIMM,OP_SHIMM) 
+       || LD_SYNTAX(OP_REG,OP_SHIMM,OP_SHIMM)
        || (LD_SYNTAX(OP_REG,OP_LIMM,OP_NONE) && (test == I(1)))))
-      *errmsg = "ld operand error";
+    *errmsg = "ld operand error";
   if (addrwb_p)
     {
       if (ls_operand[LS_BASE] != OP_REG)
@@ -1224,18 +1219,18 @@ insert_ld_syntax (insn, operand, mods, reg, value, errmsg)
 
 static long
 extract_ld_syntax (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
-  int *invalid;
+     arc_insn *insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
+     int *invalid;
 {
   int test = insn[0] & I(-1);
 
   if (!(test == I(1)))
     {
-      if((ls_operand[LS_DEST] == OP_SHIMM || ls_operand[LS_BASE] == OP_SHIMM
-         || ls_operand[LS_OFFSET] == OP_SHIMM))
+      if ((ls_operand[LS_DEST] == OP_SHIMM || ls_operand[LS_BASE] == OP_SHIMM
+          || ls_operand[LS_OFFSET] == OP_SHIMM))
        *invalid = 1;
     }
   if (!((LD_SYNTAX(OP_REG,OP_REG,OP_NONE) && (test == I(1)))
@@ -1255,12 +1250,12 @@ extract_ld_syntax (insn, operand, mods, opval, invalid)
 
 static arc_insn
 insert_shimmfinish (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   if (shimm_p)
     insn |= (shimm & ((1 << operand->bits) - 1)) << operand->shift;
@@ -1281,12 +1276,12 @@ insert_shimmfinish (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_limmfinish (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
 #if 0
   if (limm_p)
@@ -1297,12 +1292,12 @@ insert_limmfinish (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_jumpflags (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value;
-  const char **errmsg;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value;
+     const char **errmsg;
 {
   if (!flag_p)
     {
@@ -1325,8 +1320,8 @@ insert_jumpflags (insn, operand, mods, reg, value, errmsg)
       *errmsg = "bad jump flags value";
     }
   jumpflags_p = 1;
-  limm = (limm & ((1 << operand->shift) - 1))
-    | ((value & ((1 << operand->bits) - 1)) << operand->shift); 
+  limm = ((limm & ((1 << operand->shift) - 1))
+         | ((value & ((1 << operand->bits) - 1)) << operand->shift));
   return insn;
 }
 
@@ -1334,12 +1329,12 @@ insert_jumpflags (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_unopmacro (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg ATTRIBUTE_UNUSED;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg ATTRIBUTE_UNUSED;
 {
   insn |= ((insn >> ARC_SHIFT_REGB) & ARC_MASK_REG) << operand->shift;
   return insn;
@@ -1349,12 +1344,12 @@ insert_unopmacro (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_reladdr (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value;
-  const char **errmsg;
+     arc_insn insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value;
+     const char **errmsg;
 {
   if (value & 3)
     *errmsg = "branch address not on 4 byte boundary";
@@ -1378,12 +1373,12 @@ insert_reladdr (insn, operand, mods, reg, value, errmsg)
 
 static arc_insn
 insert_absaddr (insn, operand, mods, reg, value, errmsg)
-  arc_insn insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
-  long value ATTRIBUTE_UNUSED;
-  const char **errmsg;
+     arc_insn insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value *reg ATTRIBUTE_UNUSED;
+     long value ATTRIBUTE_UNUSED;
+     const char **errmsg;
 {
   if (limm_p)
     {
@@ -1396,7 +1391,7 @@ insert_absaddr (insn, operand, mods, reg, value, errmsg)
            }
          else
            {
-             if(nullify != 0x02)
+             if (nullify != 0x02)
                {
                  *errmsg = "must specify .jd or no nullify suffix";
                }
@@ -1432,11 +1427,11 @@ arc_opcode_init_extract ()
 
 static long
 extract_reg (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand;
-  int mods;
-  const struct arc_operand_value **opval;
-  int *invalid ATTRIBUTE_UNUSED;
+     arc_insn *insn;
+     const struct arc_operand *operand;
+     int mods;
+     const struct arc_operand_value **opval;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   int regno;
   long value;
@@ -1449,7 +1444,7 @@ extract_reg (insn, operand, mods, opval, invalid)
   if (regno == ARC_REG_SHIMM)
     {
       op_type = OP_SHIMM;
-    /* always return zero if dest is a shimm  mlm.  */
+      /* always return zero if dest is a shimm  mlm.  */
 
       if ('a' != operand->fmt)
        {
@@ -1491,10 +1486,10 @@ extract_reg (insn, operand, mods, opval, invalid)
       value = insn[1];
       limm_p = 1;
       /* if this is a jump instruction (j,jl), show new pc correctly.  */
-      if(0x07 == ((*insn & I(-1)) >> 27))
-        {
+      if (0x07 == ((*insn & I(-1)) >> 27))
+       {
          value = (value & 0xffffff);
-        }
+       }
     }
   /* It's a register, set OPVAL (that's the only way we distinguish registers
      from constants here).  */
@@ -1522,23 +1517,23 @@ extract_reg (insn, operand, mods, opval, invalid)
        *opval = reg;
     }
   switch(operand->fmt)
-   {
-   case 'a':
-     ls_operand[LS_DEST] = op_type; 
-     break;
-   case 's':
-     ls_operand[LS_BASE] = op_type; 
-     break;
-   case 'c':
-     if((insn[0]& I(-1)) == I(2))
-       ls_operand[LS_VALUE] = op_type; 
-     else
-       ls_operand[LS_OFFSET] = op_type;
-     break;
-   case 'o': case 'O':
-     ls_operand[LS_OFFSET] = op_type;
-     break;
-   }
+    {
+    case 'a':
+      ls_operand[LS_DEST] = op_type;
+      break;
+    case 's':
+      ls_operand[LS_BASE] = op_type;
+      break;
+    case 'c':
+      if ((insn[0]& I(-1)) == I(2))
+       ls_operand[LS_VALUE] = op_type;
+      else
+       ls_operand[LS_OFFSET] = op_type;
+      break;
+    case 'o': case 'O':
+      ls_operand[LS_OFFSET] = op_type;
+      break;
+    }
 
   return value;
 }
@@ -1548,11 +1543,11 @@ extract_reg (insn, operand, mods, opval, invalid)
 
 static long
 extract_flag (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value **opval;
-  int *invalid ATTRIBUTE_UNUSED;
+     arc_insn *insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value **opval;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   int f;
   const struct arc_operand_value *val;
@@ -1579,11 +1574,11 @@ extract_flag (insn, operand, mods, opval, invalid)
 
 static long
 extract_cond (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value **opval;
-  int *invalid ATTRIBUTE_UNUSED;
+     arc_insn *insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value **opval;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   long cond;
   const struct arc_operand_value *val;
@@ -1606,11 +1601,11 @@ extract_cond (insn, operand, mods, opval, invalid)
 
 static long
 extract_reladdr (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
-  int *invalid ATTRIBUTE_UNUSED;
+     arc_insn *insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
+     int *invalid ATTRIBUTE_UNUSED;
 {
   long addr;
 
@@ -1624,27 +1619,27 @@ extract_reladdr (insn, operand, mods, opval, invalid)
 /* extract the flags bits from a j or jl long immediate.  */
 static long
 extract_jumpflags(insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
-  int *invalid;
+     arc_insn *insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
+     int *invalid;
 {
   if (!flag_p || !limm_p)
     *invalid = 1;
-  return((flag_p && limm_p)
-         ? (insn[1] >> operand->shift) & ((1 << operand->bits) -1): 0);
+  return ((flag_p && limm_p)
+         ? (insn[1] >> operand->shift) & ((1 << operand->bits) -1): 0);
 }
 
 /* extract st insn's offset.  */
 
 static long
 extract_st_offset (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
-  int *invalid;
+     arc_insn *insn;
+     const struct arc_operand *operand;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
+     int *invalid;
 {
   int value = 0;
 
@@ -1653,7 +1648,7 @@ extract_st_offset (insn, operand, mods, opval, invalid)
       value = insn[0] & 511;
       if ((operand->flags & ARC_OPERAND_SIGNED) && (value & 256))
        value -= 512;
-      if(value)
+      if (value)
        ls_operand[LS_OFFSET] = OP_SHIMM;
     }
   else
@@ -1667,11 +1662,11 @@ extract_st_offset (insn, operand, mods, opval, invalid)
 
 static long
 extract_ld_offset (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand;
-  int mods;
-  const struct arc_operand_value **opval;
-  int *invalid;
+     arc_insn *insn;
+     const struct arc_operand *operand;
+     int mods;
+     const struct arc_operand_value **opval;
+     int *invalid;
 {
   int test = insn[0] & I(-1);
   int value;
@@ -1685,9 +1680,9 @@ extract_ld_offset (insn, operand, mods, opval, invalid)
        ls_operand[LS_OFFSET] = OP_SHIMM;
       return(value);
     }
-/* if it isn't in the insn, it's concealed behind reg 'c'.  */
-  return extract_reg(insn,
-                     &arc_operands[arc_operand_map['c']], mods, opval, invalid);
+  /* if it isn't in the insn, it's concealed behind reg 'c'.  */
+  return extract_reg (insn, &arc_operands[arc_operand_map['c']],
+                     mods, opval, invalid);
 }
 
 /* The only thing this does is set the `invalid' flag if B != C.
@@ -1696,11 +1691,11 @@ extract_ld_offset (insn, operand, mods, opval, invalid)
 
 static long
 extract_unopmacro (insn, operand, mods, opval, invalid)
-  arc_insn *insn;
-  const struct arc_operand *operand ATTRIBUTE_UNUSED;
-  int mods ATTRIBUTE_UNUSED;
-  const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
-  int *invalid;
+     arc_insn *insn;
+     const struct arc_operand *operand ATTRIBUTE_UNUSED;
+     int mods ATTRIBUTE_UNUSED;
+     const struct arc_operand_value **opval ATTRIBUTE_UNUSED;
+     int *invalid;
 {
   /* This misses the case where B == ARC_REG_SHIMM_UPDATE &&
      C == ARC_REG_SHIMM (or vice versa).  No big deal.  Those insns will get
@@ -1717,8 +1712,8 @@ extract_unopmacro (insn, operand, mods, opval, invalid)
 
 const struct arc_operand_value *
 arc_opcode_lookup_suffix (type, value)
-  const struct arc_operand *type;
-  int value;
+     const struct arc_operand *type;
+     int value;
 {
   register const struct arc_operand_value *v,*end;
   struct arc_ext_operand_value *ext_oper = arc_ext_operands;
@@ -1742,8 +1737,8 @@ arc_opcode_lookup_suffix (type, value)
 
 static const struct arc_operand_value *
 lookup_register (type, regno)
-  int type;
-  long regno;
+     int type;
+     long regno;
 {
   register const struct arc_operand_value *r,*end;
   struct arc_ext_operand_value *ext_oper = arc_ext_operands;
@@ -1769,17 +1764,17 @@ lookup_register (type, regno)
 
 int
 arc_insn_is_j(insn)
-  arc_insn insn;
+     arc_insn insn;
 {
   return (insn & (I(-1))) == I(0x7);
 }
 
 int
 arc_insn_not_jl(insn)
-  arc_insn insn;
+     arc_insn insn;
 {
-  return (insn & (I(-1)|A(-1)|C(-1)|R(-1,7,1)|R(-1,9,1))) !=
-    (I(0x7) | R(-1,9,1));
+  return ((insn & (I(-1)|A(-1)|C(-1)|R(-1,7,1)|R(-1,9,1)))
+         != (I(0x7) | R(-1,9,1)));
 }
 
 int
@@ -1802,7 +1797,7 @@ arc_operand_type(int opertype)
 
 struct arc_operand_value *
 get_ext_suffix(s)
-  char *s;
+     char *s;
 {
   struct arc_ext_operand_value *suffix = arc_ext_operands;
 
@@ -1813,11 +1808,11 @@ get_ext_suffix(s)
        return(&suffix->operand);
       suffix = suffix->next;
     }
-  return(NULL);
+  return NULL;
 }
 
 int
 arc_get_noshortcut_flag()
 {
-  return(ARC_REGISTER_NOSHORT_CUT);
+  return ARC_REGISTER_NOSHORT_CUT;
 }
This page took 0.042586 seconds and 4 git commands to generate.