aboutsummaryrefslogtreecommitdiff
path: root/include/opcode/rs6k.h
blob: efbbfdeed91e7fcde9b1267b5d53503b99718048 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/* IBM RS/6000 instruction set definitions, for GNU software.  */

/* These are all possible instruction formats as used in IBM Assembler
   Language Reference, Appendix A. */

typedef enum { A=0, B, D, I, M, SC, X, XL, XO, XFL, XFX } InsnFmt;

/* Extended opcode masks. Used for extracting extended opcode values from
   instructions. Each instruction's format decides which mask applies. 
   They *should* retain the same order as the above formats. */
      
static int eopMask[] =
	{ 0x1f, 0, 0, 0, 0, 0, 0x3ff, 0x3ff, 0x1ff, 0x3ff, 0x3ff };
	     
/* All the things you need to know about an opcode. */

typedef struct rs6000_insn {
  char	*operator;			/* opcode name		*/
  char	*opr_ext;			/* opcode name extension */
  InsnFmt format;			/* opcode format	*/
  char	p_opcode;			/* primary opcode	*/
  int	e_opcode;			/* extended opcode	*/
  char	oprnd_format[6];		/* operand format	*/
} OPCODE;

/* operand format specifiers */

#define	TO	1
#define	RA	2
#define	SI	3
#define	RT	4
#define	UI	5
#define	BF	6
#define	BFA	7
#define	BT	8
#define	BA	9
#define	BB	10
#define	BO	11
#define	BI	12
#define	RB	13
#define	RS	14
#define	SH	15
#define	MB	16
#define	ME	17
#define	SPR	18
#define	DIS	19
#define	FXM	21
#define	FRT	22
#define	NB	23
#define	FRS	24
#define	FRA	25
#define	FRB	26
#define	FRC	27
#define	FLM	28
#define	I	29
#define	LI	30
#define	A2	31
#define	TA14	32		/* 14 bit representation of target address */
#define	TA24	33		/* 24 bit representation of target address */
#define	FL1	34
#define	FL2	35
#define	LEV	36

/*	RS/6000 INSTRUCTION SET
    (sorted on primary and extended opcode)

	     oprtr	      primary  ext.
operator      ext     format  opcode   opcode   operand format
-------	    -------   ------  -------  ------   ---------------   */

