1 /* Table of opcodes for the sparc.
2 Copyright (C) 1989 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler, and GDB, the GNU disassembler.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
20 #if !defined(__STDC__) && !defined(const)
25 * Structure of an opcode table entry.
30 unsigned long int match; /* Bits that must be set. */
31 unsigned long int lose; /* Bits that must not be set. */
36 #define F_DELAYED 1 /* Delayed branch */
37 #define F_ALIAS 2 /* Alias for a "real" instruction */
40 All sparc opcodes are 32 bits, except for the `set' instruction (really
41 a macro), which is 64 bits. It is handled as a special case.
43 The match component is a mask saying which bits must match a
44 particular opcode in order for an instruction to be an instance
47 The args component is a string containing one character
48 for each operand of the instruction.
51 # Number used by optimizer. It is ignored.
55 e frs1 floating point register.
56 f frs2 floating point register.
57 g frsd floating point register.
58 b crs1 coprocessor register
59 c crs2 coprocessor register
60 D crsd coprocessor register
63 l 22 bit PC relative immediate.
64 L 30 bit PC relative immediate.
65 a Annul. The annul bit is set.
66 A Alternate address space. Stored as 8 bits.
67 C Coprocessor state register.
68 F floating point state register.
69 p Processor state register.
70 q Floating point queue.
71 r Single register that is both rs1 and rsd.
75 w Window invalid mask register.
80 /* The order of the opcodes in this table is significant:
82 * The assembler requires that all instances of the same mnemonic must be
83 consecutive. If they aren't, the assembler will bomb at runtime.
85 * The disassembler should not care about the order of the opcodes. */
87 static struct sparc_opcode sparc_opcodes[] =
90 { "ldd", 0xc1980000, 0x0060201f, "[1],D", 0 }, /* ldd [rs1+%g0],d */
91 { "ldd", 0xc1982000, 0x00601fff, "[1],D", 0 }, /* ldd [rs1+0],d */
92 { "ldd", 0xc1982000, 0x00600000, "[1+i],D", 0 },
93 { "ldd", 0xc1982000, 0x00600000, "[i+1],D", 0 },
94 { "ldd", 0xc1980000, 0x00602000, "[1+2],D", 0 },
95 { "ldd", 0xc1180000, 0x00e0201f, "[1],g", 0 }, /* ldd [rs1+%g0],d */
96 { "ldd", 0xc1182000, 0x00e01fff, "[1],g", 0 }, /* ldd [rs1+0],d */
97 { "ldd", 0xc1182000, 0x00e00000, "[1+i],g", 0 },
98 { "ldd", 0xc1182000, 0x00e00000, "[i+1],g", 0 },
99 { "ldd", 0xc1180000, 0x00e02000, "[1+2],g", 0 },
100 { "ldd", 0xc0180000, 0x01e0201f, "[1],d", 0 }, /* ldd [rs1+%g0],d */
101 { "ldd", 0xc0182000, 0x01e01fff, "[1],d", 0 }, /* ldd [rs1+0],d */
102 { "ldd", 0xc0182000, 0x01e00000, "[1+i],d", 0 },
103 { "ldd", 0xc0182000, 0x01e00000, "[i+1],d", 0 },
104 { "ldd", 0xc0180000, 0x01e02000, "[1+2],d", 0 },
105 { "ld", 0xc1880000, 0x0070201f, "[1],C", 0 }, /* ld [rs1+%g0],d */
106 { "ld", 0xc1882000, 0x00701fff, "[1],C", 0 }, /* ld [rs1+0],d */
107 { "ld", 0xc1882000, 0x00700000, "[1+i],C", 0 },
108 { "ld", 0xc1882000, 0x00700000, "[i+1],C", 0 },
109 { "ld", 0xc1880000, 0x00702000, "[1+2],C", 0 },
110 { "ld", 0xc1800000, 0x0078201f, "[1],D", 0 }, /* ld [rs1+%g0],d */
111 { "ld", 0xc1802000, 0x00781fff, "[1],D", 0 }, /* ld [rs1+0],d */
112 { "ld", 0xc1802000, 0x00780000, "[1+i],D", 0 },
113 { "ld", 0xc1802000, 0x00780000, "[i+1],D", 0 },
114 { "ld", 0xc1800000, 0x00782000, "[1+2],D", 0 },
115 { "ld", 0xc1080000, 0x00f0201f, "[1],F", 0 }, /* ld [rs1+%g0],d */
116 { "ld", 0xc1082000, 0x00f01fff, "[1],F", 0 }, /* ld [rs1+0],d */
117 { "ld", 0xc1082000, 0x00f00000, "[1+i],F", 0 },
118 { "ld", 0xc1082000, 0x00f00000, "[i+1],F", 0 },
119 { "ld", 0xc1080000, 0x00f02000, "[1+2],F", 0 },
120 { "ld", 0xc1000000, 0x00f8201f, "[1],g", 0 }, /* ld [rs1+%g0],d */
121 { "ld", 0xc1002000, 0x00f81fff, "[1],g", 0 }, /* ld [rs1+0],d */
122 { "ld", 0xc1002000, 0x00f80000, "[1+i],g", 0 },
123 { "ld", 0xc1002000, 0x00f80000, "[i+1],g", 0 },
124 { "ld", 0xc1000000, 0x00f82000, "[1+2],g", 0 },
125 { "ld", 0xc0000000, 0x01f8201f, "[1],d", 0 }, /* ld [rs1+%g0],d */
126 { "ld", 0xc0002000, 0x01f81fff, "[1],d", 0 }, /* ld [rs1+0],d */
127 { "ld", 0xc0002000, 0x01f80000, "[1+i],d", 0 },
128 { "ld", 0xc0002000, 0x01f80000, "[i+1],d", 0 },
129 { "ld", 0xc0000000, 0x01f82000, "[1+2],d", 0 },
130 { "ldstuba", 0xc0d80000, 0x0100201f, "[1]A,d", 0 }, /* ldstuba [rs1+%g0],d */
131 { "ldstuba", 0xc0d80000, 0x01002000, "[1+2]A,d", 0 },
132 { "ldsha", 0xc0d00000, 0x0128201f, "[1]A,d", 0 }, /* ldsha [rs1+%g0],d */
133 { "ldsha", 0xc0d00000, 0x01282000, "[1+2]A,d", 0 },
134 { "ldsba", 0xc0c80000, 0x0130201f, "[1]A,d", 0 }, /* ldsba [rs1+%g0],d */
135 { "ldsba", 0xc0c80000, 0x01302000, "[1+2]A,d", 0 },
136 { "ldda", 0xc0980000, 0x0160201f, "[1]A,d", 0 }, /* ldda [rs1+%g0],d */
137 { "ldda", 0xc0980000, 0x01602000, "[1+2]A,d", 0 },
138 { "lduha", 0xc0900000, 0x0168201f, "[1]A,d", 0 }, /* lduha [rs1+%g0],d */
139 { "lduha", 0xc0900000, 0x01682000, "[1+2]A,d", 0 },
140 { "ldstub", 0xc0680000, 0x0190201f, "[1],d", 0 }, /* ldstub [rs1+%g0],d */
141 { "ldstub", 0xc0682000, 0x01900000, "[1+i],d", 0 },
142 { "ldstub", 0xc0682000, 0x01900000, "[i+1],d", 0 },
143 { "ldstub", 0xc0680000, 0x01902000, "[1+2],d", 0 },
144 { "lda", 0xc0800000, 0x0178201f, "[1]A,d", 0 }, /* lda [rs1+%g0],d */
145 { "lda", 0xc0800000, 0x01782000, "[1+2]A,d", 0 },
146 { "ldsh", 0xc0500000, 0x0000000d, "[1],d", 0 }, /* ldsh [rs1+%g0],d */
147 { "ldsh", 0xc0502000, 0x01a81fff, "[1],d", 0 }, /* ldsh [rs1+0],d */
148 { "ldsh", 0xc0502000, 0x01a80000, "[1+i],d", 0 },
149 { "ldsh", 0xc0502000, 0x01a80000, "[i+1],d", 0 },
150 { "ldsh", 0xc0500000, 0x01a82000, "[1+2],d", 0 },
151 { "ldsb", 0xc0480000, 0x01b0201f, "[1],d", 0 }, /* ldsb [rs1+%g0],d */
152 { "ldsb", 0xc0482000, 0x01b01fff, "[1],d", 0 }, /* ldsb [rs1+0],d */
153 { "ldsb", 0xc0482000, 0x01b00000, "[1+i],d", 0 },
154 { "ldsb", 0xc0482000, 0x01b00000, "[i+1],d", 0 },
155 { "ldsb", 0xc0480000, 0x01b02000, "[1+2],d", 0 },
156 { "ldub", 0xc0080000, 0x01f0201f, "[1],d", 0 }, /* ldub [rs1+%g0],d */
157 { "ldub", 0xc0082000, 0x01f01fff, "[1],d", 0 }, /* ldub [rs1+0],d */
158 { "ldub", 0xc0082000, 0x01f00000, "[1+i],d", 0 },
159 { "ldub", 0xc0082000, 0x01f00000, "[i+1],d", 0 },
160 { "ldub", 0xc0080000, 0x01f02000, "[1+2],d", 0 },
161 { "lduba", 0xc0880000, 0x0170201f, "[1]A,d", 0 }, /* lduba [rs1+%g0],d */
162 { "lduba", 0xc0880000, 0x01702000, "[1+2]A,d", 0 },
163 { "lduh", 0xc0102000, 0x01e80000, "[1+i],d", 0 },
164 { "lduh", 0xc0102000, 0x01e80000, "[i+1],d", 0 },
165 { "lduh", 0xc0100000, 0x01e8201f, "[1],d", 0 }, /* lduh [rs1+%g0],d */
166 { "lduh", 0xc0102000, 0x01e81fff, "[1],d", 0 }, /* lduh [rs1+0],d */
167 { "lduh", 0xc0100000, 0x01e82000, "[1+2],d", 0 },
169 { "st", 0xc0200000, 0x01d8201f, "d,[1]", 0 }, /* st d,[rs1+%g0] */
170 { "st", 0xc0202000, 0x01d81fff, "d,[1]", 0 }, /* st d,[rs1+0] */
171 { "st", 0xc0202000, 0x01d80000, "d,[1+i]", 0 },
172 { "st", 0xc0202000, 0x01d80000, "d,[i+1]", 0 },
173 { "st", 0xc0200000, 0x01d82000, "d,[1+2]", 0 },
174 { "st", 0xc1200000, 0x00d8201f, "g,[1]", 0 }, /* st d[rs1+%g0] */
175 { "st", 0xc1202000, 0x00d81fff, "g,[1]", 0 }, /* st d,[rs1+0] */
176 { "st", 0xc1202000, 0x00d80000, "g,[1+i]", 0 },
177 { "st", 0xc1202000, 0x00d80000, "g,[i+1]", 0 },
178 { "st", 0xc1200000, 0x00d82000, "g,[1+2]", 0 },
179 { "st", 0xc1280000, 0x00d0201f, "F,[1]", 0 }, /* st %fsr,[rs1+%g0] */
180 { "st", 0xc1282000, 0x00d01fff, "F,[1]", 0 }, /* st %fsr,[rs1+0] */
181 { "st", 0xc1282000, 0x00d00000, "F,[1+i]", 0 },
182 { "st", 0xc1282000, 0x00d00000, "F,[i+1]", 0 },
183 { "st", 0xc1280000, 0x00d02000, "F,[1+2]", 0 },
184 { "st", 0xc1a00000, 0x0058201f, "D,[1]", 0 }, /* st d,[rs1+%g0] */
185 { "st", 0xc1a02000, 0x00581fff, "D,[1]", 0 }, /* st d,[rs1+0] */
186 { "st", 0xc1a02000, 0x00580000, "D,[1+i]", 0 },
187 { "st", 0xc1a02000, 0x00580000, "D,[i+1]", 0 },
188 { "st", 0xc1a00000, 0x00582000, "D,[1+2]", 0 },
189 { "st", 0xc1a80000, 0x0050201f, "C,[1]", 0 }, /* st d,[rs1+%g0] */
190 { "st", 0xc1a82000, 0x00501fff, "C,[1]", 0 }, /* st d,[rs1+0] */
191 { "st", 0xc1a82000, 0x00500000, "C,[1+i]", 0 },
192 { "st", 0xc1a82000, 0x00500000, "C,[i+1]", 0 },
193 { "st", 0xc1a80000, 0x00502000, "C,[1+2]", 0 },
194 { "sta", 0xc0a00000, 0x0108201f, "d,[1]A", 0 }, /* sta d,[rs1+%g0] */
195 { "sta", 0xc0a00000, 0x01082000, "d,[1+2]A", 0 },
197 { "stb", 0xc0280000, 0x01d0201f, "d,[1]", 0 }, /* stb d,[rs1+%g0] */
198 { "stb", 0xc0282000, 0x01d01fff, "d,[1]", 0 }, /* stb d,[rs1+0] */
199 { "stb", 0xc0282000, 0x01d00000, "d,[1+i]", 0 },
200 { "stb", 0xc0282000, 0x01d00000, "d,[i+1]", 0 },
201 { "stb", 0xc0280000, 0x01d02000, "d,[1+2]", 0 },
202 { "stba", 0xc0a80000, 0x01002000, "d,[1+2]A", 0 },
203 { "stba", 0xc0a80000, 0x0100201f, "d,[1]A", 0 }, /* stba d,[rs1+%g0] */
205 { "std", 0xc0380000, 0x01c0201f, "d,[1]", 0 }, /* std d,[rs1+%g0] */
206 { "std", 0xc0382000, 0x01c01fff, "d,[1]", 0 }, /* std d,[rs1+0] */
207 { "std", 0xc0382000, 0x01c00000, "d,[1+i]", 0 },
208 { "std", 0xc0382000, 0x01c00000, "d,[i+1]", 0 },
209 { "std", 0xc0380000, 0x01c02000, "d,[1+2]", 0 },
210 { "std", 0xc1380000, 0x00c0201f, "g,[1]", 0 }, /* std d,[rs1+%g0] */
211 { "std", 0xc1382000, 0x00c01fff, "g,[1]", 0 }, /* std d,[rs1+0] */
212 { "std", 0xc1382000, 0x00c00000, "g,[1+i]", 0 },
213 { "std", 0xc1382000, 0x00c00000, "g,[i+1]", 0 },
214 { "std", 0xc1380000, 0x00c02000, "g,[1+2]", 0 },
215 { "std", 0xc1300000, 0x00c8201f, "q,[1]", 0 }, /* std d,[rs1+%g0] */
216 { "std", 0xc1302000, 0x00c81fff, "q,[1]", 0 }, /* std d,[rs1+0] */
217 { "std", 0xc1302000, 0x00c80000, "q,[1+i]", 0 },
218 { "std", 0xc1302000, 0x00c80000, "q,[i+1]", 0 },
219 { "std", 0xc1300000, 0x00c82000, "q,[1+2]", 0 },
220 { "std", 0xc1b80000, 0x0040201f, "D,[1]", 0 }, /* std d,[rs1+%g0] */
221 { "std", 0xc1b82000, 0x00401fff, "D,[1]", 0 }, /* std d,[rs1+0] */
222 { "std", 0xc1b82000, 0x00400000, "D,[1+i]", 0 },
223 { "std", 0xc1b82000, 0x00400000, "D,[i+1]", 0 },
224 { "std", 0xc1b80000, 0x00402000, "D,[1+2]", 0 },
225 { "std", 0xc1b00000, 0x0048201f, "Q,[1]", 0 }, /* std d,[rs1+%g0] */
226 { "std", 0xc1b02000, 0x00481fff, "Q,[1]", 0 }, /* std d,[rs1+0] */
227 { "std", 0xc1b02000, 0x00480000, "Q,[1+i]", 0 },
228 { "std", 0xc1b02000, 0x00480000, "Q,[i+1]", 0 },
229 { "std", 0xc1b00000, 0x00482000, "Q,[1+2]", 0 },
230 { "stda", 0xc0b80000, 0x01402000, "d,[1+2]A", 0 },
231 { "stda", 0xc0b80000, 0x0140201f, "d,[1]A", 0 }, /* stda d,[rs1+%g0] */
233 { "sth", 0xc0300000, 0x01c8201f, "d,[1]", 0 }, /* sth d,[rs1+%g0] */
234 { "sth", 0xc0302000, 0x01c81fff, "d,[1]", 0 }, /* sth d,[rs1+0] */
235 { "sth", 0xc0300000, 0x01c82000, "d,[1+2]", 0 },
236 { "sth", 0xc0302000, 0x01c80000, "d,[1+i]", 0 },
237 { "sth", 0xc0302000, 0x01c80000, "d,[i+1]", 0 },
238 { "stha", 0xc0b00000, 0x0148201f, "d,[1]A", 0 }, /* stha d,[rs1+%g0] */
239 { "stha", 0xc0b00000, 0x01482000, "d,[1+2]A", 0 },
241 { "swap", 0xc0780000, 0x0180201f, "[1],d", 0 }, /* swap [rs1+%g0],d */
242 { "swap", 0xc0782000, 0x01801fff, "[1],d", 0 }, /* swap [rs1+0],d */
243 { "swap", 0xc0782000, 0x01800000, "[1+i],d", 0 },
244 { "swap", 0xc0782000, 0x01800000, "[i+1],d", 0 },
245 { "swap", 0xc0780000, 0x01802000, "[1+2],d", 0 },
246 { "swapa", 0xc0f80000, 0x01002000, "[1+2]A,d", 0 },
247 { "swapa", 0xc0f80000, 0x0100201f, "[1]A,d", 0 }, /* swapa [rs1+%g0],d */
249 { "restore", 0x81e80000, 0x7e17e01f, "", 0 }, /* restore %g0,%g0,%g0 */
250 { "restore", 0x81e82000, 0x7e14dfff, "", 0 }, /* restore %g0,0,%g0 */
251 { "restore", 0x81e82000, 0x00000000, "1,i,d", 0 },
252 { "restore", 0x81e80000, 0x00000000, "1,2,d", 0 },
253 { "rett", 0x81c82000, 0x40300000, "1+i", F_DELAYED },
254 { "rett", 0x81c82000, 0x40300000, "i+1", F_DELAYED },
255 { "rett", 0x81c80000, 0x40302000, "1+2", F_DELAYED },
256 { "rett", 0x81c82000, 0x40301fff, "1", F_DELAYED}, /* rett X,0 */
257 { "rett", 0x81c80000, 0x4030201f, "1", F_DELAYED}, /* rett X,%g0 */
258 { "save", 0x81e02000, 0x40180000, "1,i,d", 0 },
259 { "save", 0x81e00000, 0x40180000, "1,2,d", 0 },
261 { "ret", 0x81c7e008, 0x00001ff7, "", F_DELAYED }, /* jmpl %i7+8,%g0 */
262 { "retl", 0x81c3e008, 0x00001ff7, "", F_DELAYED }, /* jmpl %o7+8,%g0 */
264 { "jmpl", 0x81c00000, 0x4038201f, "1,d", F_DELAYED }, /* jmpl rs1+%g0,d */
265 { "jmpl", 0x81c02000, 0x4037c000, "i,d", F_DELAYED }, /* jmpl %g0+i,d */
266 { "jmpl", 0x81c02000, 0x40380000, "1+i,d", F_DELAYED },
267 { "jmpl", 0x81c02000, 0x40380000, "i+1,d", F_DELAYED },
268 { "jmpl", 0x81c00000, 0x40382000, "1+2,d", F_DELAYED },
269 { "wr", 0x81982000, 0x40600000, "1,i,t", 0 },
270 { "wr", 0x81980000, 0x40600000, "1,2,t", 0 },
271 { "wr", 0x81902000, 0x40680000, "1,i,w", 0 },
272 { "wr", 0x81900000, 0x40680000, "1,2,w", 0 },
273 { "wr", 0x81882000, 0x40700000, "1,i,p", 0 },
274 { "wr", 0x81880000, 0x40700000, "1,2,p", 0 },
275 { "wr", 0x81802000, 0x40780000, "1,i,y", 0 },
276 { "wr", 0x81800000, 0x40780000, "1,2,y", 0 },
278 { "rd", 0x81580000, 0x40a00000, "t,d", 0 },
279 { "rd", 0x81500000, 0x40a80000, "w,d", 0 },
280 { "rd", 0x81480000, 0x40b00000, "p,d", 0 },
281 { "rd", 0x81400000, 0x40b80000, "y,d", 0 },
283 { "sra", 0x81382000, 0x00000000, "1,i,d", 0 },
284 { "sra", 0x81380000, 0x00000000, "1,2,d", 0 },
285 { "srl", 0x81302000, 0x40c80000, "1,i,d", 0 },
286 { "srl", 0x81300000, 0x40c80000, "1,2,d", 0 },
287 { "sll", 0x81282000, 0x40d00000, "1,i,d", 0 },
288 { "sll", 0x81280000, 0x40d00000, "1,2,d", 0 },
290 { "mulscc", 0x81202000, 0x40d80000, "1,i,d", 0 },
291 { "mulscc", 0x81200000, 0x40d80000, "1,2,d", 0 },
293 { "clr", 0x80100000, 0x4e87e01f, "d", F_ALIAS }, /* or %g0,%g0,d */
294 { "clr", 0x80102000, 0x41efdfff, "d", F_ALIAS }, /* or %g0,0,d */
295 { "clr", 0xc0200000, 0x3fd8001f, "[1]", F_ALIAS }, /* st %g0,[rs1+%g0] */
296 { "clr", 0xc0202000, 0x3fd81fff, "[1]", F_ALIAS }, /* st %g0,[rs1+0] */
297 { "clr", 0xc0202000, 0x3fd80000, "[1+i]", F_ALIAS },
298 { "clr", 0xc0202000, 0x3fd80000, "[i+1]", F_ALIAS },
299 { "clr", 0xc0200000, 0x3fd80000, "[1+2]", F_ALIAS },
301 { "clrb", 0xc0280000, 0x3fd0001f, "[1]", F_ALIAS },/* stb %g0,[rs1+%g0] */
302 { "clrb", 0xc0282000, 0x3fd00000, "[1+i]", F_ALIAS },
303 { "clrb", 0xc0282000, 0x3fd00000, "[i+1]", F_ALIAS },
304 { "clrb", 0xc0280000, 0x3fd00000, "[1+2]", F_ALIAS },
306 { "clrh", 0xc0300000, 0x3fc8001f, "[1]", F_ALIAS },/* sth %g0,[rs1+%g0] */
307 { "clrh", 0xc0300000, 0x3fc80000, "[1+2]", F_ALIAS },
308 { "clrh", 0xc0302000, 0x3fc80000, "[1+i]", F_ALIAS },
309 { "clrh", 0xc0302000, 0x3fc80000, "[i+1]", F_ALIAS },
311 { "orncc", 0x80b02000, 0x04048000, "1,i,d", 0 },
312 { "orncc", 0x80b00000, 0x04048000, "1,2,d", 0 },
314 { "tst", 0x80900000, 0x7f6fe000, "2", 0 }, /* orcc %g0, rs2, %g0 */
315 { "tst", 0x80900000, 0x7f68201f, "1", 0 }, /* orcc rs1, %g0, %g0 */
316 { "tst", 0x80902000, 0x7f681fff, "1", 0 }, /* orcc rs1, 0, %g0 */
318 { "orcc", 0x80902000, 0x41680000, "1,i,d", 0 },
319 { "orcc", 0x80902000, 0x41680000, "i,1,d", 0 },
320 { "orcc", 0x80900000, 0x41680000, "1,2,d", 0 },
321 { "orn", 0x80302000, 0x41c80000, "1,i,d", 0 },
322 { "orn", 0x80300000, 0x41c80000, "1,2,d", 0 },
324 { "mov", 0x81800000, 0x4078201f, "1,y", F_ALIAS }, /* wr rs1,%g0,%y */
325 { "mov", 0x81802000, 0x40781fff, "1,y", F_ALIAS }, /* wr rs1,0,%y */
326 { "mov", 0x81802000, 0x40780000, "i,y", F_ALIAS },
327 { "mov", 0x81400000, 0x40b80000, "y,d", F_ALIAS }, /* rd %y,d */
328 { "mov", 0x81980000, 0x4060201f, "1,t", F_ALIAS }, /* wr rs1,%g0,%tbr */
329 { "mov", 0x81982000, 0x40601fff, "1,t", F_ALIAS }, /* wr rs1,0,%tbr */
330 { "mov", 0x81982000, 0x40600000, "i,t", F_ALIAS },
331 { "mov", 0x81580000, 0x40a00000, "t,d", F_ALIAS }, /* rd %tbr,d */
332 { "mov", 0x81900000, 0x4068201f, "1,w", F_ALIAS }, /* wr rs1,%g0,%wim */
333 { "mov", 0x81902000, 0x40681fff, "1,w", F_ALIAS }, /* wr rs1,0,%wim */
334 { "mov", 0x81902000, 0x40680000, "i,w", F_ALIAS },
335 { "mov", 0x81500000, 0x40a80000, "w,d", F_ALIAS }, /* rd %wim,d */
336 { "mov", 0x81880000, 0x4070201f, "1,p", F_ALIAS }, /* wr rs1,%g0,%psr */
337 { "mov", 0x81882000, 0x40701fff, "1,p", F_ALIAS }, /* wr rs1,0,%psr */
338 { "mov", 0x81882000, 0x40700000, "i,p", F_ALIAS },
339 { "mov", 0x81480000, 0x40b00000, "p,d", F_ALIAS }, /* rd %psr,d */
341 { "mov", 0x80102000, 0x41efc000, "i,d", 0 }, /* or %g0,i,d */
342 { "mov", 0x80100000, 0x41efe000, "2,d", 0 }, /* or %g0,rs2,d */
343 { "mov", 0x80102000, 0x41e81fff, "1,d", 0 }, /* or rs1,0,d */
344 { "mov", 0x80100000, 0x41e8201f, "1,d", 0 }, /* or rs1,%g0,d */
346 { "or", 0x80102000, 0x40800000, "1,i,d", 0 },
347 { "or", 0x80102000, 0x40800000, "i,1,d", 0 },
348 { "or", 0x80100000, 0x40800000, "1,2,d", 0 },
350 { "bset", 0x80102000, 0x40800000, "i,r", F_ALIAS },/* or rd,i,rd */
351 { "bset", 0x80100000, 0x40800000, "2,r", F_ALIAS },/* or rd,rs2,rd */
353 { "andncc", 0x80a82000, 0x41500000, "1,i,d", 0 },
354 { "andncc", 0x80a80000, 0x41500000, "1,2,d", 0 },
355 { "andn", 0x80282000, 0x41d00000, "1,i,d", 0 },
356 { "andn", 0x80280000, 0x41d00000, "1,2,d", 0 },
358 { "bclr", 0x80282000, 0x41d00000, "i,r", F_ALIAS },/* andn rd,i,rd */
359 { "bclr", 0x80280000, 0x41d00000, "2,r", F_ALIAS },/* andn rd,rs2,rd */
361 { "cmp", 0x80a02000, 0x7d580000, "1,i", 0 }, /* subcc rs1,i,%g0 */
362 { "cmp", 0x80a00000, 0x7d580000, "1,2", 0 }, /* subcc rs1,rs2,%g0 */
364 { "subcc", 0x80a02000, 0x41580000, "1,i,d", 0 },
365 { "subcc", 0x80a00000, 0x41580000, "1,2,d", 0 },
366 { "sub", 0x80202000, 0x41d80000, "1,i,d", 0 },
367 { "sub", 0x80200000, 0x41d80000, "1,2,d", 0 },
368 { "subx", 0x80602000, 0x41980000, "1,i,d", 0 },
369 { "subx", 0x80600000, 0x41980000, "1,2,d", 0 },
370 { "subxcc", 0x80e02000, 0x41180000, "1,i,d", 0 },
371 { "subxcc", 0x80e00000, 0x41180000, "1,2,d", 0 },
373 { "andcc", 0x80882000, 0x41700000, "1,i,d", 0 },
374 { "andcc", 0x80882000, 0x41700000, "i,1,d", 0 },
375 { "andcc", 0x80880000, 0x41700000, "1,2,d", 0 },
376 { "and", 0x80082000, 0x41f00000, "1,i,d", 0 },
377 { "and", 0x80082000, 0x41f00000, "i,1,d", 0 },
378 { "and", 0x80080000, 0x41f00000, "1,2,d", 0 },
380 { "inc", 0x80002001, 0x41f81ffe, "r", F_ALIAS }, /* add rs1,1,rsd */
381 { "inccc", 0x80802001, 0x41781ffe, "r", F_ALIAS }, /* addcc rd,1,rd */
382 { "dec", 0x80202001, 0x41d81ffe, "r", F_ALIAS }, /* sub rd,1,rd */
383 { "deccc", 0x80a02001, 0x41581ffe, "r", F_ALIAS }, /* subcc rd,1,rd */
385 { "btst", 0x80882000, 0x41700000, "i,1", F_ALIAS },/* andcc rs1,i,%g0 */
386 { "btst", 0x80880000, 0x41700000, "1,2", F_ALIAS },/* andcc rs1,rs2,%0 */
388 { "neg", 0x80200000, 0x41d80000, "r", F_ALIAS }, /* sub %0,rd,rd */
389 { "neg", 0x80200000, 0x41d80000, "2,d", F_ALIAS }, /* sub %0,rs2,rd */
391 { "addxcc", 0x80c02000, 0x41380000, "1,i,d", 0 },
392 { "addxcc", 0x80c02000, 0x41380000, "i,1,d", 0 },
393 { "addxcc", 0x80c00000, 0x41380000, "1,2,d", 0 },
394 { "addcc", 0x80802000, 0x41780000, "1,i,d", 0 },
395 { "addcc", 0x80802000, 0x41780000, "i,1,d", 0 },
396 { "addcc", 0x80800000, 0x41780000, "1,2,d", 0 },
397 { "addx", 0x80402000, 0x41b80000, "1,i,d", 0 },
398 { "addx", 0x80402000, 0x41b80000, "i,1,d", 0 },
399 { "addx", 0x80400000, 0x41b80000, "1,2,d", 0 },
400 { "add", 0x80002000, 0x41f80000, "1,i,d", 0 },
401 { "add", 0x80002000, 0x41f80000, "i,1,d", 0 },
402 { "add", 0x80000000, 0x41f80000, "1,2,d", 0 },
404 { "call", 0x9fc00000, 0x4038201f, "1", F_DELAYED }, /* jmpl rs1+%g0, %o7 */
405 { "call", 0x9fc00000, 0x4038201f, "1,#", F_DELAYED },
406 { "call", 0x40000000, 0x80000000, "L", F_DELAYED },
407 { "call", 0x40000000, 0x80000000, "L,#", F_DELAYED },
409 { "jmp", 0x81c00000, 0x7e38201f, "1", F_DELAYED }, /* jmpl rs1+%g0,%g0 */
410 { "jmp", 0x81c02000, 0x7e3fc000, "i", F_DELAYED }, /* jmpl %g0+i,%g0 */
411 { "jmp", 0x81c00000, 0x7e382000, "1+2", F_DELAYED }, /* jmpl rs1+rs2,%g0 */
412 { "jmp", 0x81c02000, 0x7e380000, "1+i", F_DELAYED }, /* jmpl rs1+i,%g0 */
413 { "jmp", 0x81c02000, 0x7e380000, "i+1", F_DELAYED }, /* jmpl i+rs1,%g0 */
415 { "nop", 0x01000000, 0xfeffffff, "", 0 }, /* sethi 0, %g0 */
417 { "set", 0x01000000, 0xc0c00000, "Sh,d", F_ALIAS },
419 { "sethi", 0x01000000, 0xc0c00000, "h,d", 0 },
421 { "taddcctv", 0x81102000, 0x40e00000, "1,i,d", 0 },
422 { "taddcctv", 0x81100000, 0x40e00000, "1,2,d", 0 },
423 { "taddcc", 0x81002000, 0x40f80000, "1,i,d", 0 },
424 { "taddcc", 0x81000000, 0x40f80000, "1,2,d", 0 },
426 /* Conditional instructions.
428 Because this part of the table was such a mess earlier, I have
429 macrofied it so that all the branches and traps are generated from
430 a single-line description of each condition value. */
432 #define ANNUL 0x20000000
433 #define IMMED 0x00002000
434 #define RS1_G0 0x0007C000
435 #define RS2_G0 0x0000001F
437 /* Define two branches -- one annulled, one without */
438 #define br(opcode, mask, lose, flags) \
439 { opcode, mask+ANNUL, lose, ",al", flags }, \
440 { opcode, mask , lose, "l", flags }
442 /* Define four traps: reg+reg, reg + immediate, immediate alone, reg alone. */
443 #define tr(opcode, mask, lose, flags) \
444 {opcode, mask+IMMED, lose+RS1_G0 , "i", flags }, /* %g0 + imm */ \
445 {opcode, mask+IMMED, lose , "1+i", flags }, /* rs1 + imm */ \
446 {opcode, mask , lose+IMMED , "1+2", flags }, /* rs1 + rs2 */ \
447 {opcode, mask , lose+IMMED+RS2_G0, "1", flags } /* rs1 + %g0 */
449 /* Define both branches and traps based on condition mask */
451 #define cond(bop, top, mask, flags) \
452 br(#bop, 0x00800000+(mask << 25), 0xC1400000, F_DELAYED|flags), \
453 tr(#top, 0x81d00000+(mask << 25), 0x40280000, flags)
455 #define cond(bop, top, mask, flags) \
456 br("bop", 0x00800000+(mask << 25), 0xC1400000, F_DELAYED|flags), \
457 tr("top", 0x81d00000+(mask << 25), 0x40280000, flags)
460 /* Define all the conditions, all the branches, all the traps. */
461 /* Use no extra spaces or tabs around the first two args, since cpp
462 will include them in the printed strings. */
463 cond (bvc,tvc, 0xF, 0),
464 cond (bvs,tvs, 0x7, 0),
465 cond (bpos,tpos, 0xE, 0),
466 cond (bneg,tneg, 0x6, 0),
467 cond (bcc,tcc, 0xD, 0),
468 cond (bcs,tcs, 0x5, 0),
469 cond (blu,tlu, 0x5, F_ALIAS), /* for cs */
470 cond (bgeu,tgeu, 0xD, F_ALIAS), /* for cc */
471 cond (bgu,tgu, 0xC, 0),
472 cond (bleu,tleu, 0x4, 0),
473 cond (bge,tge, 0xB, 0),
474 cond (bl,tl, 0x3, 0),
475 cond (bg,tg, 0xA, 0),
476 cond (ble,tle, 0x2, 0),
477 cond (be,te, 0x1, 0),
478 cond (bz,tz, 0x1, F_ALIAS), /* for e */
479 cond (bne,tne, 0x9, 0),
480 cond (bnz,tnz, 0x9, F_ALIAS), /* for ne */
482 cond (ba,ta, 0x8, F_ALIAS), /* for nothing */
483 cond (bn,tn, 0x0, 0),
489 { "tsubcc", 0x81080000, 0x40f00000, "1,2,d", 0 },
490 { "tsubcc", 0x81082000, 0x40f00000, "1,i,d", 0 },
491 { "tsubcctv", 0x80580000, 0x40a00000, "1,2,d", 0 },
492 { "tsubcctv", 0x80582000, 0x40a00000, "1,i,d", 0 },
494 { "unimp", 0x00000000, 0xFFFFFFFF, "l", 0 },
496 { "iflush", 0x81d80000, 0x40202000, "1+2", 0 },
497 { "iflush", 0x81d82000, 0x40200000, "1+i", 0 },
499 { "xnorcc", 0x80b80000, 0x41400000, "1,2,d", 0 },
500 { "xnorcc", 0x80b82000, 0x41400000, "1,i,d", 0 },
501 { "xnorcc", 0x80b82000, 0x41400000, "i,1,d", 0 },
502 { "xorcc", 0x80980000, 0x41600000, "1,2,d", 0 },
503 { "xorcc", 0x80982000, 0x41600000, "1,i,d", 0 },
504 { "xorcc", 0x80982000, 0x41600000, "i,1,d", 0 },
505 { "xnor", 0x80380000, 0x41c00000, "1,2,d", 0 },
506 { "xnor", 0x80382000, 0x41c00000, "1,i,d", 0 },
507 { "xnor", 0x80382000, 0x41c00000, "i,1,d", 0 },
508 { "xor", 0x80180000, 0x41e00000, "1,2,d", 0 },
509 { "xor", 0x80182000, 0x41e00000, "1,i,d", 0 },
510 { "xor", 0x80182000, 0x41e00000, "i,1,d", 0 },
512 { "not", 0x80380000, 0x41c00000, "r", F_ALIAS }, /* xnor rd,%0,rd */
513 { "not", 0x80380000, 0x41c00000, "1,d", F_ALIAS }, /* xnor rs1,%0,rd */
515 { "btog", 0x80180000, 0x41e02000, "2,r", F_ALIAS }, /* xor rd,rs2,rd */
516 { "btog", 0x80182000, 0x41e00000, "i,r", F_ALIAS }, /* xor rd,i,rd */
518 { "fpop1", 0x81a00000, 0x40580000, "[1+2],d", 0 },
519 { "fpop2", 0x81a80000, 0x40500000, "[1+2],d", 0 },
521 /* Someday somebody should give these the same treatment as the branches
522 above. FIXME someday. */
524 { "fb", 0x31800000, 0xc0400000, ",al", F_DELAYED },
525 { "fb", 0x11800000, 0xc0400000, "l", F_DELAYED },
526 { "fba", 0x31800000, 0xc0400000, ",al", F_DELAYED|F_ALIAS },
527 { "fba", 0x11800000, 0xc0400000, "l", F_DELAYED|F_ALIAS },
528 { "fbn", 0x21800000, 0xc0400000, ",al", F_DELAYED },
529 { "fbn", 0x01800000, 0xc0400000, "l", F_DELAYED },
530 { "fbu", 0x2f800000, 0xc0400000, ",al", F_DELAYED },
531 { "fbu", 0x0f800000, 0xc0400000, "l", F_DELAYED },
532 { "fbg", 0x2d800000, 0xc0400000, ",al", F_DELAYED },
533 { "fbg", 0x0d800000, 0xc0400000, "l", F_DELAYED },
534 { "fbug", 0x2b800000, 0xc0400000, ",al", F_DELAYED },
535 { "fbug", 0x0b800000, 0xc0400000, "l", F_DELAYED },
536 { "fbl", 0x29800000, 0xc0400000, ",al", F_DELAYED },
537 { "fbl", 0x09800000, 0xc0400000, "l", F_DELAYED },
538 { "fbul", 0x27800000, 0xc0400000, ",al", F_DELAYED },
539 { "fbul", 0x07800000, 0xc0400000, "l", F_DELAYED },
540 { "fblg", 0x25800000, 0xc0400000, ",al", F_DELAYED },
541 { "fblg", 0x05800000, 0xc0400000, "l", F_DELAYED },
542 { "fbne", 0x23800000, 0xc0400000, ",al", F_DELAYED },
543 { "fbne", 0x03800000, 0xc0400000, "l", F_DELAYED },
544 { "fbe", 0x33800000, 0xc0400000, ",al", F_DELAYED },
545 { "fbe", 0x13800000, 0xc0400000, "l", F_DELAYED },
546 { "fbue", 0x35800000, 0xc0400000, ",al", F_DELAYED },
547 { "fbue", 0x15800000, 0xc0400000, "l", F_DELAYED },
548 { "fbge", 0x37800000, 0xc0400000, ",al", F_DELAYED },
549 { "fbge", 0x17800000, 0xc0400000, "l", F_DELAYED },
550 { "fbuge", 0x39800000, 0xc0400000, ",al", F_DELAYED },
551 { "fbuge", 0x19800000, 0xc0400000, "l", F_DELAYED },
552 { "fble", 0x3b800000, 0xc0400000, ",al", F_DELAYED },
553 { "fble", 0x1b800000, 0xc0400000, "l", F_DELAYED },
554 { "fbule", 0x3d800000, 0xc0400000, ",al", F_DELAYED },
555 { "fbule", 0x1d800000, 0xc0400000, "l", F_DELAYED },
556 { "fbo", 0x3f800000, 0xc0400000, ",al", F_DELAYED },
557 { "fbo", 0x1f800000, 0xc0400000, "l", F_DELAYED },
559 { "cba", 0x31c00000, 0xce000000, ",al", F_DELAYED },
560 { "cba", 0x11c00000, 0xce000000, "l", F_DELAYED },
561 { "cbn", 0x21c00000, 0xde000000, ",al", F_DELAYED },
562 { "cbn", 0x01c00000, 0xde000000, "l", F_DELAYED },
563 { "cb3", 0x2fc00000, 0xc0000000, ",al", F_DELAYED },
564 { "cb3", 0x0fc00000, 0xc0000000, "l", F_DELAYED },
565 { "cb2", 0x2dc00000, 0xc0000000, ",al", F_DELAYED },
566 { "cb2", 0x0dc00000, 0xc0000000, "l", F_DELAYED },
567 { "cb23", 0x2bc00000, 0xc0000000, ",al", F_DELAYED },
568 { "cb23", 0x0bc00000, 0xc0000000, "l", F_DELAYED },
569 { "cb1", 0x29c00000, 0xc0000000, ",al", F_DELAYED },
570 { "cb1", 0x09c00000, 0xc0000000, "l", F_DELAYED },
571 { "cb13", 0x27c00000, 0xc0000000, ",al", F_DELAYED },
572 { "cb13", 0x07c00000, 0xc0000000, "l", F_DELAYED },
573 { "cb12", 0x25c00000, 0xc0000000, ",al", F_DELAYED },
574 { "cb12", 0x05c00000, 0xc0000000, "l", F_DELAYED },
575 { "cb123", 0x23c00000, 0xc0000000, ",al", F_DELAYED },
576 { "cb123", 0x03c00000, 0xc0000000, "l", F_DELAYED },
577 { "cb0", 0x33c00000, 0xc0000000, ",al", F_DELAYED },
578 { "cb0", 0x13c00000, 0xc0000000, "l", F_DELAYED },
579 { "cb03", 0x35c00000, 0xc0000000, ",al", F_DELAYED },
580 { "cb03", 0x15c00000, 0xc0000000, "l", F_DELAYED },
581 { "cb02", 0x37c00000, 0xc0000000, ",al", F_DELAYED },
582 { "cb02", 0x17c00000, 0xc0000000, "l", F_DELAYED },
583 { "cb023", 0x39c00000, 0xc0000000, ",al", F_DELAYED },
584 { "cb023", 0x19c00000, 0xc0000000, "l", F_DELAYED },
585 { "cb01", 0x3bc00000, 0xc0000000, ",al", F_DELAYED },
586 { "cb01", 0x1bc00000, 0xc0000000, "l", F_DELAYED },
587 { "cb013", 0x3dc00000, 0xc0000000, ",al", F_DELAYED },
588 { "cb013", 0x1dc00000, 0xc0000000, "l", F_DELAYED },
589 { "cb012", 0x3fc00000, 0xc0000000, ",al", F_DELAYED },
590 { "cb012", 0x1fc00000, 0xc0000000, "l", F_DELAYED },
592 { "fstoi", 0x81a01a20, 0x400025c0, "f,g", 0 },
593 { "fdtoi", 0x81a01a40, 0x400025a0, "f,g", 0 },
594 { "fxtoi", 0x81a01a60, 0x40002580, "f,g", 0 },
596 { "fitox", 0x81a01980, 0x40002660, "f,g", 0 },
597 { "fitod", 0x81a01900, 0x400026e0, "f,g", 0 },
598 { "fitos", 0x81a01880, 0x40002660, "f,g", 0 },
600 { "fstod", 0x81a01920, 0x400026c0, "f,g", 0 },
601 { "fstox", 0x81a019a0, 0x40002640, "f,g", 0 },
602 { "fdtos", 0x81a018c0, 0x40002720, "f,g", 0 },
603 { "fdtox", 0x81a019c0, 0x40002620, "f,g", 0 },
604 { "fxtos", 0x81a018e0, 0x40002700, "f,g", 0 },
605 { "fxtod", 0x81a01960, 0x40002680, "f,g", 0 },
607 { "fdivx", 0x81a009e0, 0x40083600, "e,f,g", 0 },
608 { "fdivd", 0x81a009c0, 0x40003620, "e,f,g", 0 },
609 { "fdivs", 0x81a009a0, 0x40003640, "e,f,g", 0 },
611 { "fmuls", 0x81a00920, 0x400036c0, "e,f,g", 0 },
612 { "fmuld", 0x81a00940, 0x400036a0, "e,f,g", 0 },
613 { "fmulx", 0x81a00960, 0x40003680, "e,f,g", 0 },
615 { "fsqrts", 0x81a00520, 0x40003ac0, "f,g", 0 },
616 { "fsqrtd", 0x81a00540, 0x40003aa8, "f,g", 0 },
617 { "fsqrtx", 0x81a00560, 0x40003a80, "f,g", 0 },
619 { "fabss", 0x81a00120, 0x40003ec0, "f,g", 0 },
620 { "fnegs", 0x81a000a0, 0x40003f40, "f,g", 0 },
621 { "fmovs", 0x81a00020, 0x40003fc0, "f,g", 0 },
623 { "fsubx", 0x81a008e0, 0x40003700, "e,f,g", 0 },
624 { "fsubd", 0x81a008c0, 0x40003720, "e,f,g", 0 },
625 { "fsubs", 0x81a008a0, 0x40003740, "e,f,g", 0 },
627 { "faddx", 0x81a00860, 0x40003780, "e,f,g", 0 },
628 { "faddd", 0x81a00840, 0x400037a0, "e,f,g", 0 },
629 { "fadds", 0x81a00820, 0x400037c0, "e,f,g", 0 },
631 { "fcmpex", 0x81a80ae0, 0x40003500, "e,f", 0 },
632 { "fcmped", 0x81a80ac0, 0x40003520, "e,f", 0 },
633 { "fcmpes", 0x81a80aa0, 0x40003540, "e,f", 0 },
634 { "fcmpx", 0x81a80a60, 0x40003580, "e,f", 0 },
635 { "fcmpd", 0x81a80a40, 0x400035a0, "e,f", 0 },
636 { "fcmps", 0x81a80a20, 0x400035c0, "e,f", 0 },
638 { "cpop1", 0x81b00000, 0x40480000, "[1+2],d", 0 },
639 { "cpop2", 0x81b80000, 0x40400000, "[1+2],d", 0 },
642 #define NUMOPCODES ((sizeof sparc_opcodes)/(sizeof sparc_opcodes[0]))