1 |
24 |
khays |
; Hitachi SHmedia instruction set description. -*- Scheme -*-
|
2 |
|
|
;
|
3 |
|
|
; Copyright 2000, 2001, 2007, 2009 Free Software Foundation, Inc.
|
4 |
|
|
;
|
5 |
|
|
; Contributed by Red Hat Inc; developed under contract from Hitachi
|
6 |
|
|
; Semiconductor (America) Inc.
|
7 |
|
|
;
|
8 |
|
|
; This file is part of the GNU Binutils.
|
9 |
|
|
;
|
10 |
|
|
; This program is free software; you can redistribute it and/or modify
|
11 |
|
|
; it under the terms of the GNU General Public License as published by
|
12 |
|
|
; the Free Software Foundation; either version 3 of the License, or
|
13 |
|
|
; (at your option) any later version.
|
14 |
|
|
;
|
15 |
|
|
; This program is distributed in the hope that it will be useful,
|
16 |
|
|
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
; GNU General Public License for more details.
|
19 |
|
|
;
|
20 |
|
|
; You should have received a copy of the GNU General Public License
|
21 |
|
|
; along with this program; if not, write to the Free Software
|
22 |
|
|
; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
23 |
|
|
; MA 02110-1301, USA.
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
; dshmf -- define-normal-sh-media-field
|
27 |
|
|
|
28 |
|
|
(define-pmacro (dshmf xname xcomment ignored xstart xlength)
|
29 |
|
|
(dnf xname xcomment ((ISA media)) xstart xlength))
|
30 |
|
|
|
31 |
|
|
; dshmop -- define-normal-sh-media-operand
|
32 |
|
|
|
33 |
|
|
(define-pmacro (dshmop xname xcomment ignored xhardware xfield)
|
34 |
|
|
(dnop xname xcomment ((ISA media)) xhardware xfield))
|
35 |
|
|
|
36 |
|
|
; dnshmi -- define-normal-sh-media-insn
|
37 |
|
|
|
38 |
|
|
(define-pmacro (dshmi xname xcomment xattrs xsyntax xformat xsemantics)
|
39 |
|
|
(define-insn
|
40 |
|
|
(name xname)
|
41 |
|
|
(comment xcomment)
|
42 |
|
|
(.splice attrs (.unsplice xattrs) (ISA media))
|
43 |
|
|
(syntax xsyntax)
|
44 |
|
|
(format xformat)
|
45 |
|
|
(semantics xsemantics)))
|
46 |
|
|
|
47 |
|
|
; Saturation functions.
|
48 |
|
|
; Force a value `i' into words `n' bits wide.
|
49 |
|
|
; See Hitachi SH-5 CPU core, volume 2, p. 25 for details.
|
50 |
|
|
|
51 |
|
|
; saturate -- signed saturatation function
|
52 |
|
|
|
53 |
|
|
(define-pmacro (saturate mode n i)
|
54 |
|
|
(if mode (lt i (neg mode (sll mode 1 (sub n 1))))
|
55 |
|
|
(neg (sll mode 1 (sub n 1)))
|
56 |
|
|
(if mode (lt i (sll mode 1 (sub n 1)))
|
57 |
|
|
i
|
58 |
|
|
(sub mode (sll mode 1 (sub n 1)) 1))))
|
59 |
|
|
|
60 |
|
|
; usaturate -- unsigned saturation function
|
61 |
|
|
|
62 |
|
|
(define-pmacro (usaturate mode n i)
|
63 |
|
|
(if mode (lt i (const mode 0))
|
64 |
|
|
(const mode 0)
|
65 |
|
|
(if mode (lt i (sll mode 1 n))
|
66 |
|
|
i
|
67 |
|
|
(sub mode (sll mode 1 n) 1))))
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
; Ifields.
|
71 |
|
|
|
72 |
|
|
(dshmf f-op "Opcode" () 31 6)
|
73 |
|
|
(dshmf f-ext "Extension opcode" () 19 4)
|
74 |
|
|
(dshmf f-rsvd "Reserved" (RESERVED) 3 4)
|
75 |
|
|
|
76 |
|
|
(dshmf f-left "Left register" () 25 6)
|
77 |
|
|
(dshmf f-right "Right register" () 15 6)
|
78 |
|
|
(dshmf f-dest "Destination register" () 9 6)
|
79 |
|
|
|
80 |
|
|
(define-multi-ifield
|
81 |
|
|
(name f-left-right)
|
82 |
|
|
(comment "Left and right matched register pair")
|
83 |
|
|
(attrs (ISA media))
|
84 |
|
|
(mode UINT)
|
85 |
|
|
(subfields f-left f-right)
|
86 |
|
|
(insert (sequence ()
|
87 |
|
|
(set (ifield f-left)
|
88 |
|
|
(and (ifield f-left-right) 63))
|
89 |
|
|
(set (ifield f-right)
|
90 |
|
|
(and (ifield f-left-right) 63))))
|
91 |
|
|
(extract (set (ifield f-left-right) (ifield f-left)))
|
92 |
|
|
)
|
93 |
|
|
|
94 |
|
|
(dshmf f-tra "Target register" () 6 3)
|
95 |
|
|
(dshmf f-trb "Target register" () 22 3)
|
96 |
|
|
(dshmf f-likely "Likely bit" () 9 1)
|
97 |
|
|
(dshmf f-25 "Three unused bits at bit 25" () 25 3)
|
98 |
|
|
(dshmf f-8-2 "Two unused bits at bit 8" () 8 2)
|
99 |
|
|
|
100 |
|
|
(df f-imm6 "Immediate value (6 bits)" ((ISA media)) 15 6 INT #f #f)
|
101 |
|
|
(df f-imm10 "Immediate value (10 bits)" ((ISA media)) 19 10 INT #f #f)
|
102 |
|
|
(df f-imm16 "Immediate value (16 bits)" ((ISA media)) 25 16 INT #f #f)
|
103 |
|
|
|
104 |
|
|
(dshmf f-uimm6 "Immediate value (6 bits)" () 15 6)
|
105 |
|
|
(dshmf f-uimm16 "Immediate value (16 bits)" () 25 16)
|
106 |
|
|
|
107 |
|
|
; Various displacement fields.
|
108 |
|
|
; The 10 bit field, for example, has different scaling for displacements.
|
109 |
|
|
|
110 |
|
|
(df f-disp6 "Displacement (6 bits)" ((ISA media)) 15 6 INT #f #f)
|
111 |
|
|
|
112 |
|
|
(df f-disp6x32 "Displacement (6 bits)" ((ISA media)) 15 6 INT
|
113 |
|
|
((value pc) (sra SI value 5))
|
114 |
|
|
((value pc) (sll SI value 5)))
|
115 |
|
|
|
116 |
|
|
(df f-disp10 "Displacement (10 bits)" ((ISA media)) 19 10 INT #f #f)
|
117 |
|
|
|
118 |
|
|
(df f-disp10x8 "Displacement (10 bits)" ((ISA media)) 19 10 INT
|
119 |
|
|
((value pc) (sra SI value 3))
|
120 |
|
|
((value pc) (sll SI value 3)))
|
121 |
|
|
|
122 |
|
|
(df f-disp10x4 "Displacement (10 bits)" ((ISA media)) 19 10 INT
|
123 |
|
|
((value pc) (sra SI value 2))
|
124 |
|
|
((value pc) (sll SI value 2)))
|
125 |
|
|
|
126 |
|
|
(df f-disp10x2 "Displacement (10 bits)" ((ISA media)) 19 10 INT
|
127 |
|
|
((value pc) (sra SI value 1))
|
128 |
|
|
((value pc) (sll SI value 1)))
|
129 |
|
|
|
130 |
|
|
(df f-disp16 "Displacement (16 bits)" ((ISA media) PCREL-ADDR) 25 16 INT
|
131 |
|
|
((value pc) (sra DI value 2))
|
132 |
|
|
((value pc) (add DI (sll DI value 2) pc)))
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
; Operands.
|
136 |
|
|
|
137 |
|
|
(dshmop rm "Left general purpose reg" () h-gr f-left)
|
138 |
|
|
(dshmop rn "Right general purpose reg" () h-gr f-right)
|
139 |
|
|
(dshmop rd "Destination general purpose reg" () h-gr f-dest)
|
140 |
|
|
|
141 |
|
|
(dshmop frg "Left single precision register" () h-fr f-left)
|
142 |
|
|
(dshmop frh "Right single precision register" () h-fr f-right)
|
143 |
|
|
(dshmop frf "Destination single precision reg" () h-fr f-dest)
|
144 |
|
|
(dshmop frgh "Single precision register pair" () h-fr f-left-right)
|
145 |
|
|
|
146 |
|
|
(dshmop fpf "Pair of single precision registers" () h-fp f-dest)
|
147 |
|
|
|
148 |
|
|
(dshmop fvg "Left single precision vector" () h-fv f-left)
|
149 |
|
|
(dshmop fvh "Right single precision vector" () h-fv f-right)
|
150 |
|
|
(dshmop fvf "Destination single precision vector" () h-fv f-dest)
|
151 |
|
|
(dshmop mtrxg "Left single precision matrix" () h-fmtx f-left)
|
152 |
|
|
|
153 |
|
|
(dshmop drg "Left double precision register" () h-dr f-left)
|
154 |
|
|
(dshmop drh "Right double precision register" () h-dr f-right)
|
155 |
|
|
(dshmop drf "Destination double precision reg" () h-dr f-dest)
|
156 |
|
|
(dshmop drgh "Double precision register pair" () h-dr f-left-right)
|
157 |
|
|
|
158 |
|
|
(dshmop fpscr "Floating point status register" () h-fpscr f-nil)
|
159 |
|
|
(dshmop crj "Control register j" () h-cr f-dest)
|
160 |
|
|
(dshmop crk "Control register k" () h-cr f-left)
|
161 |
|
|
|
162 |
|
|
(dshmop tra "Target register a" () h-tr f-tra)
|
163 |
|
|
(dshmop trb "Target register b" () h-tr f-trb)
|
164 |
|
|
|
165 |
|
|
(dshmop disp6 "Displacement (6 bits)" () h-sint f-disp6)
|
166 |
|
|
(dshmop disp6x32 "Displacement (6 bits, scale 32)" () h-sint f-disp6x32)
|
167 |
|
|
(dshmop disp10 "Displacement (10 bits)" () h-sint f-disp10)
|
168 |
|
|
(dshmop disp10x2 "Displacement (10 bits, scale 2)" () h-sint f-disp10x2)
|
169 |
|
|
(dshmop disp10x4 "Displacement (10 bits, scale 4)" () h-sint f-disp10x4)
|
170 |
|
|
(dshmop disp10x8 "Displacement (10 bits, scale 8)" () h-sint f-disp10x8)
|
171 |
|
|
(dshmop disp16 "Displacement (16 bits)" () h-sint f-disp16)
|
172 |
|
|
|
173 |
|
|
(dshmop imm6 "Immediate (6 bits)" () h-sint f-imm6)
|
174 |
|
|
(dshmop imm10 "Immediate (10 bits)" () h-sint f-imm10)
|
175 |
|
|
(dshmop imm16 "Immediate (16 bits)" () h-sint f-imm16)
|
176 |
|
|
(dshmop uimm6 "Immediate (6 bits)" () h-uint f-uimm6)
|
177 |
|
|
(dshmop uimm16 "Unsigned immediate (16 bits)" () h-uint f-uimm16)
|
178 |
|
|
|
179 |
|
|
; FIXME: provide these parse/print functions in `sh-media.opc'.
|
180 |
|
|
|
181 |
|
|
(define-operand (name likely) (comment "Likely branch?") (attrs (ISA media))
|
182 |
|
|
(type h-uint) (index f-likely) (handlers (parse "likely") (print "likely")))
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
; Instructions.
|
186 |
|
|
|
187 |
|
|
(dshmi add "Add"
|
188 |
|
|
()
|
189 |
|
|
"add $rm, $rn, $rd"
|
190 |
|
|
(+ (f-op 0) rm (f-ext 9) rn rd (f-rsvd 0))
|
191 |
|
|
(set rd (add rm rn)))
|
192 |
|
|
|
193 |
|
|
(dshmi addl "Add long"
|
194 |
|
|
()
|
195 |
|
|
"add.l $rm, $rn, $rd"
|
196 |
|
|
(+ (f-op 0) rm (f-ext 8) rn rd (f-rsvd 0))
|
197 |
|
|
(set rd (add (subword SI rm 1) (subword SI rn 1))))
|
198 |
|
|
|
199 |
|
|
(dshmi addi "Add immediate"
|
200 |
|
|
()
|
201 |
|
|
"addi $rm, $disp10, $rd"
|
202 |
|
|
(+ (f-op 52) rm disp10 rd (f-rsvd 0))
|
203 |
|
|
(set rd (add rm (ext DI disp10))))
|
204 |
|
|
|
205 |
|
|
(dshmi addil "Add immediate long"
|
206 |
|
|
()
|
207 |
|
|
"addi.l $rm, $disp10, $rd"
|
208 |
|
|
(+ (f-op 53) rm disp10 rd (f-rsvd 0))
|
209 |
|
|
(set rd (ext DI (add (ext SI disp10) (subword SI rm 1)))))
|
210 |
|
|
|
211 |
|
|
(dshmi addzl "Add zero extended long"
|
212 |
|
|
()
|
213 |
|
|
"addz.l $rm, $rn, $rd"
|
214 |
|
|
(+ (f-op 0) rm (f-ext 12) rn rd (f-rsvd 0))
|
215 |
|
|
(set rd (zext DI (add (subword SI rm 1) (subword SI rn 1)))))
|
216 |
|
|
|
217 |
|
|
(dshmi alloco "Allocate operand cache block"
|
218 |
|
|
()
|
219 |
|
|
"alloco $rm, $disp6x32"
|
220 |
|
|
(+ (f-op 56) rm (f-ext 4) disp6x32 (f-dest 63) (f-rsvd 0))
|
221 |
|
|
(unimp "alloco"))
|
222 |
|
|
|
223 |
|
|
(dshmi and "AND"
|
224 |
|
|
()
|
225 |
|
|
"and $rm, $rn, $rd"
|
226 |
|
|
(+ (f-op 1) rm (f-ext 11) rn rd (f-rsvd 0))
|
227 |
|
|
(set rd (and rm rn)))
|
228 |
|
|
|
229 |
|
|
(dshmi andc "AND complement"
|
230 |
|
|
()
|
231 |
|
|
"andc $rm, $rn, $rd"
|
232 |
|
|
(+ (f-op 1) rm (f-ext 15) rn rd (f-rsvd 0))
|
233 |
|
|
(set rd (and rm (inv rn))))
|
234 |
|
|
|
235 |
|
|
(dshmi andi "AND immediate"
|
236 |
|
|
()
|
237 |
|
|
"andi $rm, $disp10, $rd"
|
238 |
|
|
(+ (f-op 54) rm disp10 rd (f-rsvd 0))
|
239 |
|
|
(set rd (and rm (ext DI disp10))))
|
240 |
|
|
|
241 |
|
|
(dshmi beq "Branch if equal"
|
242 |
|
|
()
|
243 |
|
|
"beq$likely $rm, $rn, $tra"
|
244 |
|
|
(+ (f-op 25) rm (f-ext 1) rn likely (f-8-2 0) tra (f-rsvd 0))
|
245 |
|
|
(if (eq rm rn)
|
246 |
|
|
(set pc tra)))
|
247 |
|
|
|
248 |
|
|
(dshmi beqi "Branch if equal immediate"
|
249 |
|
|
()
|
250 |
|
|
"beqi$likely $rm, $imm6, $tra"
|
251 |
|
|
(+ (f-op 57) rm (f-ext 1) imm6 likely (f-8-2 0) tra (f-rsvd 0))
|
252 |
|
|
(if (eq rm (ext DI imm6))
|
253 |
|
|
(set pc tra)))
|
254 |
|
|
|
255 |
|
|
(dshmi bge "Branch if greater than or equal"
|
256 |
|
|
()
|
257 |
|
|
"bge$likely $rm, $rn, $tra"
|
258 |
|
|
(+ (f-op 25) rm (f-ext 3) rn likely (f-8-2 0) tra (f-rsvd 0))
|
259 |
|
|
(if (ge rm rn)
|
260 |
|
|
(set pc tra)))
|
261 |
|
|
|
262 |
|
|
(dshmi bgeu "Branch if greater than or equal (unsigned comparison)"
|
263 |
|
|
()
|
264 |
|
|
"bgeu$likely $rm, $rn, $tra"
|
265 |
|
|
(+ (f-op 25) rm (f-ext 11) rn likely (f-8-2 0) tra (f-rsvd 0))
|
266 |
|
|
(if (geu rm rn)
|
267 |
|
|
(set pc tra)))
|
268 |
|
|
|
269 |
|
|
(dshmi bgt "Branch greater than"
|
270 |
|
|
()
|
271 |
|
|
"bgt$likely $rm, $rn, $tra"
|
272 |
|
|
(+ (f-op 25) rm (f-ext 7) rn likely (f-8-2 0) tra (f-rsvd 0))
|
273 |
|
|
(if (gt rm rn)
|
274 |
|
|
(set pc tra)))
|
275 |
|
|
|
276 |
|
|
(dshmi bgtu "Branch greater than (unsigned comparison)"
|
277 |
|
|
()
|
278 |
|
|
"bgtu$likely $rm, $rn, $tra"
|
279 |
|
|
(+ (f-op 25) rm (f-ext 15) rn likely (f-8-2 0) tra (f-rsvd 0))
|
280 |
|
|
(if (gtu rm rn)
|
281 |
|
|
(set pc tra)))
|
282 |
|
|
|
283 |
|
|
(dshmi blink "Branch and link"
|
284 |
|
|
()
|
285 |
|
|
"blink $trb, $rd"
|
286 |
|
|
(+ (f-op 17) (f-25 0) trb (f-ext 1) (f-right 63) rd (f-rsvd 0))
|
287 |
|
|
(sequence ()
|
288 |
|
|
(set rd (or (add pc 4) 1))
|
289 |
|
|
(set pc trb)))
|
290 |
|
|
|
291 |
|
|
(dshmi bne "Branch if not equal"
|
292 |
|
|
()
|
293 |
|
|
"bne$likely $rm, $rn, $tra"
|
294 |
|
|
(+ (f-op 25) rm (f-ext 5) rn likely (f-8-2 0) tra (f-rsvd 0))
|
295 |
|
|
(if (ne rm rn)
|
296 |
|
|
(set pc tra)))
|
297 |
|
|
|
298 |
|
|
(dshmi bnei "Branch if not equal immediate"
|
299 |
|
|
()
|
300 |
|
|
"bnei$likely $rm, $imm6, $tra"
|
301 |
|
|
(+ (f-op 57) rm (f-ext 5) rn likely (f-8-2 0) tra (f-rsvd 0))
|
302 |
|
|
(if (ne rm (ext DI imm6))
|
303 |
|
|
(set pc tra)))
|
304 |
|
|
|
305 |
|
|
(dshmi brk "Breakpoint instruction"
|
306 |
|
|
()
|
307 |
|
|
"brk"
|
308 |
|
|
(+ (f-op 27) (f-left 63) (f-ext 5) (f-right 63) (f-dest 63) (f-rsvd 0))
|
309 |
|
|
(c-call "sh64_break" pc))
|
310 |
|
|
|
311 |
|
|
(define-pmacro (-byterev-step)
|
312 |
|
|
(sequence ()
|
313 |
|
|
(set result (or (sll result 8) (and source 255)))
|
314 |
|
|
(set source (srl source 8)))
|
315 |
|
|
)
|
316 |
|
|
|
317 |
|
|
(dshmi byterev "Byte reverse"
|
318 |
|
|
()
|
319 |
|
|
"byterev $rm, $rd"
|
320 |
|
|
(+ (f-op 0) rm (f-ext 15) (f-right 63) rd (f-rsvd 0))
|
321 |
|
|
(sequence ((DI source) (DI result))
|
322 |
|
|
(set source rm)
|
323 |
|
|
(set result 0)
|
324 |
|
|
(-byterev-step)
|
325 |
|
|
(-byterev-step)
|
326 |
|
|
(-byterev-step)
|
327 |
|
|
(-byterev-step)
|
328 |
|
|
(-byterev-step)
|
329 |
|
|
(-byterev-step)
|
330 |
|
|
(-byterev-step)
|
331 |
|
|
(-byterev-step)
|
332 |
|
|
(set rd result)))
|
333 |
|
|
|
334 |
|
|
(dshmi cmpeq "Compare equal"
|
335 |
|
|
()
|
336 |
|
|
"cmpeq $rm, $rn, $rd"
|
337 |
|
|
(+ (f-op 0) rm (f-ext 1) rn rd (f-rsvd 0))
|
338 |
|
|
(set rd (if DI (eq rm rn) 1 0)))
|
339 |
|
|
|
340 |
|
|
(dshmi cmpgt "Compare greater than"
|
341 |
|
|
()
|
342 |
|
|
"cmpgt $rm, $rn, $rd"
|
343 |
|
|
(+ (f-op 0) rm (f-ext 3) rn rd (f-rsvd 0))
|
344 |
|
|
(set rd (if DI (gt rm rn) 1 0)))
|
345 |
|
|
|
346 |
|
|
(dshmi cmpgtu "Compare greater than (unsigned comparison)"
|
347 |
|
|
()
|
348 |
|
|
"cmpgtu $rm,$rn, $rd"
|
349 |
|
|
(+ (f-op 0) rm (f-ext 7) rn rd (f-rsvd 0))
|
350 |
|
|
(set rd (if DI (gtu rm rn) 1 0)))
|
351 |
|
|
|
352 |
|
|
(dshmi cmveq "Conditional move if equal to zero"
|
353 |
|
|
()
|
354 |
|
|
"cmveq $rm, $rn, $rd"
|
355 |
|
|
(+ (f-op 8) rm (f-ext 1) rn rd (f-rsvd 0))
|
356 |
|
|
(if (eq rm 0)
|
357 |
|
|
(set rd rn)))
|
358 |
|
|
|
359 |
|
|
(dshmi cmvne "Conditional move if not equal to zero"
|
360 |
|
|
()
|
361 |
|
|
"cmvne $rm, $rn, $rd"
|
362 |
|
|
(+ (f-op 8) rm (f-ext 5) rn rd (f-rsvd 0))
|
363 |
|
|
(if (ne rm 0)
|
364 |
|
|
(set rd rn)))
|
365 |
|
|
|
366 |
|
|
(dshmi fabsd "Floating point absolute (double)"
|
367 |
|
|
()
|
368 |
|
|
"fabs.d $drgh, $drf"
|
369 |
|
|
(+ (f-op 6) drgh (f-ext 1) drf (f-rsvd 0))
|
370 |
|
|
(set drf (c-call DF "sh64_fabsd" drgh)))
|
371 |
|
|
|
372 |
|
|
(dshmi fabss "Floating point absolute (single)"
|
373 |
|
|
()
|
374 |
|
|
"fabs.s $frgh, $frf"
|
375 |
|
|
(+ (f-op 6) frgh (f-ext 0) frf (f-rsvd 0))
|
376 |
|
|
(set frf (c-call SF "sh64_fabss" frgh)))
|
377 |
|
|
|
378 |
|
|
(dshmi faddd "Floating point add (double)"
|
379 |
|
|
()
|
380 |
|
|
"fadd.d $drg, $drh, $drf"
|
381 |
|
|
(+ (f-op 13) drg (f-ext 1) drh drf (f-rsvd 0))
|
382 |
|
|
(set drf (c-call DF "sh64_faddd" drg drh)))
|
383 |
|
|
|
384 |
|
|
(dshmi fadds "Floating point add (single)"
|
385 |
|
|
()
|
386 |
|
|
"fadd.s $frg, $frh, $frf"
|
387 |
|
|
(+ (f-op 13) frg (f-ext 0) frh frf (f-rsvd 0))
|
388 |
|
|
(set frf (c-call SF "sh64_fadds" frg frh)))
|
389 |
|
|
|
390 |
|
|
(dshmi fcmpeqd "Floating point compare if equal (double)"
|
391 |
|
|
()
|
392 |
|
|
"fcmpeq.d $drg, $drh, $rd"
|
393 |
|
|
(+ (f-op 12) drg (f-ext 9) drh rd (f-rsvd 0))
|
394 |
|
|
(set rd (zext DI (c-call BI "sh64_fcmpeqd" drg drh))))
|
395 |
|
|
|
396 |
|
|
(dshmi fcmpeqs "Floating point compare if equal (single)"
|
397 |
|
|
()
|
398 |
|
|
"fcmpeq.s $frg, $frh, $rd"
|
399 |
|
|
(+ (f-op 12) frg (f-ext 8) frh rd (f-rsvd 0))
|
400 |
|
|
(set rd (zext DI (c-call BI "sh64_fcmpeqs" frg frh))))
|
401 |
|
|
|
402 |
|
|
(dshmi fcmpged "Floating compare compare if greater than or equal (double)"
|
403 |
|
|
()
|
404 |
|
|
"fcmpge.d $drg, $drh, $rd"
|
405 |
|
|
(+ (f-op 12) drg (f-ext 15) drh rd (f-rsvd 0))
|
406 |
|
|
(set rd (zext DI (c-call BI "sh64_fcmpged" drg drh))))
|
407 |
|
|
|
408 |
|
|
(dshmi fcmpges "Floating point compare if greater than or equal (single)"
|
409 |
|
|
()
|
410 |
|
|
"fcmpge.s $frg, $frh, $rd"
|
411 |
|
|
(+ (f-op 12) frg (f-ext 14) frh rd (f-rsvd 0))
|
412 |
|
|
(set rd (zext DI (c-call BI "sh64_fcmpges" frg frh))))
|
413 |
|
|
|
414 |
|
|
(dshmi fcmpgtd "Floating point compare if greater than (double)"
|
415 |
|
|
()
|
416 |
|
|
"fcmpgt.d $drg, $drh, $rd"
|
417 |
|
|
(+ (f-op 12) drg (f-ext 13) drh rd (f-rsvd 0))
|
418 |
|
|
(set rd (zext DI (c-call BI "sh64_fcmpgtd" drg drh))))
|
419 |
|
|
|
420 |
|
|
(dshmi fcmpgts "Floating point compare if greater than (single)"
|
421 |
|
|
()
|
422 |
|
|
"fcmpgt.s $frg, $frh, $rd"
|
423 |
|
|
(+ (f-op 12) frg (f-ext 12) frh rd (f-rsvd 0))
|
424 |
|
|
(set rd (zext DI (c-call BI "sh64_fcmpgts" frg frh))))
|
425 |
|
|
|
426 |
|
|
(dshmi fcmpund "Floating point unordered comparison (double)"
|
427 |
|
|
()
|
428 |
|
|
"fcmpun.d $drg, $drh, $rd"
|
429 |
|
|
(+ (f-op 12) drg (f-ext 11) drh rd (f-rsvd 0))
|
430 |
|
|
(set rd (zext DI (c-call BI "sh64_fcmpund" drg drh))))
|
431 |
|
|
|
432 |
|
|
(dshmi fcmpuns "Floating point unordered comparison (single)"
|
433 |
|
|
()
|
434 |
|
|
"fcmpun.s $frg, $frh, $rd"
|
435 |
|
|
(+ (f-op 12) frg (f-ext 10) frh rd (f-rsvd 0))
|
436 |
|
|
(set rd (zext DI (c-call BI "sh64_fcmpuns" frg frh))))
|
437 |
|
|
|
438 |
|
|
(dshmi fcnvds "Floating point coversion (double to single)"
|
439 |
|
|
()
|
440 |
|
|
"fcnv.ds $drgh, $frf"
|
441 |
|
|
(+ (f-op 14) drgh (f-ext 7) frf (f-rsvd 0))
|
442 |
|
|
(set frf (c-call SF "sh64_fcnvds" drgh)))
|
443 |
|
|
|
444 |
|
|
(dshmi fcnvsd "Floating point conversion (single to double)"
|
445 |
|
|
()
|
446 |
|
|
"fcnv.sd $frgh, $drf"
|
447 |
|
|
(+ (f-op 14) frgh (f-ext 6) drf (f-rsvd 0))
|
448 |
|
|
(set drf (c-call DF "sh64_fcnvsd" frgh)))
|
449 |
|
|
|
450 |
|
|
(dshmi fdivd "Floating point divide (double)"
|
451 |
|
|
()
|
452 |
|
|
"fdiv.d $drg, $drh, $drf"
|
453 |
|
|
(+ (f-op 13) drg (f-ext 5) drh drf (f-rsvd 0))
|
454 |
|
|
(set drf (c-call DF "sh64_fdivd" drg drh)))
|
455 |
|
|
|
456 |
|
|
(dshmi fdivs "Floating point divide (single)"
|
457 |
|
|
()
|
458 |
|
|
"fdiv.s $frg, $frh, $frf"
|
459 |
|
|
(+ (f-op 13) frg (f-ext 4) frh frf (f-rsvd 0))
|
460 |
|
|
(set frf (c-call SF "sh64_fdivs" frg frh)))
|
461 |
|
|
|
462 |
|
|
(dshmi fgetscr "Floating point get from FPSCR"
|
463 |
|
|
()
|
464 |
|
|
"fgetscr $frf"
|
465 |
|
|
(+ (f-op 7) (f-left 63) (f-ext 2) (f-right 63) frf (f-rsvd 0))
|
466 |
|
|
(unimp "fputscr"))
|
467 |
|
|
; FIXME: this should work!
|
468 |
|
|
; (set frf fpscr))
|
469 |
|
|
|
470 |
|
|
(dshmi fiprs "Floating point inner product (single)"
|
471 |
|
|
()
|
472 |
|
|
"fipr.s $fvg, $fvh, $frf"
|
473 |
|
|
(+ (f-op 5) fvg (f-ext 6) fvh frf (f-rsvd 0))
|
474 |
|
|
(sequence ((UQI g) (UQI h) (SF temp))
|
475 |
|
|
(set g (index-of fvg))
|
476 |
|
|
(set h (index-of fvh))
|
477 |
|
|
(set temp (c-call SF "sh64_fmuls" (reg h-fr g) (reg h-fr h)))
|
478 |
|
|
(set temp (c-call SF "sh64_fadds" temp
|
479 |
|
|
(c-call SF "sh64_fmuls" (reg h-fr (add g 1)) (reg h-fr (add h 1)))))
|
480 |
|
|
(set temp (c-call SF "sh64_fadds" temp
|
481 |
|
|
(c-call SF "sh64_fmuls" (reg h-fr (add g 2)) (reg h-fr (add h 2)))))
|
482 |
|
|
(set temp (c-call SF "sh64_fadds" temp
|
483 |
|
|
(c-call SF "sh64_fmuls" (reg h-fr (add g 3)) (reg h-fr (add h 3)))))
|
484 |
|
|
(set frf temp)))
|
485 |
|
|
|
486 |
|
|
(dshmi fldd "Floating point load (double)"
|
487 |
|
|
()
|
488 |
|
|
"fld.d $rm, $disp10x8, $drf"
|
489 |
|
|
(+ (f-op 39) rm disp10x8 drf (f-rsvd 0))
|
490 |
|
|
(set drf (mem DF (add rm disp10x8))))
|
491 |
|
|
|
492 |
|
|
(dshmi fldp "Floating point load (pair of singles)"
|
493 |
|
|
()
|
494 |
|
|
"fld.p $rm, $disp10x8, $fpf"
|
495 |
|
|
(+ (f-op 38) rm disp10x8 fpf (f-rsvd 0))
|
496 |
|
|
(sequence ((QI f))
|
497 |
|
|
(set f (index-of fpf))
|
498 |
|
|
(set (reg h-fr f) (mem SF (add rm disp10x8)))
|
499 |
|
|
(set (reg h-fr (add f 1)) (mem SF (add rm (add disp10x8 4))))))
|
500 |
|
|
|
501 |
|
|
(dshmi flds "Floating point load (single)"
|
502 |
|
|
()
|
503 |
|
|
"fld.s $rm, $disp10x4, $frf"
|
504 |
|
|
(+ (f-op 37) rm disp10x4 frf (f-rsvd 0))
|
505 |
|
|
(set frf (mem SF (add rm disp10x4))))
|
506 |
|
|
|
507 |
|
|
(dshmi fldxd "Floating point extended load (double)"
|
508 |
|
|
()
|
509 |
|
|
"fldx.d $rm, $rn, $drf"
|
510 |
|
|
(+ (f-op 7) rm (f-ext 9) rn frf (f-rsvd 0))
|
511 |
|
|
(set drf (mem DF (add rm rn))))
|
512 |
|
|
|
513 |
|
|
(dshmi fldxp "Floating point extended load (pair of singles)"
|
514 |
|
|
()
|
515 |
|
|
"fldx.p $rm, $rn, $fpf"
|
516 |
|
|
(+ (f-op 7) rm (f-ext 13) rn fpf (f-rsvd 0))
|
517 |
|
|
(sequence ((QI f))
|
518 |
|
|
(set f (index-of fpf))
|
519 |
|
|
(set (reg h-fr f) (mem SF (add rm rn)))
|
520 |
|
|
(set (reg h-fr (add f 1)) (mem SF (add rm (add rn 4))))))
|
521 |
|
|
|
522 |
|
|
(dshmi fldxs "Floating point extended load (single)"
|
523 |
|
|
()
|
524 |
|
|
"fldx.s $rm, $rn, $frf"
|
525 |
|
|
(+ (f-op 7) rm (f-ext 8) rn frf (f-rsvd 0))
|
526 |
|
|
(set frf (mem SF (add rm rn))))
|
527 |
|
|
|
528 |
|
|
(dshmi floatld "Floating point conversion (long to double)"
|
529 |
|
|
()
|
530 |
|
|
"float.ld $frgh, $drf"
|
531 |
|
|
(+ (f-op 14) frgh (f-ext 14) drf (f-rsvd 0))
|
532 |
|
|
(set drf (c-call DF "sh64_floatld" frgh)))
|
533 |
|
|
|
534 |
|
|
(dshmi floatls "Floating point conversion (long to single)"
|
535 |
|
|
()
|
536 |
|
|
"float.ls $frgh, $frf"
|
537 |
|
|
(+ (f-op 14) frgh (f-ext 12) frf (f-rsvd 0))
|
538 |
|
|
(set frf (c-call SF "sh64_floatls" frgh)))
|
539 |
|
|
|
540 |
|
|
(dshmi floatqd "Floating point conversion (quad to double)"
|
541 |
|
|
()
|
542 |
|
|
"float.qd $drgh, $drf"
|
543 |
|
|
(+ (f-op 14) drgh (f-ext 13) drf (f-rsvd 0))
|
544 |
|
|
(set drf (c-call DF "sh64_floatqd" drgh)))
|
545 |
|
|
|
546 |
|
|
(dshmi floatqs "Floating point conversion (quad to single)"
|
547 |
|
|
()
|
548 |
|
|
"float.qs $drgh, $frf"
|
549 |
|
|
(+ (f-op 14) drgh (f-ext 15) frf (f-rsvd 0))
|
550 |
|
|
(set frf (c-call SF "sh64_floatqs" drgh)))
|
551 |
|
|
|
552 |
|
|
(dshmi fmacs "Floating point multiply and accumulate (single)"
|
553 |
|
|
()
|
554 |
|
|
"fmac.s $frg, $frh, $frf"
|
555 |
|
|
(+ (f-op 13) frg (f-ext 14) frh frf (f-rsvd 0))
|
556 |
|
|
(set frf (c-call SF "sh64_fadds" frf (c-call SF "sh64_fmuls" frg frh))))
|
557 |
|
|
|
558 |
|
|
(dshmi fmovd "Floating point move double"
|
559 |
|
|
()
|
560 |
|
|
"fmov.d $drgh, $drf"
|
561 |
|
|
(+ (f-op 14) drgh (f-ext 1) drf (f-rsvd 0))
|
562 |
|
|
(set drf drgh))
|
563 |
|
|
|
564 |
|
|
(dshmi fmovdq "Floating point move (double to quad integer)"
|
565 |
|
|
()
|
566 |
|
|
"fmov.dq $drgh, $rd"
|
567 |
|
|
(+ (f-op 12) drgh (f-ext 1) rd (f-rsvd 0))
|
568 |
|
|
(set rd (subword DI drgh 0)))
|
569 |
|
|
|
570 |
|
|
(dshmi fmovls "Floating point move (lower to single)"
|
571 |
|
|
()
|
572 |
|
|
"fmov.ls $rm, $frf"
|
573 |
|
|
(+ (f-op 7) rm (f-ext 0) (f-right 63) frf (f-rsvd 0))
|
574 |
|
|
(set frf (subword SF (subword SI rm 1) 0)))
|
575 |
|
|
|
576 |
|
|
(dshmi fmovqd "Floating point move (quad to double)"
|
577 |
|
|
()
|
578 |
|
|
"fmov.qd $rm, $drf"
|
579 |
|
|
(+ (f-op 7) rm (f-ext 1) (f-right 63) frf (f-rsvd 0))
|
580 |
|
|
(set drf (subword DF rm 0)))
|
581 |
|
|
|
582 |
|
|
(dshmi fmovs "Floating point move (single)"
|
583 |
|
|
()
|
584 |
|
|
"fmov.s $frgh, $frf"
|
585 |
|
|
(+ (f-op 14) frgh (f-ext 0) frf (f-rsvd 0))
|
586 |
|
|
(set frf frgh))
|
587 |
|
|
|
588 |
|
|
(dshmi fmovsl "Floating point move (single to lower)"
|
589 |
|
|
()
|
590 |
|
|
"fmov.sl $frgh, $rd"
|
591 |
|
|
(+ (f-op 12) frgh (f-ext 0) rd (f-rsvd 0))
|
592 |
|
|
(set rd (ext DI (subword SI frgh 1))))
|
593 |
|
|
|
594 |
|
|
(dshmi fmuld "Floating point multiply (double)"
|
595 |
|
|
()
|
596 |
|
|
"fmul.d $drg, $drh, $drf"
|
597 |
|
|
(+ (f-op 13) drg (f-ext 7) drh drf (f-rsvd 0))
|
598 |
|
|
(set drf (c-call DF "sh64_fmuld" drg drh)))
|
599 |
|
|
|
600 |
|
|
(dshmi fmuls "Floating point multiply (single)"
|
601 |
|
|
()
|
602 |
|
|
"fmul.s $frg, $frh, $frf"
|
603 |
|
|
(+ (f-op 13) frg (f-ext 6) frh frf (f-rsvd 0))
|
604 |
|
|
(set frf (c-call SF "sh64_fmuls" frg frh)))
|
605 |
|
|
|
606 |
|
|
(dshmi fnegd "Floating point negate (double)"
|
607 |
|
|
()
|
608 |
|
|
"fneg.d $drgh, $drf"
|
609 |
|
|
(+ (f-op 6) drgh (f-ext 3) drf (f-rsvd 0))
|
610 |
|
|
(set drf (c-call DF "sh64_fnegd" drgh)))
|
611 |
|
|
|
612 |
|
|
(dshmi fnegs "Floating point negate (single)"
|
613 |
|
|
()
|
614 |
|
|
"fneg.s $frgh, $frf"
|
615 |
|
|
(+ (f-op 6) frgh (f-ext 2) frf (f-rsvd 0))
|
616 |
|
|
(set frf (c-call SF "sh64_fnegs" frgh)))
|
617 |
|
|
|
618 |
|
|
(dshmi fputscr "Floating point put to FPSCR"
|
619 |
|
|
()
|
620 |
|
|
"fputscr $frgh"
|
621 |
|
|
(+ (f-op 12) frgh (f-ext 2) (f-dest 63) (f-rsvd 0))
|
622 |
|
|
(unimp "fputscr"))
|
623 |
|
|
; FIXME: this should work!
|
624 |
|
|
; (set fpscr (subword SI frgh 0)))
|
625 |
|
|
|
626 |
|
|
(dshmi fsqrtd "Floating point square root (double)"
|
627 |
|
|
()
|
628 |
|
|
"fsqrt.d $drgh, $drf"
|
629 |
|
|
(+ (f-op 14) drgh (f-ext 5) drf (f-rsvd 0))
|
630 |
|
|
(set drf (c-call DF "sh64_fsqrtd" drgh)))
|
631 |
|
|
|
632 |
|
|
(dshmi fsqrts "Floating point squart root (single)"
|
633 |
|
|
()
|
634 |
|
|
"fsqrt.s $frgh, $frf"
|
635 |
|
|
(+ (f-op 14) frgh (f-ext 4) frf (f-rsvd 0))
|
636 |
|
|
(set frf (c-call SF "sh64_fsqrts" frgh)))
|
637 |
|
|
|
638 |
|
|
(dshmi fstd "Floating point store (double)"
|
639 |
|
|
()
|
640 |
|
|
"fst.d $rm, $disp10x8, $drf"
|
641 |
|
|
(+ (f-op 47) rm disp10x8 drf (f-rsvd 0))
|
642 |
|
|
(set (mem DF (add rm disp10x8)) drf))
|
643 |
|
|
|
644 |
|
|
(dshmi fstp "Floating point store (pair of singles)"
|
645 |
|
|
()
|
646 |
|
|
"fst.p $rm, $disp10x8, $fpf"
|
647 |
|
|
(+ (f-op 46) rm disp10x8 fpf (f-rsvd 0))
|
648 |
|
|
(sequence ((QI f))
|
649 |
|
|
(set f (index-of fpf))
|
650 |
|
|
(set (mem SF (add rm disp10x8)) (reg h-fr f))
|
651 |
|
|
(set (mem SF (add rm (add disp10x8 4))) (reg h-fr (add f 1)))))
|
652 |
|
|
|
653 |
|
|
(dshmi fsts "Floating point store (single)"
|
654 |
|
|
()
|
655 |
|
|
"fst.s $rm, $disp10x4, $frf"
|
656 |
|
|
(+ (f-op 45) rm disp10x4 frf (f-rsvd 0))
|
657 |
|
|
(set (mem SF (add rm disp10x4)) frf))
|
658 |
|
|
|
659 |
|
|
(dshmi fstxd "Floating point extended store (double)"
|
660 |
|
|
()
|
661 |
|
|
"fstx.d $rm, $rn, $drf"
|
662 |
|
|
(+ (f-op 15) rm (f-ext 9) rn drf (f-rsvd 0))
|
663 |
|
|
(set (mem DF (add rm rn)) drf))
|
664 |
|
|
|
665 |
|
|
(dshmi fstxp "Floating point extended store (pair of singles)"
|
666 |
|
|
()
|
667 |
|
|
"fstx.p $rm, $rn, $fpf"
|
668 |
|
|
(+ (f-op 15) rm (f-ext 13) rn fpf (f-rsvd 0))
|
669 |
|
|
(sequence ((QI f))
|
670 |
|
|
(set f (index-of fpf))
|
671 |
|
|
(set (mem SF (add rm rn)) (reg h-fr f))
|
672 |
|
|
(set (mem SF (add rm (add rn 4))) (reg h-fr (add f 1)))))
|
673 |
|
|
|
674 |
|
|
(dshmi fstxs "Floating point extended store (single)"
|
675 |
|
|
()
|
676 |
|
|
"fstx.s $rm, $rn, $frf"
|
677 |
|
|
(+ (f-op 15) rm (f-ext 8) rn frf (f-rsvd 0))
|
678 |
|
|
(set (mem SF (add rm rn)) frf))
|
679 |
|
|
|
680 |
|
|
(dshmi fsubd "Floating point subtract (double)"
|
681 |
|
|
()
|
682 |
|
|
"fsub.d $drg, $drh, $drf"
|
683 |
|
|
(+ (f-op 13) frg (f-ext 3) frh frf (f-rsvd 0))
|
684 |
|
|
(set drf (c-call DF "sh64_fsubd" drg drh)))
|
685 |
|
|
|
686 |
|
|
(dshmi fsubs "Floating point subtract (single)"
|
687 |
|
|
()
|
688 |
|
|
"fsub.s $frg, $frh, $frf"
|
689 |
|
|
(+ (f-op 13) frg (f-ext 2) frh frf (f-rsvd 0))
|
690 |
|
|
(set frf (c-call SF "sh64_fsubs" frg frh)))
|
691 |
|
|
|
692 |
|
|
(dshmi ftrcdl "Floating point conversion (double to long)"
|
693 |
|
|
()
|
694 |
|
|
"ftrc.dl $drgh, $frf"
|
695 |
|
|
(+ (f-op 14) drgh (f-ext 11) frf (f-rsvd 0))
|
696 |
|
|
(set frf (c-call SF "sh64_ftrcdl" drgh)))
|
697 |
|
|
|
698 |
|
|
(dshmi ftrcsl "Floating point conversion (single to long)"
|
699 |
|
|
()
|
700 |
|
|
"ftrc.sl $frgh, $frf"
|
701 |
|
|
(+ (f-op 14) frgh (f-ext 8) frf (f-rsvd 0))
|
702 |
|
|
(set frf (c-call SF "sh64_ftrcsl" frgh)))
|
703 |
|
|
|
704 |
|
|
(dshmi ftrcdq "Floating point conversion (double to quad)"
|
705 |
|
|
()
|
706 |
|
|
"ftrc.dq $drgh, $drf"
|
707 |
|
|
(+ (f-op 14) drgh (f-ext 9) frf (f-rsvd 0))
|
708 |
|
|
(set drf (c-call DF "sh64_ftrcdq" drgh)))
|
709 |
|
|
|
710 |
|
|
(dshmi ftrcsq "Floating point conversion (single to quad)"
|
711 |
|
|
()
|
712 |
|
|
"ftrc.sq $frgh, $drf"
|
713 |
|
|
(+ (f-op 14) frgh (f-ext 10) drf (f-rsvd 0))
|
714 |
|
|
(set drf (c-call DF "sh64_ftrcsq" frgh)))
|
715 |
|
|
|
716 |
|
|
(dshmi ftrvs "Floating point matrix multiply"
|
717 |
|
|
()
|
718 |
|
|
"ftrv.s $mtrxg, $fvh, $fvf"
|
719 |
|
|
(+ (f-op 5) mtrxg (f-ext 14) fvh fvf (f-rsvd 0))
|
720 |
|
|
(c-call "sh64_ftrvs" (index-of mtrxg) (index-of fvh) (index-of fvf)))
|
721 |
|
|
|
722 |
|
|
(dshmi getcfg "Get configuration register"
|
723 |
|
|
()
|
724 |
|
|
"getcfg $rm, $disp6, $rd"
|
725 |
|
|
(+ (f-op 48) rm (f-ext 15) disp6 rd (f-rsvd 0))
|
726 |
|
|
(unimp "getcfg"))
|
727 |
|
|
|
728 |
|
|
(dshmi getcon "Get control register"
|
729 |
|
|
()
|
730 |
|
|
"getcon $crk, $rd"
|
731 |
|
|
(+ (f-op 9) crk (f-ext 15) (f-right 63) rd (f-rsvd 0))
|
732 |
|
|
(set rd crk))
|
733 |
|
|
|
734 |
|
|
(dshmi gettr "Get target register"
|
735 |
|
|
()
|
736 |
|
|
"gettr $trb, $rd"
|
737 |
|
|
(+ (f-op 17) (f-25 0) trb (f-ext 5) (f-right 63) rd (f-rsvd 0))
|
738 |
|
|
(set rd trb))
|
739 |
|
|
|
740 |
|
|
(dshmi icbi "Invalidate instruction cache block"
|
741 |
|
|
()
|
742 |
|
|
"icbi $rm, $disp6x32"
|
743 |
|
|
(+ (f-op 56) rm (f-ext 5) disp6x32 (f-dest 63) (f-rsvd 0))
|
744 |
|
|
(unimp "icbi"))
|
745 |
|
|
|
746 |
|
|
(dshmi ldb "Load byte"
|
747 |
|
|
()
|
748 |
|
|
"ld.b $rm, $disp10, $rd"
|
749 |
|
|
(+ (f-op 32) rm disp10 rd (f-rsvd 0))
|
750 |
|
|
(set rd (ext DI (mem QI (add rm (ext DI disp10))))))
|
751 |
|
|
|
752 |
|
|
(dshmi ldl "Load long word"
|
753 |
|
|
()
|
754 |
|
|
"ld.l $rm, $disp10x4, $rd"
|
755 |
|
|
(+ (f-op 34) rm disp10x4 rd (f-rsvd 0))
|
756 |
|
|
(set rd (ext DI (mem SI (add rm (ext DI disp10x4))))))
|
757 |
|
|
|
758 |
|
|
(dshmi ldq "Load quad word"
|
759 |
|
|
()
|
760 |
|
|
"ld.q $rm, $disp10x8, $rd"
|
761 |
|
|
(+ (f-op 35) rm disp10x8 rd (f-rsvd 0))
|
762 |
|
|
(set rd (mem DI (add rm (ext DI disp10x8)))))
|
763 |
|
|
|
764 |
|
|
(dshmi ldub "Load unsigned byte"
|
765 |
|
|
()
|
766 |
|
|
"ld.ub $rm, $disp10, $rd"
|
767 |
|
|
(+ (f-op 36) rm disp10 rd (f-rsvd 0))
|
768 |
|
|
(set rd (zext DI (mem QI (add rm (ext DI disp10))))))
|
769 |
|
|
|
770 |
|
|
(dshmi lduw "Load unsigned word"
|
771 |
|
|
()
|
772 |
|
|
"ld.uw $rm, $disp10x2, $rd"
|
773 |
|
|
(+ (f-op 44) rm disp10 rd (f-rsvd 0))
|
774 |
|
|
(set rd (zext DI (mem HI (add rm (ext DI disp10x2))))))
|
775 |
|
|
|
776 |
|
|
(dshmi ldw "Load word"
|
777 |
|
|
()
|
778 |
|
|
"ld.w $rm, $disp10x2, $rd"
|
779 |
|
|
(+ (f-op 33) rm disp10 rd (f-rsvd 0))
|
780 |
|
|
(set rd (ext DI (mem HI (add rm (ext DI disp10x2))))))
|
781 |
|
|
|
782 |
|
|
(dshmi ldhil "Load high part (long word)"
|
783 |
|
|
()
|
784 |
|
|
"ldhi.l $rm, $disp6, $rd"
|
785 |
|
|
(+ (f-op 48) rm (f-ext 6) disp6 rd (f-rsvd 0))
|
786 |
|
|
; FIXME.
|
787 |
|
|
(unimp "ldhil"))
|
788 |
|
|
|
789 |
|
|
(dshmi ldhiq "Load high part (quad word)"
|
790 |
|
|
()
|
791 |
|
|
"ldhi.q $rm, $disp6, $rd"
|
792 |
|
|
(+ (f-op 48) rm (f-ext 7) disp6 rd (f-rsvd 0))
|
793 |
|
|
; FIXME.
|
794 |
|
|
(unimp "ldhiq"))
|
795 |
|
|
|
796 |
|
|
(dshmi ldlol "Load low part (long word)"
|
797 |
|
|
()
|
798 |
|
|
"ldlo.l $rm, $disp6, $rd"
|
799 |
|
|
(+ (f-op 48) rm (f-ext 2) disp6 rd (f-rsvd 0))
|
800 |
|
|
; FIXME.
|
801 |
|
|
(unimp "ldlol"))
|
802 |
|
|
|
803 |
|
|
(dshmi ldloq "Load low part (quad word)"
|
804 |
|
|
()
|
805 |
|
|
"ldlo.q $rm, $disp6, $rd"
|
806 |
|
|
(+ (f-op 48) rm (f-ext 3) disp6 rd (f-rsvd 0))
|
807 |
|
|
; FIXME;
|
808 |
|
|
(unimp "ldloq"))
|
809 |
|
|
|
810 |
|
|
(dshmi ldxb "Load byte (extended displacement)"
|
811 |
|
|
()
|
812 |
|
|
"ldx.b $rm, $rn, $rd"
|
813 |
|
|
(+ (f-op 16) rm (f-ext 0) rn rd (f-rsvd 0))
|
814 |
|
|
(set rd (ext DI (mem QI (add rm rn)))))
|
815 |
|
|
|
816 |
|
|
(dshmi ldxl "Load long word (extended displacement)"
|
817 |
|
|
()
|
818 |
|
|
"ldx.l $rm, $rn, $rd"
|
819 |
|
|
(+ (f-op 16) rm (f-ext 2) rn rd (f-rsvd 0))
|
820 |
|
|
(set rd (ext DI (mem SI (add rm rn)))))
|
821 |
|
|
|
822 |
|
|
(dshmi ldxq "Load quad word (extended displacement)"
|
823 |
|
|
()
|
824 |
|
|
"ldx.q $rm, $rn, $rd"
|
825 |
|
|
(+ (f-op 16) rm (f-ext 3) rn rd (f-rsvd 0))
|
826 |
|
|
(set rd (mem DI (add rm rn))))
|
827 |
|
|
|
828 |
|
|
(dshmi ldxub "Load unsigned byte (extended displacement)"
|
829 |
|
|
()
|
830 |
|
|
"ldx.ub $rm, $rn, $rd"
|
831 |
|
|
(+ (f-op 16) rm (f-ext 4) rn rd (f-rsvd 0))
|
832 |
|
|
(set rd (zext DI (mem UQI (add rm rn)))))
|
833 |
|
|
|
834 |
|
|
(dshmi ldxuw "Load unsigned word (extended displacement)"
|
835 |
|
|
()
|
836 |
|
|
"ldx.uw $rm, $rn, $rd"
|
837 |
|
|
(+ (f-op 16) rm (f-ext 5) rn rd (f-rsvd 0))
|
838 |
|
|
(set rd (zext DI (mem UHI (add rm rn)))))
|
839 |
|
|
|
840 |
|
|
(dshmi ldxw "Load word (extended displacement)"
|
841 |
|
|
()
|
842 |
|
|
"ldx.w $rm, $rn, $rd"
|
843 |
|
|
(+ (f-op 16) rm (f-ext 1) rn rd (f-rsvd 0))
|
844 |
|
|
(set rd (ext DI (mem HI (add rm rn)))))
|
845 |
|
|
|
846 |
|
|
|
847 |
|
|
; Macros to facilitate multimedia instructions.
|
848 |
|
|
|
849 |
|
|
(define-pmacro (slice-byte expr)
|
850 |
|
|
(sequence ((QI result7) (QI result6) (QI result5) (QI result4)
|
851 |
|
|
(QI result3) (QI result2) (QI result1) (QI result0))
|
852 |
|
|
(set result0 (expr (subword QI rm 7) (subword QI rn 7)))
|
853 |
|
|
(set result1 (expr (subword QI rm 6) (subword QI rn 6)))
|
854 |
|
|
(set result2 (expr (subword QI rm 5) (subword QI rn 5)))
|
855 |
|
|
(set result3 (expr (subword QI rm 4) (subword QI rn 4)))
|
856 |
|
|
(set result4 (expr (subword QI rm 3) (subword QI rn 3)))
|
857 |
|
|
(set result5 (expr (subword QI rm 2) (subword QI rn 2)))
|
858 |
|
|
(set result6 (expr (subword QI rm 1) (subword QI rn 1)))
|
859 |
|
|
(set result7 (expr (subword QI rm 0) (subword QI rn 0)))
|
860 |
|
|
(set rd (-join-qi result7 result6 result5 result4 result3 result2
|
861 |
|
|
result1 result0))))
|
862 |
|
|
|
863 |
|
|
(define-pmacro (slice-word expr)
|
864 |
|
|
(sequence ((HI result3) (HI result2) (HI result1) (HI result0))
|
865 |
|
|
(set result0 (expr (subword HI rm 3) (subword HI rn 3)))
|
866 |
|
|
(set result1 (expr (subword HI rm 2) (subword HI rn 2)))
|
867 |
|
|
(set result2 (expr (subword HI rm 1) (subword HI rn 1)))
|
868 |
|
|
(set result3 (expr (subword HI rm 0) (subword HI rn 0)))
|
869 |
|
|
(set rd (-join-hi result3 result2 result1 result0))))
|
870 |
|
|
|
871 |
|
|
(define-pmacro (slice-word-unop expr)
|
872 |
|
|
(sequence ((HI result3) (HI result2) (HI result1) (HI result0))
|
873 |
|
|
(set result0 (expr (subword HI rm 3)))
|
874 |
|
|
(set result1 (expr (subword HI rm 2)))
|
875 |
|
|
(set result2 (expr (subword HI rm 1)))
|
876 |
|
|
(set result3 (expr (subword HI rm 0)))
|
877 |
|
|
(set rd (-join-hi result3 result2 result1 result0))))
|
878 |
|
|
|
879 |
|
|
(define-pmacro (slice-long expr)
|
880 |
|
|
(sequence ((SI result1) (SI result0))
|
881 |
|
|
(set result0 (expr (subword SI rm 1) (subword SI rn 1)))
|
882 |
|
|
(set result1 (expr (subword SI rm 0) (subword SI rn 0)))
|
883 |
|
|
(set rd (-join-si result1 result0))))
|
884 |
|
|
|
885 |
|
|
(define-pmacro (slice-long-unop expr)
|
886 |
|
|
(sequence ((SI result1) (SI result0))
|
887 |
|
|
(set result0 (expr (subword SI rm 1)))
|
888 |
|
|
(set result1 (expr (subword SI rm 0)))
|
889 |
|
|
(set rd (-join-si result1 result0))))
|
890 |
|
|
|
891 |
|
|
; Multimedia instructions.
|
892 |
|
|
|
893 |
|
|
(dshmi mabsl "Multimedia absolute value (long word)"
|
894 |
|
|
()
|
895 |
|
|
"mabs.l $rm, $rd"
|
896 |
|
|
(+ (f-op 10) rm (f-ext 10) (f-right 63) rd (f-rsvd 0))
|
897 |
|
|
(slice-long-unop abs))
|
898 |
|
|
|
899 |
|
|
(dshmi mabsw "Multimedia absolute value (word)"
|
900 |
|
|
()
|
901 |
|
|
"mabs.w $rm, $rd"
|
902 |
|
|
(+ (f-op 10) rm (f-ext 9) (f-right 63) rd (f-rsvd 0))
|
903 |
|
|
(slice-word-unop abs))
|
904 |
|
|
|
905 |
|
|
(dshmi maddl "Multimedia add (long word)"
|
906 |
|
|
()
|
907 |
|
|
"madd.l $rm, $rn, $rd"
|
908 |
|
|
(+ (f-op 2) rm (f-ext 2) rn rd (f-rsvd 0))
|
909 |
|
|
(slice-long add))
|
910 |
|
|
|
911 |
|
|
(dshmi maddw "Multimedia add (word)"
|
912 |
|
|
()
|
913 |
|
|
"madd.w $rm, $rn, $rd"
|
914 |
|
|
(+ (f-op 2) rm (f-ext 1) rn rd (f-rsvd 0))
|
915 |
|
|
(slice-word add))
|
916 |
|
|
|
917 |
|
|
(define-pmacro (-maddsl arg1 arg2) (saturate SI 32 (add arg1 arg2)))
|
918 |
|
|
(dshmi maddsl "Multimedia add (saturating, long word)"
|
919 |
|
|
()
|
920 |
|
|
"madds.l $rm, $rn, $rd"
|
921 |
|
|
(+ (f-op 2) rm (f-ext 6) rn rd (f-rsvd 0))
|
922 |
|
|
(slice-long -maddsl))
|
923 |
|
|
|
924 |
|
|
(define-pmacro (-maddsub arg1 arg2) (usaturate QI 8 (add arg1 arg2)))
|
925 |
|
|
(dshmi maddsub "Multimedia add (saturating, unsigned byte)"
|
926 |
|
|
()
|
927 |
|
|
"madds.ub $rm, $rn, $rd"
|
928 |
|
|
(+ (f-op 2) rm (f-ext 4) rn rd (f-rsvd 0))
|
929 |
|
|
(slice-byte -maddsub))
|
930 |
|
|
|
931 |
|
|
(define-pmacro (-maddsw arg1 arg2) (saturate HI 16 (add arg1 arg2)))
|
932 |
|
|
(dshmi maddsw "Multimedia add (saturating, word)"
|
933 |
|
|
()
|
934 |
|
|
"madds.w $rm, $rn, $rd"
|
935 |
|
|
(+ (f-op 2) rm (f-ext 5) rn rd (f-rsvd 0))
|
936 |
|
|
(slice-word -maddsw))
|
937 |
|
|
|
938 |
|
|
(define-pmacro (-mcmpeq mode arg1 arg2)
|
939 |
|
|
(if mode (eq arg1 arg2) (inv mode 0) (const mode 0)))
|
940 |
|
|
|
941 |
|
|
(define-pmacro (-mcmpeqb arg1 arg2) (-mcmpeq QI arg1 arg2))
|
942 |
|
|
(dshmi mcmpeqb "Multimedia compare equal (byte)"
|
943 |
|
|
()
|
944 |
|
|
"mcmpeq.b $rm, $rn, $rd"
|
945 |
|
|
(+ (f-op 10) rm (f-ext 0) rn rd (f-rsvd 0))
|
946 |
|
|
(slice-byte -mcmpeqb))
|
947 |
|
|
|
948 |
|
|
(define-pmacro (-mcmpeql arg1 arg2) (-mcmpeq SI arg1 arg2))
|
949 |
|
|
(dshmi mcmpeql "Multimedia compare equal (long word)"
|
950 |
|
|
()
|
951 |
|
|
"mcmpeq.l $rm, $rn, $rd"
|
952 |
|
|
(+ (f-op 10) rm (f-ext 2) rn rd (f-rsvd 0))
|
953 |
|
|
(slice-long -mcmpeql))
|
954 |
|
|
|
955 |
|
|
(define-pmacro (-mcmpeqw arg1 arg2) (-mcmpeq HI arg1 arg2))
|
956 |
|
|
(dshmi mcmpeqw "Multimedia compare equal (word)"
|
957 |
|
|
()
|
958 |
|
|
"mcmpeq.w $rm, $rn, $rd"
|
959 |
|
|
(+ (f-op 10) rm (f-ext 1) rn rd (f-rsvd 0))
|
960 |
|
|
(slice-word -mcmpeqw))
|
961 |
|
|
|
962 |
|
|
(define-pmacro (-mcmpgt mode arg1 arg2)
|
963 |
|
|
(if mode (gt arg1 arg2) (inv mode 0) (const mode 0)))
|
964 |
|
|
(define-pmacro (-mcmpgtu mode arg1 arg2)
|
965 |
|
|
(if mode (gtu arg1 arg2) (inv mode 0) (const mode 0)))
|
966 |
|
|
|
967 |
|
|
(define-pmacro (-mcmpgtl arg1 arg2) (-mcmpgt SI arg1 arg2))
|
968 |
|
|
(dshmi mcmpgtl "Multimedia compare greater than (long word)"
|
969 |
|
|
()
|
970 |
|
|
"mcmpgt.l $rm, $rn, $rd"
|
971 |
|
|
(+ (f-op 10) rm (f-ext 6) rn rd (f-rsvd 0))
|
972 |
|
|
(slice-long -mcmpgtl))
|
973 |
|
|
|
974 |
|
|
(define-pmacro (-mcmpgtub arg1 arg2) (-mcmpgtu QI arg1 arg2))
|
975 |
|
|
(dshmi mcmpgtub "Multimediate compare unsigned greater than (byte)"
|
976 |
|
|
()
|
977 |
|
|
"mcmpgt.ub $rm, $rn, $rd"
|
978 |
|
|
(+ (f-op 10) rm (f-ext 4) rn rd (f-rsvd 0))
|
979 |
|
|
(slice-byte -mcmpgtub))
|
980 |
|
|
|
981 |
|
|
(define-pmacro (-mcmpgtw arg1 arg2) (-mcmpgt HI arg1 arg2))
|
982 |
|
|
(dshmi mcmpgtw "Multimedia compare greater than (word)"
|
983 |
|
|
()
|
984 |
|
|
"mcmpgt.w $rm, $rn, $rd"
|
985 |
|
|
(+ (f-op 10) rm (f-ext 5) rn rd (f-rsvd 0))
|
986 |
|
|
(slice-word -mcmpgtw))
|
987 |
|
|
|
988 |
|
|
(dshmi mcmv "Multimedia conditional move"
|
989 |
|
|
()
|
990 |
|
|
"mcmv $rm, $rn, $rd"
|
991 |
|
|
(+ (f-op 18) rm (f-ext 3) rn rd (f-rsvd 0))
|
992 |
|
|
(set rd (or (and rm rn) (and rd (inv rn)))))
|
993 |
|
|
|
994 |
|
|
(dshmi mcnvslw "Multimedia convert/saturate (long to word)"
|
995 |
|
|
()
|
996 |
|
|
"mcnvs.lw $rm, $rn, $rd"
|
997 |
|
|
(+ (f-op 19) rm (f-ext 13) rn rd (f-rsvd 0))
|
998 |
|
|
(sequence ((HI result3) (HI result2) (HI result1) (HI result0))
|
999 |
|
|
(set result0 (saturate HI 16 (subword SI rm 0)))
|
1000 |
|
|
(set result1 (saturate HI 16 (subword SI rm 1)))
|
1001 |
|
|
(set result2 (saturate HI 16 (subword SI rn 0)))
|
1002 |
|
|
(set result3 (saturate HI 16 (subword SI rn 1)))
|
1003 |
|
|
(set rd (-join-hi result3 result2 result1 result0))))
|
1004 |
|
|
|
1005 |
|
|
(dshmi mcnvswb "Multimedia convert/saturate (word to byte)"
|
1006 |
|
|
()
|
1007 |
|
|
"mcnvs.wb $rm, $rn, $rd"
|
1008 |
|
|
(+ (f-op 19) rm (f-ext 8) rn rd (f-rsvd 0))
|
1009 |
|
|
(sequence ((QI result7) (QI result6) (QI result5) (QI result4)
|
1010 |
|
|
(QI result3) (QI result2) (QI result1) (QI result0))
|
1011 |
|
|
(set result0 (saturate QI 8 (subword HI rm 0)))
|
1012 |
|
|
(set result1 (saturate QI 8 (subword HI rm 1)))
|
1013 |
|
|
(set result2 (saturate QI 8 (subword HI rm 2)))
|
1014 |
|
|
(set result3 (saturate QI 8 (subword HI rm 3)))
|
1015 |
|
|
(set result4 (saturate QI 8 (subword HI rn 0)))
|
1016 |
|
|
(set result5 (saturate QI 8 (subword HI rn 1)))
|
1017 |
|
|
(set result6 (saturate QI 8 (subword HI rn 2)))
|
1018 |
|
|
(set result7 (saturate QI 8 (subword HI rn 3)))
|
1019 |
|
|
(set rd (-join-qi result7 result6 result5 result4
|
1020 |
|
|
result3 result2 result1 result0))))
|
1021 |
|
|
|
1022 |
|
|
(dshmi mcnvswub "Multimedia convert/saturate (word to unsigned byte)"
|
1023 |
|
|
()
|
1024 |
|
|
"mcnvs.wub $rm, $rn, $rd"
|
1025 |
|
|
(+ (f-op 19) rm (f-ext 12) rn rd (f-rsvd 0))
|
1026 |
|
|
(sequence ((QI result7) (QI result6) (QI result5) (QI result4)
|
1027 |
|
|
(QI result3) (QI result2) (QI result1) (QI result0))
|
1028 |
|
|
(set result0 (usaturate QI 8 (subword HI rm 0)))
|
1029 |
|
|
(set result1 (usaturate QI 8 (subword HI rm 1)))
|
1030 |
|
|
(set result2 (usaturate QI 8 (subword HI rm 2)))
|
1031 |
|
|
(set result3 (usaturate QI 8 (subword HI rm 3)))
|
1032 |
|
|
(set result4 (usaturate QI 8 (subword HI rn 0)))
|
1033 |
|
|
(set result5 (usaturate QI 8 (subword HI rn 1)))
|
1034 |
|
|
(set result6 (usaturate QI 8 (subword HI rn 2)))
|
1035 |
|
|
(set result7 (usaturate QI 8 (subword HI rn 3)))
|
1036 |
|
|
(set rd (-join-qi result7 result6 result5 result4 result3
|
1037 |
|
|
result2 result1 result0))))
|
1038 |
|
|
|
1039 |
|
|
; mexter -- generate an mexterN instruction, where:
|
1040 |
|
|
; op = primary opcode
|
1041 |
|
|
; extop = extended opcode
|
1042 |
|
|
|
1043 |
|
|
(define-pmacro (make-mextr n op extop)
|
1044 |
|
|
(dshmi (.sym mextr n)
|
1045 |
|
|
(.str "Multimedia extract 64-bit slice (from byte " n ")")
|
1046 |
|
|
()
|
1047 |
|
|
(.str "mextr" n " $rm, $rn, $rd")
|
1048 |
|
|
(+ (f-op op) rm (f-ext extop) rn rd (f-rsvd 0))
|
1049 |
|
|
(sequence ((QI count) (DI mask) (DI rhs))
|
1050 |
|
|
(set count (mul QI 8 (sub QI 8 n)))
|
1051 |
|
|
(set mask (sll DI (inv 0) count))
|
1052 |
|
|
(set rhs (srl (and rm mask) count))
|
1053 |
|
|
(set count (mul QI 8 n))
|
1054 |
|
|
(set mask (srl DI (inv 0) count))
|
1055 |
|
|
(set rd (or DI rhs (sll DI (and rn mask) count))))))
|
1056 |
|
|
|
1057 |
|
|
(make-mextr 1 10 7)
|
1058 |
|
|
(make-mextr 2 10 11)
|
1059 |
|
|
(make-mextr 3 10 15)
|
1060 |
|
|
(make-mextr 4 11 3)
|
1061 |
|
|
(make-mextr 5 11 7)
|
1062 |
|
|
(make-mextr 6 11 11)
|
1063 |
|
|
(make-mextr 7 11 15)
|
1064 |
|
|
|
1065 |
|
|
(dshmi mmacfxwl "Multimedia fractional multiply (word to long)"
|
1066 |
|
|
()
|
1067 |
|
|
"mmacfx.wl $rm, $rn, $rd"
|
1068 |
|
|
(+ (f-op 18) rm (f-ext 1) rn rd (f-rsvd 0))
|
1069 |
|
|
(sequence ((SI temp) (SI result1) (SI result0))
|
1070 |
|
|
(set result0 (subword SI rd 0))
|
1071 |
|
|
(set result1 (subword SI rd 1))
|
1072 |
|
|
(set temp (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
|
1073 |
|
|
(set temp (saturate SI 32 (sll temp 1)))
|
1074 |
|
|
(set result0 (saturate SI 32 (add result0 temp)))
|
1075 |
|
|
(set temp (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
|
1076 |
|
|
(set temp (saturate SI 32 (sll temp 1)))
|
1077 |
|
|
(set result1 (saturate SI 32 (add result1 temp)))
|
1078 |
|
|
(set rd (-join-si result1 result0))))
|
1079 |
|
|
|
1080 |
|
|
(dshmi mmacnfx.wl "Multimedia fractional multiple (word to long)"
|
1081 |
|
|
()
|
1082 |
|
|
"mmacnfx.wl $rm, $rn, $rd"
|
1083 |
|
|
(+ (f-op 18) rn (f-ext 5) rn rd (f-rsvd 0))
|
1084 |
|
|
(sequence ((SI temp) (SI result1) (SI result0))
|
1085 |
|
|
(set result0 (subword SI rd 0))
|
1086 |
|
|
(set result1 (subword SI rd 1))
|
1087 |
|
|
(set temp (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
|
1088 |
|
|
(set temp (saturate SI 32 (sll temp 1)))
|
1089 |
|
|
(set result0 (saturate SI 32 (sub result0 temp)))
|
1090 |
|
|
(set temp (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
|
1091 |
|
|
(set temp (saturate SI 32 (sll temp 1)))
|
1092 |
|
|
(set result1 (saturate SI 32 (sub result1 temp)))
|
1093 |
|
|
(set rd (-join-si result1 result0))))
|
1094 |
|
|
|
1095 |
|
|
(dshmi mmull "Multimedia multiply (long word)"
|
1096 |
|
|
()
|
1097 |
|
|
"mmul.l $rm, $rn, $rd"
|
1098 |
|
|
(+ (f-op 19) rm (f-ext 2) rn rd (f-rsvd 0))
|
1099 |
|
|
(slice-long mul))
|
1100 |
|
|
|
1101 |
|
|
(dshmi mmulw "Multimedia multiply (word)"
|
1102 |
|
|
()
|
1103 |
|
|
"mmul.w $rm, $rn, $rd"
|
1104 |
|
|
(+ (f-op 19) rm (f-ext 1) rn rd (f-rsvd 0))
|
1105 |
|
|
(slice-word mul))
|
1106 |
|
|
|
1107 |
|
|
(dshmi mmulfxl "Multimedia fractional multiply (long word)"
|
1108 |
|
|
()
|
1109 |
|
|
"mmulfx.l $rm, $rn, $rd"
|
1110 |
|
|
(+ (f-op 19) rm (f-ext 6) rn rd (f-rsvd 0))
|
1111 |
|
|
(sequence ((DI temp) (SI result0) (SI result1))
|
1112 |
|
|
(set temp (mul (zext DI (subword SI rm 0)) (zext DI (subword SI rn 0))))
|
1113 |
|
|
(set result0 (saturate SI 32 (sra temp 31)))
|
1114 |
|
|
(set temp (mul (zext DI (subword SI rm 1)) (zext DI (subword SI rn 1))))
|
1115 |
|
|
(set result1 (saturate SI 32 (sra temp 31)))
|
1116 |
|
|
(set rd (-join-si result1 result0))))
|
1117 |
|
|
|
1118 |
|
|
(dshmi mmulfxw "Multimedia fractional multiply (word)"
|
1119 |
|
|
()
|
1120 |
|
|
"mmulfx.w $rm, $rn, $rd"
|
1121 |
|
|
(+ (f-op 19) rm (f-ext 5) rn rd (f-rsvd 0))
|
1122 |
|
|
(sequence ((SI temp) (HI result0) (HI result1) (HI result2) (HI result3))
|
1123 |
|
|
(set temp (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
|
1124 |
|
|
(set result0 (saturate HI 16 (sra temp 15)))
|
1125 |
|
|
(set temp (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
|
1126 |
|
|
(set result1 (saturate HI 16 (sra temp 15)))
|
1127 |
|
|
(set temp (mul (zext SI (subword HI rm 2)) (zext SI (subword HI rn 2))))
|
1128 |
|
|
(set result2 (saturate HI 16 (sra temp 15)))
|
1129 |
|
|
(set temp (mul (zext SI (subword HI rm 3)) (zext SI (subword HI rn 3))))
|
1130 |
|
|
(set result3 (saturate HI 16 (sra temp 15)))
|
1131 |
|
|
(set rd (-join-hi result3 result2 result1 result0))))
|
1132 |
|
|
|
1133 |
|
|
(dshmi mmulfxrpw "Multimedia fractional multiply round positive (word op)"
|
1134 |
|
|
()
|
1135 |
|
|
"mmulfxrp.w $rm, $rn, $rd"
|
1136 |
|
|
(+ (f-op 19) rm (f-ext 9) rn rd (f-rsvd 0))
|
1137 |
|
|
(sequence ((SI temp) (HI result0) (HI result1) (HI result2) (HI result3) (HI c))
|
1138 |
|
|
(set c (sll 1 14))
|
1139 |
|
|
(set temp (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
|
1140 |
|
|
(set result0 (saturate HI 16 (sra (add temp c) 15)))
|
1141 |
|
|
(set temp (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
|
1142 |
|
|
(set result1 (saturate HI 16 (sra (add temp c) 15)))
|
1143 |
|
|
(set temp (mul (zext SI (subword HI rm 2)) (zext SI (subword HI rn 2))))
|
1144 |
|
|
(set result2 (saturate HI 16 (sra (add temp c) 15)))
|
1145 |
|
|
(set temp (mul (zext SI (subword HI rm 3)) (zext SI (subword HI rn 3))))
|
1146 |
|
|
(set result3 (saturate HI 16 (sra (add temp c) 15)))
|
1147 |
|
|
(set rd (-join-hi result3 result2 result1 result0))))
|
1148 |
|
|
|
1149 |
|
|
(dshmi mmulhiwl "Multimedia multiply higher halves (word to long)"
|
1150 |
|
|
()
|
1151 |
|
|
"mmulhi.wl $rm, $rn, $rd"
|
1152 |
|
|
(+ (f-op 19) rm (f-ext 14) rn rd (f-rsvd 0))
|
1153 |
|
|
(sequence ((SI result1) (SI result0))
|
1154 |
|
|
(set result0 (mul (zext SI (subword HI rm 2)) (zext SI (subword HI rn 2))))
|
1155 |
|
|
(set result1 (mul (zext SI (subword HI rm 3)) (zext SI (subword HI rn 3))))
|
1156 |
|
|
(set rd (-join-si result1 result0))))
|
1157 |
|
|
|
1158 |
|
|
(dshmi mmullowl "Multimedia multiply lower halves (word to long)"
|
1159 |
|
|
()
|
1160 |
|
|
"mmullo.wl $rm, $rn, $rd"
|
1161 |
|
|
(+ (f-op 19) rm (f-ext 10) rn rd (f-rsvd 0))
|
1162 |
|
|
(sequence ((SI result1) (SI result0))
|
1163 |
|
|
(set result0 (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
|
1164 |
|
|
(set result1 (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
|
1165 |
|
|
(set rd (-join-si result1 result0))))
|
1166 |
|
|
|
1167 |
|
|
(dshmi mmulsumwq "Multimedia multiply and accumulate (word to quad)"
|
1168 |
|
|
()
|
1169 |
|
|
"mmulsum.wq $rm, $rn, $rd"
|
1170 |
|
|
(+ (f-op 18) rm (f-ext 9) rn rd (f-rsvd 0))
|
1171 |
|
|
(sequence ((DI acc))
|
1172 |
|
|
(set acc (mul SI (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
|
1173 |
|
|
(set acc (add acc (mul SI (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1)))))
|
1174 |
|
|
(set acc (add acc (mul SI (zext SI (subword HI rm 2)) (zext SI (subword HI rn 2)))))
|
1175 |
|
|
(set acc (add acc (mul SI (zext SI (subword HI rm 3)) (zext SI (subword HI rn 3)))))
|
1176 |
|
|
(set rd (add rd acc))))
|
1177 |
|
|
|
1178 |
|
|
(dshmi movi "Move immediate"
|
1179 |
|
|
()
|
1180 |
|
|
"movi $imm16, $rd"
|
1181 |
|
|
(+ (f-op 51) imm16 rd (f-rsvd 0))
|
1182 |
|
|
(set rd (ext DI imm16)))
|
1183 |
|
|
|
1184 |
|
|
(dshmi mpermw "Multimedia permutate word"
|
1185 |
|
|
()
|
1186 |
|
|
"mperm.w $rm, $rn, $rd"
|
1187 |
|
|
(+ (f-op 10) rm (f-ext 13) rn rd (f-rsvd 0))
|
1188 |
|
|
(sequence ((QI control) (HI result3) (HI result2) (HI result1) (HI result0))
|
1189 |
|
|
(set control (and QI rn #x3f))
|
1190 |
|
|
(set result0 (subword HI rm (sub 3 (and control 3))))
|
1191 |
|
|
(set result1 (subword HI rm (sub 3 (and (srl control 2) 3))))
|
1192 |
|
|
(set result2 (subword HI rm (sub 3 (and (srl control 4) 3))))
|
1193 |
|
|
(set result3 (subword HI rm (sub 3 (and (srl control 6) 3))))
|
1194 |
|
|
(set rd (-join-hi result3 result2 result1 result0))))
|
1195 |
|
|
|
1196 |
|
|
(dshmi msadubq "Multimedia absolute difference (byte)"
|
1197 |
|
|
()
|
1198 |
|
|
"msad.ubq $rm, $rn, $rd"
|
1199 |
|
|
(+ (f-op 18) rm (f-ext 0) rn rd (f-rsvd 0))
|
1200 |
|
|
(sequence ((DI acc))
|
1201 |
|
|
(set acc (abs DI (sub (subword QI rm 0) (subword QI rn 1))))
|
1202 |
|
|
(set acc (add DI acc (abs (sub (subword QI rm 1) (subword QI rn 1)))))
|
1203 |
|
|
(set acc (add DI acc (abs (sub (subword QI rm 2) (subword QI rn 2)))))
|
1204 |
|
|
(set acc (add DI acc (abs (sub (subword QI rm 3) (subword QI rn 3)))))
|
1205 |
|
|
(set acc (add DI acc (abs (sub (subword QI rm 4) (subword QI rn 4)))))
|
1206 |
|
|
(set acc (add DI acc (abs (sub (subword QI rm 5) (subword QI rn 5)))))
|
1207 |
|
|
(set acc (add DI acc (abs (sub (subword QI rm 6) (subword QI rn 6)))))
|
1208 |
|
|
(set acc (add DI acc (abs (sub (subword QI rm 7) (subword QI rn 7)))))
|
1209 |
|
|
(set rd (add rd acc))))
|
1210 |
|
|
|
1211 |
|
|
(define-pmacro (-mshaldsl arg) (saturate SI 32 (sll arg (and rn 31))))
|
1212 |
|
|
(dshmi mshaldsl "Multimedia saturating arithmetic left shift (long word)"
|
1213 |
|
|
()
|
1214 |
|
|
"mshalds.l $rm, $rn, $rd"
|
1215 |
|
|
(+ (f-op 3) rm (f-ext 6) rn rd (f-rsvd 0))
|
1216 |
|
|
(slice-long-unop -mshaldsl))
|
1217 |
|
|
|
1218 |
|
|
(define-pmacro (-mshaldsw arg) (saturate HI 16 (sll arg (and rn 15))))
|
1219 |
|
|
(dshmi mshaldsw "Multimedia saturating arithmetic left shift (word)"
|
1220 |
|
|
()
|
1221 |
|
|
"mshalds.w $rm, $rn, $rd"
|
1222 |
|
|
(+ (f-op 3) rm (f-ext 5) rn rd (f-rsvd 0))
|
1223 |
|
|
(slice-word-unop -mshaldsw))
|
1224 |
|
|
|
1225 |
|
|
(define-pmacro (-mshardl arg) (sra arg (and rn 31)))
|
1226 |
|
|
(dshmi mshardl "Multimedia arithmetic right shift (long)"
|
1227 |
|
|
()
|
1228 |
|
|
"mshard.l $rm, $rn, $rd"
|
1229 |
|
|
(+ (f-op 3) rm (f-ext 10) rn rd (f-rsvd 0))
|
1230 |
|
|
(slice-long-unop -mshardl))
|
1231 |
|
|
|
1232 |
|
|
(define-pmacro (-mshardw arg) (sra arg (and rn 15)))
|
1233 |
|
|
(dshmi mshardw "Multimedia arithmetic right shift (word)"
|
1234 |
|
|
()
|
1235 |
|
|
"mshard.w $rm, $rn, $rd"
|
1236 |
|
|
(+ (f-op 3) rm (f-ext 9) rn rd (f-rsvd 0))
|
1237 |
|
|
(slice-word-unop -mshardw))
|
1238 |
|
|
|
1239 |
|
|
(dshmi mshardsq "Multimedia saturating arithmetic right shift (quad word)"
|
1240 |
|
|
()
|
1241 |
|
|
"mshards.q $rm, $rn, $rd"
|
1242 |
|
|
(+ (f-op 3) rm (f-ext 11) rn rd (f-rsvd 0))
|
1243 |
|
|
(set rd (saturate DI 16 (sra rm (and rn 63)))))
|
1244 |
|
|
|
1245 |
|
|
(dshmi mshfhib "Multimedia shuffle higher-half (byte)"
|
1246 |
|
|
()
|
1247 |
|
|
"mshfhi.b $rm, $rn, $rd"
|
1248 |
|
|
(+ (f-op 11) rm (f-ext 4) rn rd (f-rsvd 0))
|
1249 |
|
|
(sequence ((QI result7) (QI result6) (QI result5) (QI result4)
|
1250 |
|
|
(QI result3) (QI result2) (QI result1) (QI result0))
|
1251 |
|
|
(set result0 (subword QI rm 4))
|
1252 |
|
|
(set result1 (subword QI rn 4))
|
1253 |
|
|
(set result2 (subword QI rm 5))
|
1254 |
|
|
(set result3 (subword QI rn 5))
|
1255 |
|
|
(set result4 (subword QI rm 6))
|
1256 |
|
|
(set result5 (subword QI rn 6))
|
1257 |
|
|
(set result6 (subword QI rm 7))
|
1258 |
|
|
(set result7 (subword QI rn 7))
|
1259 |
|
|
(set rd (-join-qi result7 result6 result5 result4 result3
|
1260 |
|
|
result2 result1 result0))))
|
1261 |
|
|
|
1262 |
|
|
(dshmi mshfhil "Multimedia shuffle higher-half (long)"
|
1263 |
|
|
()
|
1264 |
|
|
"mshfhi.l $rm, $rn, $rd"
|
1265 |
|
|
(+ (f-op 11) rm (f-ext 6) rn rd (f-rsvd 0))
|
1266 |
|
|
(sequence ((SI result1) (SI result0))
|
1267 |
|
|
(set result0 (subword SI rm 1))
|
1268 |
|
|
(set result1 (subword SI rn 1))
|
1269 |
|
|
(set rd (-join-si result1 result0))))
|
1270 |
|
|
|
1271 |
|
|
(dshmi mshfhiw "Multimedia shuffle higher-half (word)"
|
1272 |
|
|
()
|
1273 |
|
|
"mshfhi.w $rm, $rn, $rd"
|
1274 |
|
|
(+ (f-op 11) rm (f-ext 5) rn rd (f-rsvd 0))
|
1275 |
|
|
(sequence ((HI result3) (HI result2) (HI result1) (HI result0))
|
1276 |
|
|
(set result0 (subword HI rm 2))
|
1277 |
|
|
(set result1 (subword HI rn 2))
|
1278 |
|
|
(set result2 (subword HI rm 3))
|
1279 |
|
|
(set result3 (subword HI rn 3))
|
1280 |
|
|
(set rd (-join-hi result3 result2 result1 result0))))
|
1281 |
|
|
|
1282 |
|
|
(dshmi mshflob "Multimedia shuffle lower-half (byte)"
|
1283 |
|
|
()
|
1284 |
|
|
"mshflo.b $rm, $rn, $rd"
|
1285 |
|
|
(+ (f-op 11) rm (f-ext 0) rn rd (f-rsvd 0))
|
1286 |
|
|
(sequence ((QI result7) (QI result6) (QI result5) (QI result4)
|
1287 |
|
|
(QI result3) (QI result2) (QI result1) (QI result0))
|
1288 |
|
|
(set result0 (subword QI rm 0))
|
1289 |
|
|
(set result1 (subword QI rn 0))
|
1290 |
|
|
(set result2 (subword QI rm 1))
|
1291 |
|
|
(set result3 (subword QI rn 1))
|
1292 |
|
|
(set result4 (subword QI rm 2))
|
1293 |
|
|
(set result5 (subword QI rn 2))
|
1294 |
|
|
(set result6 (subword QI rm 3))
|
1295 |
|
|
(set result7 (subword QI rn 3))
|
1296 |
|
|
(set rd (-join-qi result7 result6 result5 result4 result3
|
1297 |
|
|
result2 result1 result0))))
|
1298 |
|
|
|
1299 |
|
|
(dshmi mshflol "Multimedia shuffle lower-half (long)"
|
1300 |
|
|
()
|
1301 |
|
|
"mshflo.l $rm, $rn, $rd"
|
1302 |
|
|
(+ (f-op 11) rm (f-ext 2) rn rd (f-rsvd 0))
|
1303 |
|
|
(sequence ((SI result1) (SI result0))
|
1304 |
|
|
(set result0 (subword SI rm 0))
|
1305 |
|
|
(set result1 (subword SI rn 0))
|
1306 |
|
|
(set rd (-join-si result1 result0))))
|
1307 |
|
|
|
1308 |
|
|
(dshmi mshflow "Multimedia shuffle lower-half (word)"
|
1309 |
|
|
()
|
1310 |
|
|
"mshflo.w $rm, $rn, $rd"
|
1311 |
|
|
(+ (f-op 11) rm (f-ext 1) rn rd (f-rsvd 0))
|
1312 |
|
|
(sequence ((HI result3) (HI result2) (HI result1) (HI result0))
|
1313 |
|
|
(set result0 (subword HI rm 0))
|
1314 |
|
|
(set result1 (subword HI rn 0))
|
1315 |
|
|
(set result2 (subword HI rm 1))
|
1316 |
|
|
(set result3 (subword HI rn 1))
|
1317 |
|
|
(set rd (-join-hi result3 result2 result1 result0))))
|
1318 |
|
|
|
1319 |
|
|
(define-pmacro (-mshlldl arg) (sll arg (and rn 31)))
|
1320 |
|
|
(dshmi mshlldl "Multimedia logical left shift (long word)"
|
1321 |
|
|
()
|
1322 |
|
|
"mshlld.l $rm, $rn, $rd"
|
1323 |
|
|
(+ (f-op 3) rm (f-ext 2) rn rd (f-rsvd 0))
|
1324 |
|
|
(slice-long-unop -mshlldl))
|
1325 |
|
|
|
1326 |
|
|
(define-pmacro (-mshlldw arg) (sll arg (and rn 15)))
|
1327 |
|
|
(dshmi mshlldw "Multimedia logical left shift (word)"
|
1328 |
|
|
()
|
1329 |
|
|
"mshlld.w $rm, $rn, $rd"
|
1330 |
|
|
(+ (f-op 3) rm (f-ext 1) rn rd (f-rsvd 0))
|
1331 |
|
|
(slice-word-unop -mshlldw))
|
1332 |
|
|
|
1333 |
|
|
(define-pmacro (-mshlrdl arg) (srl arg (and rn 31)))
|
1334 |
|
|
(dshmi mshlrdl "Multimedia logical right shift (long word)"
|
1335 |
|
|
()
|
1336 |
|
|
"mshlrd.l $rm, $rn, $rd"
|
1337 |
|
|
(+ (f-op 3) rm (f-ext 14) rn rd (f-rsvd 0))
|
1338 |
|
|
(slice-long-unop -mshlrdl))
|
1339 |
|
|
|
1340 |
|
|
(define-pmacro (-mshlrdw arg) (srl arg (and rn 15)))
|
1341 |
|
|
(dshmi mshlrdw "Multimedia logical right shift (word)"
|
1342 |
|
|
()
|
1343 |
|
|
"mshlrd.w $rm, $rn, $rd"
|
1344 |
|
|
(+ (f-op 3) rm (f-ext 13) rn rd (f-rsvd 0))
|
1345 |
|
|
(slice-word-unop -mshlrdw))
|
1346 |
|
|
|
1347 |
|
|
(dshmi msubl "Multimedia subtract (long word)"
|
1348 |
|
|
()
|
1349 |
|
|
"msub.l $rm, $rn, $rd"
|
1350 |
|
|
(+ (f-op 2) rm (f-ext 10) rn rd (f-rsvd 0))
|
1351 |
|
|
(slice-long sub))
|
1352 |
|
|
|
1353 |
|
|
(dshmi msubw "Multimedia add (word)"
|
1354 |
|
|
()
|
1355 |
|
|
"msub.w $rm, $rn, $rd"
|
1356 |
|
|
(+ (f-op 2) rm (f-ext 9) rn rd (f-rsvd 0))
|
1357 |
|
|
(slice-word sub))
|
1358 |
|
|
|
1359 |
|
|
(define-pmacro (-msubsl arg1 arg2) (saturate SI 32 (sub arg1 arg2)))
|
1360 |
|
|
(dshmi msubsl "Multimedia subtract (saturating long)"
|
1361 |
|
|
()
|
1362 |
|
|
"msubs.l $rm, $rn, $rd"
|
1363 |
|
|
(+ (f-op 2) rm (f-ext 14) rn rd (f-rsvd 0))
|
1364 |
|
|
(slice-long -msubsl))
|
1365 |
|
|
|
1366 |
|
|
(define-pmacro (-msubsub arg1 arg2) (usaturate QI 8 (sub arg1 arg2)))
|
1367 |
|
|
(dshmi msubsub "Multimedia subtract (saturating byte)"
|
1368 |
|
|
()
|
1369 |
|
|
"msubs.ub $rm, $rn, $rd"
|
1370 |
|
|
(+ (f-op 2) rm (f-ext 12) rn rd (f-rsvd 0))
|
1371 |
|
|
(slice-byte -msubsub))
|
1372 |
|
|
|
1373 |
|
|
(define-pmacro (-msubsw arg1 arg2) (saturate HI 16 (sub arg1 arg2)))
|
1374 |
|
|
(dshmi msubsw "Multimedia subtract (saturating word)"
|
1375 |
|
|
()
|
1376 |
|
|
"msubs.w $rm, $rn, $rd"
|
1377 |
|
|
(+ (f-op 2) rm (f-ext 13) rn rd (f-rsvd 0))
|
1378 |
|
|
(slice-byte -msubsw))
|
1379 |
|
|
|
1380 |
|
|
(dshmi mulsl "Multiply signed long"
|
1381 |
|
|
()
|
1382 |
|
|
"muls.l $rm, $rn, $rd"
|
1383 |
|
|
(+ (f-op 1) rm (f-ext 14) rn rd (f-rsvd 0))
|
1384 |
|
|
(set rd (mul (ext DI (subword SI rm 1)) (ext DI (subword SI rn 1)))))
|
1385 |
|
|
|
1386 |
|
|
(dshmi mulul "Multiply unsigned long"
|
1387 |
|
|
()
|
1388 |
|
|
"mulu.l $rm, $rn, $rd"
|
1389 |
|
|
(+ (f-op 0) rm (f-ext 14) rn rd (f-rsvd 0))
|
1390 |
|
|
(set rd (mul (zext DI (subword SI rm 1)) (zext DI (subword SI rn 1)))))
|
1391 |
|
|
|
1392 |
|
|
(dshmi nop "No operation"
|
1393 |
|
|
()
|
1394 |
|
|
"nop"
|
1395 |
|
|
(+ (f-op 27) (f-left 63) (f-ext 0) (f-right 63) (f-dest 63) (f-rsvd 0))
|
1396 |
|
|
(nop))
|
1397 |
|
|
|
1398 |
|
|
(dshmi nsb "Number of consecutive sign bits"
|
1399 |
|
|
()
|
1400 |
|
|
"nsb $rm, $rd"
|
1401 |
|
|
(+ (f-op 0) rm (f-ext 13) (f-right 63) rd (f-rsvd 0))
|
1402 |
|
|
; Semantics requires a loop construct, so punt to C.
|
1403 |
|
|
(set rd (c-call DI "sh64_nsb" rm)))
|
1404 |
|
|
|
1405 |
|
|
(dshmi ocbi "Invalidate operand cache block"
|
1406 |
|
|
()
|
1407 |
|
|
"ocbi $rm, $disp6x32"
|
1408 |
|
|
(+ (f-op 56) rm (f-ext 9) disp6x32 (f-dest 63) (f-rsvd 0))
|
1409 |
|
|
(unimp "ocbi"))
|
1410 |
|
|
|
1411 |
|
|
(dshmi ocbp "Purge operand cache block"
|
1412 |
|
|
()
|
1413 |
|
|
"ocbp $rm, $disp6x32"
|
1414 |
|
|
(+ (f-op 56) rm (f-ext 8) disp6x32 (f-dest 63) (f-rsvd 0))
|
1415 |
|
|
(unimp "ocbp"))
|
1416 |
|
|
|
1417 |
|
|
(dshmi ocbwb "Write-back operand cache block"
|
1418 |
|
|
()
|
1419 |
|
|
"ocbwb $rm, $disp6x32"
|
1420 |
|
|
(+ (f-op 56) rm (f-ext 12) disp6x32 (f-dest 63) (f-rsvd 0))
|
1421 |
|
|
(unimp "ocbwb"))
|
1422 |
|
|
|
1423 |
|
|
(dshmi or "OR"
|
1424 |
|
|
()
|
1425 |
|
|
"or $rm, $rn, $rd"
|
1426 |
|
|
(+ (f-op 1) rm (f-ext 9) rn rd (f-rsvd 0))
|
1427 |
|
|
(set rd (or rm rn)))
|
1428 |
|
|
|
1429 |
|
|
(dshmi ori "OR immediate"
|
1430 |
|
|
()
|
1431 |
|
|
"ori $rm, $imm10, $rd"
|
1432 |
|
|
(+ (f-op 55) rm imm10 rd (f-rsvd 0))
|
1433 |
|
|
(set rd (or rm (ext DI imm10))))
|
1434 |
|
|
|
1435 |
|
|
(dshmi prefi "Prefetch instruction"
|
1436 |
|
|
()
|
1437 |
|
|
"prefi $rm, $disp6x32"
|
1438 |
|
|
(+ (f-op 56) rm (f-ext 1) disp6x32 (f-right 63) (f-rsvd 0))
|
1439 |
|
|
(unimp "prefi"))
|
1440 |
|
|
|
1441 |
|
|
(dshmi pta "Prepare target register for SHmedia target"
|
1442 |
|
|
()
|
1443 |
|
|
"pta$likely $disp16, $tra"
|
1444 |
|
|
(+ (f-op 58) disp16 likely (f-8-2 0) tra (f-rsvd 0))
|
1445 |
|
|
(set tra (add disp16 1)))
|
1446 |
|
|
|
1447 |
|
|
(dshmi ptabs "Prepare target register with absolute value from register"
|
1448 |
|
|
()
|
1449 |
|
|
"ptabs$likely $rn, $tra"
|
1450 |
|
|
(+ (f-op 26) (f-left 63) (f-ext 1) rn likely (f-8-2 0) tra (f-rsvd 0))
|
1451 |
|
|
(set tra rn))
|
1452 |
|
|
|
1453 |
|
|
(dshmi ptb "Prepare target register for SHcompact target"
|
1454 |
|
|
()
|
1455 |
|
|
"ptb$likely $disp16, $tra"
|
1456 |
|
|
(+ (f-op 59) disp16 likely (f-8-2 0) tra (f-rsvd 0))
|
1457 |
|
|
(set tra disp16))
|
1458 |
|
|
|
1459 |
|
|
(dshmi ptrel "Prepare target register with relative value from register"
|
1460 |
|
|
()
|
1461 |
|
|
"ptrel$likely $rn, $tra"
|
1462 |
|
|
(+ (f-op 26) (f-left 63) (f-ext 5) rn likely (f-8-2 0) tra (f-rsvd 0))
|
1463 |
|
|
(set tra (add pc rn)))
|
1464 |
|
|
|
1465 |
|
|
(dshmi putcfg "Put configuration register"
|
1466 |
|
|
()
|
1467 |
|
|
"putcfg $rm, $disp6, $rd"
|
1468 |
|
|
(+ (f-op 56) rm (f-ext 15) disp6 rd (f-rsvd 0))
|
1469 |
|
|
(unimp "putcfg"))
|
1470 |
|
|
|
1471 |
|
|
(dshmi putcon "Put control register"
|
1472 |
|
|
()
|
1473 |
|
|
"putcon $rm, $crj"
|
1474 |
|
|
(+ (f-op 27) rm (f-ext 15) (f-right 63) crj (f-rsvd 0))
|
1475 |
|
|
(set crj rm))
|
1476 |
|
|
|
1477 |
|
|
(dshmi rte "Return from exception"
|
1478 |
|
|
()
|
1479 |
|
|
"rte"
|
1480 |
|
|
(+ (f-op 27) (f-left 63) (f-ext 3) (f-right 63) (f-dest 63) (f-rsvd 0))
|
1481 |
|
|
(unimp "rte"))
|
1482 |
|
|
|
1483 |
|
|
(dshmi shard "Arithmetic right shift"
|
1484 |
|
|
()
|
1485 |
|
|
"shard $rm, $rn, $rd"
|
1486 |
|
|
(+ (f-op 1) rm (f-ext 7) rn rd (f-rsvd 0))
|
1487 |
|
|
(set rd (sra rm (and rn 63))))
|
1488 |
|
|
|
1489 |
|
|
(dshmi shardl "Arithmetic right shift (long word)"
|
1490 |
|
|
()
|
1491 |
|
|
"shard.l $rm, $rn, $rd"
|
1492 |
|
|
(+ (f-op 1) rm (f-ext 6) rn rd (f-rsvd 0))
|
1493 |
|
|
(set rd (ext DI (sra (subword SI rm 1) (and rn 63)))))
|
1494 |
|
|
|
1495 |
|
|
(dshmi shari "Arithmetic right shift (immediate count)"
|
1496 |
|
|
()
|
1497 |
|
|
"shari $rm, $uimm6, $rd"
|
1498 |
|
|
(+ (f-op 49) rm (f-ext 7) uimm6 rd (f-rsvd 0))
|
1499 |
|
|
(set rd (sra rm uimm6)))
|
1500 |
|
|
|
1501 |
|
|
(dshmi sharil "Arithmetic right shift (long word, immediate count)"
|
1502 |
|
|
()
|
1503 |
|
|
"shari.l $rm, $uimm6, $rd"
|
1504 |
|
|
(+ (f-op 49) rm (f-ext 6) uimm6 rd (f-rsvd 0))
|
1505 |
|
|
(set rd (ext DI (sra (subword SI rm 1) (and uimm6 63)))))
|
1506 |
|
|
|
1507 |
|
|
(dshmi shlld "Logical left shift"
|
1508 |
|
|
()
|
1509 |
|
|
"shlld $rm, $rn, $rd"
|
1510 |
|
|
(+ (f-op 1) rm (f-ext 1) rn rd (f-rsvd 0))
|
1511 |
|
|
(set rd (sll rm (and rn 63))))
|
1512 |
|
|
|
1513 |
|
|
(dshmi shlldl "Logical left shift (long word)"
|
1514 |
|
|
()
|
1515 |
|
|
"shlld.l $rm, $rn, $rd"
|
1516 |
|
|
(+ (f-op 1) rm (f-ext 0) rn rd (f-rsvd 0))
|
1517 |
|
|
(set rd (ext DI (sll (subword SI rm 1) (and rn 63)))))
|
1518 |
|
|
|
1519 |
|
|
(dshmi shlli "Logical left shift (immediate count)"
|
1520 |
|
|
()
|
1521 |
|
|
"shlli $rm, $uimm6, $rd"
|
1522 |
|
|
(+ (f-op 49) rm (f-ext 1) uimm6 rd (f-rsvd 0))
|
1523 |
|
|
(set rd (sll rm uimm6)))
|
1524 |
|
|
|
1525 |
|
|
(dshmi shllil "Logical left shift (long word, immediate count)"
|
1526 |
|
|
()
|
1527 |
|
|
"shlli.l $rm, $uimm6, $rd"
|
1528 |
|
|
(+ (f-op 49) rm (f-ext 0) uimm6 rd (f-rsvd 0))
|
1529 |
|
|
(set rd (ext DI (sll (subword SI rm 1) (and uimm6 63)))))
|
1530 |
|
|
|
1531 |
|
|
(dshmi shlrd "Logical right shift"
|
1532 |
|
|
()
|
1533 |
|
|
"shlrd $rm, $rn, $rd"
|
1534 |
|
|
(+ (f-op 1) rm (f-ext 3) rn rd (f-rsvd 0))
|
1535 |
|
|
(set rd (srl rm (and rn 63))))
|
1536 |
|
|
|
1537 |
|
|
(dshmi shlrdl "Logical right shift (long word)"
|
1538 |
|
|
()
|
1539 |
|
|
"shlrd.l $rm, $rn, $rd"
|
1540 |
|
|
(+ (f-op 1) rm (f-ext 2) rn rd (f-rsvd 0))
|
1541 |
|
|
(set rd (ext DI (srl (subword SI rm 1) (and rn 63)))))
|
1542 |
|
|
|
1543 |
|
|
(dshmi shlri "Logical right shift (immediate count)"
|
1544 |
|
|
()
|
1545 |
|
|
"shlri $rm, $uimm6, $rd"
|
1546 |
|
|
(+ (f-op 49) rm (f-ext 3) uimm6 rd (f-rsvd 0))
|
1547 |
|
|
(set rd (srl rm uimm6)))
|
1548 |
|
|
|
1549 |
|
|
(dshmi shlril "Logical right shift (long word, immediate count)"
|
1550 |
|
|
()
|
1551 |
|
|
"shlri.l $rm, $uimm6, $rd"
|
1552 |
|
|
(+ (f-op 49) rm (f-ext 2) uimm6 rd (f-rsvd 0))
|
1553 |
|
|
(set rd (ext DI (srl (subword SI rm 1) (and uimm6 63)))))
|
1554 |
|
|
|
1555 |
|
|
(dshmi shori "Shift-or immediate"
|
1556 |
|
|
()
|
1557 |
|
|
"shori $uimm16, $rd"
|
1558 |
|
|
(+ (f-op 50) uimm16 rd (f-rsvd 0))
|
1559 |
|
|
(set rd (or (sll rd 16) (zext DI uimm16))))
|
1560 |
|
|
|
1561 |
|
|
(dshmi sleep "Sleep"
|
1562 |
|
|
()
|
1563 |
|
|
"sleep"
|
1564 |
|
|
(+ (f-op 27) (f-left 63) (f-ext 7) (f-right 63) (f-dest 63) (f-rsvd 0))
|
1565 |
|
|
(unimp "sleep"))
|
1566 |
|
|
|
1567 |
|
|
(dshmi stb "Store byte"
|
1568 |
|
|
()
|
1569 |
|
|
"st.b $rm, $disp10, $rd"
|
1570 |
|
|
(+ (f-op 40) rm disp10 rd (f-rsvd 0))
|
1571 |
|
|
(set (mem UQI (add rm (ext DI disp10))) (and QI rd #xff)))
|
1572 |
|
|
|
1573 |
|
|
(dshmi stl "Store long word"
|
1574 |
|
|
()
|
1575 |
|
|
"st.l $rm, $disp10x4, $rd"
|
1576 |
|
|
(+ (f-op 42) rm disp10x4 rd (f-rsvd 0))
|
1577 |
|
|
(set (mem SI (add rm (ext DI disp10x4))) (and SI rd #xffffffff)))
|
1578 |
|
|
|
1579 |
|
|
(dshmi stq "Store quad word"
|
1580 |
|
|
()
|
1581 |
|
|
"st.q $rm, $disp10x8, $rd"
|
1582 |
|
|
(+ (f-op 43) rm disp10x8 rd (f-rsvd 0))
|
1583 |
|
|
(set (mem DI (add rm (ext DI disp10x8))) rd))
|
1584 |
|
|
|
1585 |
|
|
(dshmi stw "Store word"
|
1586 |
|
|
()
|
1587 |
|
|
"st.w $rm, $disp10x2, $rd"
|
1588 |
|
|
(+ (f-op 41) rm disp10x2 rd (f-rsvd 0))
|
1589 |
|
|
(set (mem HI (add rm (ext DI disp10x2))) (and HI rd #xffff)))
|
1590 |
|
|
|
1591 |
|
|
(define-pmacro (-sthi-byte)
|
1592 |
|
|
(sequence ()
|
1593 |
|
|
(set (mem UQI addr) (and QI val #xff))
|
1594 |
|
|
(set val (srl val 8))
|
1595 |
|
|
(set addr (add addr 1))))
|
1596 |
|
|
|
1597 |
|
|
(dshmi sthil "Store high part (long word)"
|
1598 |
|
|
()
|
1599 |
|
|
"sthi.l $rm, $disp6, $rd"
|
1600 |
|
|
(+ (f-op 56) rm (f-ext 6) disp6 rd (f-rsvd 0))
|
1601 |
|
|
(sequence ((DI addr) (QI bytecount) (DI val))
|
1602 |
|
|
(set addr (add rm disp6))
|
1603 |
|
|
(set bytecount (add (and addr 3) 1))
|
1604 |
|
|
(if endian
|
1605 |
|
|
(set val rd)
|
1606 |
|
|
(set val (srl rd (sub 32 (mul 8 bytecount)))))
|
1607 |
|
|
(set addr (add (sub addr bytecount) 1))
|
1608 |
|
|
(if (gt bytecount 3)
|
1609 |
|
|
(-sthi-byte))
|
1610 |
|
|
(if (gt bytecount 2)
|
1611 |
|
|
(-sthi-byte))
|
1612 |
|
|
(if (gt bytecount 1)
|
1613 |
|
|
(-sthi-byte))
|
1614 |
|
|
(if (gt bytecount 0)
|
1615 |
|
|
(-sthi-byte))))
|
1616 |
|
|
|
1617 |
|
|
(dshmi sthiq "Store high part (quad word)"
|
1618 |
|
|
()
|
1619 |
|
|
"sthi.q $rm, $disp6, $rd"
|
1620 |
|
|
(+ (f-op 56) rm (f-ext 7) disp6 rd (f-rsvd 0))
|
1621 |
|
|
(sequence ((DI addr) (QI bytecount) (DI val))
|
1622 |
|
|
(set addr (add rm disp6))
|
1623 |
|
|
(set bytecount (add (and addr 7) 1))
|
1624 |
|
|
(if endian
|
1625 |
|
|
(set val rd)
|
1626 |
|
|
(set val (srl rd (sub 64 (mul 8 bytecount)))))
|
1627 |
|
|
(set addr (add (sub addr bytecount) 1))
|
1628 |
|
|
(if (gt bytecount 7)
|
1629 |
|
|
(-sthi-byte))
|
1630 |
|
|
(if (gt bytecount 6)
|
1631 |
|
|
(-sthi-byte))
|
1632 |
|
|
(if (gt bytecount 5)
|
1633 |
|
|
(-sthi-byte))
|
1634 |
|
|
(if (gt bytecount 4)
|
1635 |
|
|
(-sthi-byte))
|
1636 |
|
|
(if (gt bytecount 3)
|
1637 |
|
|
(-sthi-byte))
|
1638 |
|
|
(if (gt bytecount 2)
|
1639 |
|
|
(-sthi-byte))
|
1640 |
|
|
(if (gt bytecount 1)
|
1641 |
|
|
(-sthi-byte))
|
1642 |
|
|
(if (gt bytecount 0)
|
1643 |
|
|
(-sthi-byte))))
|
1644 |
|
|
|
1645 |
|
|
(dshmi stlol "Store low part (long word)"
|
1646 |
|
|
()
|
1647 |
|
|
"stlo.l $rm, $disp6, $rd"
|
1648 |
|
|
(+ (f-op 56) rm (f-ext 2) disp6 rd (f-rsvd 0))
|
1649 |
|
|
; FIXME.
|
1650 |
|
|
(unimp "stlol"))
|
1651 |
|
|
|
1652 |
|
|
(dshmi stloq "Store low part (quad word)"
|
1653 |
|
|
()
|
1654 |
|
|
"stlo.q $rm, $disp6, $rd"
|
1655 |
|
|
(+ (f-op 56) rm (f-ext 3) disp6 rd (f-rsvd 0))
|
1656 |
|
|
; FIXME.
|
1657 |
|
|
(unimp "stloq"))
|
1658 |
|
|
|
1659 |
|
|
(dshmi stxb "Store byte (extended displacement)"
|
1660 |
|
|
()
|
1661 |
|
|
"stx.b $rm, $rn, $rd"
|
1662 |
|
|
(+ (f-op 24) rm (f-ext 0) rn rd (f-rsvd 0))
|
1663 |
|
|
(set (mem UQI (add rm rn)) (subword QI rd 7)))
|
1664 |
|
|
|
1665 |
|
|
(dshmi stxl "Store long (extended displacement)"
|
1666 |
|
|
()
|
1667 |
|
|
"stx.l $rm, $rn, $rd"
|
1668 |
|
|
(+ (f-op 24) rm (f-ext 2) rn rd (f-rsvd 0))
|
1669 |
|
|
(set (mem SI (add rm rn)) (subword SI rd 1)))
|
1670 |
|
|
|
1671 |
|
|
(dshmi stxq "Store quad word (extended displacement)"
|
1672 |
|
|
()
|
1673 |
|
|
"stx.q $rm, $rn, $rd"
|
1674 |
|
|
(+ (f-op 24) rm (f-ext 3) rn rd (f-rsvd 0))
|
1675 |
|
|
(set (mem DI (add rm rn)) rd))
|
1676 |
|
|
|
1677 |
|
|
(dshmi stxw "Store word (extended displacement)"
|
1678 |
|
|
()
|
1679 |
|
|
"stx.w $rm, $rn, $rd"
|
1680 |
|
|
(+ (f-op 24) rm (f-ext 1) rn rd (f-rsvd 0))
|
1681 |
|
|
(set (mem HI (add rm rn)) (subword HI rd 3)))
|
1682 |
|
|
|
1683 |
|
|
(dshmi sub "Subtract"
|
1684 |
|
|
()
|
1685 |
|
|
"sub $rm, $rn, $rd"
|
1686 |
|
|
(+ (f-op 0) rm (f-ext 11) rn rd (f-rsvd 0))
|
1687 |
|
|
(set rd (sub rm rn)))
|
1688 |
|
|
|
1689 |
|
|
(dshmi subl "Subtract long"
|
1690 |
|
|
()
|
1691 |
|
|
"sub.l $rm, $rn, $rd"
|
1692 |
|
|
(+ (f-op 0) rm (f-ext 10) rn rd (f-rsvd 0))
|
1693 |
|
|
(set rd (ext DI (sub (subword SI rm 1) (subword SI rn 1)))))
|
1694 |
|
|
|
1695 |
|
|
(dshmi swapq "Swap quad words"
|
1696 |
|
|
()
|
1697 |
|
|
"swap.q $rm, $rn, $rd"
|
1698 |
|
|
(+ (f-op 8) rm (f-ext 3) rn rd (f-rsvd 0))
|
1699 |
|
|
(sequence ((DI addr) (DI temp))
|
1700 |
|
|
(set addr (add rm rn))
|
1701 |
|
|
(set temp (mem DI addr))
|
1702 |
|
|
(set (mem DI addr) rd)
|
1703 |
|
|
(set rd temp)))
|
1704 |
|
|
|
1705 |
|
|
(dshmi synci "Synchronise instruction fetch"
|
1706 |
|
|
()
|
1707 |
|
|
"synci"
|
1708 |
|
|
(+ (f-op 27) (f-left 63) (f-ext 2) (f-right 63) (f-dest 63) (f-rsvd 0))
|
1709 |
|
|
(unimp "synci"))
|
1710 |
|
|
|
1711 |
|
|
(dshmi synco "Synchronise data operations"
|
1712 |
|
|
()
|
1713 |
|
|
"synco"
|
1714 |
|
|
(+ (f-op 27) (f-left 63) (f-ext 6) (f-right 63) (f-dest 63) (f-rsvd 0))
|
1715 |
|
|
(unimp "synco"))
|
1716 |
|
|
|
1717 |
|
|
(dshmi trapa "Trap"
|
1718 |
|
|
()
|
1719 |
|
|
"trapa $rm"
|
1720 |
|
|
(+ (f-op 27) rm (f-ext 1) (f-right 63) (f-dest 63) (f-rsvd 0))
|
1721 |
|
|
(c-call "sh64_trapa" rm pc))
|
1722 |
|
|
|
1723 |
|
|
(dshmi xor "Exclusive OR"
|
1724 |
|
|
()
|
1725 |
|
|
"xor $rm, $rn, $rd"
|
1726 |
|
|
(+ (f-op 1) rm (f-ext 13) rn rd (f-rsvd 0))
|
1727 |
|
|
(set rd (xor rm rn)))
|
1728 |
|
|
|
1729 |
|
|
(dshmi xori "Exclusive OR immediate"
|
1730 |
|
|
()
|
1731 |
|
|
"xori $rm, $imm6, $rd"
|
1732 |
|
|
(+ (f-op 49) rm (f-ext 13) rn rd (f-rsvd 0))
|
1733 |
|
|
(set rd (xor rm (ext DI imm6))))
|