struct rs6000_insn rs6k_ops [] = {

{"ti",		0,	D,	3,	-1,	{TO,RA,SI,0}	},
{"muli",	0,	D,	7,	-1,	{RT,RA,SI,0}	},
{"sfi",		0,	D,	8,	-1,	{RT,RA,SI,0}	},
{"dozi",	0,	D,	9,	-1,	{RT,RA,SI,0}	},
{"cmpli",	0,	D,	10,	-1,	{BF,RA,UI,0}	},
{"cmpi",	0,	D,	11,	-1,	{BF,RA,SI,0}	},
{"ai",		0,	D,	12,	-1,	{RT,RA,SI,0}	},
{"ai.",		0,	D,	13,	-1,	{RT,RA,SI,0}	},
{"lil",		0,	D,	14,	-1,	{RT,SI,0}	}, /* same as `cal' */
{"cal",		0,	D,	14,	-1,	{RT,DIS,RA,0}	},
{"liu",		0,	D,	15,	-1,	{RT, UI,0}	}, /* same as `cau' */
{"cau",		0,	D,	15,	-1,	{RT,RA,UI,0}	},
{"bb",		"1tfl",	B,	16,	-1,	{LI,A2,0}	},
/*		^^^^^
  exception #1. Either fix this, or document what you are doing here. FIXMEmgo.
*/
{"bc",		"la",	B,	16,	-1,	{BO,BI,TA14,0}	},
{"svc",		"la",	SC,	17,	-1,	{LEV,FL1,FL2,0}	},
{"b",		"la",	I,	18,	-1,	{TA24,0}	},
{"mcrf",	0,	XL,	19,	0,	{BF,BFA,0}	},
{"bcr",		"l",	XL,	19,	16,	{BO,BI,0}	},
{"cror",	0,	XL,	19,	33,	{BT,BA,BB,0}	},
{"crandc",	0,	XL,	19,	129,	{BT,BA,BB,0}	},
{"bcc",		"l",	XL,	19,	193,	{BO,BI,0}	},
{"crnor",	0,	XL,	19,	225,	{BT,BA,BB,0}	},
{"crand",	0,	XL,	19,	257,	{BT,BA,BB,0}	},
{"creqv",	0,	XL,	19,	289,	{BT,BA,BB,0}	},
{"crnand",	0,	XL,	19,	289,	{BT,BA,BB,0}	},
{"crxor",	0,	XL,	19,	417,	{BT,BA,BB,0}	},
{"crorc",	0,	XL,	19,	449,	{BT,BA,BB,0}	},
{"bcr",		"l",	XL,	19,	528,	{BO,BI,0}	},
{"rlimi",	".",	M,	20,	-1,	{RA,RS,SH,MB,ME,0} /*??*/},
{"rlinm",	".",	M,	21,	-1,	{RA,RS,SH,MB,ME,0} /*??*/},
{"rlmi",	".",	M,	22,	-1,	{RA,RS,RB,MB,ME,0} /*??*/},
{"rlnm",	".",	M,	23,	-1,	{RA,RS,RB,MB,ME,0} /*??*/},
{"oril",	0,	D,	24,	-1,	{RA,RS,UI,0}	},
{"oriu",	0,	D,	25,	-1,	{RA,RS,UI,0}	},
{"xoril",	0,	D,	26,	-1,	{RA,RS,UI,0}	},
{"xoriu",	0,	D,	27,	-1,	{RA,RS,UI,0}	},
{"andil.",	0,	D,	28,	-1,	{RA,RS,UI,0}	},
{"andiu.",	0,	D,	29,	-1,	{RA,RS,UI,0}	},
{"cmp",		0,	X,	31,	0,	{BF,RA,RB,0}	},
{"t",		0,	X,	31,	4,	{TO,RA,RB,0}	},
{"sf",		"o.",	XO,	31,	8,	{RT,RA,RB,0}	},
{"a",		"o.",	XO,	31,	10,	{RT,RA,RB,0}	},
{"mfcr",	0,	X,	31,	19,	{RT,0}		},
{"lx",		0,	X,	31,	23,	{RT,RA,RB,0}	},
{"sl",		".",	X,	31,	24,	{RA,RS,RB,0}	},
{"cntlz",	".",	XO,	31,	26,	{RA,RS,0}	},
{"and",		".",	X,	31,	28,	{RA,RS,RB,0}	},
{"maskg",	".",	X,	31,	29,	{RA,RS,RB,0}	},
{"cmpl",	0,	X,	31,	32,	{BF,RA,RB,0}	},
{"sfe",		"o.",	XO,	31,	136,	{RT,RA,RB,0}	},
{"lux",		0,	X,	31,	55,	{RT,RA,RB,0}	},
{"andc",	".",	X,	31,	60,	{RA,RS,RB,0}	},
{"mfmsr",	0,	X,	31,	83,	{RT,0}		},
{"lbzx",	0,	X,	31,	87,	{RT,RA,RB,0}	},
{"neg",		"o.",	XO,	31,	104,	{RT,RA,0}	},
{"mul",		"o.",	XO,	31,	107,	{RT,RA,RB,0}	},
{"lbzux",	0,	X,	31,	119,	{RT,RA,RB,0}	},
{"nor",		".",	X,	31,	124,	{RA,RS,RB,0}	},
{"ae",		"o.",	XO,	31,	138,	{RT,RA,RB,0}	},
{"mtcrf",	0,	XFX,	31,	144,	{FXM,RS,0}	},
{"stx",		0,	X,	31,	151,	{RS,RA,RB,0}	},
{"slq",		".",	X,	31,	152,	{RA,RS,RB,0}	},
{"sle",		".",	X,	31,	153,	{RA,RS,RB,0}	},
{"stux",	0,	X,	31,	183,	{RS,RA,RB,0}	},
{"sliq",	".",	X,	31,	184,	{RA,RS,SH,0}	},
{"sfze",	"o.",	XO,	31,	200,	{RT,RA,0}	},
{"aze",		"o.",	XO,	31,	202,	{RT,RA,0}	},
{"stbx",	0,	X,	31,	215,	{RS,RA,RB,0}	},
{"sllq",	".",	X,	31,	216,	{RA,RS,RB,0}	},
{"sleq",	".",	X,	31,	217,	{RA,RS,RB,0}	},
{"sfme",	"o.",	XO,	31,	232,	{RT,RA,0}	},
{"ame",		"o.",	XO,	31,	234,	{RT,RA,0}	},
{"muls",	"o.",	XO,	31,	235,	{RT,RA,RB,0}	},
{"stbux",	0,	X,	31,	247,	{RS,RA,RB,0}	},
{"slliq", 	".",	X,	31,	248,	{RA,RS,SH,0}	},
{"doz",		"o.",	X,	31,	264,	{RT,RA,RB,0}	},
{"cax",		"o.",	XO,	31,	266,	{RT,RA,RB,0}	},
{"lscbx",	".",	X,	31,	277,	{RT,RA,RB,0}	},
{"lhzx",	0,	X,	31,	279,	{RT,RA,RB,0}	},
{"eqv",		".",	X,	31,	284,	{RA,RS,RB,0}	},
{"lhzux",	0,	X,	31,	311,	{RT,RA,RB,0}	},
{"xor",		".",	X,	31,	316,	{RA,RS,RB,0}	},
{"div",		"o.",	XO,	31,	331,	{RT,RA,RB,0}	},
{"mfspr",	0,	X,	31,	339,	{RT,SPR,0}	},
{"lhax",	0,	X,	31,	343,	{RT,RA,RB,0}	},
{"abs",		"o.",	XO,	31,	360,	{RT,RA,0}	},
{"divs",	"o.",	XO,	31,	363,	{RT,RA,RB,0}	},
{"lhaux",	0,	X,	31,	375,	{RT,RA,RB,0}	},
{"sthx",	0,	X,	31,	407,	{RS,RA,RB,0}	},
{"orc",		".",	X,	31,	412,	{RA,RS,RB,0}	},
{"sthux",	0,	X,	31,	439,	{RS,RA,RB,0}	},
{"or",		".",	X,	31,	444,	{RA,RS,RB,0}	},
{"mtspr",	0,	X,	31,	467,	{SPR,RS,0}	},
{"nand",	".",	X,	31,	476,	{RA,RS,RB,0}	},
{"nabs",	"o.",	XO,	31,	488,	{RT,RA,0}	},
{"mcrxr",	0,	X,	31,	512,	{BF,0}		},
{"lsx",		0,	X,	31,	533,	{RT,RA,RB,0}	},
{"lbrx",	0,	X,	31,	534,	{RT,RA,RB,0}	},
{"lfsx",	0,	X,	31,	535,	{FRT,RA,RB,0}	},
{"sr",		".",	X,	31,	536,	{RA,RS,RB,0}	},
{"rrib",	".",	X,	31,	537,	{RA,RS,RB,0}	},
{"maskir",	".",	X,	31,	541,	{RA,RS,RB,0}	},
{"lfsux",	0,	X,	31,	567,	{FRT,RA,RB,0}	},
{"lsi",		0,	X,	31,	597,	{RT,RA,NB,0}	},
{"lfdx",	0,	X,	31,	599,	{FRT,RA,RB,0}	},
{"lfdux",	0,	X,	31,	631,	{FRT,RA,RB,0}	},
{"stsx",	0,	X,	31,	661,	{RS,RA,RB,0}	},
{"stbrx",	0,	X,	31,	662,	{RS,RA,RB,0}	},
{"stfsx",	0,	X,	31,	663,	{FRS,RA,RB,0}	},
{"srq",		".",	X,	31,	664,	{RA,RS,RB,0}	},
{"sre",		".",	X,	31,	665,	{RA,RS,RB,0}	},
{"stfsux",	0,	X,	31,	695,	{FRS,RA,RB,0}	},
{"sriq",	".",	X,	31,	696,	{RA,RS,SH,0}	},
{"stsi",	0,	X,	31,	725,	{RS,RA,NB,0}	},
{"stfdx",	0,	X,	31,	727,	{FRS,RA,RB,0}	},
{"srlq",	".",	X,	31,	728,	{RA,RS,RB,0}	},
{"sreq",	".",	X,	31,	729,	{RA,RS,RB,0}	},
{"stfdux",	0,	X,	31,	759,	{FRS,RA,RB,0}	},
{"srliq",	".",	X,	31,	760,	{RA,RS,SH,0}	},
{"lhbrx",	0,	X,	31,	790,	{RT,RA,RB,0}	},
{"sra",		".",	X,	31,	792,	{RA,RS,RB,0}	},
{"srai",	".",	X,	31,	824,	{RA,RS,SH,0}	},
{"sthbrx",	0,	X,	31,	918,	{RS,RA,RB,0}	},
{"sraq",	".",	X,	31,	920,	{RA,RS,RB,0}	},
{"srea",	".",	X,	31,	921,	{RA,RS,RB,0}	},
{"exts",	".",	X,	31,	922,	{RA,RS,0}	},
{"sraiq",	".",	X,	31,	952,	{RA,RS,SH,0}	},
{"l",		0,	D,	32,	-1,	{RT,DIS,RA,0}	},
{"lu",		0,	D,	33,	-1,	{RT,DIS,RA,0}	},
{"lbz",		0,	D,	34,	-1,	{RT,DIS,RA,0}	},
{"lbzu",	0,	D,	35,	-1,	{RT,DIS,RA,0}	},
{"st",		0,	D,	36,	-1,	{RS,DIS,RA,0}	},
{"stu",		0,	D,	37,	-1,	{RS,DIS,RA,0}	},
{"stb",		0,	D,	38,	-1,	{RS,DIS,RA,0}	},
{"stbu",	0,	D,	39,	-1,	{RS,DIS,RA,0}	},
{"lhz",		0,	D,	40,	-1,	{RT,DIS,RA,0}	},
{"lhzu",	0,	D,	41,	-1,	{RT,DIS,RA,0}	},
{"lha",		0,	D,	42,	-1,	{RT,DIS,RA,0}	},
{"lhau",	0,	D,	43,	-1,	{RT,DIS,RA,0}	},
{"sth",		0,	D,	44,	-1,	{RS,DIS,RA,0}	},
{"sthu",	0,	D,	45,	-1,	{RS,DIS,RA,0}	},
{"lm",		0,	D,	46,	-1,	{RT,DIS,RA,0}	},
{"stm",		0,	D,	47,	-1,	{RS,DIS,RA,0}	},
{"lfs",		0,	D,	48,	-1,	{FRT,DIS,RA,0}	},
{"lfsu",	0,	D,	49,	-1,	{FRT,DIS,RA,0}	},
{"lfd",		0,	D,	50,	-1,	{FRT,DIS,RA,0}	},
{"lfdu",	0,	D,	51,	-1,	{FRT,DIS,RA,0}	},
{"stfs",	0,	D,	52,	-1,	{FRS,DIS,RA,0}	},
{"stfsu",	0,	D,	53,	-1,	{FRS,DIS,RA,0}	},
{"stfd",	0,	D,	54,	-1,	{FRS,DIS,RA,0}	},
{"stfdu",	0,	D,	55,	-1,	{FRS,DIS,RA,0}	},
{"fcmpu",	0,	X,	63,	0,	{BF,FRA,FRB,0}	},
{"frsp",	".",	X,	63,	12,	{FRT,FRB,0}	},
{"fd",		".",	A,	63,	18,	{FRT,FRA,FRB,0}	},
{"fs",		".",	A,	63,	20,	{FRT,FRA,FRB,0}	},
{"fa",		".",	A,	63,	21,	{FRT,FRA,FRB,0}	},
{"fm",		".",	A,	63,	25,	{FRT,FRA,FRC,0}	},
{"fms",		".",	A,	63,	28,	{FRT,FRA,FRC,FRB,0}	},
{"fma",		".",	A,	63,	29,	{FRT,FRA,FRC,FRB,0}	},
{"fnms",	".",	A,	63,	30,	{FRT,FRA,FRC,FRB,0}	},
{"fnma",	".",	A,	63,	31,	{FRT,FRA,FRC,FRB,0}	},
{"fcmpo",	0,	X,	63,	32,	{BF,FRA,FRB,0}	},
{"mtfsb1",	".",	X,	63,	38,	{BT,0}		},
{"fneg",	".",	X,	63,	40,	{FRT,FRB,0}	},
{"mcrfs",	0,	X,	63,	64,	{BF,BFA,0}	},
{"mtfsb0",	".",	X,	63,	70,	{BT,0}		},
{"fmr",		".",	X,	63,	72,	{FRT,FRB,0}	},
{"mtfsfi",	".",	X,	63,	134,	{BF,I,0}	},
{"fnabs",	".",	X,	63,	136,	{FRT,FRB,0}	},
{"fabs",	".",	X,	63,	264,	{FRT,FRB,0}	},
{"mffs",	".",	X,	63,	583,	{FRT,0}		},
{"mtfsf",	".",	XFL,	63,	711,	{FLM,FRB,0}	},
};

#define	NOPCODES	(sizeof (rs6k_ops) / sizeof (struct rs6000_insn))