import gdb-2000-02-02 snapshot
[external/binutils.git] / opcodes / mcore-opc.h
1 /* Assembler instructions for Motorola's Mcore processor
2    Copyright (C) 1999 Free Software Foundation, Inc.
3
4    
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
18
19 #include "ansidecl.h"
20
21 typedef enum
22 {
23   O0,    OT,   O1,   OC,   O2,    X1,    OI,    OB,
24   OMa,   SI,   I7,   LS,   BR,    BL,    LR,    LJ,
25   RM,    RQ,   JSR,  JMP,  OBRa,  OBRb,  OBRc,  OBR2,
26   O1R1,  OMb,  OMc,  SIa,
27   JC,    JU,   JL,   RSI,  DO21,  OB2
28 }
29 mcore_opclass;
30
31 typedef struct inst
32 {
33   char *         name;
34   mcore_opclass  opclass;
35   unsigned char  transfer;
36   unsigned short inst;
37 }
38 mcore_opcode_info;
39
40 #ifdef DEFINE_TABLE
41 mcore_opcode_info mcore_table[] =
42 {
43   { "bkpt",     O0,     0,      0x0000 },
44   { "sync",     O0,     0,      0x0001 },
45   { "rte",      O0,     1,      0x0002 },
46   { "rfe",      O0,     1,      0x0002 },
47   { "rfi",      O0,     1,      0x0003 },
48   { "stop",     O0,     0,      0x0004 },
49   { "wait",     O0,     0,      0x0005 },
50   { "doze",     O0,     0,      0x0006 },
51   { "trap",     OT,     0,      0x0008 },
52 /* SPACE:                       0x000C - 0x000F */
53 /* SPACE:                       0x0010 - 0x001F */
54   { "mvc",      O1,     0,      0x0020 },
55   { "mvcv",     O1,     0,      0x0030 },
56   { "ldq",      RQ,     0,      0x0040 },
57   { "stq",      RQ,     0,      0x0050 },
58   { "ldm",      RM,     0,      0x0060 },
59   { "stm",      RM,     0,      0x0070 },
60   { "dect",     O1,     0,      0x0080 },
61   { "decf",     O1,     0,      0x0090 },
62   { "inct",     O1,     0,      0x00A0 },
63   { "incf",     O1,     0,      0x00B0 },
64   { "jmp",      JMP,    2,      0x00C0 },
65 #define MCORE_INST_JMP  0x00C0
66   { "jsr",      JSR,    0,      0x00D0 },
67 #define MCORE_INST_JSR  0x00E0
68   { "ff1",      O1,     0,      0x00E0 },
69   { "brev",     O1,     0,      0x00F0 },
70   { "xtrb3",    X1,     0,      0x0100 },
71   { "xtrb2",    X1,     0,      0x0110 },
72   { "xtrb1",    X1,     0,      0x0120 },
73   { "xtrb0",    X1,     0,      0x0130 },
74   { "zextb",    O1,     0,      0x0140 },
75   { "sextb",    O1,     0,      0x0150 },
76   { "zexth",    O1,     0,      0x0160 },
77   { "sexth",    O1,     0,      0x0170 },
78   { "declt",    O1,     0,      0x0180 },
79   { "tstnbz",   O1,     0,      0x0190 },
80   { "decgt",    O1,     0,      0x01A0 },
81   { "decne",    O1,     0,      0x01B0 },
82   { "clrt",     O1,     0,      0x01C0 },
83   { "clrf",     O1,     0,      0x01D0 },
84   { "abs",      O1,     0,      0x01E0 },
85   { "not",      O1,     0,      0x01F0 },
86   { "movt",     O2,     0,      0x0200 },
87   { "mult",     O2,     0,      0x0300 },
88   { "loopt",    BL,     0,      0x0400 },
89   { "subu",     O2,     0,      0x0500 },
90   { "sub",      O2,     0,      0x0500 }, /* Official alias.  */
91   { "addc",     O2,     0,      0x0600 },
92   { "subc",     O2,     0,      0x0700 },
93 /* SPACE: 0x0800-0x08ff for a diadic operation */
94 /* SPACE: 0x0900-0x09ff for a diadic operation */
95   { "movf",     O2,     0,      0x0A00 },
96   { "lsr",      O2,     0,      0x0B00 },
97   { "cmphs",    O2,     0,      0x0C00 },
98   { "cmplt",    O2,     0,      0x0D00 },
99   { "tst",      O2,     0,      0x0E00 },
100   { "cmpne",    O2,     0,      0x0F00 },
101   { "mfcr",     OC,     0,      0x1000 },
102   { "mov",      O2,     0,      0x1200 },
103   { "bgenr",    O2,     0,      0x1300 },
104   { "rsub",     O2,     0,      0x1400 },
105   { "ixw",      O2,     0,      0x1500 },
106   { "and",      O2,     0,      0x1600 },
107   { "xor",      O2,     0,      0x1700 },
108   { "mtcr",     OC,     0,      0x1800 },
109   { "asr",      O2,     0,      0x1A00 },
110   { "lsl",      O2,     0,      0x1B00 },
111   { "addu",     O2,     0,      0x1C00 },
112   { "add",      O2,     0,      0x1C00 }, /* Official alias.  */
113   { "ixh",      O2,     0,      0x1D00 },
114   { "or",       O2,     0,      0x1E00 },
115   { "andn",     O2,     0,      0x1F00 },
116   { "addi",     OI,     0,      0x2000 },
117 #define MCORE_INST_ADDI 0x2000
118   { "cmplti",   OI,     0,      0x2200 },
119   { "subi",     OI,     0,      0x2400 },
120 /* SPACE: 0x2600-0x27ff open for a register+immediate  operation */
121   { "rsubi",    OB,     0,      0x2800 },
122   { "cmpnei",   OB,     0,      0x2A00 },
123   { "bmaski",   OMa,    0,      0x2C00 },
124   { "divu",     O1R1,   0,      0x2C10 },
125 /* SPACE:                       0x2c20 - 0x2c7f */  
126   { "bmaski",   OMb,    0,      0x2C80 },
127   { "bmaski",   OMc,    0,      0x2D00 },
128   { "andi",     OB,     0,      0x2E00 },
129   { "bclri",    OB,     0,      0x3000 },
130 /* SPACE:                       0x3200 - 0x320f */
131   { "divs",     O1R1,   0,      0x3210 },
132 /* SPACE:                       0x3220 - 0x326f */  
133   { "bgeni",    OBRa,   0,      0x3270 },
134   { "bgeni",    OBRb,   0,      0x3280 },
135   { "bgeni",    OBRc,   0,      0x3300 },
136   { "bseti",    OB,     0,      0x3400 },
137   { "btsti",    OB,     0,      0x3600 },
138   { "xsr",      O1,     0,      0x3800 },
139   { "rotli",    SIa,    0,      0x3800 },
140   { "asrc",     O1,     0,      0x3A00 },
141   { "asri",     SIa,    0,      0x3A00 },
142   { "lslc",     O1,     0,      0x3C00 },
143   { "lsli",     SIa,    0,      0x3C00 },
144   { "lsrc",     O1,     0,      0x3E00 },
145   { "lsri",     SIa,    0,      0x3E00 },
146 /* SPACE:                       0x4000 - 0x5fff */
147   { "movi",     I7,     0,      0x6000 },
148 #define MCORE_INST_BMASKI_ALT   0x6000
149 #define MCORE_INST_BGENI_ALT    0x6000
150 /* SPACE:                       0x6900 - 0x6FFF */
151   { "jmpi",     LJ,     1,      0x7000 },
152   { "jsri",     LJ,     0,      0x7F00 },
153 #define MCORE_INST_JMPI 0x7000
154   { "lrw",      LR,     0,      0x7000 },
155 #define MCORE_INST_JSRI 0x7F00
156   { "ld",       LS,     0,      0x8000 },
157   { "ldw",      LS,     0,      0x8000 },
158   { "ld.w",     LS,     0,      0x8000 },
159   { "st",       LS,     0,      0x9000 },
160   { "stw",      LS,     0,      0x9000 },
161   { "st.w",     LS,     0,      0x9000 },
162   { "ldb",      LS,     0,      0xA000 },
163   { "ld.b",     LS,     0,      0xA000 },
164   { "stb",      LS,     0,      0xB000 },
165   { "st.b",     LS,     0,      0xB000 },
166   { "ldh",      LS,     0,      0xC000 },
167   { "ld.h",     LS,     0,      0xC000 },
168   { "sth",      LS,     0,      0xD000 },
169   { "st.h",     LS,     0,      0xD000 },
170   { "bt",       BR,     0,      0xE000 },
171   { "bf",       BR,     0,      0xE800 },
172   { "br",       BR,     1,      0xF000 },
173 #define MCORE_INST_BR   0xF000
174   { "bsr",      BR,     0,      0xF800 },
175 #define MCORE_INST_BSR  0xF800
176
177 /* The following are relaxable branches */
178   { "jbt",      JC,     0,      0xE000 },
179   { "jbf",      JC,     0,      0xE800 },
180   { "jbr",      JU,     1,      0xF000 },
181   { "jbsr",     JL,     0,      0xF800 },
182
183 /* The following are aliases for other instructions */
184   { "rts",      O0,     2,      0x00CF },  /* jmp r15 */
185   { "rolc",     DO21,   0,      0x0600 },  /* addc rd,rd */
186   { "rotlc",    DO21,   0,      0x0600 },  /* addc rd,rd */
187   { "setc",     O0,     0,      0x0C00 },  /* cmphs r0,r0 */
188   { "clrc",     O0,     0,      0x0F00 },  /* cmpne r0,r0 */
189   { "tstle",    O1,     0,      0x2200 },  /* cmplti rd,1 */
190   { "cmplei",   OB,     0,      0x2200 },  /* cmplei rd,X -> cmplti rd,X+1 */
191   { "neg",      O1,     0,      0x2800 },  /* rsubi rd,0 */
192   { "tstne",    O1,     0,      0x2A00 },  /* cmpnei rd,0 */
193   { "tstlt",    O1,     0,      0x37F0 },  /* btsti rx,31 */
194   { "mclri",    OB2,    0,      0x3000 },  /* bclri rx,log2(imm) */
195   { "mgeni",    OBR2,   0,      0x3200 },  /* bgeni rx,log2(imm) */
196   { "mseti",    OB2,    0,      0x3400 },  /* bseti rx,log2(imm) */
197   { "mtsti",    OB2,    0,      0x3600 },  /* btsti rx,log2(imm) */
198   { "rori",     RSI,    0,      0x3800 },
199   { "rotri",    RSI,    0,      0x3800 },
200   { "nop",      O0,     0,      0x1200 },  /* mov r0, r0 */
201   { 0,          0,      0,      0 }
202 };
203 #endif