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