xref: /haiku/src/system/libroot/os/arch/sparc/instr.h (revision 803a4704e82749bce36c05ee56792dad62576144)
1*803a4704SPulkoMandy /*-
2*803a4704SPulkoMandy  * SPDX-License-Identifier: BSD-4-Clause
3*803a4704SPulkoMandy  *
4*803a4704SPulkoMandy  * Copyright (c) 1994 David S. Miller, davem@nadzieja.rutgers.edu
5*803a4704SPulkoMandy  * Copyright (c) 1995 Paul Kranenburg
6*803a4704SPulkoMandy  * Copyright (c) 2001 Thomas Moestl <tmm@FreeBSD.org>
7*803a4704SPulkoMandy  * All rights reserved.
8*803a4704SPulkoMandy  *
9*803a4704SPulkoMandy  * Redistribution and use in source and binary forms, with or without
10*803a4704SPulkoMandy  * modification, are permitted provided that the following conditions
11*803a4704SPulkoMandy  * are met:
12*803a4704SPulkoMandy  * 1. Redistributions of source code must retain the above copyright
13*803a4704SPulkoMandy  *    notice, this list of conditions and the following disclaimer.
14*803a4704SPulkoMandy  * 2. Redistributions in binary form must reproduce the above copyright
15*803a4704SPulkoMandy  *    notice, this list of conditions and the following disclaimer in the
16*803a4704SPulkoMandy  *    documentation and/or other materials provided with the distribution.
17*803a4704SPulkoMandy  * 3. All advertising materials mentioning features or use of this software
18*803a4704SPulkoMandy  *    must display the following acknowledgement:
19*803a4704SPulkoMandy  *      This product includes software developed by David Miller.
20*803a4704SPulkoMandy  * 4. The name of the author may not be used to endorse or promote products
21*803a4704SPulkoMandy  *    derived from this software without specific prior written permission
22*803a4704SPulkoMandy  *
23*803a4704SPulkoMandy  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24*803a4704SPulkoMandy  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25*803a4704SPulkoMandy  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26*803a4704SPulkoMandy  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27*803a4704SPulkoMandy  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28*803a4704SPulkoMandy  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29*803a4704SPulkoMandy  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30*803a4704SPulkoMandy  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31*803a4704SPulkoMandy  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32*803a4704SPulkoMandy  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*803a4704SPulkoMandy  *
34*803a4704SPulkoMandy  *	from: NetBSD: db_disasm.c,v 1.9 2000/08/16 11:29:42 pk Exp
35*803a4704SPulkoMandy  *
36*803a4704SPulkoMandy  * $FreeBSD$
37*803a4704SPulkoMandy  */
38*803a4704SPulkoMandy 
39*803a4704SPulkoMandy #ifndef _MACHINE_INSTR_H_
40*803a4704SPulkoMandy #define _MACHINE_INSTR_H_
41*803a4704SPulkoMandy 
42*803a4704SPulkoMandy /*
43*803a4704SPulkoMandy  * Definitions for all instruction formats
44*803a4704SPulkoMandy  */
45*803a4704SPulkoMandy #define	IF_OP_SHIFT		30
46*803a4704SPulkoMandy #define	IF_OP_BITS		 2
47*803a4704SPulkoMandy #define	IF_IMM_SHIFT		 0	/* Immediate/Displacement */
48*803a4704SPulkoMandy 
49*803a4704SPulkoMandy /*
50*803a4704SPulkoMandy  * Definitions for format 2
51*803a4704SPulkoMandy  */
52*803a4704SPulkoMandy #define	IF_F2_RD_SHIFT		25
53*803a4704SPulkoMandy #define	IF_F2_RD_BITS		 5
54*803a4704SPulkoMandy #define	IF_F2_A_SHIFT		29
55*803a4704SPulkoMandy #define	IF_F2_A_BITS		 1
56*803a4704SPulkoMandy #define	IF_F2_COND_SHIFT	25
57*803a4704SPulkoMandy #define	IF_F2_COND_BITS		 4
58*803a4704SPulkoMandy #define	IF_F2_RCOND_SHIFT	25
59*803a4704SPulkoMandy #define	IF_F2_RCOND_BITS	 3
60*803a4704SPulkoMandy #define	IF_F2_OP2_SHIFT		22
61*803a4704SPulkoMandy #define	IF_F2_OP2_BITS		 3
62*803a4704SPulkoMandy #define	IF_F2_CC1_SHIFT		21
63*803a4704SPulkoMandy #define	IF_F2_CC1_BITS		 1
64*803a4704SPulkoMandy #define	IF_F2_CC0_SHIFT		20
65*803a4704SPulkoMandy #define	IF_F2_CC0_BITS		 1
66*803a4704SPulkoMandy #define	IF_F2_CC_SHIFT		20	/* CC0 and CC1 combined. */
67*803a4704SPulkoMandy #define	IF_F2_CC_BITS		 2
68*803a4704SPulkoMandy #define	IF_F2_D16HI_SHIFT	20
69*803a4704SPulkoMandy #define	IF_F2_D16HI_BITS	 2
70*803a4704SPulkoMandy #define	IF_F2_P_SHIFT		19
71*803a4704SPulkoMandy #define	IF_F2_P_BITS		 1
72*803a4704SPulkoMandy #define	IF_F2_RS1_SHIFT		14
73*803a4704SPulkoMandy #define	IF_F2_RS1_BITS		 5
74*803a4704SPulkoMandy 
75*803a4704SPulkoMandy /*
76*803a4704SPulkoMandy  * Definitions for format 3
77*803a4704SPulkoMandy  */
78*803a4704SPulkoMandy #define	IF_F3_OP3_SHIFT		19
79*803a4704SPulkoMandy #define	IF_F3_OP3_BITS		 6
80*803a4704SPulkoMandy #define	IF_F3_RD_SHIFT		IF_F2_RD_SHIFT
81*803a4704SPulkoMandy #define	IF_F3_RD_BITS		IF_F2_RD_BITS
82*803a4704SPulkoMandy #define	IF_F3_FCN_SHIFT		25
83*803a4704SPulkoMandy #define	IF_F3_FCN_BITS		 5
84*803a4704SPulkoMandy #define	IF_F3_CC1_SHIFT		26
85*803a4704SPulkoMandy #define	IF_F3_CC1_BITS		 1
86*803a4704SPulkoMandy #define	IF_F3_CC0_SHIFT		25
87*803a4704SPulkoMandy #define	IF_F3_CC0_BITS		 1
88*803a4704SPulkoMandy #define	IF_F3_CC_SHIFT		25	/* CC0 and CC1 combined. */
89*803a4704SPulkoMandy #define	IF_F3_CC_BITS		 2
90*803a4704SPulkoMandy #define	IF_F3_RS1_SHIFT		IF_F2_RS1_SHIFT
91*803a4704SPulkoMandy #define	IF_F3_RS1_BITS		IF_F2_RS1_BITS
92*803a4704SPulkoMandy #define	IF_F3_I_SHIFT		13
93*803a4704SPulkoMandy #define	IF_F3_I_BITS		 1
94*803a4704SPulkoMandy #define	IF_F3_X_SHIFT		12
95*803a4704SPulkoMandy #define	IF_F3_X_BITS		 1
96*803a4704SPulkoMandy #define	IF_F3_RCOND_SHIFT	10
97*803a4704SPulkoMandy #define	IF_F3_RCOND_BITS	 3
98*803a4704SPulkoMandy #define	IF_F3_IMM_ASI_SHIFT	 5
99*803a4704SPulkoMandy #define	IF_F3_IMM_ASI_BITS	 8
100*803a4704SPulkoMandy #define	IF_F3_OPF_SHIFT		 5
101*803a4704SPulkoMandy #define	IF_F3_OPF_BITS		 9
102*803a4704SPulkoMandy #define	IF_F3_CMASK_SHIFT	 4
103*803a4704SPulkoMandy #define	IF_F3_CMASK_BITS	 3
104*803a4704SPulkoMandy #define	IF_F3_RS2_SHIFT		 0
105*803a4704SPulkoMandy #define	IF_F3_RS2_BITS		 5
106*803a4704SPulkoMandy #define	IF_F3_SHCNT32_SHIFT	 0
107*803a4704SPulkoMandy #define	IF_F3_SHCNT32_BITS	 5
108*803a4704SPulkoMandy #define	IF_F3_SHCNT64_SHIFT	 0
109*803a4704SPulkoMandy #define	IF_F3_SHCNT64_BITS	 6
110*803a4704SPulkoMandy 
111*803a4704SPulkoMandy /*
112*803a4704SPulkoMandy  * Definitions for format 4
113*803a4704SPulkoMandy  */
114*803a4704SPulkoMandy #define	IF_F4_OP3_SHIFT		IF_F3_OP3_SHIFT
115*803a4704SPulkoMandy #define	IF_F4_OP3_BITS		IF_F3_OP3_BITS
116*803a4704SPulkoMandy #define	IF_F4_RD_SHIFT		IF_F2_RD_SHIFT
117*803a4704SPulkoMandy #define	IF_F4_RD_BITS		IF_F2_RD_BITS
118*803a4704SPulkoMandy #define	IF_F4_RS1_SHIFT		IF_F2_RS1_SHIFT
119*803a4704SPulkoMandy #define	IF_F4_RS1_BITS		IF_F2_RS1_BITS
120*803a4704SPulkoMandy #define	IF_F4_TCOND_SHIFT	IF_F2_COND_SHIFT	/* cond for Tcc */
121*803a4704SPulkoMandy #define	IF_F4_TCOND_BITS	IF_F2_COND_BITS
122*803a4704SPulkoMandy #define	IF_F4_CC2_SHIFT		18
123*803a4704SPulkoMandy #define	IF_F4_CC2_BITS		 1
124*803a4704SPulkoMandy #define	IF_F4_COND_SHIFT	14
125*803a4704SPulkoMandy #define	IF_F4_COND_BITS		 4
126*803a4704SPulkoMandy #define	IF_F4_I_SHIFT		IF_F3_I_SHIFT
127*803a4704SPulkoMandy #define	IF_F4_I_BITS		IF_F3_I_BITS
128*803a4704SPulkoMandy #define	IF_F4_OPF_CC_SHIFT	11
129*803a4704SPulkoMandy #define	IF_F4_OPF_CC_BITS	 3
130*803a4704SPulkoMandy #define	IF_F4_CC1_SHIFT		12
131*803a4704SPulkoMandy #define	IF_F4_CC1_BITS		 1
132*803a4704SPulkoMandy #define	IF_F4_CC0_SHIFT		11
133*803a4704SPulkoMandy #define	IF_F4_CC0_BITS		 1
134*803a4704SPulkoMandy #define	IF_F4_RCOND_SHIFT	IF_F3_RCOND_SHIFT
135*803a4704SPulkoMandy #define	IF_F4_RCOND_BITS	IF_F3_RCOND_BITS
136*803a4704SPulkoMandy #define	IF_F4_OPF_LOW_SHIFT	 5
137*803a4704SPulkoMandy #define	IF_F4_RS2_SHIFT		IF_F3_RS2_SHIFT
138*803a4704SPulkoMandy #define	IF_F4_RS2_BITS		IF_F3_RS2_BITS
139*803a4704SPulkoMandy #define	IF_F4_SW_TRAP_SHIFT	 0
140*803a4704SPulkoMandy #define	IF_F4_SW_TRAP_BITS	 7
141*803a4704SPulkoMandy 
142*803a4704SPulkoMandy /*
143*803a4704SPulkoMandy  * Macros to decode instructions
144*803a4704SPulkoMandy  */
145*803a4704SPulkoMandy /* Extract a field */
146*803a4704SPulkoMandy #define	IF_MASK(s, w)		(((1 << (w)) - 1) << (s))
147*803a4704SPulkoMandy #define	IF_EXTRACT(x, s, w)	(((x) & IF_MASK((s), (w))) >> (s))
148*803a4704SPulkoMandy #define	IF_DECODE(x, f) \
149*803a4704SPulkoMandy 	IF_EXTRACT((x), IF_ ## f ## _SHIFT, IF_ ## f ## _BITS)
150*803a4704SPulkoMandy 
151*803a4704SPulkoMandy /* Sign-extend a field of width W */
152*803a4704SPulkoMandy #define	IF_SEXT(x, w) \
153*803a4704SPulkoMandy 	(((x) & (1L << ((w) - 1))) != 0 ? \
154*803a4704SPulkoMandy 	    (-1L - ((x) ^ ((1L << (w)) - 1))) : (x))
155*803a4704SPulkoMandy 
156*803a4704SPulkoMandy #if 0
157*803a4704SPulkoMandy /*
158*803a4704SPulkoMandy  * The following C variant is from db_disassemble.c, and surely faster, but it
159*803a4704SPulkoMandy  * relies on behaviour that is undefined by the C standard (>> in conjunction
160*803a4704SPulkoMandy  * with signed negative arguments).
161*803a4704SPulkoMandy  */
162*803a4704SPulkoMandy #define	IF_SEXT(v, w)	((((long long)(v)) << (64 - w)) >> (64 - w))
163*803a4704SPulkoMandy /* Assembler version of the above */
164*803a4704SPulkoMandy #define	IF_SEXT(v, w) \
165*803a4704SPulkoMandy 	{ u_long t; ( __asm __volatile("sllx %1, %2, %0; srax %0, %2, %0" :
166*803a4704SPulkoMandy 	    "=r" (t) : "r" (v) : "i" (64 - w)); t)}
167*803a4704SPulkoMandy #endif
168*803a4704SPulkoMandy 
169*803a4704SPulkoMandy /* All instruction formats */
170*803a4704SPulkoMandy #define	IF_OP(i)		IF_DECODE(i, OP)
171*803a4704SPulkoMandy 
172*803a4704SPulkoMandy /* Instruction format 2 */
173*803a4704SPulkoMandy #define	IF_F2_RD(i)		IF_DECODE((i), F2_RD)
174*803a4704SPulkoMandy #define	IF_F2_A(i)		IF_DECODE((i), F2_A)
175*803a4704SPulkoMandy #define	IF_F2_COND(i)		IF_DECODE((i), F2_COND)
176*803a4704SPulkoMandy #define	IF_F2_RCOND(i)		IF_DECODE((i), F2_RCOND)
177*803a4704SPulkoMandy #define	IF_F2_OP2(i)		IF_DECODE((i), F2_OP2)
178*803a4704SPulkoMandy #define	IF_F2_CC1(i)		IF_DECODE((i), F2_CC1)
179*803a4704SPulkoMandy #define	IF_F2_CC0(i)		IF_DECODE((i), F2_CC0)
180*803a4704SPulkoMandy #define	IF_F2_CC(i)		IF_DECODE((i), F2_CC)
181*803a4704SPulkoMandy #define	IF_F2_D16HI(i)		IF_DECODE((i), F2_D16HI)
182*803a4704SPulkoMandy #define	IF_F2_P(i)		IF_DECODE((i), F2_P)
183*803a4704SPulkoMandy #define	IF_F2_RS1(i)		IF_DECODE((i), F2_RS1)
184*803a4704SPulkoMandy 
185*803a4704SPulkoMandy /* Instruction format 3 */
186*803a4704SPulkoMandy #define	IF_F3_OP3(i)		IF_DECODE((i), F3_OP3)
187*803a4704SPulkoMandy #define	IF_F3_RD(i)		IF_F2_RD((i))
188*803a4704SPulkoMandy #define	IF_F3_FCN(i)		IF_DECODE((i), F3_FCN)
189*803a4704SPulkoMandy #define	IF_F3_CC1(i)		IF_DECODE((i), F3_CC1)
190*803a4704SPulkoMandy #define	IF_F3_CC0(i)		IF_DECODE((i), F3_CC0)
191*803a4704SPulkoMandy #define	IF_F3_CC(i)		IF_DECODE((i), F3_CC)
192*803a4704SPulkoMandy #define	IF_F3_RS1(i)		IF_F2_RS1((i))
193*803a4704SPulkoMandy #define	IF_F3_I(i)		IF_DECODE((i), F3_I)
194*803a4704SPulkoMandy #define	IF_F3_X(i)		IF_DECODE((i), F3_X)
195*803a4704SPulkoMandy #define	IF_F3_RCOND(i)		IF_DECODE((i), F3_RCOND)
196*803a4704SPulkoMandy #define	IF_F3_IMM_ASI(i)	IF_DECODE((i), F3_IMM_ASI)
197*803a4704SPulkoMandy #define	IF_F3_OPF(i)		IF_DECODE((i), F3_OPF)
198*803a4704SPulkoMandy #define	IF_F3_CMASK(i)		IF_DECODE((i), F3_CMASK)
199*803a4704SPulkoMandy #define	IF_F3_RS2(i)		IF_DECODE((i), F3_RS2)
200*803a4704SPulkoMandy #define	IF_F3_SHCNT32(i)	IF_DECODE((i), F3_SHCNT32)
201*803a4704SPulkoMandy #define	IF_F3_SHCNT64(i)	IF_DECODE((i), F3_SHCNT64)
202*803a4704SPulkoMandy 
203*803a4704SPulkoMandy /* Instruction format 4 */
204*803a4704SPulkoMandy #define	IF_F4_OP3(i)		IF_F3_OP3((i))
205*803a4704SPulkoMandy #define	IF_F4_RD(i)		IF_F3_RD((i))
206*803a4704SPulkoMandy #define	IF_F4_TCOND(i)		IF_DECODE((i), F4_TCOND)
207*803a4704SPulkoMandy #define	IF_F4_RS1(i)		IF_F3_RS1((i))
208*803a4704SPulkoMandy #define	IF_F4_CC2(i)		IF_DECODE((i), F4_CC2)
209*803a4704SPulkoMandy #define	IF_F4_COND(i)		IF_DECODE((i), F4_COND)
210*803a4704SPulkoMandy #define	IF_F4_I(i)		IF_F3_I((i))
211*803a4704SPulkoMandy #define	IF_F4_OPF_CC(i)		IF_DECODE((i), F4_OPF_CC)
212*803a4704SPulkoMandy #define	IF_F4_RCOND(i)		IF_F3_RCOND((i))
213*803a4704SPulkoMandy #define	IF_F4_OPF_LOW(i, w)	IF_EXTRACT((i), IF_F4_OPF_LOW_SHIFT, (w))
214*803a4704SPulkoMandy #define	IF_F4_RS2(i)		IF_F3_RS2((i))
215*803a4704SPulkoMandy #define	IF_F4_SW_TRAP(i)	IF_DECODE((i), F4_SW_TRAP)
216*803a4704SPulkoMandy 
217*803a4704SPulkoMandy /* Extract an immediate from an instruction, with an without sign extension */
218*803a4704SPulkoMandy #define	IF_IMM(i, w)	IF_EXTRACT((i), IF_IMM_SHIFT, (w))
219*803a4704SPulkoMandy #define	IF_SIMM(i, w)	({ u_long b = (w), x = IF_IMM((i), b); IF_SEXT((x), b); })
220*803a4704SPulkoMandy 
221*803a4704SPulkoMandy /*
222*803a4704SPulkoMandy  * Macros to encode instructions
223*803a4704SPulkoMandy  */
224*803a4704SPulkoMandy #define	IF_INSERT(x, s, w)	(((x) & ((1 << (w)) - 1)) << (s))
225*803a4704SPulkoMandy #define	IF_ENCODE(x, f) \
226*803a4704SPulkoMandy 	IF_INSERT((x), IF_ ## f ## _SHIFT, IF_ ## f ## _BITS)
227*803a4704SPulkoMandy 
228*803a4704SPulkoMandy /* All instruction formats */
229*803a4704SPulkoMandy #define	EIF_OP(x)		IF_ENCODE((x), OP)
230*803a4704SPulkoMandy 
231*803a4704SPulkoMandy /* Instruction format 2 */
232*803a4704SPulkoMandy #define	EIF_F2_RD(x)		IF_ENCODE((x), F2_RD)
233*803a4704SPulkoMandy #define	EIF_F2_A(x)		IF_ENCODE((x), F2_A)
234*803a4704SPulkoMandy #define	EIF_F2_COND(x)		IF_ENCODE((x), F2_COND)
235*803a4704SPulkoMandy #define	EIF_F2_RCOND(x)		IF_ENCODE((x), F2_RCOND)
236*803a4704SPulkoMandy #define	EIF_F2_OP2(x)		IF_ENCODE((x), F2_OP2)
237*803a4704SPulkoMandy #define	EIF_F2_CC1(x)		IF_ENCODE((x), F2_CC1)
238*803a4704SPulkoMandy #define	EIF_F2_CC0(x)		IF_ENCODE((x), F2_CC0)
239*803a4704SPulkoMandy #define	EIF_F2_D16HI(x)		IF_ENCODE((x), F2_D16HI)
240*803a4704SPulkoMandy #define	EIF_F2_P(x)		IF_ENCODE((x), F2_P)
241*803a4704SPulkoMandy #define	EIF_F2_RS1(x)		IF_ENCODE((x), F2_RS1)
242*803a4704SPulkoMandy 
243*803a4704SPulkoMandy /* Instruction format 3 */
244*803a4704SPulkoMandy #define	EIF_F3_OP3(x)		IF_ENCODE((x), F3_OP3)
245*803a4704SPulkoMandy #define	EIF_F3_RD(x)		EIF_F2_RD((x))
246*803a4704SPulkoMandy #define	EIF_F3_FCN(x)		IF_ENCODE((x), F3_FCN)
247*803a4704SPulkoMandy #define	EIF_F3_CC1(x)		IF_ENCODE((x), F3_CC1)
248*803a4704SPulkoMandy #define	EIF_F3_CC0(x)		IF_ENCODE((x), F3_CC0)
249*803a4704SPulkoMandy #define	EIF_F3_RS1(x)		EIF_F2_RS1((x))
250*803a4704SPulkoMandy #define	EIF_F3_I(x)		IF_ENCODE((x), F3_I)
251*803a4704SPulkoMandy #define	EIF_F3_X(x)		IF_ENCODE((x), F3_X)
252*803a4704SPulkoMandy #define	EIF_F3_RCOND(x)		IF_ENCODE((x), F3_RCOND)
253*803a4704SPulkoMandy #define	EIF_F3_IMM_ASI(x)	IF_ENCODE((x), F3_IMM_ASI)
254*803a4704SPulkoMandy #define	EIF_F3_OPF(x)		IF_ENCODE((x), F3_OPF)
255*803a4704SPulkoMandy #define	EIF_F3_CMASK(x)		IF_ENCODE((x), F3_CMASK)
256*803a4704SPulkoMandy #define	EIF_F3_RS2(x)		IF_ENCODE((x), F3_RS2)
257*803a4704SPulkoMandy #define	EIF_F3_SHCNT32(x)	IF_ENCODE((x), F3_SHCNT32)
258*803a4704SPulkoMandy #define	EIF_F3_SHCNT64(x)	IF_ENCODE((x), F3_SHCNT64)
259*803a4704SPulkoMandy 
260*803a4704SPulkoMandy /* Instruction format 4 */
261*803a4704SPulkoMandy #define	EIF_F4_OP3(x)		EIF_F3_OP3((x))
262*803a4704SPulkoMandy #define	EIF_F4_RD(x)		EIF_F2_RD((x))
263*803a4704SPulkoMandy #define	EIF_F4_TCOND(x)		IF_ENCODE((x), F4_TCOND)
264*803a4704SPulkoMandy #define	EIF_F4_RS1(x)		EIF_F2_RS1((x))
265*803a4704SPulkoMandy #define	EIF_F4_CC2(x)		IF_ENCODE((x), F4_CC2)
266*803a4704SPulkoMandy #define	EIF_F4_COND(x)		IF_ENCODE((x), F4_COND)
267*803a4704SPulkoMandy #define	EIF_F4_I(x)		EIF_F3_I((x))
268*803a4704SPulkoMandy #define	EIF_F4_OPF_CC(x)	IF_ENCODE((x), F4_OPF_CC)
269*803a4704SPulkoMandy #define	EIF_F4_RCOND(x)		EIF_F3_RCOND((x))
270*803a4704SPulkoMandy #define	EIF_F4_OPF_LOW(i, w)	IF_INSERT((x), IF_F4_OPF_CC_SHIFT, (w))
271*803a4704SPulkoMandy #define	EIF_F4_RS2(x)		EIF_F3_RS2((x))
272*803a4704SPulkoMandy #define	EIF_F4_SW_TRAP(x)	IF_ENCODE((x), F4_SW_TRAP)
273*803a4704SPulkoMandy 
274*803a4704SPulkoMandy /* Immediates */
275*803a4704SPulkoMandy #define	EIF_IMM(x, w)	IF_INSERT((x), IF_IMM_SHIFT, (w))
276*803a4704SPulkoMandy #define	EIF_SIMM(x, w)	IF_EIMM((x), (w))
277*803a4704SPulkoMandy 
278*803a4704SPulkoMandy /*
279*803a4704SPulkoMandy  * OP field values (specifying the instruction format)
280*803a4704SPulkoMandy  */
281*803a4704SPulkoMandy #define	IOP_FORM2		0x00	/* Format 2: sethi, branches */
282*803a4704SPulkoMandy #define	IOP_CALL		0x01	/* Format 1: call */
283*803a4704SPulkoMandy #define	IOP_MISC		0x02	/* Format 3 or 4: arith & misc */
284*803a4704SPulkoMandy #define	IOP_LDST		0x03	/* Format 4: loads and stores */
285*803a4704SPulkoMandy 
286*803a4704SPulkoMandy /*
287*803a4704SPulkoMandy  * OP2/OP3 values (specifying the actual instruction)
288*803a4704SPulkoMandy  */
289*803a4704SPulkoMandy /* OP2 values for format 2 (OP = 0) */
290*803a4704SPulkoMandy #define	INS0_ILLTRAP		0x00
291*803a4704SPulkoMandy #define	INS0_BPcc		0x01
292*803a4704SPulkoMandy #define	INS0_Bicc		0x02
293*803a4704SPulkoMandy #define	INS0_BPr		0x03
294*803a4704SPulkoMandy #define	INS0_SETHI	       	0x04	/* with rd = 0 and imm22 = 0, nop */
295*803a4704SPulkoMandy #define	INS0_FBPfcc		0x05
296*803a4704SPulkoMandy #define	INS0_FBfcc		0x06
297*803a4704SPulkoMandy /* undefined			0x07 */
298*803a4704SPulkoMandy 
299*803a4704SPulkoMandy /* OP3 values for Format 3 and 4 (OP = 2) */
300*803a4704SPulkoMandy #define	INS2_ADD		0x00
301*803a4704SPulkoMandy #define	INS2_AND		0x01
302*803a4704SPulkoMandy #define	INS2_OR			0x02
303*803a4704SPulkoMandy #define	INS2_XOR		0x03
304*803a4704SPulkoMandy #define	INS2_SUB		0x04
305*803a4704SPulkoMandy #define	INS2_ANDN		0x05
306*803a4704SPulkoMandy #define	INS2_ORN		0x06
307*803a4704SPulkoMandy #define	INS2_XNOR		0x07
308*803a4704SPulkoMandy #define	INS2_ADDC		0x08
309*803a4704SPulkoMandy #define	INS2_MULX		0x09
310*803a4704SPulkoMandy #define	INS2_UMUL		0x0a
311*803a4704SPulkoMandy #define	INS2_SMUL		0x0b
312*803a4704SPulkoMandy #define	INS2_SUBC		0x0c
313*803a4704SPulkoMandy #define	INS2_UDIVX		0x0d
314*803a4704SPulkoMandy #define	INS2_UDIV		0x0e
315*803a4704SPulkoMandy #define	INS2_SDIV		0x0f
316*803a4704SPulkoMandy #define	INS2_ADDcc		0x10
317*803a4704SPulkoMandy #define	INS2_ANDcc		0x11
318*803a4704SPulkoMandy #define	INS2_ORcc		0x12
319*803a4704SPulkoMandy #define	INS2_XORcc		0x13
320*803a4704SPulkoMandy #define	INS2_SUBcc		0x14
321*803a4704SPulkoMandy #define	INS2_ANDNcc		0x15
322*803a4704SPulkoMandy #define	INS2_ORNcc		0x16
323*803a4704SPulkoMandy #define	INS2_XNORcc		0x17
324*803a4704SPulkoMandy #define	INS2_ADDCcc		0x18
325*803a4704SPulkoMandy /* undefined			0x19 */
326*803a4704SPulkoMandy #define	INS2_UMULcc		0x1a
327*803a4704SPulkoMandy #define	INS2_SMULcc		0x1b
328*803a4704SPulkoMandy #define	INS2_SUBCcc		0x1c
329*803a4704SPulkoMandy /* undefined			0x1d */
330*803a4704SPulkoMandy #define	INS2_UDIVcc		0x1e
331*803a4704SPulkoMandy #define	INS2_SDIVcc		0x1f
332*803a4704SPulkoMandy #define	INS2_TADDcc		0x20
333*803a4704SPulkoMandy #define	INS2_TSUBcc		0x21
334*803a4704SPulkoMandy #define	INS2_TADDccTV		0x22
335*803a4704SPulkoMandy #define	INS2_TSUBccTV		0x23
336*803a4704SPulkoMandy #define	INS2_MULScc		0x24
337*803a4704SPulkoMandy #define	INS2_SSL		0x25	/* SLLX when IF_X(i) == 1 */
338*803a4704SPulkoMandy #define	INS2_SRL		0x26	/* SRLX when IF_X(i) == 1 */
339*803a4704SPulkoMandy #define	INS2_SRA		0x27	/* SRAX when IF_X(i) == 1 */
340*803a4704SPulkoMandy #define	INS2_RD			0x28	/* and MEMBAR, STBAR */
341*803a4704SPulkoMandy /* undefined			0x29 */
342*803a4704SPulkoMandy #define	INS2_RDPR		0x2a
343*803a4704SPulkoMandy #define	INS2_FLUSHW		0x2b
344*803a4704SPulkoMandy #define	INS2_MOVcc		0x2c
345*803a4704SPulkoMandy #define	INS2_SDIVX		0x2d
346*803a4704SPulkoMandy #define	INS2_POPC		0x2e	/* undefined if IF_RS1(i) != 0 */
347*803a4704SPulkoMandy #define	INS2_MOVr		0x2f
348*803a4704SPulkoMandy #define	INS2_WR			0x30	/* and SIR */
349*803a4704SPulkoMandy #define	INS2_SV_RSTR		0x31	/* saved, restored */
350*803a4704SPulkoMandy #define	INS2_WRPR		0x32
351*803a4704SPulkoMandy /* undefined			0x33 */
352*803a4704SPulkoMandy #define	INS2_FPop1		0x34	/* further encoded in opf field */
353*803a4704SPulkoMandy #define	INS2_FPop2		0x35	/* further encoded in opf field */
354*803a4704SPulkoMandy #define	INS2_IMPLDEP1		0x36
355*803a4704SPulkoMandy #define	INS2_IMPLDEP2		0x37
356*803a4704SPulkoMandy #define	INS2_JMPL		0x38
357*803a4704SPulkoMandy #define	INS2_RETURN		0x39
358*803a4704SPulkoMandy #define	INS2_Tcc		0x3a
359*803a4704SPulkoMandy #define	INS2_FLUSH		0x3b
360*803a4704SPulkoMandy #define	INS2_SAVE		0x3c
361*803a4704SPulkoMandy #define	INS2_RESTORE		0x3d
362*803a4704SPulkoMandy #define	INS2_DONE_RETR		0x3e	/* done, retry */
363*803a4704SPulkoMandy /* undefined			0x3f */
364*803a4704SPulkoMandy 
365*803a4704SPulkoMandy /* OP3 values for format 3 (OP = 3) */
366*803a4704SPulkoMandy #define	INS3_LDUW		0x00
367*803a4704SPulkoMandy #define	INS3_LDUB		0x01
368*803a4704SPulkoMandy #define	INS3_LDUH		0x02
369*803a4704SPulkoMandy #define	INS3_LDD		0x03
370*803a4704SPulkoMandy #define	INS3_STW		0x04
371*803a4704SPulkoMandy #define	INS3_STB		0x05
372*803a4704SPulkoMandy #define	INS3_STH		0x06
373*803a4704SPulkoMandy #define	INS3_STD		0x07
374*803a4704SPulkoMandy #define	INS3_LDSW		0x08
375*803a4704SPulkoMandy #define	INS3_LDSB		0x09
376*803a4704SPulkoMandy #define	INS3_LDSH		0x0a
377*803a4704SPulkoMandy #define	INS3_LDX		0x0b
378*803a4704SPulkoMandy /* undefined			0x0c */
379*803a4704SPulkoMandy #define	INS3_LDSTUB		0x0d
380*803a4704SPulkoMandy #define	INS3_STX		0x0e
381*803a4704SPulkoMandy #define	INS3_SWAP		0x0f
382*803a4704SPulkoMandy #define	INS3_LDUWA		0x10
383*803a4704SPulkoMandy #define	INS3_LDUBA		0x11
384*803a4704SPulkoMandy #define	INS3_LDUHA		0x12
385*803a4704SPulkoMandy #define	INS3_LDDA		0x13
386*803a4704SPulkoMandy #define	INS3_STWA		0x14
387*803a4704SPulkoMandy #define	INS3_STBA		0x15
388*803a4704SPulkoMandy #define	INS3_STHA		0x16
389*803a4704SPulkoMandy #define	INS3_STDA		0x17
390*803a4704SPulkoMandy #define	INS3_LDSWA		0x18
391*803a4704SPulkoMandy #define	INS3_LDSBA		0x19
392*803a4704SPulkoMandy #define	INS3_LDSHA		0x1a
393*803a4704SPulkoMandy #define	INS3_LDXA		0x1b
394*803a4704SPulkoMandy /* undefined			0x1c */
395*803a4704SPulkoMandy #define	INS3_LDSTUBA		0x1d
396*803a4704SPulkoMandy #define	INS3_STXA		0x1e
397*803a4704SPulkoMandy #define	INS3_SWAPA		0x1f
398*803a4704SPulkoMandy #define	INS3_LDF		0x20
399*803a4704SPulkoMandy #define	INS3_LDFSR		0x21	/* and LDXFSR */
400*803a4704SPulkoMandy #define	INS3_LDQF		0x22
401*803a4704SPulkoMandy #define	INS3_LDDF		0x23
402*803a4704SPulkoMandy #define	INS3_STF		0x24
403*803a4704SPulkoMandy #define	INS3_STFSR		0x25	/* and STXFSR */
404*803a4704SPulkoMandy #define	INS3_STQF		0x26
405*803a4704SPulkoMandy #define	INS3_STDF		0x27
406*803a4704SPulkoMandy /* undefined			0x28 - 0x2c */
407*803a4704SPulkoMandy #define	INS3_PREFETCH		0x2d
408*803a4704SPulkoMandy /* undefined			0x2e - 0x2f */
409*803a4704SPulkoMandy #define	INS3_LDFA		0x30
410*803a4704SPulkoMandy /* undefined			0x31 */
411*803a4704SPulkoMandy #define	INS3_LDQFA		0x32
412*803a4704SPulkoMandy #define	INS3_LDDFA		0x33
413*803a4704SPulkoMandy #define	INS3_STFA		0x34
414*803a4704SPulkoMandy /* undefined			0x35 */
415*803a4704SPulkoMandy #define	INS3_STQFA		0x36
416*803a4704SPulkoMandy #define	INS3_STDFA		0x37
417*803a4704SPulkoMandy /* undefined			0x38 - 0x3b */
418*803a4704SPulkoMandy #define	INS3_CASA		0x39
419*803a4704SPulkoMandy #define	INS3_PREFETCHA		0x3a
420*803a4704SPulkoMandy #define	INS3_CASXA		0x3b
421*803a4704SPulkoMandy 
422*803a4704SPulkoMandy /*
423*803a4704SPulkoMandy  * OPF values (floating point instructions, IMPLDEP)
424*803a4704SPulkoMandy  */
425*803a4704SPulkoMandy /*
426*803a4704SPulkoMandy  * These values are or'ed to the FPop values to get the instructions.
427*803a4704SPulkoMandy  * They describe the operand type(s).
428*803a4704SPulkoMandy  */
429*803a4704SPulkoMandy #define	INSFP_i			0x000	/* 32-bit int */
430*803a4704SPulkoMandy #define	INSFP_s			0x001	/* 32-bit single */
431*803a4704SPulkoMandy #define	INSFP_d			0x002	/* 64-bit double */
432*803a4704SPulkoMandy #define	INSFP_q			0x003	/* 128-bit quad */
433*803a4704SPulkoMandy /* FPop1. The comments give the types for which this instruction is defined. */
434*803a4704SPulkoMandy #define	INSFP1_FMOV		0x000	/* s, d, q */
435*803a4704SPulkoMandy #define	INSFP1_FNEG		0x004	/* s, d, q */
436*803a4704SPulkoMandy #define	INSFP1_FABS		0x008	/* s, d, q */
437*803a4704SPulkoMandy #define	INSFP1_FSQRT		0x028	/* s, d, q */
438*803a4704SPulkoMandy #define	INSFP1_FADD		0x040	/* s, d, q */
439*803a4704SPulkoMandy #define	INSFP1_FSUB		0x044	/* s, d, q */
440*803a4704SPulkoMandy #define	INSFP1_FMUL		0x048	/* s, d, q */
441*803a4704SPulkoMandy #define	INSFP1_FDIV		0x04c	/* s, d, q */
442*803a4704SPulkoMandy #define	INSFP1_FsMULd		0x068	/* s */
443*803a4704SPulkoMandy #define	INSFP1_FdMULq		0x06c	/* d */
444*803a4704SPulkoMandy #define	INSFP1_FTOx		0x080	/* s, d, q */
445*803a4704SPulkoMandy #define	INSFP1_FxTOs		0x084	/* special: i only */
446*803a4704SPulkoMandy #define	INSFP1_FxTOd		0x088	/* special: i only */
447*803a4704SPulkoMandy #define	INSFP1_FxTOq		0x08c	/* special: i only */
448*803a4704SPulkoMandy #define	INSFP1_FTOs		0x0c4	/* i, d, q */
449*803a4704SPulkoMandy #define	INSFP1_FTOd		0x0c8	/* i, s, q */
450*803a4704SPulkoMandy #define	INSFP1_FTOq		0x0cc	/* i, s, d */
451*803a4704SPulkoMandy #define	INSFP1_FTOi		0x0d0	/* i, s, d */
452*803a4704SPulkoMandy 
453*803a4704SPulkoMandy /* FPop2 */
454*803a4704SPulkoMandy #define	INSFP2_FMOV_CCMUL	0x40
455*803a4704SPulkoMandy #define	INSFP2_FMOV_CCOFFS	0x00
456*803a4704SPulkoMandy /* Use the IFCC_* constants for cc. Operand types: s, d, q */
457*803a4704SPulkoMandy #define	INSFP2_FMOV_CC(cc)	((cc) * INSFP2_FMOV_CCMUL + INSFP2_FMOV_CCOFFS)
458*803a4704SPulkoMandy #define	INSFP2_FMOV_RCMUL	0x20
459*803a4704SPulkoMandy #define	INSFP2_FMOV_RCOFFS	0x04
460*803a4704SPulkoMandy /* Use the IRCOND_* constants for rc. Operand types: s, d, q */
461*803a4704SPulkoMandy #define	INSFP2_FMOV_RC(rc)	((rc) * INSFP2_FMOV_RCMUL + INSFP2_FMOV_RCOFFS)
462*803a4704SPulkoMandy #define	INSFP2_FCMP		0x050	/* s, d, q */
463*803a4704SPulkoMandy #define	INSFP2_FCMPE		0x054	/* s, d, q */
464*803a4704SPulkoMandy 
465*803a4704SPulkoMandy /* Decode 5-bit register field into 6-bit number (for doubles and quads). */
466*803a4704SPulkoMandy #define	INSFPdq_RN(rn)		(((rn) & ~1) | (((rn) & 1) << 5))
467*803a4704SPulkoMandy 
468*803a4704SPulkoMandy /* IMPLDEP1 for Sun UltraSparc */
469*803a4704SPulkoMandy #define	IIDP1_EDGE8		0x00
470*803a4704SPulkoMandy #define	IIDP1_EDGE8N		0x01	/* US-III */
471*803a4704SPulkoMandy #define	IIDP1_EDGE8L		0x02
472*803a4704SPulkoMandy #define	IIDP1_EDGE8LN		0x03	/* US-III */
473*803a4704SPulkoMandy #define	IIDP1_EDGE16		0x04
474*803a4704SPulkoMandy #define	IIDP1_EDGE16N		0x05	/* US-III */
475*803a4704SPulkoMandy #define	IIDP1_EDGE16L		0x06
476*803a4704SPulkoMandy #define	IIDP1_EDGE16LN		0x07	/* US-III */
477*803a4704SPulkoMandy #define	IIDP1_EDGE32		0x08
478*803a4704SPulkoMandy #define	IIDP1_EDGE32N		0x09	/* US-III */
479*803a4704SPulkoMandy #define	IIDP1_EDGE32L		0x0a
480*803a4704SPulkoMandy #define	IIDP1_EDGE32LN		0x0b	/* US-III */
481*803a4704SPulkoMandy #define	IIDP1_ARRAY8		0x10
482*803a4704SPulkoMandy #define	IIDP1_ARRAY16		0x12
483*803a4704SPulkoMandy #define	IIDP1_ARRAY32		0x14
484*803a4704SPulkoMandy #define	IIDP1_ALIGNADDRESS	0x18
485*803a4704SPulkoMandy #define	IIDP1_BMASK		0x19	/* US-III */
486*803a4704SPulkoMandy #define	IIDP1_ALIGNADDRESS_L	0x1a
487*803a4704SPulkoMandy #define	IIDP1_FCMPLE16		0x20
488*803a4704SPulkoMandy #define	IIDP1_FCMPNE16		0x22
489*803a4704SPulkoMandy #define	IIDP1_FCMPLE32		0x24
490*803a4704SPulkoMandy #define	IIDP1_FCMPNE32		0x26
491*803a4704SPulkoMandy #define	IIDP1_FCMPGT16		0x28
492*803a4704SPulkoMandy #define	IIDP1_FCMPEQ16		0x2a
493*803a4704SPulkoMandy #define	IIDP1_FCMPGT32		0x2c
494*803a4704SPulkoMandy #define	IIDP1_FCMPEQ32		0x2e
495*803a4704SPulkoMandy #define	IIDP1_FMUL8x16		0x31
496*803a4704SPulkoMandy #define	IIDP1_FMUL8x16AU	0x33
497*803a4704SPulkoMandy #define	IIDP1_FMUL8X16AL	0x35
498*803a4704SPulkoMandy #define	IIDP1_FMUL8SUx16	0x36
499*803a4704SPulkoMandy #define	IIDP1_FMUL8ULx16	0x37
500*803a4704SPulkoMandy #define	IIDP1_FMULD8SUx16	0x38
501*803a4704SPulkoMandy #define	IIDP1_FMULD8ULx16	0x39
502*803a4704SPulkoMandy #define	IIDP1_FPACK32		0x3a
503*803a4704SPulkoMandy #define	IIDP1_FPACK16		0x3b
504*803a4704SPulkoMandy #define	IIDP1_FPACKFIX		0x3d
505*803a4704SPulkoMandy #define	IIDP1_PDIST		0x3e
506*803a4704SPulkoMandy #define	IIDP1_FALIGNDATA	0x48
507*803a4704SPulkoMandy #define	IIDP1_FPMERGE		0x4b
508*803a4704SPulkoMandy #define	IIDP1_BSHUFFLE		0x4c	/* US-III */
509*803a4704SPulkoMandy #define	IIDP1_FEXPAND		0x4d
510*803a4704SPulkoMandy #define	IIDP1_FPADD16		0x50
511*803a4704SPulkoMandy #define	IIDP1_FPADD16S		0x51
512*803a4704SPulkoMandy #define	IIDP1_FPADD32		0x52
513*803a4704SPulkoMandy #define	IIDP1_FPADD32S		0x53
514*803a4704SPulkoMandy #define	IIDP1_SUB16		0x54
515*803a4704SPulkoMandy #define	IIDP1_SUB16S		0x55
516*803a4704SPulkoMandy #define	IIDP1_SUB32		0x56
517*803a4704SPulkoMandy #define	IIDP1_SUB32S		0x57
518*803a4704SPulkoMandy #define	IIDP1_FZERO		0x60
519*803a4704SPulkoMandy #define	IIDP1_FZEROS		0x61
520*803a4704SPulkoMandy #define	IIDP1_FNOR		0x62
521*803a4704SPulkoMandy #define	IIDP1_FNORS		0x63
522*803a4704SPulkoMandy #define	IIDP1_FANDNOT2		0x64
523*803a4704SPulkoMandy #define	IIDP1_FANDNOT2S		0x65
524*803a4704SPulkoMandy #define	IIDP1_NOT2		0x66
525*803a4704SPulkoMandy #define	IIDP1_NOT2S		0x67
526*803a4704SPulkoMandy #define	IIDP1_FANDNOT1		0x68
527*803a4704SPulkoMandy #define	IIDP1_FANDNOT1S		0x69
528*803a4704SPulkoMandy #define	IIDP1_FNOT1		0x6a
529*803a4704SPulkoMandy #define	IIDP1_FNOT1S		0x6b
530*803a4704SPulkoMandy #define	IIDP1_FXOR		0x6c
531*803a4704SPulkoMandy #define	IIDP1_FXORS		0x6d
532*803a4704SPulkoMandy #define	IIDP1_FNAND		0x6e
533*803a4704SPulkoMandy #define	IIDP1_FNANDS		0x6f
534*803a4704SPulkoMandy #define	IIDP1_FAND		0x70
535*803a4704SPulkoMandy #define	IIDP1_FANDS		0x71
536*803a4704SPulkoMandy #define	IIDP1_FXNOR		0x72
537*803a4704SPulkoMandy #define	IIDP1_FXNORS		0x73
538*803a4704SPulkoMandy #define	IIDP1_FSRC1		0x74
539*803a4704SPulkoMandy #define	IIDP1_FSRC1S		0x75
540*803a4704SPulkoMandy #define	IIDP1_FORNOT2		0x76
541*803a4704SPulkoMandy #define	IIDP1_FORNOT2S		0x77
542*803a4704SPulkoMandy #define	IIDP1_FSRC2		0x78
543*803a4704SPulkoMandy #define	IIDP1_FSRC2S		0x79
544*803a4704SPulkoMandy #define	IIDP1_FORNOT1		0x7a
545*803a4704SPulkoMandy #define	IIDP1_FORNOT1S		0x7b
546*803a4704SPulkoMandy #define	IIDP1_FOR		0x7c
547*803a4704SPulkoMandy #define	IIDP1_FORS		0x7d
548*803a4704SPulkoMandy #define	IIDP1_FONE		0x7e
549*803a4704SPulkoMandy #define	IIDP1_FONES		0x7f
550*803a4704SPulkoMandy #define	IIDP1_SHUTDOWN		0x80
551*803a4704SPulkoMandy #define	IIDP1_SIAM		0x81	/* US-III */
552*803a4704SPulkoMandy 
553*803a4704SPulkoMandy /*
554*803a4704SPulkoMandy  * Instruction modifiers
555*803a4704SPulkoMandy  */
556*803a4704SPulkoMandy /* cond values for integer ccr's */
557*803a4704SPulkoMandy #define	IICOND_N		0x00
558*803a4704SPulkoMandy #define	IICOND_E		0x01
559*803a4704SPulkoMandy #define	IICOND_LE		0x02
560*803a4704SPulkoMandy #define	IICOND_L		0x03
561*803a4704SPulkoMandy #define	IICOND_LEU		0x04
562*803a4704SPulkoMandy #define	IICOND_CS		0x05
563*803a4704SPulkoMandy #define	IICOND_NEG		0x06
564*803a4704SPulkoMandy #define	IICOND_VS		0x07
565*803a4704SPulkoMandy #define	IICOND_A		0x08
566*803a4704SPulkoMandy #define	IICOND_NE		0x09
567*803a4704SPulkoMandy #define	IICOND_G		0x0a
568*803a4704SPulkoMandy #define	IICOND_GE		0x0b
569*803a4704SPulkoMandy #define	IICOND_GU		0x0c
570*803a4704SPulkoMandy #define	IICOND_CC		0x0d
571*803a4704SPulkoMandy #define	IICOND_POS		0x0e
572*803a4704SPulkoMandy #define	IICOND_VC		0x0f
573*803a4704SPulkoMandy 
574*803a4704SPulkoMandy /* cond values for fp ccr's */
575*803a4704SPulkoMandy #define	IFCOND_N		0x00
576*803a4704SPulkoMandy #define	IFCOND_NE		0x01
577*803a4704SPulkoMandy #define	IFCOND_LG		0x02
578*803a4704SPulkoMandy #define	IFCOND_UL		0x03
579*803a4704SPulkoMandy #define	IFCOND_L		0x04
580*803a4704SPulkoMandy #define	IFCOND_UG		0x05
581*803a4704SPulkoMandy #define	IFCOND_G		0x06
582*803a4704SPulkoMandy #define	IFCOND_U		0x07
583*803a4704SPulkoMandy #define	IFCOND_A		0x08
584*803a4704SPulkoMandy #define	IFCOND_E		0x09
585*803a4704SPulkoMandy #define	IFCOND_UE		0x0a
586*803a4704SPulkoMandy #define	IFCOND_GE		0x0b
587*803a4704SPulkoMandy #define	IFCOND_UGE		0x0c
588*803a4704SPulkoMandy #define	IFCOND_LE		0x0d
589*803a4704SPulkoMandy #define	IFCOND_ULE		0x0e
590*803a4704SPulkoMandy #define	IFCOND_O		0x0f
591*803a4704SPulkoMandy 
592*803a4704SPulkoMandy /* rcond values for BPr, MOVr, FMOVr */
593*803a4704SPulkoMandy #define	IRCOND_Z		0x01
594*803a4704SPulkoMandy #define	IRCOND_LEZ		0x02
595*803a4704SPulkoMandy #define	IRCOND_LZ		0x03
596*803a4704SPulkoMandy #define	IRCOND_NZ		0x05
597*803a4704SPulkoMandy #define	IRCOND_GZ		0x06
598*803a4704SPulkoMandy #define	IRCOND_GEZ		0x07
599*803a4704SPulkoMandy 
600*803a4704SPulkoMandy /* cc values for MOVcc and FMOVcc */
601*803a4704SPulkoMandy #define	IFCC_ICC		0x04
602*803a4704SPulkoMandy #define	IFCC_XCC		0x06
603*803a4704SPulkoMandy /* if true, the lower 2 bits are the fcc number */
604*803a4704SPulkoMandy #define	IFCC_FCC(c)		((c) & 3)
605*803a4704SPulkoMandy #define	IFCC_GET_FCC(c)		((c) & 3)
606*803a4704SPulkoMandy #define	IFCC_ISFCC(c)		(((c) & 4) == 0)
607*803a4704SPulkoMandy 
608*803a4704SPulkoMandy /* cc values for BPc and Tcc */
609*803a4704SPulkoMandy #define	IBCC_ICC		0x00
610*803a4704SPulkoMandy #define	IBCC_XCC		0x02
611*803a4704SPulkoMandy 
612*803a4704SPulkoMandy /*
613*803a4704SPulkoMandy  * Integer registers
614*803a4704SPulkoMandy  */
615*803a4704SPulkoMandy #define	IREG_G0			0x00
616*803a4704SPulkoMandy #define	IREG_O0			0x08
617*803a4704SPulkoMandy #define	IREG_L0			0x10
618*803a4704SPulkoMandy #define	IREQ_I0			0x18
619*803a4704SPulkoMandy 
620*803a4704SPulkoMandy #endif /* !_MACHINE_INSTR_H_ */
621