1 /* to sanitize this file, grep -v v9 < sparc.h > clean-sparc.h */
3 /* Definitions for opcode table for the sparc.
4 Copyright 1989, 1991, 1992 Free Software Foundation, Inc.
6 This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
10 GAS/GDB is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 GAS/GDB is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with GAS or GDB; see the file COPYING. If not, write to
22 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
24 /* The SPARC opcode table (and other related data) is defined in
25 the BFD library in opc-sparc.c. If you change anything here, make
26 sure you fix up that file, and vice versa. */
28 /* FIXME-someday: perhaps the ,a's and such should be embedded in the
29 instruction's name rather than the args. This would make gas faster, pinsn
30 slower, but would mess up some macros a bit. xoxorich. */
32 #if !defined(__STDC__) && !defined(const)
36 #define sparc_architecture bfd_sparc_architecture
37 #define architecture_pname bfd_sparc_architecture_pname
38 #define sparc_opcode bfd_sparc_opcode
39 #define sparc_opcodes bfd_sparc_opcodes
42 * Structure of an opcode table entry.
43 * This enumerator must parallel the architecture_pname array
46 enum sparc_architecture
{
54 extern const char *architecture_pname
[];
56 /* Sparclite and v9 are both supersets of v8; we can't bump between them. */
58 #define ARCHITECTURES_CONFLICT_P(ARCH1, ARCH2) ((ARCH1) == sparclite && (ARCH2) == v9)
62 unsigned long match
; /* Bits that must be set. */
63 unsigned long lose
; /* Bits that must not be set. */
65 /* This was called "delayed" in versions before the flags. */
67 enum sparc_architecture architecture
;
70 #define F_DELAYED 1 /* Delayed branch */
71 #define F_ALIAS 2 /* Alias for a "real" instruction */
75 All sparc opcodes are 32 bits, except for the `set' instruction (really a
76 macro), which is 64 bits. It is handled as a special case.
78 The match component is a mask saying which bits must match a particular
79 opcode in order for an instruction to be an instance of that opcode.
81 The args component is a string containing one character for each operand of the
85 # Number used by optimizer. It is ignored.
89 e frs1 floating point register.
90 v frs1 floating point register (double/even).
91 V frs1 floating point register (quad/multiple of 4).
92 f frs2 floating point register.
93 B frs2 floating point register (double/even).
94 R frs2 floating point register (quad/multiple of 4).
95 j frs3 floating point register. (v9)
96 u frs3 floating point register. (double/even) (v9)
97 U frs3 floating point register. (quad/multiple of 4) (v9)
98 g frsd floating point register.
99 H frsd floating point register (double/even).
100 J frsd floating point register (quad/multiple of 4).
101 b crs1 coprocessor register
102 c crs2 coprocessor register
103 D crsd coprocessor register
104 m alternate space register (asr) in rd
105 M alternate space register (asr) in rs1
107 K MEMBAR mask (4 bits). (v9)
108 I 11 bit Immediate. (v9)
111 k 2+14 bit PC relative immediate. (v9)
112 G 19 bit PC relative immediate. (v9)
113 l 22 bit PC relative immediate.
114 L 30 bit PC relative immediate.
115 a Annul. The annul bit is set.
116 A Alternate address space. Stored as 8 bits.
117 C Coprocessor state register.
118 F floating point state register.
119 p Processor state register.
120 N Branch predict clear ",pn" (v9)
121 T Branch predict set ",pt" (v9)
124 q Floating point queue.
125 r Single register that is both rs1 and rsd.
128 t Trap base register.
129 w Window invalid mask register.
141 ! Privileged Register in rd (v9)
142 ? Privileged Register in rs1 (v9)
144 The following chars are unused: (note: ,[] are used as punctuation)
149 #define OP2(x) (((x)&0x7) << 22) /* op2 field of format2 insns */
150 #define OP3(x) (((x)&0x3f) << 19) /* op3 field of format3 insns */
151 #define OP(x) ((unsigned)((x)&0x3) << 30) /* op field of all insns */
152 #define OPF(x) (((x)&0x1ff) << 5) /* opf field of float insns */
153 #define OPF_LOW(x) OPF((x)&0xf) /* v9 */
154 #define F3F(x, y, z) (OP(x) | OP3(y) | OPF(z)) /* format3 float insns */
155 #define F3I(x) (((x)&0x1) << 13) /* immediate field of format 3 insns */
156 #define F2(x, y) (OP(x) | OP2(y)) /* format 2 insns */
157 #define F3(x, y, z) (OP(x) | OP3(y) | F3I(z)) /* format3 insns */
158 #define F1(x) (OP(x))
159 #define DISP30(x) ((x)&0x3fffffff)
160 #define ASI(x) (((x)&0xff) << 5) /* asi field of format3 insns */
161 #define RS2(x) ((x)&0x1f) /* rs2 field */
162 #define SIMM13(x) ((x)&0x1fff) /* simm13 field */
163 #define RD(x) (((x)&0x1f) << 25) /* destination register field */
164 #define RS1(x) (((x)&0x1f) << 14) /* rs1 field */
165 #define ASI_RS2(x) (SIMM13(x))
167 #define ANNUL (1<<29)
168 #define BPRED (1<<19) /* v9 */
171 #define RS1_G0 RS1(~0)
172 #define RS2_G0 RS2(~0)
174 extern struct sparc_opcode sparc_opcodes
[];
175 extern const int bfd_sparc_num_opcodes
;
177 #define NUMOPCODES bfd_sparc_num_opcodes