xref: /netbsd-src/external/gpl3/gdb/dist/cpu/mep-c5.cpu (revision a2e2270fc5bff6bcbd2c81db532c53a470bd1be5)
1*a2e2270fSchristos; Copyright 2011 Free Software Foundation, Inc.
2*a2e2270fSchristos;
3*a2e2270fSchristos; Contributed by Red Hat Inc;
4*a2e2270fSchristos;
5*a2e2270fSchristos; This file is part of the GNU Binutils.
6*a2e2270fSchristos;
7*a2e2270fSchristos; This program is free software; you can redistribute it and/or modify
8*a2e2270fSchristos; it under the terms of the GNU General Public License as published by
9*a2e2270fSchristos; the Free Software Foundation; either version 3 of the License, or
10*a2e2270fSchristos; (at your option) any later version.
11*a2e2270fSchristos;
12*a2e2270fSchristos; This program is distributed in the hope that it will be useful,
13*a2e2270fSchristos; but WITHOUT ANY WARRANTY; without even the implied warranty of
14*a2e2270fSchristos; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*a2e2270fSchristos; GNU General Public License for more details.
16*a2e2270fSchristos;
17*a2e2270fSchristos; You should have received a copy of the GNU General Public License
18*a2e2270fSchristos; along with this program; if not, write to the Free Software
19*a2e2270fSchristos; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20*a2e2270fSchristos; MA 02110-1301, USA.
21*a2e2270fSchristos
22*a2e2270fSchristos; Insns introduced for the MeP-c5 core
23*a2e2270fSchristos;
24*a2e2270fSchristos
25*a2e2270fSchristos(dnf f-c5n4     "extended field"     (all-mep-core-isas)   16  4)
26*a2e2270fSchristos(dnf f-c5n5     "extended field"     (all-mep-core-isas)   20  4)
27*a2e2270fSchristos(dnf f-c5n6     "extended field"     (all-mep-core-isas)   24  4)
28*a2e2270fSchristos(dnf f-c5n7     "extended field"     (all-mep-core-isas)   28  4)
29*a2e2270fSchristos(dnf f-rl5      "register l c5"      (all-mep-core-isas)   20  4)
30*a2e2270fSchristos(df  f-12s20    "extended field"     (all-mep-core-isas)   20  12  INT #f #f)
31*a2e2270fSchristos
32*a2e2270fSchristos(dnop rl5       "register Rl c5"     (all-mep-core-isas) h-gpr   f-rl5)
33*a2e2270fSchristos(dnop cdisp12   "copro addend (12 bits)" (all-mep-core-isas) h-sint  f-12s20)
34*a2e2270fSchristos
35*a2e2270fSchristos(dnci stcb_r "store in control bus space" (VOLATILE (MACH c5))
36*a2e2270fSchristos     "stcb $rn,($rma)"
37*a2e2270fSchristos     (+ MAJ_7 rn rma (f-sub4 12))
38*a2e2270fSchristos     (c-call VOID "do_stcb" rn (and rma #xffff))
39*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rn))
40*a2e2270fSchristos	   (unit u-use-gpr (in usereg rma))
41*a2e2270fSchristos	   (unit u-exec)
42*a2e2270fSchristos	   (unit u-stcb))))
43*a2e2270fSchristos
44*a2e2270fSchristos(dnci ldcb_r "load from control bus space" (VOLATILE (MACH c5) (LATENCY 3))
45*a2e2270fSchristos     "ldcb $rn,($rma)"
46*a2e2270fSchristos     (+ MAJ_7 rn rma (f-sub4 13))
47*a2e2270fSchristos     (set rn (c-call SI "do_ldcb" (and rma #xffff)))
48*a2e2270fSchristos      ((mep (unit u-use-gpr (in usereg rma))
49*a2e2270fSchristos	    (unit u-ldcb)
50*a2e2270fSchristos	    (unit u-exec)
51*a2e2270fSchristos	    (unit u-ldcb-gpr (out loadreg rn)))))
52*a2e2270fSchristos
53*a2e2270fSchristos(dnci pref "cache prefetch" ((MACH c5) VOLATILE)
54*a2e2270fSchristos     "pref $cimm4,($rma)"
55*a2e2270fSchristos     (+ MAJ_7 cimm4 rma (f-sub4 5))
56*a2e2270fSchristos     (sequence ()
57*a2e2270fSchristos	       (c-call VOID "check_option_dcache" pc)
58*a2e2270fSchristos	       (c-call VOID "do_cache_prefetch" cimm4 rma pc))
59*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
60*a2e2270fSchristos	   (unit u-exec))))
61*a2e2270fSchristos
62*a2e2270fSchristos(dnci prefd "cache prefetch" ((MACH c5) VOLATILE)
63*a2e2270fSchristos     "pref $cimm4,$sdisp16($rma)"
64*a2e2270fSchristos     (+ MAJ_15 cimm4 rma (f-sub4 3) sdisp16)
65*a2e2270fSchristos     (sequence ()
66*a2e2270fSchristos	       (c-call VOID "check_option_dcache" pc)
67*a2e2270fSchristos	       (c-call VOID "do_cache_prefetch" cimm4 (add INT rma (ext SI sdisp16)) pc))
68*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
69*a2e2270fSchristos	   (unit u-exec))))
70*a2e2270fSchristos
71*a2e2270fSchristos(dnci casb3 "compare and swap byte 3" ((MACH c5) VOLATILE OPTIONAL_BIT_INSN)
72*a2e2270fSchristos      "casb3 $rl5,$rn,($rm)"
73*a2e2270fSchristos      (+ MAJ_15 rn rm (f-sub4 #x1) (f-c5n4 #x2) rl5 (f-c5n6 #x0) (f-c5n7 #x0))
74*a2e2270fSchristos      (sequence ()
75*a2e2270fSchristos		(c-call VOID "do_casb3" (index-of rl5) rn rm pc)
76*a2e2270fSchristos		(set rl5 rl5)
77*a2e2270fSchristos		)
78*a2e2270fSchristos      ((mep (unit u-use-gpr (in usereg rl5))
79*a2e2270fSchristos	    (unit u-load-gpr (out loadreg rl5))
80*a2e2270fSchristos	    (unit u-exec))))
81*a2e2270fSchristos
82*a2e2270fSchristos(dnci cash3 "compare and swap halfword 3" ((MACH c5) VOLATILE OPTIONAL_BIT_INSN)
83*a2e2270fSchristos      "cash3 $rl5,$rn,($rm)"
84*a2e2270fSchristos      (+ MAJ_15 rn rm (f-sub4 #x1) (f-c5n4 #x2) rl5 (f-c5n6 #x0) (f-c5n7 #x1))
85*a2e2270fSchristos      (sequence ()
86*a2e2270fSchristos		(c-call VOID "do_cash3" (index-of rl5) rn rm pc)
87*a2e2270fSchristos		(set rl5 rl5)
88*a2e2270fSchristos		)
89*a2e2270fSchristos      ((mep (unit u-use-gpr (in usereg rl5))
90*a2e2270fSchristos	    (unit u-load-gpr (out loadreg rl5))
91*a2e2270fSchristos	    (unit u-exec))))
92*a2e2270fSchristos
93*a2e2270fSchristos(dnci casw3 "compare and swap word 3" ((MACH c5) VOLATILE OPTIONAL_BIT_INSN)
94*a2e2270fSchristos      "casw3 $rl5,$rn,($rm)"
95*a2e2270fSchristos      (+ MAJ_15 rn rm (f-sub4 #x1) (f-c5n4 #x2) rl5 (f-c5n6 #x0) (f-c5n7 #x2))
96*a2e2270fSchristos      (sequence ()
97*a2e2270fSchristos		(c-call VOID "do_casw3" (index-of rl5) rn rm pc)
98*a2e2270fSchristos		(set rl5 rl5)
99*a2e2270fSchristos		)
100*a2e2270fSchristos      ((mep (unit u-use-gpr (in usereg rl5))
101*a2e2270fSchristos	    (unit u-load-gpr (out loadreg rl5))
102*a2e2270fSchristos	    (unit u-exec))))
103*a2e2270fSchristos
104*a2e2270fSchristos
105*a2e2270fSchristos
106*a2e2270fSchristos(dnci sbcp "store byte coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5))
107*a2e2270fSchristos     "sbcp $crn,$cdisp12($rma)"
108*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 0) cdisp12)
109*a2e2270fSchristos     (sequence ()
110*a2e2270fSchristos	       (c-call "check_option_cp" pc)
111*a2e2270fSchristos	       (c-call VOID "check_write_to_text" (add rma (ext SI cdisp12)))
112*a2e2270fSchristos	       (set (mem QI (add rma (ext SI cdisp12))) (and crn #xff)))
113*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
114*a2e2270fSchristos	   (unit u-exec))))
115*a2e2270fSchristos
116*a2e2270fSchristos(dnci lbcp "load byte coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5))
117*a2e2270fSchristos     "lbcp $crn,$cdisp12($rma)"
118*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 4) cdisp12)
119*a2e2270fSchristos     (sequence ()
120*a2e2270fSchristos	       (c-call "check_option_cp" pc)
121*a2e2270fSchristos	       (set crn (ext SI (mem QI (add rma (ext SI cdisp12))))))
122*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
123*a2e2270fSchristos	   (unit u-exec))))
124*a2e2270fSchristos
125*a2e2270fSchristos(dnci lbucp "load byte coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5))
126*a2e2270fSchristos     "lbucp $crn,$cdisp12($rma)"
127*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 12) cdisp12)
128*a2e2270fSchristos     (sequence ()
129*a2e2270fSchristos	       (c-call "check_option_cp" pc)
130*a2e2270fSchristos	       (set crn (zext SI (mem QI (add rma (ext SI cdisp12))))))
131*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
132*a2e2270fSchristos	   (unit u-exec))))
133*a2e2270fSchristos
134*a2e2270fSchristos
135*a2e2270fSchristos(dnci shcp "store half-word coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5))
136*a2e2270fSchristos     "shcp $crn,$cdisp12($rma)"
137*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 1) cdisp12)
138*a2e2270fSchristos     (sequence ()
139*a2e2270fSchristos	       (c-call "check_option_cp" pc)
140*a2e2270fSchristos	       (c-call VOID "check_write_to_text" (add rma (ext SI cdisp12)))
141*a2e2270fSchristos	       (set (mem HI (add rma (ext SI cdisp12))) (and crn #xffff)))
142*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
143*a2e2270fSchristos	   (unit u-exec))))
144*a2e2270fSchristos
145*a2e2270fSchristos(dnci lhcp "load half-word coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5))
146*a2e2270fSchristos     "lhcp $crn,$cdisp12($rma)"
147*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 5) cdisp12)
148*a2e2270fSchristos     (sequence ()
149*a2e2270fSchristos	       (c-call "check_option_cp" pc)
150*a2e2270fSchristos	       (set crn (ext SI (mem HI (add rma (ext SI cdisp12))))))
151*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
152*a2e2270fSchristos	   (unit u-exec))))
153*a2e2270fSchristos
154*a2e2270fSchristos(dnci lhucp "load half-word coprocessor" (OPTIONAL_CP_INSN (STALL STORE) (MACH c5))
155*a2e2270fSchristos     "lhucp $crn,$cdisp12($rma)"
156*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 6) (f-ext4 13) cdisp12)
157*a2e2270fSchristos     (sequence ()
158*a2e2270fSchristos	       (c-call "check_option_cp" pc)
159*a2e2270fSchristos	       (set crn (zext SI (mem HI (add rma (ext SI cdisp12))))))
160*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
161*a2e2270fSchristos	   (unit u-exec))))
162*a2e2270fSchristos
163*a2e2270fSchristos
164*a2e2270fSchristos(dnci lbucpa "load byte coprocessor" (OPTIONAL_CP_INSN (STALL LOAD) (MACH c5))
165*a2e2270fSchristos     "lbucpa $crn,($rma+),$cdisp10"
166*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xC) (f-ext62 #x0) cdisp10)
167*a2e2270fSchristos     (sequence ()
168*a2e2270fSchristos	       (c-call "check_option_cp" pc)
169*a2e2270fSchristos	       (set crn (zext SI (mem QI rma)))
170*a2e2270fSchristos	       (set rma (add rma cdisp10)))
171*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
172*a2e2270fSchristos	   (unit u-exec))))
173*a2e2270fSchristos
174*a2e2270fSchristos(dnci lhucpa "load half-word coprocessor" (OPTIONAL_CP_INSN (STALL LOAD) (MACH c5))
175*a2e2270fSchristos     "lhucpa $crn,($rma+),$cdisp10a2"
176*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xD) (f-ext62 #x0) cdisp10a2)
177*a2e2270fSchristos     (sequence ()
178*a2e2270fSchristos	       (c-call "check_option_cp" pc)
179*a2e2270fSchristos	       (set crn (zext SI (mem HI (and rma (inv SI 1)))))
180*a2e2270fSchristos	       (set rma (add rma (ext SI cdisp10a2))))
181*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
182*a2e2270fSchristos	   (unit u-exec))))
183*a2e2270fSchristos
184*a2e2270fSchristos(dnci lbucpm0 "lbucpm0" (OPTIONAL_CP_INSN (MACH c5))
185*a2e2270fSchristos     "lbucpm0 $crn,($rma+),$cdisp10"
186*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xc) (f-ext62 #x2) cdisp10)
187*a2e2270fSchristos     (sequence ()
188*a2e2270fSchristos	       (c-call "check_option_cp" pc)
189*a2e2270fSchristos	       (set crn (zext SI (mem QI rma)))
190*a2e2270fSchristos	       (set rma (mod0 cdisp10)))
191*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
192*a2e2270fSchristos	   (unit u-exec))))
193*a2e2270fSchristos
194*a2e2270fSchristos(dnci lhucpm0 "lhucpm0" (OPTIONAL_CP_INSN (MACH c5))
195*a2e2270fSchristos     "lhucpm0 $crn,($rma+),$cdisp10a2"
196*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xd) (f-ext62 #x2) cdisp10a2)
197*a2e2270fSchristos     (sequence ()
198*a2e2270fSchristos	       (c-call "check_option_cp" pc)
199*a2e2270fSchristos	       (set crn (zext SI (mem HI (and rma (inv SI 1)))))
200*a2e2270fSchristos	       (set rma (mod0 cdisp10a2)))
201*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
202*a2e2270fSchristos	   (unit u-exec))))
203*a2e2270fSchristos
204*a2e2270fSchristos(dnci lbucpm1 "lbucpm1" (OPTIONAL_CP_INSN (MACH c5))
205*a2e2270fSchristos     "lbucpm1 $crn,($rma+),$cdisp10"
206*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xc) (f-ext62 #x3) cdisp10)
207*a2e2270fSchristos     (sequence ()
208*a2e2270fSchristos	       (c-call "check_option_cp" pc)
209*a2e2270fSchristos	       (set crn (zext SI (mem QI rma)))
210*a2e2270fSchristos	       (set rma (mod1 cdisp10)))
211*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
212*a2e2270fSchristos	   (unit u-exec))))
213*a2e2270fSchristos
214*a2e2270fSchristos(dnci lhucpm1 "lhucpm1" (OPTIONAL_CP_INSN (MACH c5))
215*a2e2270fSchristos     "lhucpm1 $crn,($rma+),$cdisp10a2"
216*a2e2270fSchristos     (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #xd) (f-ext62 #x3) cdisp10a2)
217*a2e2270fSchristos     (sequence ()
218*a2e2270fSchristos	       (c-call "check_option_cp" pc)
219*a2e2270fSchristos	       (set crn (zext SI (mem HI (and rma (inv SI 1)))))
220*a2e2270fSchristos	       (set rma (mod1 cdisp10a2)))
221*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rma))
222*a2e2270fSchristos	   (unit u-exec))))
223*a2e2270fSchristos
224*a2e2270fSchristos(dnci uci "uci" ((MACH c5) VOLATILE)
225*a2e2270fSchristos     "uci $rn,$rm,$uimm16"
226*a2e2270fSchristos     (+ MAJ_15 rn rm (f-sub4 2) simm16)
227*a2e2270fSchristos     (set rn (c-call SI "do_UCI" rn rm (zext SI uimm16) pc))
228*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rm))
229*a2e2270fSchristos	   (unit u-use-gpr (in usereg rn))
230*a2e2270fSchristos	   (unit u-exec))))
231*a2e2270fSchristos
232*a2e2270fSchristos(dnf f-c5-rnm     "register n/m"              (all-mep-isas)    4  8)
233*a2e2270fSchristos(dnf f-c5-rm      "register m"              (all-mep-isas)    8  4)
234*a2e2270fSchristos(df  f-c5-16u16  "general 16-bit u-val"    (all-mep-isas) 16 16 UINT #f #f)
235*a2e2270fSchristos
236*a2e2270fSchristos(dnmf f-c5-rmuimm20 "20-bit immediate in Rm/Imm16" (all-mep-isas) UINT
237*a2e2270fSchristos      (f-c5-rm f-c5-16u16)
238*a2e2270fSchristos      (sequence () ; insert
239*a2e2270fSchristos		(set (ifield f-c5-rm)    (srl (ifield f-c5-rmuimm20) 16))
240*a2e2270fSchristos		(set (ifield f-c5-16u16) (and (ifield f-c5-rmuimm20) #xffff))
241*a2e2270fSchristos		)
242*a2e2270fSchristos      (sequence () ; extract
243*a2e2270fSchristos		(set (ifield f-c5-rmuimm20) (or (ifield f-c5-16u16)
244*a2e2270fSchristos						(sll (ifield f-c5-rm) 16)))
245*a2e2270fSchristos		)
246*a2e2270fSchristos      )
247*a2e2270fSchristos(dnop c5rmuimm20 "20-bit immediate in rm and imm16" (all-mep-core-isas) h-uint f-c5-rmuimm20)
248*a2e2270fSchristos
249*a2e2270fSchristos(dnmf f-c5-rnmuimm24 "24-bit immediate in Rm/Imm16" (all-mep-isas) UINT
250*a2e2270fSchristos      (f-c5-rnm f-c5-16u16)
251*a2e2270fSchristos      (sequence () ; insert
252*a2e2270fSchristos		(set (ifield f-c5-rnm)    (srl (ifield f-c5-rnmuimm24) 16))
253*a2e2270fSchristos		(set (ifield f-c5-16u16) (and (ifield f-c5-rnmuimm24) #xffff))
254*a2e2270fSchristos		)
255*a2e2270fSchristos      (sequence () ; extract
256*a2e2270fSchristos		(set (ifield f-c5-rnmuimm24) (or (ifield f-c5-16u16)
257*a2e2270fSchristos						(sll (ifield f-c5-rnm) 16)))
258*a2e2270fSchristos		)
259*a2e2270fSchristos      )
260*a2e2270fSchristos(dnop c5rnmuimm24 "24-bit immediate in rn, rm, and imm16" (all-mep-core-isas) h-uint f-c5-rnmuimm24)
261*a2e2270fSchristos
262*a2e2270fSchristos(dnci dsp "dsp" ((MACH c5) VOLATILE)
263*a2e2270fSchristos     "dsp $rn,$rm,$uimm16"
264*a2e2270fSchristos     (+ MAJ_15 rn rm (f-sub4 0) uimm16)
265*a2e2270fSchristos     (set rn (c-call SI "do_DSP" rn rm (zext SI uimm16) pc))
266*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rm))
267*a2e2270fSchristos	   (unit u-use-gpr (in usereg rn))
268*a2e2270fSchristos	   (unit u-exec))))
269*a2e2270fSchristos
270*a2e2270fSchristos(dnci dsp0 "dsp0" ((MACH c5) VOLATILE NO-DIS ALIAS)
271*a2e2270fSchristos     "dsp0 $c5rnmuimm24"
272*a2e2270fSchristos     (+ MAJ_15 c5rnmuimm24 (f-sub4 0))
273*a2e2270fSchristos     (c-call VOID "do_DSP" (zext SI c5rnmuimm24) pc)
274*a2e2270fSchristos     ((mep (unit u-exec))))
275*a2e2270fSchristos
276*a2e2270fSchristos(dnci dsp1 "dsp1" ((MACH c5) VOLATILE NO-DIS ALIAS)
277*a2e2270fSchristos     "dsp1 $rn,$c5rmuimm20"
278*a2e2270fSchristos     (+ MAJ_15 rn (f-sub4 0) c5rmuimm20)
279*a2e2270fSchristos     (set rn (c-call SI "do_DSP" rn (zext SI c5rmuimm20) pc))
280*a2e2270fSchristos     ((mep (unit u-use-gpr (in usereg rn))
281*a2e2270fSchristos	   (unit u-exec))))
282