xref: /netbsd-src/external/gpl3/binutils.old/dist/include/opcode/sparc.h (revision e992f068c547fd6e84b3f104dc2340adcc955732)
175fd0b74Schristos /* Definitions for opcode table for the sparc.
2*e992f068Schristos    Copyright (C) 1989-2022 Free Software Foundation, Inc.
375fd0b74Schristos 
475fd0b74Schristos    This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
575fd0b74Schristos    the GNU Binutils.
675fd0b74Schristos 
775fd0b74Schristos    GAS/GDB is free software; you can redistribute it and/or modify
875fd0b74Schristos    it under the terms of the GNU General Public License as published by
975fd0b74Schristos    the Free Software Foundation; either version 3, or (at your option)
1075fd0b74Schristos    any later version.
1175fd0b74Schristos 
1275fd0b74Schristos    GAS/GDB is distributed in the hope that it will be useful,
1375fd0b74Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
1475fd0b74Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
1575fd0b74Schristos    GNU General Public License for more details.
1675fd0b74Schristos 
1775fd0b74Schristos    You should have received a copy of the GNU General Public License
1875fd0b74Schristos    along with GAS or GDB; see the file COPYING3.  If not, write to
1975fd0b74Schristos    the Free Software Foundation, 51 Franklin Street - Fifth Floor,
2075fd0b74Schristos    Boston, MA 02110-1301, USA.  */
2175fd0b74Schristos 
2275fd0b74Schristos #include "ansidecl.h"
2375fd0b74Schristos 
2475fd0b74Schristos #ifdef __cplusplus
2575fd0b74Schristos extern "C" {
2675fd0b74Schristos #endif
2775fd0b74Schristos 
2875fd0b74Schristos /* The SPARC opcode table (and other related data) is defined in
2975fd0b74Schristos    the opcodes library in sparc-opc.c.  If you change anything here, make
3075fd0b74Schristos    sure you fix up that file, and vice versa.  */
3175fd0b74Schristos 
3275fd0b74Schristos  /* FIXME-someday: perhaps the ,a's and such should be embedded in the
3375fd0b74Schristos     instruction's name rather than the args.  This would make gas faster, pinsn
3475fd0b74Schristos     slower, but would mess up some macros a bit.  xoxorich. */
3575fd0b74Schristos 
3675fd0b74Schristos /* List of instruction sets variations.
3775fd0b74Schristos    These values are such that each element is either a superset of a
3875fd0b74Schristos    preceding each one or they conflict in which case SPARC_OPCODE_CONFLICT_P
3975fd0b74Schristos    returns non-zero.
4075fd0b74Schristos    The values are indices into `sparc_opcode_archs' defined in sparc-opc.c.
4175fd0b74Schristos    Don't change this without updating sparc-opc.c.  */
4275fd0b74Schristos 
4375fd0b74Schristos enum sparc_opcode_arch_val
4475fd0b74Schristos {
4575fd0b74Schristos   SPARC_OPCODE_ARCH_V6 = 0,
4675fd0b74Schristos   SPARC_OPCODE_ARCH_V7,
4775fd0b74Schristos   SPARC_OPCODE_ARCH_V8,
4875fd0b74Schristos   SPARC_OPCODE_ARCH_LEON,
4975fd0b74Schristos   SPARC_OPCODE_ARCH_SPARCLET,
5075fd0b74Schristos   SPARC_OPCODE_ARCH_SPARCLITE,
5175fd0b74Schristos   /* V9 variants must appear last.  */
5275fd0b74Schristos   SPARC_OPCODE_ARCH_V9,
5375fd0b74Schristos   SPARC_OPCODE_ARCH_V9A, /* V9 with ultrasparc additions.  */
5475fd0b74Schristos   SPARC_OPCODE_ARCH_V9B, /* V9 with ultrasparc and cheetah additions.  */
5575fd0b74Schristos   SPARC_OPCODE_ARCH_V9C, /* V9 with UA2005 and T1 additions.  */
5675fd0b74Schristos   SPARC_OPCODE_ARCH_V9D, /* V9 with UA2007 and T3 additions.  */
5775fd0b74Schristos   SPARC_OPCODE_ARCH_V9E, /* V9 with OSA2011 and T4 additions modulus integer multiply-add.  */
5875fd0b74Schristos   SPARC_OPCODE_ARCH_V9V, /* V9 with OSA2011 and T4 additions, integer
5975fd0b74Schristos                             multiply and Fujitsu fp multiply-add.  */
6075fd0b74Schristos   SPARC_OPCODE_ARCH_V9M, /* V9 with OSA2015 and M7 additions.  */
61ede78133Schristos   SPARC_OPCODE_ARCH_M8,  /* V9 with OSA2017 and M8 additions.  */
62ede78133Schristos   SPARC_OPCODE_ARCH_MAX = SPARC_OPCODE_ARCH_M8,
6375fd0b74Schristos   SPARC_OPCODE_ARCH_BAD  /* Error return from sparc_opcode_lookup_arch.  */
6475fd0b74Schristos };
6575fd0b74Schristos 
6675fd0b74Schristos 
6775fd0b74Schristos /* Given an enum sparc_opcode_arch_val, return the bitmask to use in
6875fd0b74Schristos    insn encoding/decoding.  */
6975fd0b74Schristos #define SPARC_OPCODE_ARCH_MASK(arch) (1 << (arch))
7075fd0b74Schristos 
7175fd0b74Schristos /* Given a valid sparc_opcode_arch_val, return non-zero if it's v9.  */
7275fd0b74Schristos #define SPARC_OPCODE_ARCH_V9_P(arch) ((arch) >= SPARC_OPCODE_ARCH_V9)
7375fd0b74Schristos 
7475fd0b74Schristos /* Table of cpu variants.  */
7575fd0b74Schristos 
7675fd0b74Schristos typedef struct sparc_opcode_arch
7775fd0b74Schristos {
7875fd0b74Schristos   const char *name;
7975fd0b74Schristos   /* Mask of sparc_opcode_arch_val's supported.
8075fd0b74Schristos      EG: For v7 this would be
8175fd0b74Schristos      (SPARC_OPCODE_ARCH_MASK (..._V6) | SPARC_OPCODE_ARCH_MASK (..._V7)).
8275fd0b74Schristos      These are short's because sparc_opcode.architecture is.  */
8375fd0b74Schristos   short supported;
84ede78133Schristos   /* Bitmaps describing the set of hardware capabilities implemented
85ede78133Schristos      by the opcode arch.  */
86ede78133Schristos   int hwcaps;
87ede78133Schristos   int hwcaps2;
8875fd0b74Schristos } sparc_opcode_arch;
8975fd0b74Schristos 
9075fd0b74Schristos extern const struct sparc_opcode_arch sparc_opcode_archs[];
9175fd0b74Schristos 
9275fd0b74Schristos /* Given architecture name, look up it's sparc_opcode_arch_val value.  */
9375fd0b74Schristos extern enum sparc_opcode_arch_val sparc_opcode_lookup_arch (const char *);
9475fd0b74Schristos 
9575fd0b74Schristos /* Return the bitmask of supported architectures for ARCH.  */
9675fd0b74Schristos #define SPARC_OPCODE_SUPPORTED(ARCH) (sparc_opcode_archs[ARCH].supported)
9775fd0b74Schristos 
9875fd0b74Schristos /* Non-zero if ARCH1 conflicts with ARCH2.
9975fd0b74Schristos    IE: ARCH1 as a supported bit set that ARCH2 doesn't, and vice versa.  */
10075fd0b74Schristos #define SPARC_OPCODE_CONFLICT_P(ARCH1, ARCH2) \
10175fd0b74Schristos  (((SPARC_OPCODE_SUPPORTED (ARCH1) & SPARC_OPCODE_SUPPORTED (ARCH2)) \
10275fd0b74Schristos    != SPARC_OPCODE_SUPPORTED (ARCH1)) \
10375fd0b74Schristos   && ((SPARC_OPCODE_SUPPORTED (ARCH1) & SPARC_OPCODE_SUPPORTED (ARCH2)) \
10475fd0b74Schristos      != SPARC_OPCODE_SUPPORTED (ARCH2)))
10575fd0b74Schristos 
10675fd0b74Schristos /* Structure of an opcode table entry.  */
10775fd0b74Schristos 
10875fd0b74Schristos typedef struct sparc_opcode
10975fd0b74Schristos {
11075fd0b74Schristos   const char *name;
11175fd0b74Schristos   unsigned long match;	/* Bits that must be set.  */
11275fd0b74Schristos   unsigned long lose;	/* Bits that must not be set.  */
11375fd0b74Schristos   const char *args;
11475fd0b74Schristos   /* This was called "delayed" in versions before the flags.  */
11575fd0b74Schristos   unsigned int flags;
11675fd0b74Schristos   unsigned int hwcaps;
11775fd0b74Schristos   unsigned int hwcaps2;
11875fd0b74Schristos   short architecture;	/* Bitmask of sparc_opcode_arch_val's.  */
11975fd0b74Schristos } sparc_opcode;
12075fd0b74Schristos 
121ede78133Schristos /* Struct for ASIs - to handle ASIs introduced in a specific architecture */
122ede78133Schristos typedef struct
123ede78133Schristos {
124ede78133Schristos   int value;
125ede78133Schristos   const char *name;
126ede78133Schristos   short architecture;
127ede78133Schristos } sparc_asi;
128ede78133Schristos 
12975fd0b74Schristos /* FIXME: Add F_ANACHRONISTIC flag for v9.  */
13075fd0b74Schristos #define	F_DELAYED	0x00000001 /* Delayed branch.  */
13175fd0b74Schristos #define	F_ALIAS		0x00000002 /* Alias for a "real" instruction.  */
13275fd0b74Schristos #define	F_UNBR		0x00000004 /* Unconditional branch.  */
13375fd0b74Schristos #define	F_CONDBR	0x00000008 /* Conditional branch.  */
13475fd0b74Schristos #define	F_JSR		0x00000010 /* Subroutine call.  */
13575fd0b74Schristos #define F_FLOAT		0x00000020 /* Floating point instruction (not a branch).  */
13675fd0b74Schristos #define F_FBR		0x00000040 /* Floating point branch.  */
13775fd0b74Schristos #define F_PREFERRED	0x00000080 /* A preferred alias.  */
13875fd0b74Schristos 
13975fd0b74Schristos #define F_PREF_ALIAS	(F_ALIAS|F_PREFERRED)
14075fd0b74Schristos 
14175fd0b74Schristos /* These must match the ELF_SPARC_HWCAP_* and ELF_SPARC_HWCAP2_*
14275fd0b74Schristos    values precisely.  See include/elf/sparc.h.  */
14375fd0b74Schristos #define HWCAP_MUL32	0x00000001 /* umul/umulcc/smul/smulcc insns */
14475fd0b74Schristos #define HWCAP_DIV32	0x00000002 /* udiv/udivcc/sdiv/sdivcc insns */
14575fd0b74Schristos #define HWCAP_FSMULD	0x00000004 /* 'fsmuld' insn */
14675fd0b74Schristos #define HWCAP_V8PLUS	0x00000008 /* v9 insns available to 32bit */
14775fd0b74Schristos #define HWCAP_POPC	0x00000010 /* 'popc' insn */
14875fd0b74Schristos #define HWCAP_VIS	0x00000020 /* VIS insns */
14975fd0b74Schristos #define HWCAP_VIS2	0x00000040 /* VIS2 insns */
15075fd0b74Schristos #define HWCAP_ASI_BLK_INIT	\
15175fd0b74Schristos 			0x00000080 /* block init ASIs */
15275fd0b74Schristos #define HWCAP_FMAF	0x00000100 /* fused multiply-add */
15375fd0b74Schristos #define HWCAP_VIS3	0x00000400 /* VIS3 insns */
15475fd0b74Schristos #define HWCAP_HPC	0x00000800 /* HPC insns */
15575fd0b74Schristos #define HWCAP_RANDOM	0x00001000 /* 'random' insn */
15675fd0b74Schristos #define HWCAP_TRANS	0x00002000 /* transaction insns */
15775fd0b74Schristos #define HWCAP_FJFMAU	0x00004000 /* unfused multiply-add */
15875fd0b74Schristos #define HWCAP_IMA	0x00008000 /* integer multiply-add */
15975fd0b74Schristos #define HWCAP_ASI_CACHE_SPARING \
16075fd0b74Schristos 			0x00010000 /* cache sparing ASIs */
16175fd0b74Schristos #define HWCAP_AES	0x00020000 /* AES crypto insns */
16275fd0b74Schristos #define HWCAP_DES	0x00040000 /* DES crypto insns */
16375fd0b74Schristos #define HWCAP_KASUMI	0x00080000 /* KASUMI crypto insns */
16475fd0b74Schristos #define HWCAP_CAMELLIA 	0x00100000 /* CAMELLIA crypto insns */
16575fd0b74Schristos #define HWCAP_MD5	0x00200000 /* MD5 hashing insns */
16675fd0b74Schristos #define HWCAP_SHA1	0x00400000 /* SHA1 hashing insns */
16775fd0b74Schristos #define HWCAP_SHA256	0x00800000 /* SHA256 hashing insns */
16875fd0b74Schristos #define HWCAP_SHA512	0x01000000 /* SHA512 hashing insns */
16975fd0b74Schristos #define HWCAP_MPMUL	0x02000000 /* Multiple Precision Multiply */
17075fd0b74Schristos #define HWCAP_MONT	0x04000000 /* Montgomery Mult/Sqrt */
17175fd0b74Schristos #define HWCAP_PAUSE	0x08000000 /* Pause insn */
17275fd0b74Schristos #define HWCAP_CBCOND	0x10000000 /* Compare and Branch insns */
17375fd0b74Schristos #define HWCAP_CRC32C	0x20000000 /* CRC32C insn */
17475fd0b74Schristos 
17575fd0b74Schristos #define HWCAP2_FJATHPLUS 0x00000001 /* Fujitsu Athena+ */
17675fd0b74Schristos #define HWCAP2_VIS3B     0x00000002 /* Subset of VIS3 present on sparc64 X+.  */
17775fd0b74Schristos #define HWCAP2_ADP       0x00000004 /* Application Data Protection */
17875fd0b74Schristos #define HWCAP2_SPARC5    0x00000008 /* The 29 new fp and sub instructions */
17975fd0b74Schristos #define HWCAP2_MWAIT     0x00000010 /* mwait instruction and load/monitor ASIs */
18075fd0b74Schristos #define HWCAP2_XMPMUL    0x00000020 /* XOR multiple precision multiply */
18175fd0b74Schristos #define HWCAP2_XMONT     0x00000040 /* XOR Montgomery mult/sqr instructions */
18275fd0b74Schristos #define HWCAP2_NSEC      \
18375fd0b74Schristos                          0x00000080 /* pause insn with support for nsec timings */
18475fd0b74Schristos #define HWCAP2_FJATHHPC  0x00001000 /* Fujitsu HPC instrs */
18575fd0b74Schristos #define HWCAP2_FJDES     0x00002000 /* Fujitsu DES instrs */
18675fd0b74Schristos #define HWCAP2_FJAES     0x00010000 /* Fujitsu AES instrs */
18775fd0b74Schristos 
188ede78133Schristos #define HWCAP2_SPARC6    0x00020000 /* OSA2017 new instructions */
189ede78133Schristos #define HWCAP2_ONADDSUB  0x00040000 /* Oracle Number add/subtract */
190ede78133Schristos #define HWCAP2_ONMUL     0x00080000 /* Oracle Number multiply */
191ede78133Schristos #define HWCAP2_ONDIV     0x00100000 /* Oracle Number divide */
192ede78133Schristos #define HWCAP2_DICTUNP   0x00200000 /* Dictionary unpack instruction */
193ede78133Schristos #define HWCAP2_FPCMPSHL  0x00400000 /* Partition compare with shifted result */
194ede78133Schristos #define HWCAP2_RLE       0x00800000 /* Run-length encoded burst and length */
195ede78133Schristos #define HWCAP2_SHA3      0x01000000 /* SHA3 instruction */
196ede78133Schristos 
19775fd0b74Schristos 
19875fd0b74Schristos /* All sparc opcodes are 32 bits, except for the `set' instruction (really a
19975fd0b74Schristos    macro), which is 64 bits. It is handled as a special case.
20075fd0b74Schristos 
20175fd0b74Schristos    The match component is a mask saying which bits must match a particular
20275fd0b74Schristos    opcode in order for an instruction to be an instance of that opcode.
20375fd0b74Schristos 
20475fd0b74Schristos    The args component is a string containing one character for each operand of the
20575fd0b74Schristos    instruction.
20675fd0b74Schristos 
20775fd0b74Schristos    Kinds of operands:
20875fd0b74Schristos 	#	Number used by optimizer.	It is ignored.
20975fd0b74Schristos 	1	rs1 register.
21075fd0b74Schristos 	2	rs2 register.
21175fd0b74Schristos 	d	rd register.
21275fd0b74Schristos 	e	frs1 floating point register.
21375fd0b74Schristos 	v	frs1 floating point register (double/even).
21475fd0b74Schristos 	V	frs1 floating point register (quad/multiple of 4).
215ede78133Schristos 	;	frs1 floating piont register (multiple of 8).
21675fd0b74Schristos 	f	frs2 floating point register.
21775fd0b74Schristos 	B	frs2 floating point register (double/even).
21875fd0b74Schristos 	R	frs2 floating point register (quad/multiple of 4).
219ede78133Schristos 	:	frs2 floating point register (multiple of 8).
220ede78133Schristos 	'	rs2m floating point register (double/even) in FPCMPSHL. (m8)
22175fd0b74Schristos 	4	frs3 floating point register.
22275fd0b74Schristos 	5	frs3 floating point register (doube/even).
22375fd0b74Schristos 	g	frsd floating point register.
22475fd0b74Schristos 	H	frsd floating point register (double/even).
22575fd0b74Schristos 	J	frsd floating point register (quad/multiple of 4).
22675fd0b74Schristos 	}       frsd floating point register (double/even) that is == frs2
227ede78133Schristos 	^	frsd floating piont register in ON instructions.
22875fd0b74Schristos 	b	crs1 coprocessor register
22975fd0b74Schristos 	c	crs2 coprocessor register
23075fd0b74Schristos 	D	crsd coprocessor register
23175fd0b74Schristos 	m	alternate space register (asr) in rd
23275fd0b74Schristos 	M	alternate space register (asr) in rs1
23375fd0b74Schristos 	h	22 high bits.
23475fd0b74Schristos 	X	5 bit unsigned immediate
23575fd0b74Schristos 	Y	6 bit unsigned immediate
23675fd0b74Schristos 	3	SIAM mode (3 bits). (v9b)
23775fd0b74Schristos 	K	MEMBAR mask (7 bits). (v9)
23875fd0b74Schristos 	j	10 bit Immediate. (v9)
23975fd0b74Schristos 	I	11 bit Immediate. (v9)
24075fd0b74Schristos 	i	13 bit Immediate.
24175fd0b74Schristos 	n	22 bit immediate.
24275fd0b74Schristos 	k	2+14 bit PC relative immediate. (v9)
24375fd0b74Schristos 	G	19 bit PC relative immediate. (v9)
24475fd0b74Schristos 	l	22 bit PC relative immediate.
24575fd0b74Schristos 	L	30 bit PC relative immediate.
24675fd0b74Schristos 	a	Annul.	The annul bit is set.
24775fd0b74Schristos 	A	Alternate address space. Stored as 8 bits.
24875fd0b74Schristos 	C	Coprocessor state register.
24975fd0b74Schristos 	F	floating point state register.
25075fd0b74Schristos 	p	Processor state register.
25175fd0b74Schristos 	N	Branch predict clear ",pn" (v9)
25275fd0b74Schristos 	T	Branch predict set ",pt" (v9)
25375fd0b74Schristos 	z	%icc. (v9)
25475fd0b74Schristos 	Z	%xcc. (v9)
25575fd0b74Schristos 	q	Floating point queue.
25675fd0b74Schristos 	r	Single register that is both rs1 and rd.
25775fd0b74Schristos 	O	Single register that is both rs2 and rd.
25875fd0b74Schristos 	Q	Coprocessor queue.
25975fd0b74Schristos 	S	Special case.
26075fd0b74Schristos 	t	Trap base register.
26175fd0b74Schristos 	w	Window invalid mask register.
26275fd0b74Schristos 	y	Y register.
26375fd0b74Schristos 	u	sparclet coprocessor registers in rd position
26475fd0b74Schristos 	U	sparclet coprocessor registers in rs1 position
26575fd0b74Schristos 	E	%ccr. (v9)
26675fd0b74Schristos 	s	%fprs. (v9)
26775fd0b74Schristos 	P	%pc.  (v9)
26875fd0b74Schristos 	W	%tick.	(v9)
26975fd0b74Schristos 	{	%mcdper. (v9b)
270ede78133Schristos 	&	%entropy.  (m8)
27175fd0b74Schristos 	o	%asi. (v9)
27275fd0b74Schristos 	6	%fcc0. (v9)
27375fd0b74Schristos 	7	%fcc1. (v9)
27475fd0b74Schristos 	8	%fcc2. (v9)
27575fd0b74Schristos 	9	%fcc3. (v9)
27675fd0b74Schristos 	!	Privileged Register in rd (v9)
27775fd0b74Schristos 	?	Privileged Register in rs1 (v9)
27875fd0b74Schristos 	%	Hyperprivileged Register in rd (v9b)
27975fd0b74Schristos 	$	Hyperprivileged Register in rs1 (v9b)
28075fd0b74Schristos 	*	Prefetch function constant. (v9)
28175fd0b74Schristos 	x	OPF field (v9 impdep).
28275fd0b74Schristos 	0	32/64 bit immediate for set or setx (v9) insns
28375fd0b74Schristos 	_	Ancillary state register in rd (v9a)
28475fd0b74Schristos 	/	Ancillary state register in rs1 (v9a)
28575fd0b74Schristos 	(	entire floating point state register (%efsr)
28675fd0b74Schristos 	)	5 bit immediate placed in RS3 field
287ede78133Schristos 	=	2+8 bit PC relative immediate. (v9)
288ede78133Schristos 	|	FPCMPSHL 2 bit immediate. (m8)  */
28975fd0b74Schristos 
29075fd0b74Schristos #define OP2(x)		(((x) & 0x7) << 22)  /* Op2 field of format2 insns.  */
29175fd0b74Schristos #define OP3(x)		(((x) & 0x3f) << 19) /* Op3 field of format3 insns.  */
29275fd0b74Schristos #define OP(x)		((unsigned) ((x) & 0x3) << 30) /* Op field of all insns.  */
29375fd0b74Schristos #define OPF(x)		(((x) & 0x1ff) << 5) /* Opf field of float insns.  */
29475fd0b74Schristos #define OPF_LOW5(x)	OPF ((x) & 0x1f)     /* V9.  */
29575fd0b74Schristos #define OPF_LOW4(x)	OPF ((x) & 0xf)      /* V9.  */
296ede78133Schristos #define OPM(x)		(((x) & 0x7) << 10)  /* opm field of misaligned load/store insns.  */
297ede78133Schristos #define OPMI(x)	(((x) & 0x1) << 9)   /* opm i field of misaligned load/store insns.  */
298ede78133Schristos #define ONFCN(x)	(((x) & 0x3) << 26)  /* fcn field of Oracle Number insns.  */
299ede78133Schristos #define REVFCN(x)	(((x) & 0x3) << 0)   /* fcn field of REV* insns.  */
30075fd0b74Schristos #define F3F(x, y, z)	(OP (x) | OP3 (y) | OPF (z)) /* Format3 float insns.  */
30175fd0b74Schristos #define F3F4(x, y, z)	(OP (x) | OP3 (y) | OPF_LOW4 (z))
30275fd0b74Schristos #define F3I(x)		(((x) & 0x1) << 13)  /* Immediate field of format 3 insns.  */
30375fd0b74Schristos #define F2(x, y)	(OP (x) | OP2(y))    /* Format 2 insns.  */
30475fd0b74Schristos #define F3(x, y, z)	(OP (x) | OP3(y) | F3I(z)) /* Format3 insns.  */
30575fd0b74Schristos #define F1(x)		(OP (x))
30675fd0b74Schristos #define DISP30(x)	((x) & 0x3fffffff)
30775fd0b74Schristos #define ASI(x)		(((x) & 0xff) << 5)  /* Asi field of format3 insns.  */
30875fd0b74Schristos #define RS2(x)		((x) & 0x1f)         /* Rs2 field.  */
30975fd0b74Schristos #define SIMM13(x)	((x) & 0x1fff)       /* Simm13 field.  */
310ede78133Schristos #define SIMM10(x)	((x) & 0x3ff)	     /* Simm10 field.  */
31175fd0b74Schristos #define RD(x)		(((x) & 0x1f) << 25) /* Destination register field.  */
31275fd0b74Schristos #define RS1(x)		(((x) & 0x1f) << 14) /* Rs1 field.  */
31375fd0b74Schristos #define RS3(x)		(((x) & 0x1f) << 9)  /* Rs3 field.  */
31475fd0b74Schristos #define ASI_RS2(x)	(SIMM13 (x))
31575fd0b74Schristos #define MEMBAR(x)	((x) & 0x7f)
31675fd0b74Schristos #define SLCPOP(x)	(((x) & 0x7f) << 6)  /* Sparclet cpop.  */
31775fd0b74Schristos 
31875fd0b74Schristos #define ANNUL	(1 << 29)
31975fd0b74Schristos #define BPRED	(1 << 19)	/* V9.  */
32075fd0b74Schristos #define	IMMED	F3I (1)
32175fd0b74Schristos #define RD_G0	RD (~0)
32275fd0b74Schristos #define	RS1_G0	RS1 (~0)
32375fd0b74Schristos #define	RS2_G0	RS2 (~0)
32475fd0b74Schristos 
32575fd0b74Schristos extern const struct sparc_opcode sparc_opcodes[];
32675fd0b74Schristos extern const int sparc_num_opcodes;
32775fd0b74Schristos 
328ede78133Schristos extern const sparc_asi *sparc_encode_asi (const char *);
32975fd0b74Schristos extern const char *sparc_decode_asi (int);
33075fd0b74Schristos extern int sparc_encode_membar (const char *);
33175fd0b74Schristos extern const char *sparc_decode_membar (int);
33275fd0b74Schristos extern int sparc_encode_prefetch (const char *);
33375fd0b74Schristos extern const char *sparc_decode_prefetch (int);
33475fd0b74Schristos extern int sparc_encode_sparclet_cpreg (const char *);
33575fd0b74Schristos extern const char *sparc_decode_sparclet_cpreg (int);
33675fd0b74Schristos 
33775fd0b74Schristos /* Local Variables:
33875fd0b74Schristos    fill-column: 131
33975fd0b74Schristos    comment-column: 0
34075fd0b74Schristos    End: */
34175fd0b74Schristos 
34275fd0b74Schristos #ifdef __cplusplus
34375fd0b74Schristos }
34475fd0b74Schristos #endif
345