Add support for files that contain multiple symbol index tables. Fixes PR 15835
[deliverable/binutils-gdb.git] / opcodes / rx-decode.opc
index a426b86416a0d1c415abbd222591a2a7320272e5..7c641fa3ff0897ba57de87c93aa6ca9a725928e0 100644 (file)
@@ -1,9 +1,29 @@
 /* -*- c -*- */
+/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
+   Contributed by Red Hat.
+   Written by DJ Delorie.
+
+   This file is part of the GNU opcodes library.
+
+   This library 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 3, or (at your option)
+   any later version.
+
+   It is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
+
+#include "sysdep.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#include "config.h"
 #include "ansidecl.h"
 #include "opcode/rx.h"
 
@@ -28,21 +48,24 @@ static int bwl[] =
 {
   RX_Byte,
   RX_Word,
-  RX_Long
+  RX_Long,
+  RX_Bad_Size /* Bogus instructions can have a size field set to 3.  */
 };
 
 static int sbwl[] =
 {
   RX_SByte,
   RX_SWord,
-  RX_Long
+  RX_Long,
+  RX_Bad_Size /* Bogus instructions can have a size field set to 3.  */
 };
 
-static int ubwl[] =
+static int ubw[] =
 {
   RX_UByte,
   RX_UWord,
-  RX_Long
+  RX_Bad_Size,/* Bogus instructions can have a size field set to 2.  */
+  RX_Bad_Size /* Bogus instructions can have a size field set to 3.  */
 };
 
 static int memex[] =
@@ -61,7 +84,7 @@ static int memex[] =
                        rx->op[n].size = s )
 
 /* This is for the BWL and BW bitfields.  */
-static int SCALE[] = { 1, 2, 4 };
+static int SCALE[] = { 1, 2, 4, 0 };
 /* This is for the prefix size enum.  */
 static int PSCALE[] = { 4, 1, 1, 1, 2, 2, 2, 3, 4 };
 
@@ -108,7 +131,7 @@ static int dsp3map[] = { 8, 9, 10, 3, 4, 5, 6, 7 };
 
 #define BWL(sz)     rx->op[0].size = rx->op[1].size = rx->op[2].size = rx->size = bwl[sz]
 #define sBWL(sz)    rx->op[0].size = rx->op[1].size = rx->op[2].size = rx->size = sbwl[sz]
-#define uBWL(sz)    rx->op[0].size = rx->op[1].size = rx->op[2].size = rx->size = ubwl[sz]
+#define uBW(sz)     rx->op[0].size = rx->op[1].size = rx->op[2].size = rx->size = ubw[sz]
 #define P(t, n)            rx->op[n].size = (t!=3) ? RX_UByte : RX_Long;
 
 #define F(f) store_flags(rx, f)
@@ -226,7 +249,7 @@ rx_disp (int n, int type, int reg, int size, LocalData * ld)
 #define xZ 2
 #define xC 1
 
-#define F_____ 
+#define F_____
 #define F___ZC rx->flags_0 = rx->flags_s = xZ|xC;
 #define F__SZ_ rx->flags_0 = rx->flags_s = xS|xZ;
 #define F__SZC rx->flags_0 = rx->flags_s = xS|xZ|xC;
