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