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