@@ -262,7 +285,20 @@ rx_decode_opcode (unsigned long pc AU,
   ID(mov); DR(rdst); SC(IMM (1)); F_____;
 
 /** 1111 10sd rdst im sz       mov%s   #%1, %0 */
-  ID(mov); sBWL (sz); DD(sd, rdst, sz); SC(IMMex(im)); F_____;
+  ID(mov); DD(sd, rdst, sz);
+  if ((im == 1 && sz == 0)
+      || (im == 2 && sz == 1)
+      || (im == 0 && sz == 2))
+    {
+      BWL (sz);
+      SC(IMM(im));
+    }
+  else
+    {
+      sBWL (sz);
+      SC(IMMex(im));
+    }
+   F_____;
 
 /** 0110 0110 immm rdst                mov%s   #%1, %0 */
   ID(mov); DR(rdst); SC(immm); F_____;
@@ -271,7 +307,7 @@ rx_decode_opcode (unsigned long pc AU,
   ID(mov); sBWL (sz); DIs(dst, d*16+sppp, sz); SC(IMM(1)); F_____;
 
 /** 11sz sd ss rsrc rdst       mov%s   %1, %0 */
-  if (ss == 3 && sz == 2 && rsrc == 0 && rdst == 0)
+  if (sd == 3 && ss == 3 && sz == 2 && rsrc == 0 && rdst == 0)
     {
       ID(nop2);
       rx->syntax = "nop";
@@ -302,7 +338,7 @@ rx_decode_opcode (unsigned long pc AU,
   ID(movbir); sBWL(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____;
 
 /** 1111 1110 11sz isrc bsrc rdst      movu%s  [%1, %2], %0 */
-  ID(movbi); uBWL(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____;
+  ID(movbi); uBW(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____;
 
 /** 1111 1101 0010 0p sz rdst rsrc     mov%s   %1, %0 */
   ID(mov); sBWL (sz); SR(rsrc); F_____;
@@ -313,13 +349,13 @@ rx_decode_opcode (unsigned long pc AU,
   OP(1, p ? RX_Operand_Predec : RX_Operand_Postinc, rsrc, 0);
 
 /** 1011 w dsp a src b dst     movu%s  %1, %0 */
-  ID(mov); uBWL(w); DR(dst); SIs(src, dsp*4+a*2+b, w); F_____;
+  ID(mov); uBW(w); DR(dst); SIs(src, dsp*4+a*2+b, w); F_____;
 
 /** 0101 1 s ss rsrc rdst      movu%s  %1, %0 */
-  ID(mov); uBWL(s); SD(ss, rsrc, s); DR(rdst); F_____;
+  ID(mov); uBW(s); SD(ss, rsrc, s); DR(rdst); F_____;
 
 /** 1111 1101 0011 1p sz rsrc rdst     movu%s  %1, %0 */
-  ID(mov); uBWL (sz); DR(rdst); F_____;
+  ID(mov); uBW (sz); DR(rdst); F_____;
    OP(1, p ? RX_Operand_Predec : RX_Operand_Postinc, rsrc, 0);
 
 /*----------------------------------------------------------------------*/
@@ -330,10 +366,10 @@ rx_decode_opcode (unsigned long pc AU,
 
 /** 0110 1110 dsta dstb                pushm   %1-%2 */
   ID(pushm); SR(dsta); S2R(dstb); F_____;
-  
+
 /** 0111 1110 1011 rdst                pop     %0 */
   ID(mov); OP(1, RX_Operand_Postinc, 0, 0); DR(rdst); F_____;
-  
+
 /** 0111 1110 10sz rsrc                push%s  %1 */
   ID(mov); BWL(sz); OP(0, RX_Operand_Predec, 0, 0); SR(rsrc); F_____;
 
@@ -862,6 +898,8 @@ rx_decode_opcode (unsigned long pc AU,
 
 /** 1111 1100 0110 00sd rdst rsrc      bset    %1, %0%S0 */
   ID(bset); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE); F_____;
+  if (sd == 3) /* bset reg,reg */
+    BWL(LSIZE);
 
 /** 0111 100b ittt rdst                        bset    #%1, %0 */
   ID(bset); BWL(LSIZE); SC(b*16+ittt); DR(rdst); F_____;
@@ -872,6 +910,8 @@ rx_decode_opcode (unsigned long pc AU,
 
 /** 1111 1100 0110 01sd rdst rsrc      bclr    %1, %0%S0 */
   ID(bclr); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE); F_____;
+  if (sd == 3) /* bset reg,reg */
+    BWL(LSIZE);
 
 /** 0111 101b ittt rdst                        bclr    #%1, %0 */
   ID(bclr); BWL(LSIZE); SC(b*16+ittt); DR(rdst); F_____;
@@ -882,6 +922,8 @@ rx_decode_opcode (unsigned long pc AU,
 
 /** 1111 1100 0110 10sd rdst rsrc      btst    %2, %1%S1 */
   ID(btst); BWL(BSIZE); S2R(rsrc); SD(sd, rdst, BSIZE); F___ZC;
+  if (sd == 3) /* bset reg,reg */
+    BWL(LSIZE);
 
 /** 0111 110b ittt rdst                        btst    #%2, %1 */
   ID(btst); BWL(LSIZE); S2C(b*16+ittt); SR(rdst); F___ZC;
@@ -892,6 +934,8 @@ rx_decode_opcode (unsigned long pc AU,
 
 /** 1111 1100 0110 11sd rdst rsrc      bnot    %1, %0%S0 */
   ID(bnot); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE);
+  if (sd == 3) /* bset reg,reg */
+    BWL(LSIZE);
 
 /** 1111 1101 111bittt 1111 rdst       bnot    #%1, %0 */
   ID(bnot); BWL(LSIZE); SC(bittt); DR(rdst);
This page took 0.026583 seconds and 4 git commands to generate.