xref: /openbsd-src/gnu/usr.bin/binutils/cpu/iq2000m.cpu (revision cf2f2c5620d6d9a4fd01930983c4b9a1f76d7aa3)
1*cf2f2c56Smiod; IQ2000-only CPU description. -*- Scheme -*-
2*cf2f2c56Smiod;
3*cf2f2c56Smiod; Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
4*cf2f2c56Smiod;
5*cf2f2c56Smiod; Contributed by Red Hat Inc; developed under contract from Vitesse.
6*cf2f2c56Smiod;
7*cf2f2c56Smiod; This file is part of the GNU Binutils.
8*cf2f2c56Smiod;
9*cf2f2c56Smiod; This program is free software; you can redistribute it and/or modify
10*cf2f2c56Smiod; it under the terms of the GNU General Public License as published by
11*cf2f2c56Smiod; the Free Software Foundation; either version 2 of the License, or
12*cf2f2c56Smiod; (at your option) any later version.
13*cf2f2c56Smiod;
14*cf2f2c56Smiod; This program is distributed in the hope that it will be useful,
15*cf2f2c56Smiod; but WITHOUT ANY WARRANTY; without even the implied warranty of
16*cf2f2c56Smiod; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*cf2f2c56Smiod; GNU General Public License for more details.
18*cf2f2c56Smiod;
19*cf2f2c56Smiod; You should have received a copy of the GNU General Public License
20*cf2f2c56Smiod; along with this program; if not, write to the Free Software
21*cf2f2c56Smiod; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*cf2f2c56Smiod
23*cf2f2c56Smiod(dni andoui "and upper ones immediate" (MACH2000 USES-RS USES-RT)
24*cf2f2c56Smiod     "andoui $rt,$rs,$hi16"
25*cf2f2c56Smiod     (+ OP_ANDOUI rs rt hi16)
26*cf2f2c56Smiod     (set rt (and rs (or (sll hi16 16) #xFFFF)))
27*cf2f2c56Smiod     ())
28*cf2f2c56Smiod
29*cf2f2c56Smiod(dni andoui2 "and upper ones immediate" (ALIAS NO-DIS MACH2000 USES-RS USES-RT)
30*cf2f2c56Smiod     "andoui ${rt-rs},$hi16"
31*cf2f2c56Smiod     (+ OP_ANDOUI rt-rs hi16)
32*cf2f2c56Smiod     (set rt-rs (and rt-rs (or (sll hi16 16) #xFFFF)))
33*cf2f2c56Smiod     ())
34*cf2f2c56Smiod
35*cf2f2c56Smiod(dni orui2 "or upper immediate" (ALIAS NO-DIS MACH2000 USES-RS USES-RT)
36*cf2f2c56Smiod     "orui ${rt-rs},$hi16"
37*cf2f2c56Smiod     (+ OP_ORUI rt-rs hi16)
38*cf2f2c56Smiod     (set rt-rs (or rt-rs (sll hi16 16)))
39*cf2f2c56Smiod     ())
40*cf2f2c56Smiod
41*cf2f2c56Smiod(dni orui "or upper immediate" (MACH2000 USES-RS USES-RT)
42*cf2f2c56Smiod     "orui $rt,$rs,$hi16"
43*cf2f2c56Smiod     (+ OP_ORUI rs rt hi16)
44*cf2f2c56Smiod     (set rt (or rs (sll hi16 16)))
45*cf2f2c56Smiod     ())
46*cf2f2c56Smiod
47*cf2f2c56Smiod(dni bgtz "branch if greater than zero" (MACH2000 USES-RS)
48*cf2f2c56Smiod     "bgtz $rs,$offset"
49*cf2f2c56Smiod     (+ OP_BGTZ rs (f-rt 0) offset)
50*cf2f2c56Smiod     (if (gt rs 0)
51*cf2f2c56Smiod	 (delay 1 (set pc offset)))
52*cf2f2c56Smiod     ())
53*cf2f2c56Smiod
54*cf2f2c56Smiod
55*cf2f2c56Smiod(dni bgtzl "branch if greater than zero likely" (MACH2000 USES-RS)
56*cf2f2c56Smiod     "bgtzl $rs,$offset"
57*cf2f2c56Smiod     (+ OP_BGTZL rs (f-rt 0) offset)
58*cf2f2c56Smiod     (if (gt rs 0)
59*cf2f2c56Smiod	 (delay 1 (set pc offset))
60*cf2f2c56Smiod	 (skip 1))
61*cf2f2c56Smiod     ())
62*cf2f2c56Smiod
63*cf2f2c56Smiod(dni blez "branch if less than or equal to zero" (MACH2000 USES-RS)
64*cf2f2c56Smiod     "blez $rs,$offset"
65*cf2f2c56Smiod     (+ OP_BLEZ rs (f-rt 0) offset)
66*cf2f2c56Smiod     (if (le rs 0)
67*cf2f2c56Smiod	 (delay 1 (set pc offset)))
68*cf2f2c56Smiod     ())
69*cf2f2c56Smiod
70*cf2f2c56Smiod(dni blezl "branch if less than or equal to zero likely" (MACH2000 USES-RS)
71*cf2f2c56Smiod     "blezl $rs,$offset"
72*cf2f2c56Smiod     (+ OP_BLEZL rs (f-rt 0) offset)
73*cf2f2c56Smiod     (if (le rs 0)
74*cf2f2c56Smiod	 (delay 1 (set pc offset))
75*cf2f2c56Smiod	 (skip 1))
76*cf2f2c56Smiod     ())
77*cf2f2c56Smiod
78*cf2f2c56Smiod
79*cf2f2c56Smiod(dni mrgb "merge bytes" (MACH2000 USES-RD USES-RS USES-RT)
80*cf2f2c56Smiod     "mrgb $rd,$rs,$rt,$mask"
81*cf2f2c56Smiod     (+ OP_SPECIAL rs rt rd (f-10 0) mask FUNC_MRGB)
82*cf2f2c56Smiod     (sequence ((SI temp))
83*cf2f2c56Smiod	       (if (bitclear? mask 0)
84*cf2f2c56Smiod		   (set temp (and rs #xFF))
85*cf2f2c56Smiod		   (set temp (and rt #xFF)))
86*cf2f2c56Smiod	       (if (bitclear? mask 1)
87*cf2f2c56Smiod		   (set temp (or temp (and rs #xFF00)))
88*cf2f2c56Smiod		   (set temp (or temp (and rt #xFF00))))
89*cf2f2c56Smiod	       (if (bitclear? mask 2)
90*cf2f2c56Smiod		   (set temp (or temp (and rs #xFF0000)))
91*cf2f2c56Smiod		   (set temp (or temp (and rt #xFF0000))))
92*cf2f2c56Smiod	       (if (bitclear? mask 3)
93*cf2f2c56Smiod		   (set temp (or temp (and rs #xFF000000)))
94*cf2f2c56Smiod		   (set temp (or temp (and rt #xFF000000))))
95*cf2f2c56Smiod	       (set rd temp))
96*cf2f2c56Smiod     ())
97*cf2f2c56Smiod
98*cf2f2c56Smiod(dni mrgb2 "merge bytes" (ALIAS NO-DIS MACH2000 USES-RD USES-RS USES-RT)
99*cf2f2c56Smiod     "mrgb ${rd-rs},$rt,$mask"
100*cf2f2c56Smiod     (+ OP_SPECIAL rt rd-rs (f-10 0) mask FUNC_MRGB)
101*cf2f2c56Smiod     (sequence ((SI temp))
102*cf2f2c56Smiod	       (if (bitclear? mask 0)
103*cf2f2c56Smiod		   (set temp (and rd-rs #xFF))
104*cf2f2c56Smiod		   (set temp (and rt #xFF)))
105*cf2f2c56Smiod	       (if (bitclear? mask 1)
106*cf2f2c56Smiod		   (set temp (or temp (and rd-rs #xFF00)))
107*cf2f2c56Smiod		   (set temp (or temp (and rt #xFF00))))
108*cf2f2c56Smiod	       (if (bitclear? mask 2)
109*cf2f2c56Smiod		   (set temp (or temp (and rd-rs #xFF0000)))
110*cf2f2c56Smiod		   (set temp (or temp (and rt #xFF0000))))
111*cf2f2c56Smiod	       (if (bitclear? mask 3)
112*cf2f2c56Smiod		   (set temp (or temp (and rd-rs #xFF000000)))
113*cf2f2c56Smiod		   (set temp (or temp (and rt #xFF000000))))
114*cf2f2c56Smiod	       (set rd-rs temp))
115*cf2f2c56Smiod     ())
116*cf2f2c56Smiod
117*cf2f2c56Smiod; NOTE: None of these instructions' semantics are specified, so they
118*cf2f2c56Smiod; will not work in a simulator.
119*cf2f2c56Smiod;
120*cf2f2c56Smiod; Architectural and coprocessor instructions.
121*cf2f2c56Smiod; BREAK and SYSCALL are implemented with escape hatches to the C
122*cf2f2c56Smiod; code.  These are used by the test suite to indicate pass/failures.
123*cf2f2c56Smiod
124*cf2f2c56Smiod(dni bctxt "branch and switch context" (MACH2000 DELAY-SLOT COND-CTI USES-RS)
125*cf2f2c56Smiod     "bctxt $rs,$offset"
126*cf2f2c56Smiod     (+ OP_REGIMM rs (f-rt 6) offset)
127*cf2f2c56Smiod     (unimp bctxt)
128*cf2f2c56Smiod     ())
129*cf2f2c56Smiod
130*cf2f2c56Smiod(dni bc0f "branch if copro 0 condition false" (MACH2000 DELAY-SLOT COND-CTI)
131*cf2f2c56Smiod     "bc0f $offset"
132*cf2f2c56Smiod     (+ OP_COP0 (f-rs 8) (f-rt 0) offset)
133*cf2f2c56Smiod     (unimp bc0f)
134*cf2f2c56Smiod     ())
135*cf2f2c56Smiod
136*cf2f2c56Smiod(dni bc0fl "branch if copro 0 condition false likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI)
137*cf2f2c56Smiod     "bc0fl $offset"
138*cf2f2c56Smiod     (+ OP_COP0 (f-rs 8) (f-rt 2) offset)
139*cf2f2c56Smiod     (unimp bc0fl)
140*cf2f2c56Smiod     ())
141*cf2f2c56Smiod
142*cf2f2c56Smiod(dni bc3f "branch if copro 3 condition false" (MACH2000 DELAY-SLOT COND-CTI)
143*cf2f2c56Smiod     "bc3f $offset"
144*cf2f2c56Smiod     (+ OP_COP3 (f-rs 8) (f-rt 0) offset)
145*cf2f2c56Smiod     (unimp bc3f)
146*cf2f2c56Smiod     ())
147*cf2f2c56Smiod
148*cf2f2c56Smiod(dni bc3fl "branch if copro 3 condition false likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI)
149*cf2f2c56Smiod     "bc3fl $offset"
150*cf2f2c56Smiod     (+ OP_COP3 (f-rs 8) (f-rt 2) offset)
151*cf2f2c56Smiod     (unimp bc3fl)
152*cf2f2c56Smiod     ())
153*cf2f2c56Smiod
154*cf2f2c56Smiod(dni bc0t "branch if copro 0 condition true" (MACH2000 DELAY-SLOT COND-CTI)
155*cf2f2c56Smiod     "bc0t $offset"
156*cf2f2c56Smiod     (+ OP_COP0 (f-rs 8) (f-rt 1) offset)
157*cf2f2c56Smiod     (unimp bc0t)
158*cf2f2c56Smiod     ())
159*cf2f2c56Smiod
160*cf2f2c56Smiod(dni bc0tl "branch if copro 0 condition true likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI)
161*cf2f2c56Smiod     "bc0tl $offset"
162*cf2f2c56Smiod     (+ OP_COP0 (f-rs 8) (f-rt 3) offset)
163*cf2f2c56Smiod     (unimp bc0tl)
164*cf2f2c56Smiod     ())
165*cf2f2c56Smiod
166*cf2f2c56Smiod(dni bc3t "branch if copro 3 condition true" (MACH2000 DELAY-SLOT COND-CTI)
167*cf2f2c56Smiod     "bc3t $offset"
168*cf2f2c56Smiod     (+ OP_COP3 (f-rs 8) (f-rt 1) offset)
169*cf2f2c56Smiod     (unimp bc3t)
170*cf2f2c56Smiod     ())
171*cf2f2c56Smiod
172*cf2f2c56Smiod(dni bc3tl "branch if copro 3 condition true likely" (MACH2000 DELAY-SLOT COND-CTI SKIP-CTI)
173*cf2f2c56Smiod     "bc3tl $offset"
174*cf2f2c56Smiod     (+ OP_COP3 (f-rs 8) (f-rt 3) offset)
175*cf2f2c56Smiod     (unimp bc3tl)
176*cf2f2c56Smiod     ())
177*cf2f2c56Smiod
178*cf2f2c56Smiod; Note that we don't set the USES-RD or USES-RT attributes for many of the following
179*cf2f2c56Smiod; instructions, as it's the COP register that's being specified.
180*cf2f2c56Smiod
181*cf2f2c56Smiod(dni cfc0 "control from coprocessor 0" (MACH2000 LOAD-DELAY USES-RT)
182*cf2f2c56Smiod     "cfc0 $rt,$rd"
183*cf2f2c56Smiod     (+ OP_COP0 (f-rs 2) rt rd (f-10-11 0))
184*cf2f2c56Smiod     (unimp cfc0)
185*cf2f2c56Smiod     ())
186*cf2f2c56Smiod
187*cf2f2c56Smiod(dni cfc1 "control from coprocessor 1" (MACH2000 LOAD-DELAY USES-RT)
188*cf2f2c56Smiod     "cfc1 $rt,$rd"
189*cf2f2c56Smiod     (+ OP_COP1 (f-rs 2) rt rd (f-10-11 0))
190*cf2f2c56Smiod     (unimp cfc1)
191*cf2f2c56Smiod     ())
192*cf2f2c56Smiod
193*cf2f2c56Smiod(dni cfc2 "control from coprocessor 2" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN)
194*cf2f2c56Smiod     "cfc2 $rt,$rd"
195*cf2f2c56Smiod     (+ OP_COP2 (f-rs 2) rt rd (f-10-11 0))
196*cf2f2c56Smiod     (unimp cfc2)
197*cf2f2c56Smiod     ())
198*cf2f2c56Smiod
199*cf2f2c56Smiod(dni cfc3 "control from coprocessor 3" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN)
200*cf2f2c56Smiod     "cfc3 $rt,$rd"
201*cf2f2c56Smiod     (+ OP_COP3 (f-rs 2) rt rd (f-10-11 0))
202*cf2f2c56Smiod     (unimp cfc3)
203*cf2f2c56Smiod     ())
204*cf2f2c56Smiod
205*cf2f2c56Smiod; COPz instructions are an instruction form, not real instructions
206*cf2f2c56Smiod; with associated assembly mnemonics.  Therefore, they are omitted
207*cf2f2c56Smiod; from the ISA description.
208*cf2f2c56Smiod
209*cf2f2c56Smiod(dni chkhdr "check header" (MACH2000 LOAD-DELAY USES-RD YIELD-INSN)
210*cf2f2c56Smiod     "chkhdr $rd,$rt"
211*cf2f2c56Smiod     (+ OP_COP3 (f-rs 9) rt rd (f-shamt 0) (f-func 0))
212*cf2f2c56Smiod     (unimp chkhdr)
213*cf2f2c56Smiod     ())
214*cf2f2c56Smiod
215*cf2f2c56Smiod(dni ctc0 "control to coprocessor 0" (MACH2000 USES-RT)
216*cf2f2c56Smiod     "ctc0 $rt,$rd"
217*cf2f2c56Smiod     (+ OP_COP0 (f-rs 6) rt rd (f-10-11 0))
218*cf2f2c56Smiod     (unimp ctc0)
219*cf2f2c56Smiod     ())
220*cf2f2c56Smiod
221*cf2f2c56Smiod(dni ctc1 "control to coprocessor 1" (MACH2000 USES-RT)
222*cf2f2c56Smiod     "ctc1 $rt,$rd"
223*cf2f2c56Smiod     (+ OP_COP1 (f-rs 6) rt rd (f-10-11 0))
224*cf2f2c56Smiod     (unimp ctc1)
225*cf2f2c56Smiod     ())
226*cf2f2c56Smiod
227*cf2f2c56Smiod(dni ctc2 "control to coprocessor 2" (MACH2000 USES-RT)
228*cf2f2c56Smiod     "ctc2 $rt,$rd"
229*cf2f2c56Smiod     (+ OP_COP2 (f-rs 6) rt rd (f-10-11 0))
230*cf2f2c56Smiod     (unimp ctc2)
231*cf2f2c56Smiod     ())
232*cf2f2c56Smiod
233*cf2f2c56Smiod(dni ctc3 "control to coprocessor 3" (MACH2000 USES-RT)
234*cf2f2c56Smiod     "ctc3 $rt,$rd"
235*cf2f2c56Smiod     (+ OP_COP3 (f-rs 6) rt rd (f-10-11 0))
236*cf2f2c56Smiod     (unimp ctc3)
237*cf2f2c56Smiod     ())
238*cf2f2c56Smiod
239*cf2f2c56Smiod(dni jcr "jump context register" (MACH2000 DELAY-SLOT UNCOND-CTI USES-RS)
240*cf2f2c56Smiod     "jcr $rs"
241*cf2f2c56Smiod     (+ OP_SPECIAL rs (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_JCR)
242*cf2f2c56Smiod     (unimp jcr)
243*cf2f2c56Smiod     ())
244*cf2f2c56Smiod
245*cf2f2c56Smiod(dni luc32 "lookup chain 32 bits" (MACH2000 USES-RD USES-RT YIELD-INSN)
246*cf2f2c56Smiod     "luc32 $rt,$rd"
247*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 3))
248*cf2f2c56Smiod     (unimp luc32)
249*cf2f2c56Smiod     ())
250*cf2f2c56Smiod
251*cf2f2c56Smiod(dni luc32l "lookup chain 32 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN)
252*cf2f2c56Smiod     "luc32l $rt,$rd"
253*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 7))
254*cf2f2c56Smiod     (unimp luc32l)
255*cf2f2c56Smiod     ())
256*cf2f2c56Smiod
257*cf2f2c56Smiod(dni luc64 "lookup chain 64 bits" (MACH2000 USES-RD USES-RT YIELD-INSN)
258*cf2f2c56Smiod     "luc64 $rt,$rd"
259*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 11))
260*cf2f2c56Smiod     (unimp luc64)
261*cf2f2c56Smiod     ())
262*cf2f2c56Smiod
263*cf2f2c56Smiod(dni luc64l "lookup chain 64 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN)
264*cf2f2c56Smiod     "luc64l $rt,$rd"
265*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 15))
266*cf2f2c56Smiod     (unimp luc64l)
267*cf2f2c56Smiod     ())
268*cf2f2c56Smiod
269*cf2f2c56Smiod(dni luk "lookup key" (MACH2000 USES-RD USES-RT)
270*cf2f2c56Smiod     "luk $rt,$rd"
271*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 8))
272*cf2f2c56Smiod     (unimp luk)
273*cf2f2c56Smiod     ())
274*cf2f2c56Smiod
275*cf2f2c56Smiod(dni lulck "lookup lock" (MACH2000 USES-RT YIELD-INSN)
276*cf2f2c56Smiod     "lulck $rt"
277*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 4))
278*cf2f2c56Smiod     (unimp lulck)
279*cf2f2c56Smiod     ())
280*cf2f2c56Smiod
281*cf2f2c56Smiod(dni lum32 "lookup match 32 bits" (MACH2000 USES-RD USES-RT YIELD-INSN)
282*cf2f2c56Smiod     "lum32 $rt,$rd"
283*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 2))
284*cf2f2c56Smiod     (unimp lum32)
285*cf2f2c56Smiod     ())
286*cf2f2c56Smiod
287*cf2f2c56Smiod(dni lum32l "lookup match 32 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN)
288*cf2f2c56Smiod     "lum32l $rt,$rd"
289*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 6))
290*cf2f2c56Smiod     (unimp lum32l)
291*cf2f2c56Smiod     ())
292*cf2f2c56Smiod
293*cf2f2c56Smiod(dni lum64 "lookup match 64 bits" (MACH2000 USES-RD USES-RT YIELD-INSN)
294*cf2f2c56Smiod     "lum64 $rt,$rd"
295*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 10))
296*cf2f2c56Smiod     (unimp lum64)
297*cf2f2c56Smiod     ())
298*cf2f2c56Smiod
299*cf2f2c56Smiod(dni lum64l "lookup match 64 bits and lock" (MACH2000 USES-RD USES-RT YIELD-INSN)
300*cf2f2c56Smiod     "lum64l $rt,$rd"
301*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 14))
302*cf2f2c56Smiod     (unimp lum64l)
303*cf2f2c56Smiod     ())
304*cf2f2c56Smiod
305*cf2f2c56Smiod(dni lur "lookup read" (MACH2000 USES-RD USES-RT YIELD-INSN)
306*cf2f2c56Smiod     "lur $rt,$rd"
307*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 1))
308*cf2f2c56Smiod     (unimp lur)
309*cf2f2c56Smiod     ())
310*cf2f2c56Smiod
311*cf2f2c56Smiod(dni lurl "lookup read and lock" (MACH2000 USES-RD USES-RT YIELD-INSN)
312*cf2f2c56Smiod     "lurl $rt,$rd"
313*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 5))
314*cf2f2c56Smiod     (unimp lurl)
315*cf2f2c56Smiod     ())
316*cf2f2c56Smiod
317*cf2f2c56Smiod(dni luulck "lookup unlock" (MACH2000 USES-RT YIELD-INSN)
318*cf2f2c56Smiod     "luulck $rt"
319*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 0))
320*cf2f2c56Smiod     (unimp luulck)
321*cf2f2c56Smiod     ())
322*cf2f2c56Smiod
323*cf2f2c56Smiod(dni mfc0 "move from coprocessor 0" (MACH2000 LOAD-DELAY USES-RT)
324*cf2f2c56Smiod     "mfc0 $rt,$rd"
325*cf2f2c56Smiod     (+ OP_COP0 (f-rs 0) rt rd (f-10-11 0))
326*cf2f2c56Smiod     (unimp mfc0)
327*cf2f2c56Smiod     ())
328*cf2f2c56Smiod
329*cf2f2c56Smiod(dni mfc1 "move from coprocessor 1" (MACH2000 LOAD-DELAY USES-RT)
330*cf2f2c56Smiod     "mfc1 $rt,$rd"
331*cf2f2c56Smiod     (+ OP_COP1 (f-rs 0) rt rd (f-10-11 0))
332*cf2f2c56Smiod     (unimp mfc1)
333*cf2f2c56Smiod     ())
334*cf2f2c56Smiod
335*cf2f2c56Smiod(dni mfc2 "move from coprocessor 2" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN)
336*cf2f2c56Smiod     "mfc2 $rt,$rd"
337*cf2f2c56Smiod     (+ OP_COP2 (f-rs 0) rt rd (f-10-11 0))
338*cf2f2c56Smiod     (unimp mfc2)
339*cf2f2c56Smiod     ())
340*cf2f2c56Smiod
341*cf2f2c56Smiod(dni mfc3 "move from coprocessor 3" (MACH2000 LOAD-DELAY USES-RT YIELD-INSN)
342*cf2f2c56Smiod     "mfc3 $rt,$rd"
343*cf2f2c56Smiod     (+ OP_COP3 (f-rs 0) rt rd (f-10-11 0))
344*cf2f2c56Smiod     (unimp mfc3)
345*cf2f2c56Smiod     ())
346*cf2f2c56Smiod
347*cf2f2c56Smiod(dni mtc0 "move to coprocessor 0" (MACH2000 USES-RT)
348*cf2f2c56Smiod     "mtc0 $rt,$rd"
349*cf2f2c56Smiod     (+ OP_COP0 (f-rs 4) rt rd (f-10-11 0))
350*cf2f2c56Smiod     (unimp mtc0)
351*cf2f2c56Smiod     ())
352*cf2f2c56Smiod
353*cf2f2c56Smiod(dni mtc1 "move to coprocessor 1" (MACH2000 USES-RT)
354*cf2f2c56Smiod     "mtc1 $rt,$rd"
355*cf2f2c56Smiod     (+ OP_COP1 (f-rs 4) rt rd (f-10-11 0))
356*cf2f2c56Smiod     (unimp mtc1)
357*cf2f2c56Smiod     ())
358*cf2f2c56Smiod
359*cf2f2c56Smiod(dni mtc2 "move to coprocessor 2" (MACH2000 USES-RT)
360*cf2f2c56Smiod     "mtc2 $rt,$rd"
361*cf2f2c56Smiod     (+ OP_COP2 (f-rs 4) rt rd (f-10-11 0))
362*cf2f2c56Smiod     (unimp mtc2)
363*cf2f2c56Smiod     ())
364*cf2f2c56Smiod
365*cf2f2c56Smiod(dni mtc3 "move to coprocessor 3" (MACH2000 USES-RT)
366*cf2f2c56Smiod     "mtc3 $rt,$rd"
367*cf2f2c56Smiod     (+ OP_COP3 (f-rs 4) rt rd (f-10-11 0))
368*cf2f2c56Smiod     (unimp mtc3)
369*cf2f2c56Smiod     ())
370*cf2f2c56Smiod
371*cf2f2c56Smiod(dni pkrl "pkrl" (MACH2000 USES-RD USES-RT YIELD-INSN)
372*cf2f2c56Smiod     "pkrl $rd,$rt"
373*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 7))
374*cf2f2c56Smiod     (unimp pkrl)
375*cf2f2c56Smiod     ())
376*cf2f2c56Smiod
377*cf2f2c56Smiod(dni pkrlr1 "pkrlr1" (MACH2000 USES-RT YIELD-INSN)
378*cf2f2c56Smiod     "pkrlr1 $rt,$count"
379*cf2f2c56Smiod     (+ OP_COP3 (f-rs 29) rt count)
380*cf2f2c56Smiod     (unimp pkrlr1)
381*cf2f2c56Smiod     ())
382*cf2f2c56Smiod
383*cf2f2c56Smiod(dni pkrlr30 "pkrlr30" (MACH2000 USES-RT YIELD-INSN)
384*cf2f2c56Smiod     "pkrlr30 $rt,$count"
385*cf2f2c56Smiod     (+ OP_COP3 (f-rs 31) rt count)
386*cf2f2c56Smiod     (unimp pkrlr30)
387*cf2f2c56Smiod     ())
388*cf2f2c56Smiod
389*cf2f2c56Smiod(dni rb "dma read bytes" (MACH2000 USES-RD USES-RT YIELD-INSN)
390*cf2f2c56Smiod     "rb $rd,$rt"
391*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 4))
392*cf2f2c56Smiod     (unimp rb)
393*cf2f2c56Smiod     ())
394*cf2f2c56Smiod
395*cf2f2c56Smiod(dni rbr1 "dma read bytes using r1" (MACH2000 USES-RT YIELD-INSN)
396*cf2f2c56Smiod     "rbr1 $rt,$count"
397*cf2f2c56Smiod     (+ OP_COP3 (f-rs 24) rt count)
398*cf2f2c56Smiod     (unimp rbr1)
399*cf2f2c56Smiod     ())
400*cf2f2c56Smiod
401*cf2f2c56Smiod(dni rbr30 "dma read bytes using r30" (MACH2000 USES-RT YIELD-INSN)
402*cf2f2c56Smiod     "rbr30 $rt,$count"
403*cf2f2c56Smiod     (+ OP_COP3 (f-rs 26) rt count)
404*cf2f2c56Smiod     (unimp rbr30)
405*cf2f2c56Smiod     ())
406*cf2f2c56Smiod
407*cf2f2c56Smiod(dni rfe "restore from exception" (MACH2000)
408*cf2f2c56Smiod     "rfe"
409*cf2f2c56Smiod     (+ OP_COP0 (f-25 1) (f-24-19 0) (f-func 16))
410*cf2f2c56Smiod     (unimp rfe)
411*cf2f2c56Smiod     ())
412*cf2f2c56Smiod
413*cf2f2c56Smiod(dni rx "dma read word64s" (MACH2000 USES-RD USES-RT YIELD-INSN)
414*cf2f2c56Smiod     "rx $rd,$rt"
415*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 6))
416*cf2f2c56Smiod     (unimp rx)
417*cf2f2c56Smiod     ())
418*cf2f2c56Smiod
419*cf2f2c56Smiod(dni rxr1 "dma read word64s using r1" (MACH2000 USES-RT YIELD-INSN)
420*cf2f2c56Smiod     "rxr1 $rt,$count"
421*cf2f2c56Smiod     (+ OP_COP3 (f-rs 28) rt count)
422*cf2f2c56Smiod     (unimp rxr1)
423*cf2f2c56Smiod     ())
424*cf2f2c56Smiod
425*cf2f2c56Smiod(dni rxr30 "dma read word 64s using r30" (MACH2000 USES-RT YIELD-INSN)
426*cf2f2c56Smiod     "rxr30 $rt,$count"
427*cf2f2c56Smiod     (+ OP_COP3 (f-rs 30) rt count)
428*cf2f2c56Smiod     (unimp rxr30)
429*cf2f2c56Smiod     ())
430*cf2f2c56Smiod
431*cf2f2c56Smiod(dni sleep "sleep" (MACH2000 YIELD-INSN)
432*cf2f2c56Smiod     "sleep"
433*cf2f2c56Smiod     (+ OP_SPECIAL execode FUNC_SLEEP)
434*cf2f2c56Smiod     (unimp sleep)
435*cf2f2c56Smiod     ())
436*cf2f2c56Smiod
437*cf2f2c56Smiod(dni srrd "sram read" (MACH2000 USES-RT YIELD-INSN)
438*cf2f2c56Smiod     "srrd $rt"
439*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 16))
440*cf2f2c56Smiod     (unimp srrd)
441*cf2f2c56Smiod     ())
442*cf2f2c56Smiod
443*cf2f2c56Smiod(dni srrdl "sram read and lock" (MACH2000 USES-RT YIELD-INSN)
444*cf2f2c56Smiod     "srrdl $rt"
445*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 20))
446*cf2f2c56Smiod     (unimp srrdl)
447*cf2f2c56Smiod     ())
448*cf2f2c56Smiod
449*cf2f2c56Smiod(dni srulck "sram unlock" (MACH2000 USES-RT YIELD-INSN)
450*cf2f2c56Smiod     "srulck $rt"
451*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 22))
452*cf2f2c56Smiod     (unimp srulck)
453*cf2f2c56Smiod     ())
454*cf2f2c56Smiod
455*cf2f2c56Smiod(dni srwr "sram write" (MACH2000 USES-RD USES-RT YIELD-INSN)
456*cf2f2c56Smiod     "srwr $rt,$rd"
457*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 17))
458*cf2f2c56Smiod     (unimp srwr)
459*cf2f2c56Smiod     ())
460*cf2f2c56Smiod
461*cf2f2c56Smiod(dni srwru "sram write and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN)
462*cf2f2c56Smiod     "srwru $rt,$rd"
463*cf2f2c56Smiod     (+ OP_COP2 (f-rs 1) rt rd (f-shamt 0) (f-func 21))
464*cf2f2c56Smiod     (unimp srwru)
465*cf2f2c56Smiod     ())
466*cf2f2c56Smiod
467*cf2f2c56Smiod(dni trapqfl "yield if dma queue full" (MACH2000 YIELD-INSN)
468*cf2f2c56Smiod     "trapqfl"
469*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) (f-rt 0) (f-rd 0) (f-shamt 0) (f-func 8))
470*cf2f2c56Smiod     (unimp trapqfl)
471*cf2f2c56Smiod     ())
472*cf2f2c56Smiod
473*cf2f2c56Smiod(dni trapqne "yield if dma queue not empty" (MACH2000 YIELD-INSN)
474*cf2f2c56Smiod     "trapqne"
475*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) (f-rt 0) (f-rd 0) (f-shamt 0) (f-func 9))
476*cf2f2c56Smiod     (unimp trapqne)
477*cf2f2c56Smiod     ())
478*cf2f2c56Smiod
479*cf2f2c56Smiod(dni traprel "traprel" (MACH2000 USES-RT YIELD-INSN)
480*cf2f2c56Smiod     "traprel $rt"
481*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) rt (f-rd 0) (f-shamt 0) (f-func 10))
482*cf2f2c56Smiod     (unimp traprel)
483*cf2f2c56Smiod     ())
484*cf2f2c56Smiod
485*cf2f2c56Smiod(dni wb "dma write bytes" (MACH2000 USES-RD USES-RT YIELD-INSN)
486*cf2f2c56Smiod     "wb $rd,$rt"
487*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 0))
488*cf2f2c56Smiod     (unimp wb)
489*cf2f2c56Smiod     ())
490*cf2f2c56Smiod
491*cf2f2c56Smiod(dni wbu "dma write bytes and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN)
492*cf2f2c56Smiod     "wbu $rd,$rt"
493*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 1))
494*cf2f2c56Smiod     (unimp wbu)
495*cf2f2c56Smiod     ())
496*cf2f2c56Smiod
497*cf2f2c56Smiod(dni wbr1 "dma write bytes using r1" (MACH2000 USES-RT YIELD-INSN)
498*cf2f2c56Smiod     "wbr1 $rt,$count"
499*cf2f2c56Smiod     (+ OP_COP3 (f-rs 16) rt count)
500*cf2f2c56Smiod     (unimp wbr1)
501*cf2f2c56Smiod     ())
502*cf2f2c56Smiod
503*cf2f2c56Smiod(dni wbr1u "dma write bytes using r1 and unlock" (MACH2000 USES-RT YIELD-INSN)
504*cf2f2c56Smiod     "wbr1u $rt,$count"
505*cf2f2c56Smiod     (+ OP_COP3 (f-rs 17) rt count)
506*cf2f2c56Smiod     (unimp wbr1u)
507*cf2f2c56Smiod     ())
508*cf2f2c56Smiod
509*cf2f2c56Smiod(dni wbr30 "dma write bytes using r30" (MACH2000 USES-RT YIELD-INSN)
510*cf2f2c56Smiod     "wbr30 $rt,$count"
511*cf2f2c56Smiod     (+ OP_COP3 (f-rs 18) rt count)
512*cf2f2c56Smiod     (unimp wbr30)
513*cf2f2c56Smiod     ())
514*cf2f2c56Smiod
515*cf2f2c56Smiod(dni wbr30u "dma write bytes using r30 and unlock" (MACH2000 USES-RT YIELD-INSN)
516*cf2f2c56Smiod     "wbr30u $rt,$count"
517*cf2f2c56Smiod     (+ OP_COP3 (f-rs 19) rt count)
518*cf2f2c56Smiod     (unimp wbr30u)
519*cf2f2c56Smiod     ())
520*cf2f2c56Smiod
521*cf2f2c56Smiod(dni wx "dma write word64s" (MACH2000 USES-RD USES-RT YIELD-INSN)
522*cf2f2c56Smiod     "wx $rd,$rt"
523*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 2))
524*cf2f2c56Smiod     (unimp wx)
525*cf2f2c56Smiod     ())
526*cf2f2c56Smiod
527*cf2f2c56Smiod(dni wxu "dma write word64s and unlock" (MACH2000 USES-RD USES-RT YIELD-INSN)
528*cf2f2c56Smiod     "wxu $rd,$rt"
529*cf2f2c56Smiod     (+ OP_COP3 (f-rs 1) rt rd (f-shamt 0) (f-func 3))
530*cf2f2c56Smiod     (unimp wxu)
531*cf2f2c56Smiod     ())
532*cf2f2c56Smiod
533*cf2f2c56Smiod(dni wxr1 "dma write word64s using r1" (MACH2000 USES-RT YIELD-INSN)
534*cf2f2c56Smiod     "wxr1 $rt,$count"
535*cf2f2c56Smiod     (+ OP_COP3 (f-rs 20) rt count)
536*cf2f2c56Smiod     (unimp wxr1)
537*cf2f2c56Smiod     ())
538*cf2f2c56Smiod
539*cf2f2c56Smiod(dni wxr1u "dma write word64s using r1 and unlock" (MACH2000 USES-RT YIELD-INSN)
540*cf2f2c56Smiod     "wxr1u $rt,$count"
541*cf2f2c56Smiod     (+ OP_COP3 (f-rs 21) rt count)
542*cf2f2c56Smiod     (unimp wxr1u)
543*cf2f2c56Smiod     ())
544*cf2f2c56Smiod
545*cf2f2c56Smiod(dni wxr30 "dma write word64s using r30" (MACH2000 USES-RT YIELD-INSN)
546*cf2f2c56Smiod     "wxr30 $rt,$count"
547*cf2f2c56Smiod     (+ OP_COP3 (f-rs 22) rt count)
548*cf2f2c56Smiod     (unimp wxr30)
549*cf2f2c56Smiod     ())
550*cf2f2c56Smiod
551*cf2f2c56Smiod(dni wxr30u "dma write word64s using r30 and unlock" (MACH2000 USES-RT YIELD-INSN)
552*cf2f2c56Smiod     "wxr30u $rt,$count"
553*cf2f2c56Smiod     (+ OP_COP3 (f-rs 23) rt count)
554*cf2f2c56Smiod     (unimp wxr30u)
555*cf2f2c56Smiod     ())
556*cf2f2c56Smiod
557*cf2f2c56Smiod
558*cf2f2c56Smiod; Load/Store instructions.
559*cf2f2c56Smiod
560*cf2f2c56Smiod(dni ldw "load double word" (MACH2000 EVEN-REG-NUM LOAD-DELAY USES-RT)
561*cf2f2c56Smiod     "ldw $rt,$lo16($base)"
562*cf2f2c56Smiod     (+ OP_LDW base rt lo16)
563*cf2f2c56Smiod     (sequence ((SI addr))
564*cf2f2c56Smiod	       (set addr (and (add base lo16) (inv 3)))
565*cf2f2c56Smiod	       (set (reg h-gr (add (ifield f-rt) 1)) (mem SI addr))
566*cf2f2c56Smiod	       (set rt (mem SI (add addr 4))))
567*cf2f2c56Smiod     ())
568*cf2f2c56Smiod
569*cf2f2c56Smiod(dni sdw "store double word" (MACH2000 EVEN-REG-NUM USES-RT)
570*cf2f2c56Smiod     "sdw $rt,$lo16($base)"
571*cf2f2c56Smiod     (+ OP_SDW base rt lo16)
572*cf2f2c56Smiod     (sequence ((SI addr))
573*cf2f2c56Smiod	       (set addr (and (add base lo16) (inv 3)))
574*cf2f2c56Smiod	       (set (mem SI (add addr 4)) rt)
575*cf2f2c56Smiod	       (set (mem SI addr) (reg h-gr (add (ifield f-rt) 1))))
576*cf2f2c56Smiod     ())
577*cf2f2c56Smiod
578*cf2f2c56Smiod
579*cf2f2c56Smiod; Jump instructions
580*cf2f2c56Smiod
581*cf2f2c56Smiod(dni j "jump" (MACH2000)
582*cf2f2c56Smiod     "j $jmptarg"
583*cf2f2c56Smiod     (+ OP_J (f-rsrvd 0) jmptarg)
584*cf2f2c56Smiod     (delay 1 (set pc jmptarg))
585*cf2f2c56Smiod     ())
586*cf2f2c56Smiod
587*cf2f2c56Smiod(dni jal "jump and link" (MACH2000 USES-R31)
588*cf2f2c56Smiod     "jal $jmptarg"
589*cf2f2c56Smiod     (+ OP_JAL (f-rsrvd 0) jmptarg)
590*cf2f2c56Smiod     (delay 1
591*cf2f2c56Smiod	    (sequence ()
592*cf2f2c56Smiod		      (set (reg h-gr 31) (add pc 8))
593*cf2f2c56Smiod		      (set pc jmptarg)))
594*cf2f2c56Smiod     ())
595*cf2f2c56Smiod
596*cf2f2c56Smiod(dni bmb "branch if matching byte-lane" (MACH2000 USES-RS USES-RT)
597*cf2f2c56Smiod     "bmb $rs,$rt,$offset"
598*cf2f2c56Smiod     (+ OP_BMB rs rt offset)
599*cf2f2c56Smiod     (sequence ((BI branch?))
600*cf2f2c56Smiod	       (set branch? 0)
601*cf2f2c56Smiod	       (if (eq (and rs #xFF) (and rt #xFF))
602*cf2f2c56Smiod		   (set branch? 1))
603*cf2f2c56Smiod	       (if (eq (and rs #xFF00) (and rt #xFF00))
604*cf2f2c56Smiod		   (set branch? 1))
605*cf2f2c56Smiod	       (if (eq (and rs #xFF0000) (and rt #xFF0000))
606*cf2f2c56Smiod		   (set branch? 1))
607*cf2f2c56Smiod	       (if (eq (and rs #xFF000000) (and rt #xFF000000))
608*cf2f2c56Smiod		   (set branch? 1))
609*cf2f2c56Smiod	       (if branch?
610*cf2f2c56Smiod		   (delay 1 (set pc offset))))
611*cf2f2c56Smiod     ())
612*cf2f2c56Smiod
613*cf2f2c56Smiod
614*cf2f2c56Smiod; Macros
615*cf2f2c56Smiod
616*cf2f2c56Smiod(dnmi ldw-base-0 "load double word - implied base 0" (MACH2000 EVEN-REG-NUM LOAD-DELAY USES-RT USES-RS NO-DIS)
617*cf2f2c56Smiod      "ldw $rt,$lo16"
618*cf2f2c56Smiod      (emit ldw rt lo16 (base 0))
619*cf2f2c56Smiod)
620*cf2f2c56Smiod
621*cf2f2c56Smiod(dnmi sdw-base-0 "store double word - implied base 0" (MACH2000 EVEN-REG-NUM USES-RT NO-DIS)
622*cf2f2c56Smiod      "sdw $rt,$lo16"
623*cf2f2c56Smiod      (emit sdw rt lo16 (base 0))
624*cf2f2c56Smiod)
625*cf2f2c56Smiod
626*cf2f2c56Smiod
627*cf2f2c56Smiod
628*cf2f2c56Smiod
629*cf2f2c56Smiod
630*cf2f2c56Smiod
631