1 ; Hitachi SHmedia instruction set description. -*- Scheme -*-
3 ; Copyright 2000, 2001 Free Software Foundation, Inc.
5 ; Contributed by Red Hat Inc; developed under contract from Hitachi
6 ; Semiconductor (America) Inc.
8 ; This file is part of the GNU Binutils.
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 2 of the License, or
13 ; (at your option) any later version.
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.
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, MA 02110-1301, USA.
25 ; dshmf -- define-normal-sh-media-field
27 (define-pmacro (dshmf xname xcomment ignored xstart xlength)
28 (dnf xname xcomment ((ISA media)) xstart xlength))
30 ; dshmop -- define-normal-sh-media-operand
32 (define-pmacro (dshmop xname xcomment ignored xhardware xfield)
33 (dnop xname xcomment ((ISA media)) xhardware xfield))
35 ; dnshmi -- define-normal-sh-media-insn
37 (define-pmacro (dshmi xname xcomment xattrs xsyntax xformat xsemantics)
41 (.splice attrs (.unsplice xattrs) (ISA media))
44 (semantics xsemantics)))
46 ; Saturation functions.
47 ; Force a value `i' into words `n' bits wide.
48 ; See Hitachi SH-5 CPU core, volume 2, p. 25 for details.
50 ; saturate -- signed saturatation function
52 (define-pmacro (saturate mode n i)
53 (if mode (lt i (neg mode (sll mode 1 (sub n 1))))
54 (neg (sll mode 1 (sub n 1)))
55 (if mode (lt i (sll mode 1 (sub n 1)))
57 (sub mode (sll mode 1 (sub n 1)) 1))))
59 ; usaturate -- unsigned saturation function
61 (define-pmacro (usaturate mode n i)
62 (if mode (lt i (const mode 0))
64 (if mode (lt i (sll mode 1 n))
66 (sub mode (sll mode 1 n) 1))))
71 (dshmf f-op "Opcode" () 31 6)
72 (dshmf f-ext "Extension opcode" () 19 4)
73 (dshmf f-rsvd "Reserved" (RESERVED) 3 4)
75 (dshmf f-left "Left register" () 25 6)
76 (dshmf f-right "Right register" () 15 6)
77 (dshmf f-dest "Destination register" () 9 6)
81 (comment "Left and right matched register pair")
84 (subfields f-left f-right)
87 (and (ifield f-left-right) 63))
89 (and (ifield f-left-right) 63))))
90 (extract (set (ifield f-left-right) (ifield f-left)))
93 (dshmf f-tra "Target register" () 6 3)
94 (dshmf f-trb "Target register" () 22 3)
95 (dshmf f-likely "Likely bit" () 9 1)
96 (dshmf f-25 "Three unused bits at bit 25" () 25 3)
97 (dshmf f-8-2 "Two unused bits at bit 8" () 8 2)
99 (df f-imm6 "Immediate value (6 bits)" ((ISA media)) 15 6 INT #f #f)
100 (df f-imm10 "Immediate value (10 bits)" ((ISA media)) 19 10 INT #f #f)
101 (df f-imm16 "Immediate value (16 bits)" ((ISA media)) 25 16 INT #f #f)
103 (dshmf f-uimm6 "Immediate value (6 bits)" () 15 6)
104 (dshmf f-uimm16 "Immediate value (16 bits)" () 25 16)
106 ; Various displacement fields.
107 ; The 10 bit field, for example, has different scaling for displacements.
109 (df f-disp6 "Displacement (6 bits)" ((ISA media)) 15 6 INT #f #f)
111 (df f-disp6x32 "Displacement (6 bits)" ((ISA media)) 15 6 INT
112 ((value pc) (sra SI value 5))
113 ((value pc) (sll SI value 5)))
115 (df f-disp10 "Displacement (10 bits)" ((ISA media)) 19 10 INT #f #f)
117 (df f-disp10x8 "Displacement (10 bits)" ((ISA media)) 19 10 INT
118 ((value pc) (sra SI value 3))
119 ((value pc) (sll SI value 3)))
121 (df f-disp10x4 "Displacement (10 bits)" ((ISA media)) 19 10 INT
122 ((value pc) (sra SI value 2))
123 ((value pc) (sll SI value 2)))
125 (df f-disp10x2 "Displacement (10 bits)" ((ISA media)) 19 10 INT
126 ((value pc) (sra SI value 1))
127 ((value pc) (sll SI value 1)))
129 (df f-disp16 "Displacement (16 bits)" ((ISA media) PCREL-ADDR) 25 16 INT
130 ((value pc) (sra DI value 2))
131 ((value pc) (add DI (sll DI value 2) pc)))
136 (dshmop rm "Left general purpose reg" () h-gr f-left)
137 (dshmop rn "Right general purpose reg" () h-gr f-right)
138 (dshmop rd "Destination general purpose reg" () h-gr f-dest)
140 (dshmop frg "Left single precision register" () h-fr f-left)
141 (dshmop frh "Right single precision register" () h-fr f-right)
142 (dshmop frf "Destination single precision reg" () h-fr f-dest)
143 (dshmop frgh "Single precision register pair" () h-fr f-left-right)
145 (dshmop fpf "Pair of single precision registers" () h-fp f-dest)
147 (dshmop fvg "Left single precision vector" () h-fv f-left)
148 (dshmop fvh "Right single precision vector" () h-fv f-right)
149 (dshmop fvf "Destination single precision vector" () h-fv f-dest)
150 (dshmop mtrxg "Left single precision matrix" () h-fmtx f-left)
152 (dshmop drg "Left double precision register" () h-dr f-left)
153 (dshmop drh "Right double precision register" () h-dr f-right)
154 (dshmop drf "Destination double precision reg" () h-dr f-dest)
155 (dshmop drgh "Double precision register pair" () h-dr f-left-right)
157 (dshmop fpscr "Floating point status register" () h-fpscr f-nil)
158 (dshmop crj "Control register j" () h-cr f-dest)
159 (dshmop crk "Control register k" () h-cr f-left)
161 (dshmop tra "Target register a" () h-tr f-tra)
162 (dshmop trb "Target register b" () h-tr f-trb)
164 (dshmop disp6 "Displacement (6 bits)" () h-sint f-disp6)
165 (dshmop disp6x32 "Displacement (6 bits, scale 32)" () h-sint f-disp6x32)
166 (dshmop disp10 "Displacement (10 bits)" () h-sint f-disp10)
167 (dshmop disp10x2 "Displacement (10 bits, scale 2)" () h-sint f-disp10x2)
168 (dshmop disp10x4 "Displacement (10 bits, scale 4)" () h-sint f-disp10x4)
169 (dshmop disp10x8 "Displacement (10 bits, scale 8)" () h-sint f-disp10x8)
170 (dshmop disp16 "Displacement (16 bits)" () h-sint f-disp16)
172 (dshmop imm6 "Immediate (6 bits)" () h-sint f-imm6)
173 (dshmop imm10 "Immediate (10 bits)" () h-sint f-imm10)
174 (dshmop imm16 "Immediate (16 bits)" () h-sint f-imm16)
175 (dshmop uimm6 "Immediate (6 bits)" () h-uint f-uimm6)
176 (dshmop uimm16 "Unsigned immediate (16 bits)" () h-uint f-uimm16)
178 ; FIXME: provide these parse/print functions in `sh-media.opc'.
180 (define-operand (name likely) (comment "Likely branch?") (attrs (ISA media))
181 (type h-uint) (index f-likely) (handlers (parse "likely") (print "likely")))
189 (+ (f-op 0) rm (f-ext 9) rn rd (f-rsvd 0))
190 (set rd (add rm rn)))
192 (dshmi addl "Add long"
194 "add.l $rm, $rn, $rd"
195 (+ (f-op 0) rm (f-ext 8) rn rd (f-rsvd 0))
196 (set rd (add (subword SI rm 1) (subword SI rn 1))))
198 (dshmi addi "Add immediate"
200 "addi $rm, $disp10, $rd"
201 (+ (f-op 52) rm disp10 rd (f-rsvd 0))
202 (set rd (add rm (ext DI disp10))))
204 (dshmi addil "Add immediate long"
206 "addi.l $rm, $disp10, $rd"
207 (+ (f-op 53) rm disp10 rd (f-rsvd 0))
208 (set rd (ext DI (add (ext SI disp10) (subword SI rm 1)))))
210 (dshmi addzl "Add zero extended long"
212 "addz.l $rm, $rn, $rd"
213 (+ (f-op 0) rm (f-ext 12) rn rd (f-rsvd 0))
214 (set rd (zext DI (add (subword SI rm 1) (subword SI rn 1)))))
216 (dshmi alloco "Allocate operand cache block"
218 "alloco $rm, $disp6x32"
219 (+ (f-op 56) rm (f-ext 4) disp6x32 (f-dest 63) (f-rsvd 0))
225 (+ (f-op 1) rm (f-ext 11) rn rd (f-rsvd 0))
226 (set rd (and rm rn)))
228 (dshmi andc "AND complement"
231 (+ (f-op 1) rm (f-ext 15) rn rd (f-rsvd 0))
232 (set rd (and rm (inv rn))))
234 (dshmi andi "AND immediate"
236 "andi $rm, $disp10, $rd"
237 (+ (f-op 54) rm disp10 rd (f-rsvd 0))
238 (set rd (and rm (ext DI disp10))))
240 (dshmi beq "Branch if equal"
242 "beq$likely $rm, $rn, $tra"
243 (+ (f-op 25) rm (f-ext 1) rn likely (f-8-2 0) tra (f-rsvd 0))
247 (dshmi beqi "Branch if equal immediate"
249 "beqi$likely $rm, $imm6, $tra"
250 (+ (f-op 57) rm (f-ext 1) imm6 likely (f-8-2 0) tra (f-rsvd 0))
251 (if (eq rm (ext DI imm6))
254 (dshmi bge "Branch if greater than or equal"
256 "bge$likely $rm, $rn, $tra"
257 (+ (f-op 25) rm (f-ext 3) rn likely (f-8-2 0) tra (f-rsvd 0))
261 (dshmi bgeu "Branch if greater than or equal (unsigned comparison)"
263 "bgeu$likely $rm, $rn, $tra"
264 (+ (f-op 25) rm (f-ext 11) rn likely (f-8-2 0) tra (f-rsvd 0))
268 (dshmi bgt "Branch greater than"
270 "bgt$likely $rm, $rn, $tra"
271 (+ (f-op 25) rm (f-ext 7) rn likely (f-8-2 0) tra (f-rsvd 0))
275 (dshmi bgtu "Branch greater than (unsigned comparison)"
277 "bgtu$likely $rm, $rn, $tra"
278 (+ (f-op 25) rm (f-ext 15) rn likely (f-8-2 0) tra (f-rsvd 0))
282 (dshmi blink "Branch and link"
285 (+ (f-op 17) (f-25 0) trb (f-ext 1) (f-right 63) rd (f-rsvd 0))
287 (set rd (or (add pc 4) 1))
290 (dshmi bne "Branch if not equal"
292 "bne$likely $rm, $rn, $tra"
293 (+ (f-op 25) rm (f-ext 5) rn likely (f-8-2 0) tra (f-rsvd 0))
297 (dshmi bnei "Branch if not equal immediate"
299 "bnei$likely $rm, $imm6, $tra"
300 (+ (f-op 57) rm (f-ext 5) rn likely (f-8-2 0) tra (f-rsvd 0))
301 (if (ne rm (ext DI imm6))
304 (dshmi brk "Breakpoint instruction"
307 (+ (f-op 27) (f-left 63) (f-ext 5) (f-right 63) (f-dest 63) (f-rsvd 0))
308 (c-call "sh64_break" pc))
310 (define-pmacro (-byterev-step)
312 (set result (or (sll result 8) (and source 255)))
313 (set source (srl source 8)))
316 (dshmi byterev "Byte reverse"
319 (+ (f-op 0) rm (f-ext 15) (f-right 63) rd (f-rsvd 0))
320 (sequence ((DI source) (DI result))
333 (dshmi cmpeq "Compare equal"
335 "cmpeq $rm, $rn, $rd"
336 (+ (f-op 0) rm (f-ext 1) rn rd (f-rsvd 0))
337 (set rd (if DI (eq rm rn) 1 0)))
339 (dshmi cmpgt "Compare greater than"
341 "cmpgt $rm, $rn, $rd"
342 (+ (f-op 0) rm (f-ext 3) rn rd (f-rsvd 0))
343 (set rd (if DI (gt rm rn) 1 0)))
345 (dshmi cmpgtu "Compare greater than (unsigned comparison)"
347 "cmpgtu $rm,$rn, $rd"
348 (+ (f-op 0) rm (f-ext 7) rn rd (f-rsvd 0))
349 (set rd (if DI (gtu rm rn) 1 0)))
351 (dshmi cmveq "Conditional move if equal to zero"
353 "cmveq $rm, $rn, $rd"
354 (+ (f-op 8) rm (f-ext 1) rn rd (f-rsvd 0))
358 (dshmi cmvne "Conditional move if not equal to zero"
360 "cmvne $rm, $rn, $rd"
361 (+ (f-op 8) rm (f-ext 5) rn rd (f-rsvd 0))
365 (dshmi fabsd "Floating point absolute (double)"
368 (+ (f-op 6) drgh (f-ext 1) drf (f-rsvd 0))
369 (set drf (c-call DF "sh64_fabsd" drgh)))
371 (dshmi fabss "Floating point absolute (single)"
374 (+ (f-op 6) frgh (f-ext 0) frf (f-rsvd 0))
375 (set frf (c-call SF "sh64_fabss" frgh)))
377 (dshmi faddd "Floating point add (double)"
379 "fadd.d $drg, $drh, $drf"
380 (+ (f-op 13) drg (f-ext 1) drh drf (f-rsvd 0))
381 (set drf (c-call DF "sh64_faddd" drg drh)))
383 (dshmi fadds "Floating point add (single)"
385 "fadd.s $frg, $frh, $frf"
386 (+ (f-op 13) frg (f-ext 0) frh frf (f-rsvd 0))
387 (set frf (c-call SF "sh64_fadds" frg frh)))
389 (dshmi fcmpeqd "Floating point compare if equal (double)"
391 "fcmpeq.d $drg, $drh, $rd"
392 (+ (f-op 12) drg (f-ext 9) drh rd (f-rsvd 0))
393 (set rd (zext DI (c-call BI "sh64_fcmpeqd" drg drh))))
395 (dshmi fcmpeqs "Floating point compare if equal (single)"
397 "fcmpeq.s $frg, $frh, $rd"
398 (+ (f-op 12) frg (f-ext 8) frh rd (f-rsvd 0))
399 (set rd (zext DI (c-call BI "sh64_fcmpeqs" frg frh))))
401 (dshmi fcmpged "Floating compare compare if greater than or equal (double)"
403 "fcmpge.d $drg, $drh, $rd"
404 (+ (f-op 12) drg (f-ext 15) drh rd (f-rsvd 0))
405 (set rd (zext DI (c-call BI "sh64_fcmpged" drg drh))))
407 (dshmi fcmpges "Floating point compare if greater than or equal (single)"
409 "fcmpge.s $frg, $frh, $rd"
410 (+ (f-op 12) frg (f-ext 14) frh rd (f-rsvd 0))
411 (set rd (zext DI (c-call BI "sh64_fcmpges" frg frh))))
413 (dshmi fcmpgtd "Floating point compare if greater than (double)"
415 "fcmpgt.d $drg, $drh, $rd"
416 (+ (f-op 12) drg (f-ext 13) drh rd (f-rsvd 0))
417 (set rd (zext DI (c-call BI "sh64_fcmpgtd" drg drh))))
419 (dshmi fcmpgts "Floating point compare if greater than (single)"
421 "fcmpgt.s $frg, $frh, $rd"
422 (+ (f-op 12) frg (f-ext 12) frh rd (f-rsvd 0))
423 (set rd (zext DI (c-call BI "sh64_fcmpgts" frg frh))))
425 (dshmi fcmpund "Floating point unordered comparison (double)"
427 "fcmpun.d $drg, $drh, $rd"
428 (+ (f-op 12) drg (f-ext 11) drh rd (f-rsvd 0))
429 (set rd (zext DI (c-call BI "sh64_fcmpund" drg drh))))
431 (dshmi fcmpuns "Floating point unordered comparison (single)"
433 "fcmpun.s $frg, $frh, $rd"
434 (+ (f-op 12) frg (f-ext 10) frh rd (f-rsvd 0))
435 (set rd (zext DI (c-call BI "sh64_fcmpuns" frg frh))))
437 (dshmi fcnvds "Floating point coversion (double to single)"
439 "fcnv.ds $drgh, $frf"
440 (+ (f-op 14) drgh (f-ext 7) frf (f-rsvd 0))
441 (set frf (c-call SF "sh64_fcnvds" drgh)))
443 (dshmi fcnvsd "Floating point conversion (single to double)"
445 "fcnv.sd $frgh, $drf"
446 (+ (f-op 14) frgh (f-ext 6) drf (f-rsvd 0))
447 (set drf (c-call DF "sh64_fcnvsd" frgh)))
449 (dshmi fdivd "Floating point divide (double)"
451 "fdiv.d $drg, $drh, $drf"
452 (+ (f-op 13) drg (f-ext 5) drh drf (f-rsvd 0))
453 (set drf (c-call DF "sh64_fdivd" drg drh)))
455 (dshmi fdivs "Floating point divide (single)"
457 "fdiv.s $frg, $frh, $frf"
458 (+ (f-op 13) frg (f-ext 4) frh frf (f-rsvd 0))
459 (set frf (c-call SF "sh64_fdivs" frg frh)))
461 (dshmi fgetscr "Floating point get from FPSCR"
464 (+ (f-op 7) (f-left 63) (f-ext 2) (f-right 63) frf (f-rsvd 0))
466 ; FIXME: this should work!
469 (dshmi fiprs "Floating point inner product (single)"
471 "fipr.s $fvg, $fvh, $frf"
472 (+ (f-op 5) fvg (f-ext 6) fvh frf (f-rsvd 0))
473 (sequence ((UQI g) (UQI h) (SF temp))
474 (set g (index-of fvg))
475 (set h (index-of fvh))
476 (set temp (c-call SF "sh64_fmuls" (reg h-fr g) (reg h-fr h)))
477 (set temp (c-call SF "sh64_fadds" temp
478 (c-call SF "sh64_fmuls" (reg h-fr (add g 1)) (reg h-fr (add h 1)))))
479 (set temp (c-call SF "sh64_fadds" temp
480 (c-call SF "sh64_fmuls" (reg h-fr (add g 2)) (reg h-fr (add h 2)))))
481 (set temp (c-call SF "sh64_fadds" temp
482 (c-call SF "sh64_fmuls" (reg h-fr (add g 3)) (reg h-fr (add h 3)))))
485 (dshmi fldd "Floating point load (double)"
487 "fld.d $rm, $disp10x8, $drf"
488 (+ (f-op 39) rm disp10x8 drf (f-rsvd 0))
489 (set drf (mem DF (add rm disp10x8))))
491 (dshmi fldp "Floating point load (pair of singles)"
493 "fld.p $rm, $disp10x8, $fpf"
494 (+ (f-op 38) rm disp10x8 fpf (f-rsvd 0))
496 (set f (index-of fpf))
497 (set (reg h-fr f) (mem SF (add rm disp10x8)))
498 (set (reg h-fr (add f 1)) (mem SF (add rm (add disp10x8 4))))))
500 (dshmi flds "Floating point load (single)"
502 "fld.s $rm, $disp10x4, $frf"
503 (+ (f-op 37) rm disp10x4 frf (f-rsvd 0))
504 (set frf (mem SF (add rm disp10x4))))
506 (dshmi fldxd "Floating point extended load (double)"
508 "fldx.d $rm, $rn, $drf"
509 (+ (f-op 7) rm (f-ext 9) rn frf (f-rsvd 0))
510 (set drf (mem DF (add rm rn))))
512 (dshmi fldxp "Floating point extended load (pair of singles)"
514 "fldx.p $rm, $rn, $fpf"
515 (+ (f-op 7) rm (f-ext 13) rn fpf (f-rsvd 0))
517 (set f (index-of fpf))
518 (set (reg h-fr f) (mem SF (add rm rn)))
519 (set (reg h-fr (add f 1)) (mem SF (add rm (add rn 4))))))
521 (dshmi fldxs "Floating point extended load (single)"
523 "fldx.s $rm, $rn, $frf"
524 (+ (f-op 7) rm (f-ext 8) rn frf (f-rsvd 0))
525 (set frf (mem SF (add rm rn))))
527 (dshmi floatld "Floating point conversion (long to double)"
529 "float.ld $frgh, $drf"
530 (+ (f-op 14) frgh (f-ext 14) drf (f-rsvd 0))
531 (set drf (c-call DF "sh64_floatld" frgh)))
533 (dshmi floatls "Floating point conversion (long to single)"
535 "float.ls $frgh, $frf"
536 (+ (f-op 14) frgh (f-ext 12) frf (f-rsvd 0))
537 (set frf (c-call SF "sh64_floatls" frgh)))
539 (dshmi floatqd "Floating point conversion (quad to double)"
541 "float.qd $drgh, $drf"
542 (+ (f-op 14) drgh (f-ext 13) drf (f-rsvd 0))
543 (set drf (c-call DF "sh64_floatqd" drgh)))
545 (dshmi floatqs "Floating point conversion (quad to single)"
547 "float.qs $drgh, $frf"
548 (+ (f-op 14) drgh (f-ext 15) frf (f-rsvd 0))
549 (set frf (c-call SF "sh64_floatqs" drgh)))
551 (dshmi fmacs "Floating point multiply and accumulate (single)"
553 "fmac.s $frg, $frh, $frf"
554 (+ (f-op 13) frg (f-ext 14) frh frf (f-rsvd 0))
555 (set frf (c-call SF "sh64_fadds" frf (c-call SF "sh64_fmuls" frg frh))))
557 (dshmi fmovd "Floating point move double"
560 (+ (f-op 14) drgh (f-ext 1) drf (f-rsvd 0))
563 (dshmi fmovdq "Floating point move (double to quad integer)"
566 (+ (f-op 12) drgh (f-ext 1) rd (f-rsvd 0))
567 (set rd (subword DI drgh 0)))
569 (dshmi fmovls "Floating point move (lower to single)"
572 (+ (f-op 7) rm (f-ext 0) (f-right 63) frf (f-rsvd 0))
573 (set frf (subword SF (subword SI rm 1) 0)))
575 (dshmi fmovqd "Floating point move (quad to double)"
578 (+ (f-op 7) rm (f-ext 1) (f-right 63) frf (f-rsvd 0))
579 (set drf (subword DF rm 0)))
581 (dshmi fmovs "Floating point move (single)"
584 (+ (f-op 14) frgh (f-ext 0) frf (f-rsvd 0))
587 (dshmi fmovsl "Floating point move (single to lower)"
590 (+ (f-op 12) frgh (f-ext 0) rd (f-rsvd 0))
591 (set rd (ext DI (subword SI frgh 1))))
593 (dshmi fmuld "Floating point multiply (double)"
595 "fmul.d $drg, $drh, $drf"
596 (+ (f-op 13) drg (f-ext 7) drh drf (f-rsvd 0))
597 (set drf (c-call DF "sh64_fmuld" drg drh)))
599 (dshmi fmuls "Floating point multiply (single)"
601 "fmul.s $frg, $frh, $frf"
602 (+ (f-op 13) frg (f-ext 6) frh frf (f-rsvd 0))
603 (set frf (c-call SF "sh64_fmuls" frg frh)))
605 (dshmi fnegd "Floating point negate (double)"
608 (+ (f-op 6) drgh (f-ext 3) drf (f-rsvd 0))
609 (set drf (c-call DF "sh64_fnegd" drgh)))
611 (dshmi fnegs "Floating point negate (single)"
614 (+ (f-op 6) frgh (f-ext 2) frf (f-rsvd 0))
615 (set frf (c-call SF "sh64_fnegs" frgh)))
617 (dshmi fputscr "Floating point put to FPSCR"
620 (+ (f-op 12) frgh (f-ext 2) (f-dest 63) (f-rsvd 0))
622 ; FIXME: this should work!
623 ; (set fpscr (subword SI frgh 0)))
625 (dshmi fsqrtd "Floating point square root (double)"
627 "fsqrt.d $drgh, $drf"
628 (+ (f-op 14) drgh (f-ext 5) drf (f-rsvd 0))
629 (set drf (c-call DF "sh64_fsqrtd" drgh)))
631 (dshmi fsqrts "Floating point squart root (single)"
633 "fsqrt.s $frgh, $frf"
634 (+ (f-op 14) frgh (f-ext 4) frf (f-rsvd 0))
635 (set frf (c-call SF "sh64_fsqrts" frgh)))
637 (dshmi fstd "Floating point store (double)"
639 "fst.d $rm, $disp10x8, $drf"
640 (+ (f-op 47) rm disp10x8 drf (f-rsvd 0))
641 (set (mem DF (add rm disp10x8)) drf))
643 (dshmi fstp "Floating point store (pair of singles)"
645 "fst.p $rm, $disp10x8, $fpf"
646 (+ (f-op 46) rm disp10x8 fpf (f-rsvd 0))
648 (set f (index-of fpf))
649 (set (mem SF (add rm disp10x8)) (reg h-fr f))
650 (set (mem SF (add rm (add disp10x8 4))) (reg h-fr (add f 1)))))
652 (dshmi fsts "Floating point store (single)"
654 "fst.s $rm, $disp10x4, $frf"
655 (+ (f-op 45) rm disp10x4 frf (f-rsvd 0))
656 (set (mem SF (add rm disp10x4)) frf))
658 (dshmi fstxd "Floating point extended store (double)"
660 "fstx.d $rm, $rn, $drf"
661 (+ (f-op 15) rm (f-ext 9) rn drf (f-rsvd 0))
662 (set (mem DF (add rm rn)) drf))
664 (dshmi fstxp "Floating point extended store (pair of singles)"
666 "fstx.p $rm, $rn, $fpf"
667 (+ (f-op 15) rm (f-ext 13) rn fpf (f-rsvd 0))
669 (set f (index-of fpf))
670 (set (mem SF (add rm rn)) (reg h-fr f))
671 (set (mem SF (add rm (add rn 4))) (reg h-fr (add f 1)))))
673 (dshmi fstxs "Floating point extended store (single)"
675 "fstx.s $rm, $rn, $frf"
676 (+ (f-op 15) rm (f-ext 8) rn frf (f-rsvd 0))
677 (set (mem SF (add rm rn)) frf))
679 (dshmi fsubd "Floating point subtract (double)"
681 "fsub.d $drg, $drh, $drf"
682 (+ (f-op 13) frg (f-ext 3) frh frf (f-rsvd 0))
683 (set drf (c-call DF "sh64_fsubd" drg drh)))
685 (dshmi fsubs "Floating point subtract (single)"
687 "fsub.s $frg, $frh, $frf"
688 (+ (f-op 13) frg (f-ext 2) frh frf (f-rsvd 0))
689 (set frf (c-call SF "sh64_fsubs" frg frh)))
691 (dshmi ftrcdl "Floating point conversion (double to long)"
693 "ftrc.dl $drgh, $frf"
694 (+ (f-op 14) drgh (f-ext 11) frf (f-rsvd 0))
695 (set frf (c-call SF "sh64_ftrcdl" drgh)))
697 (dshmi ftrcsl "Floating point conversion (single to long)"
699 "ftrc.sl $frgh, $frf"
700 (+ (f-op 14) frgh (f-ext 8) frf (f-rsvd 0))
701 (set frf (c-call SF "sh64_ftrcsl" frgh)))
703 (dshmi ftrcdq "Floating point conversion (double to quad)"
705 "ftrc.dq $drgh, $drf"
706 (+ (f-op 14) drgh (f-ext 9) frf (f-rsvd 0))
707 (set drf (c-call DF "sh64_ftrcdq" drgh)))
709 (dshmi ftrcsq "Floating point conversion (single to quad)"
711 "ftrc.sq $frgh, $drf"
712 (+ (f-op 14) frgh (f-ext 10) drf (f-rsvd 0))
713 (set drf (c-call DF "sh64_ftrcsq" frgh)))
715 (dshmi ftrvs "Floating point matrix multiply"
717 "ftrv.s $mtrxg, $fvh, $fvf"
718 (+ (f-op 5) mtrxg (f-ext 14) fvh fvf (f-rsvd 0))
719 (c-call "sh64_ftrvs" (index-of mtrxg) (index-of fvh) (index-of fvf)))
721 (dshmi getcfg "Get configuration register"
723 "getcfg $rm, $disp6, $rd"
724 (+ (f-op 48) rm (f-ext 15) disp6 rd (f-rsvd 0))
727 (dshmi getcon "Get control register"
730 (+ (f-op 9) crk (f-ext 15) (f-right 63) rd (f-rsvd 0))
733 (dshmi gettr "Get target register"
736 (+ (f-op 17) (f-25 0) trb (f-ext 5) (f-right 63) rd (f-rsvd 0))
739 (dshmi icbi "Invalidate instruction cache block"
741 "icbi $rm, $disp6x32"
742 (+ (f-op 56) rm (f-ext 5) disp6x32 (f-dest 63) (f-rsvd 0))
745 (dshmi ldb "Load byte"
747 "ld.b $rm, $disp10, $rd"
748 (+ (f-op 32) rm disp10 rd (f-rsvd 0))
749 (set rd (ext DI (mem QI (add rm (ext DI disp10))))))
751 (dshmi ldl "Load long word"
753 "ld.l $rm, $disp10x4, $rd"
754 (+ (f-op 34) rm disp10x4 rd (f-rsvd 0))
755 (set rd (ext DI (mem SI (add rm (ext DI disp10x4))))))
757 (dshmi ldq "Load quad word"
759 "ld.q $rm, $disp10x8, $rd"
760 (+ (f-op 35) rm disp10x8 rd (f-rsvd 0))
761 (set rd (mem DI (add rm (ext DI disp10x8)))))
763 (dshmi ldub "Load unsigned byte"
765 "ld.ub $rm, $disp10, $rd"
766 (+ (f-op 36) rm disp10 rd (f-rsvd 0))
767 (set rd (zext DI (mem QI (add rm (ext DI disp10))))))
769 (dshmi lduw "Load unsigned word"
771 "ld.uw $rm, $disp10x2, $rd"
772 (+ (f-op 44) rm disp10 rd (f-rsvd 0))
773 (set rd (zext DI (mem HI (add rm (ext DI disp10x2))))))
775 (dshmi ldw "Load word"
777 "ld.w $rm, $disp10x2, $rd"
778 (+ (f-op 33) rm disp10 rd (f-rsvd 0))
779 (set rd (ext DI (mem HI (add rm (ext DI disp10x2))))))
781 (dshmi ldhil "Load high part (long word)"
783 "ldhi.l $rm, $disp6, $rd"
784 (+ (f-op 48) rm (f-ext 6) disp6 rd (f-rsvd 0))
788 (dshmi ldhiq "Load high part (quad word)"
790 "ldhi.q $rm, $disp6, $rd"
791 (+ (f-op 48) rm (f-ext 7) disp6 rd (f-rsvd 0))
795 (dshmi ldlol "Load low part (long word)"
797 "ldlo.l $rm, $disp6, $rd"
798 (+ (f-op 48) rm (f-ext 2) disp6 rd (f-rsvd 0))
802 (dshmi ldloq "Load low part (quad word)"
804 "ldlo.q $rm, $disp6, $rd"
805 (+ (f-op 48) rm (f-ext 3) disp6 rd (f-rsvd 0))
809 (dshmi ldxb "Load byte (extended displacement)"
811 "ldx.b $rm, $rn, $rd"
812 (+ (f-op 16) rm (f-ext 0) rn rd (f-rsvd 0))
813 (set rd (ext DI (mem QI (add rm rn)))))
815 (dshmi ldxl "Load long word (extended displacement)"
817 "ldx.l $rm, $rn, $rd"
818 (+ (f-op 16) rm (f-ext 2) rn rd (f-rsvd 0))
819 (set rd (ext DI (mem SI (add rm rn)))))
821 (dshmi ldxq "Load quad word (extended displacement)"
823 "ldx.q $rm, $rn, $rd"
824 (+ (f-op 16) rm (f-ext 3) rn rd (f-rsvd 0))
825 (set rd (mem DI (add rm rn))))
827 (dshmi ldxub "Load unsigned byte (extended displacement)"
829 "ldx.ub $rm, $rn, $rd"
830 (+ (f-op 16) rm (f-ext 4) rn rd (f-rsvd 0))
831 (set rd (zext DI (mem UQI (add rm rn)))))
833 (dshmi ldxuw "Load unsigned word (extended displacement)"
835 "ldx.uw $rm, $rn, $rd"
836 (+ (f-op 16) rm (f-ext 5) rn rd (f-rsvd 0))
837 (set rd (zext DI (mem UHI (add rm rn)))))
839 (dshmi ldxw "Load word (extended displacement)"
841 "ldx.w $rm, $rn, $rd"
842 (+ (f-op 16) rm (f-ext 1) rn rd (f-rsvd 0))
843 (set rd (ext DI (mem HI (add rm rn)))))
846 ; Macros to facilitate multimedia instructions.
848 (define-pmacro (slice-byte expr)
849 (sequence ((QI result7) (QI result6) (QI result5) (QI result4)
850 (QI result3) (QI result2) (QI result1) (QI result0))
851 (set result0 (expr (subword QI rm 7) (subword QI rn 7)))
852 (set result1 (expr (subword QI rm 6) (subword QI rn 6)))
853 (set result2 (expr (subword QI rm 5) (subword QI rn 5)))
854 (set result3 (expr (subword QI rm 4) (subword QI rn 4)))
855 (set result4 (expr (subword QI rm 3) (subword QI rn 3)))
856 (set result5 (expr (subword QI rm 2) (subword QI rn 2)))
857 (set result6 (expr (subword QI rm 1) (subword QI rn 1)))
858 (set result7 (expr (subword QI rm 0) (subword QI rn 0)))
859 (set rd (-join-qi result7 result6 result5 result4 result3 result2
862 (define-pmacro (slice-word expr)
863 (sequence ((HI result3) (HI result2) (HI result1) (HI result0))
864 (set result0 (expr (subword HI rm 3) (subword HI rn 3)))
865 (set result1 (expr (subword HI rm 2) (subword HI rn 2)))
866 (set result2 (expr (subword HI rm 1) (subword HI rn 1)))
867 (set result3 (expr (subword HI rm 0) (subword HI rn 0)))
868 (set rd (-join-hi result3 result2 result1 result0))))
870 (define-pmacro (slice-word-unop expr)
871 (sequence ((HI result3) (HI result2) (HI result1) (HI result0))
872 (set result0 (expr (subword HI rm 3)))
873 (set result1 (expr (subword HI rm 2)))
874 (set result2 (expr (subword HI rm 1)))
875 (set result3 (expr (subword HI rm 0)))
876 (set rd (-join-hi result3 result2 result1 result0))))
878 (define-pmacro (slice-long expr)
879 (sequence ((SI result1) (SI result0))
880 (set result0 (expr (subword SI rm 1) (subword SI rn 1)))
881 (set result1 (expr (subword SI rm 0) (subword SI rn 0)))
882 (set rd (-join-si result1 result0))))
884 (define-pmacro (slice-long-unop expr)
885 (sequence ((SI result1) (SI result0))
886 (set result0 (expr (subword SI rm 1)))
887 (set result1 (expr (subword SI rm 0)))
888 (set rd (-join-si result1 result0))))
890 ; Multimedia instructions.
892 (dshmi mabsl "Multimedia absolute value (long word)"
895 (+ (f-op 10) rm (f-ext 10) (f-right 63) rd (f-rsvd 0))
896 (slice-long-unop abs))
898 (dshmi mabsw "Multimedia absolute value (word)"
901 (+ (f-op 10) rm (f-ext 9) (f-right 63) rd (f-rsvd 0))
902 (slice-word-unop abs))
904 (dshmi maddl "Multimedia add (long word)"
906 "madd.l $rm, $rn, $rd"
907 (+ (f-op 2) rm (f-ext 2) rn rd (f-rsvd 0))
910 (dshmi maddw "Multimedia add (word)"
912 "madd.w $rm, $rn, $rd"
913 (+ (f-op 2) rm (f-ext 1) rn rd (f-rsvd 0))
916 (define-pmacro (-maddsl arg1 arg2) (saturate SI 32 (add arg1 arg2)))
917 (dshmi maddsl "Multimedia add (saturating, long word)"
919 "madds.l $rm, $rn, $rd"
920 (+ (f-op 2) rm (f-ext 6) rn rd (f-rsvd 0))
921 (slice-long -maddsl))
923 (define-pmacro (-maddsub arg1 arg2) (usaturate QI 8 (add arg1 arg2)))
924 (dshmi maddsub "Multimedia add (saturating, unsigned byte)"
926 "madds.ub $rm, $rn, $rd"
927 (+ (f-op 2) rm (f-ext 4) rn rd (f-rsvd 0))
928 (slice-byte -maddsub))
930 (define-pmacro (-maddsw arg1 arg2) (saturate HI 16 (add arg1 arg2)))
931 (dshmi maddsw "Multimedia add (saturating, word)"
933 "madds.w $rm, $rn, $rd"
934 (+ (f-op 2) rm (f-ext 5) rn rd (f-rsvd 0))
935 (slice-word -maddsw))
937 (define-pmacro (-mcmpeq mode arg1 arg2)
938 (if mode (eq arg1 arg2) (inv mode 0) (const mode 0)))
940 (define-pmacro (-mcmpeqb arg1 arg2) (-mcmpeq QI arg1 arg2))
941 (dshmi mcmpeqb "Multimedia compare equal (byte)"
943 "mcmpeq.b $rm, $rn, $rd"
944 (+ (f-op 10) rm (f-ext 0) rn rd (f-rsvd 0))
945 (slice-byte -mcmpeqb))
947 (define-pmacro (-mcmpeql arg1 arg2) (-mcmpeq SI arg1 arg2))
948 (dshmi mcmpeql "Multimedia compare equal (long word)"
950 "mcmpeq.l $rm, $rn, $rd"
951 (+ (f-op 10) rm (f-ext 2) rn rd (f-rsvd 0))
952 (slice-long -mcmpeql))
954 (define-pmacro (-mcmpeqw arg1 arg2) (-mcmpeq HI arg1 arg2))
955 (dshmi mcmpeqw "Multimedia compare equal (word)"
957 "mcmpeq.w $rm, $rn, $rd"
958 (+ (f-op 10) rm (f-ext 1) rn rd (f-rsvd 0))
959 (slice-word -mcmpeqw))
961 (define-pmacro (-mcmpgt mode arg1 arg2)
962 (if mode (gt arg1 arg2) (inv mode 0) (const mode 0)))
963 (define-pmacro (-mcmpgtu mode arg1 arg2)
964 (if mode (gtu arg1 arg2) (inv mode 0) (const mode 0)))
966 (define-pmacro (-mcmpgtl arg1 arg2) (-mcmpgt SI arg1 arg2))
967 (dshmi mcmpgtl "Multimedia compare greater than (long word)"
969 "mcmpgt.l $rm, $rn, $rd"
970 (+ (f-op 10) rm (f-ext 6) rn rd (f-rsvd 0))
971 (slice-long -mcmpgtl))
973 (define-pmacro (-mcmpgtub arg1 arg2) (-mcmpgtu QI arg1 arg2))
974 (dshmi mcmpgtub "Multimediate compare unsigned greater than (byte)"
976 "mcmpgt.ub $rm, $rn, $rd"
977 (+ (f-op 10) rm (f-ext 4) rn rd (f-rsvd 0))
978 (slice-byte -mcmpgtub))
980 (define-pmacro (-mcmpgtw arg1 arg2) (-mcmpgt HI arg1 arg2))
981 (dshmi mcmpgtw "Multimedia compare greater than (word)"
983 "mcmpgt.w $rm, $rn, $rd"
984 (+ (f-op 10) rm (f-ext 5) rn rd (f-rsvd 0))
985 (slice-word -mcmpgtw))
987 (dshmi mcmv "Multimedia conditional move"
990 (+ (f-op 18) rm (f-ext 3) rn rd (f-rsvd 0))
991 (set rd (or (and rm rn) (and rd (inv rn)))))
993 (dshmi mcnvslw "Multimedia convert/saturate (long to word)"
995 "mcnvs.lw $rm, $rn, $rd"
996 (+ (f-op 19) rm (f-ext 13) rn rd (f-rsvd 0))
997 (sequence ((HI result3) (HI result2) (HI result1) (HI result0))
998 (set result0 (saturate HI 16 (subword SI rm 0)))
999 (set result1 (saturate HI 16 (subword SI rm 1)))
1000 (set result2 (saturate HI 16 (subword SI rn 0)))
1001 (set result3 (saturate HI 16 (subword SI rn 1)))
1002 (set rd (-join-hi result3 result2 result1 result0))))
1004 (dshmi mcnvswb "Multimedia convert/saturate (word to byte)"
1006 "mcnvs.wb $rm, $rn, $rd"
1007 (+ (f-op 19) rm (f-ext 8) rn rd (f-rsvd 0))
1008 (sequence ((QI result7) (QI result6) (QI result5) (QI result4)
1009 (QI result3) (QI result2) (QI result1) (QI result0))
1010 (set result0 (saturate QI 8 (subword HI rm 0)))
1011 (set result1 (saturate QI 8 (subword HI rm 1)))
1012 (set result2 (saturate QI 8 (subword HI rm 2)))
1013 (set result3 (saturate QI 8 (subword HI rm 3)))
1014 (set result4 (saturate QI 8 (subword HI rn 0)))
1015 (set result5 (saturate QI 8 (subword HI rn 1)))
1016 (set result6 (saturate QI 8 (subword HI rn 2)))
1017 (set result7 (saturate QI 8 (subword HI rn 3)))
1018 (set rd (-join-qi result7 result6 result5 result4
1019 result3 result2 result1 result0))))
1021 (dshmi mcnvswub "Multimedia convert/saturate (word to unsigned byte)"
1023 "mcnvs.wub $rm, $rn, $rd"
1024 (+ (f-op 19) rm (f-ext 12) rn rd (f-rsvd 0))
1025 (sequence ((QI result7) (QI result6) (QI result5) (QI result4)
1026 (QI result3) (QI result2) (QI result1) (QI result0))
1027 (set result0 (usaturate QI 8 (subword HI rm 0)))
1028 (set result1 (usaturate QI 8 (subword HI rm 1)))
1029 (set result2 (usaturate QI 8 (subword HI rm 2)))
1030 (set result3 (usaturate QI 8 (subword HI rm 3)))
1031 (set result4 (usaturate QI 8 (subword HI rn 0)))
1032 (set result5 (usaturate QI 8 (subword HI rn 1)))
1033 (set result6 (usaturate QI 8 (subword HI rn 2)))
1034 (set result7 (usaturate QI 8 (subword HI rn 3)))
1035 (set rd (-join-qi result7 result6 result5 result4 result3
1036 result2 result1 result0))))
1038 ; mexter -- generate an mexterN instruction, where:
1039 ; op = primary opcode
1040 ; extop = extended opcode
1042 (define-pmacro (make-mextr n op extop)
1043 (dshmi (.sym mextr n)
1044 (.str "Multimedia extract 64-bit slice (from byte " n ")")
1046 (.str "mextr" n " $rm, $rn, $rd")
1047 (+ (f-op op) rm (f-ext extop) rn rd (f-rsvd 0))
1048 (sequence ((QI count) (DI mask) (DI rhs))
1049 (set count (mul QI 8 (sub QI 8 n)))
1050 (set mask (sll DI (inv 0) count))
1051 (set rhs (srl (and rm mask) count))
1052 (set count (mul QI 8 n))
1053 (set mask (srl DI (inv 0) count))
1054 (set rd (or DI rhs (sll DI (and rn mask) count))))))
1057 (make-mextr 2 10 11)
1058 (make-mextr 3 10 15)
1061 (make-mextr 6 11 11)
1062 (make-mextr 7 11 15)
1064 (dshmi mmacfxwl "Multimedia fractional multiply (word to long)"
1066 "mmacfx.wl $rm, $rn, $rd"
1067 (+ (f-op 18) rm (f-ext 1) rn rd (f-rsvd 0))
1068 (sequence ((SI temp) (SI result1) (SI result0))
1069 (set result0 (subword SI rd 0))
1070 (set result1 (subword SI rd 1))
1071 (set temp (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
1072 (set temp (saturate SI 32 (sll temp 1)))
1073 (set result0 (saturate SI 32 (add result0 temp)))
1074 (set temp (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
1075 (set temp (saturate SI 32 (sll temp 1)))
1076 (set result1 (saturate SI 32 (add result1 temp)))
1077 (set rd (-join-si result1 result0))))
1079 (dshmi mmacnfx.wl "Multimedia fractional multiple (word to long)"
1081 "mmacnfx.wl $rm, $rn, $rd"
1082 (+ (f-op 18) rn (f-ext 5) rn rd (f-rsvd 0))
1083 (sequence ((SI temp) (SI result1) (SI result0))
1084 (set result0 (subword SI rd 0))
1085 (set result1 (subword SI rd 1))
1086 (set temp (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
1087 (set temp (saturate SI 32 (sll temp 1)))
1088 (set result0 (saturate SI 32 (sub result0 temp)))
1089 (set temp (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
1090 (set temp (saturate SI 32 (sll temp 1)))
1091 (set result1 (saturate SI 32 (sub result1 temp)))
1092 (set rd (-join-si result1 result0))))
1094 (dshmi mmull "Multimedia multiply (long word)"
1096 "mmul.l $rm, $rn, $rd"
1097 (+ (f-op 19) rm (f-ext 2) rn rd (f-rsvd 0))
1100 (dshmi mmulw "Multimedia multiply (word)"
1102 "mmul.w $rm, $rn, $rd"
1103 (+ (f-op 19) rm (f-ext 1) rn rd (f-rsvd 0))
1106 (dshmi mmulfxl "Multimedia fractional multiply (long word)"
1108 "mmulfx.l $rm, $rn, $rd"
1109 (+ (f-op 19) rm (f-ext 6) rn rd (f-rsvd 0))
1110 (sequence ((DI temp) (SI result0) (SI result1))
1111 (set temp (mul (zext DI (subword SI rm 0)) (zext DI (subword SI rn 0))))
1112 (set result0 (saturate SI 32 (sra temp 31)))
1113 (set temp (mul (zext DI (subword SI rm 1)) (zext DI (subword SI rn 1))))
1114 (set result1 (saturate SI 32 (sra temp 31)))
1115 (set rd (-join-si result1 result0))))
1117 (dshmi mmulfxw "Multimedia fractional multiply (word)"
1119 "mmulfx.w $rm, $rn, $rd"
1120 (+ (f-op 19) rm (f-ext 5) rn rd (f-rsvd 0))
1121 (sequence ((SI temp) (HI result0) (HI result1) (HI result2) (HI result3))
1122 (set temp (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
1123 (set result0 (saturate HI 16 (sra temp 15)))
1124 (set temp (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
1125 (set result1 (saturate HI 16 (sra temp 15)))
1126 (set temp (mul (zext SI (subword HI rm 2)) (zext SI (subword HI rn 2))))
1127 (set result2 (saturate HI 16 (sra temp 15)))
1128 (set temp (mul (zext SI (subword HI rm 3)) (zext SI (subword HI rn 3))))
1129 (set result3 (saturate HI 16 (sra temp 15)))
1130 (set rd (-join-hi result3 result2 result1 result0))))
1132 (dshmi mmulfxrpw "Multimedia fractional multiply round positive (word op)"
1134 "mmulfxrp.w $rm, $rn, $rd"
1135 (+ (f-op 19) rm (f-ext 9) rn rd (f-rsvd 0))
1136 (sequence ((SI temp) (HI result0) (HI result1) (HI result2) (HI result3) (HI c))
1138 (set temp (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
1139 (set result0 (saturate HI 16 (sra (add temp c) 15)))
1140 (set temp (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
1141 (set result1 (saturate HI 16 (sra (add temp c) 15)))
1142 (set temp (mul (zext SI (subword HI rm 2)) (zext SI (subword HI rn 2))))
1143 (set result2 (saturate HI 16 (sra (add temp c) 15)))
1144 (set temp (mul (zext SI (subword HI rm 3)) (zext SI (subword HI rn 3))))
1145 (set result3 (saturate HI 16 (sra (add temp c) 15)))
1146 (set rd (-join-hi result3 result2 result1 result0))))
1148 (dshmi mmulhiwl "Multimedia multiply higher halves (word to long)"
1150 "mmulhi.wl $rm, $rn, $rd"
1151 (+ (f-op 19) rm (f-ext 14) rn rd (f-rsvd 0))
1152 (sequence ((SI result1) (SI result0))
1153 (set result0 (mul (zext SI (subword HI rm 2)) (zext SI (subword HI rn 2))))
1154 (set result1 (mul (zext SI (subword HI rm 3)) (zext SI (subword HI rn 3))))
1155 (set rd (-join-si result1 result0))))
1157 (dshmi mmullowl "Multimedia multiply lower halves (word to long)"
1159 "mmullo.wl $rm, $rn, $rd"
1160 (+ (f-op 19) rm (f-ext 10) rn rd (f-rsvd 0))
1161 (sequence ((SI result1) (SI result0))
1162 (set result0 (mul (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
1163 (set result1 (mul (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1))))
1164 (set rd (-join-si result1 result0))))
1166 (dshmi mmulsumwq "Multimedia multiply and accumulate (word to quad)"
1168 "mmulsum.wq $rm, $rn, $rd"
1169 (+ (f-op 18) rm (f-ext 9) rn rd (f-rsvd 0))
1170 (sequence ((DI acc))
1171 (set acc (mul SI (zext SI (subword HI rm 0)) (zext SI (subword HI rn 0))))
1172 (set acc (add acc (mul SI (zext SI (subword HI rm 1)) (zext SI (subword HI rn 1)))))
1173 (set acc (add acc (mul SI (zext SI (subword HI rm 2)) (zext SI (subword HI rn 2)))))
1174 (set acc (add acc (mul SI (zext SI (subword HI rm 3)) (zext SI (subword HI rn 3)))))
1175 (set rd (add rd acc))))
1177 (dshmi movi "Move immediate"
1180 (+ (f-op 51) imm16 rd (f-rsvd 0))
1181 (set rd (ext DI imm16)))
1183 (dshmi mpermw "Multimedia permutate word"
1185 "mperm.w $rm, $rn, $rd"
1186 (+ (f-op 10) rm (f-ext 13) rn rd (f-rsvd 0))
1187 (sequence ((QI control) (HI result3) (HI result2) (HI result1) (HI result0))
1188 (set control (and QI rn #x3f))
1189 (set result0 (subword HI rm (sub 3 (and control 3))))
1190 (set result1 (subword HI rm (sub 3 (and (srl control 2) 3))))
1191 (set result2 (subword HI rm (sub 3 (and (srl control 4) 3))))
1192 (set result3 (subword HI rm (sub 3 (and (srl control 6) 3))))
1193 (set rd (-join-hi result3 result2 result1 result0))))
1195 (dshmi msadubq "Multimedia absolute difference (byte)"
1197 "msad.ubq $rm, $rn, $rd"
1198 (+ (f-op 18) rm (f-ext 0) rn rd (f-rsvd 0))
1199 (sequence ((DI acc))
1200 (set acc (abs DI (sub (subword QI rm 0) (subword QI rn 1))))
1201 (set acc (add DI acc (abs (sub (subword QI rm 1) (subword QI rn 1)))))
1202 (set acc (add DI acc (abs (sub (subword QI rm 2) (subword QI rn 2)))))
1203 (set acc (add DI acc (abs (sub (subword QI rm 3) (subword QI rn 3)))))
1204 (set acc (add DI acc (abs (sub (subword QI rm 4) (subword QI rn 4)))))
1205 (set acc (add DI acc (abs (sub (subword QI rm 5) (subword QI rn 5)))))
1206 (set acc (add DI acc (abs (sub (subword QI rm 6) (subword QI rn 6)))))
1207 (set acc (add DI acc (abs (sub (subword QI rm 7) (subword QI rn 7)))))
1208 (set rd (add rd acc))))
1210 (define-pmacro (-mshaldsl arg) (saturate SI 32 (sll arg (and rn 31))))
1211 (dshmi mshaldsl "Multimedia saturating arithmetic left shift (long word)"
1213 "mshalds.l $rm, $rn, $rd"
1214 (+ (f-op 3) rm (f-ext 6) rn rd (f-rsvd 0))
1215 (slice-long-unop -mshaldsl))
1217 (define-pmacro (-mshaldsw arg) (saturate HI 16 (sll arg (and rn 15))))
1218 (dshmi mshaldsw "Multimedia saturating arithmetic left shift (word)"
1220 "mshalds.w $rm, $rn, $rd"
1221 (+ (f-op 3) rm (f-ext 5) rn rd (f-rsvd 0))
1222 (slice-word-unop -mshaldsw))
1224 (define-pmacro (-mshardl arg) (sra arg (and rn 31)))
1225 (dshmi mshardl "Multimedia arithmetic right shift (long)"
1227 "mshard.l $rm, $rn, $rd"
1228 (+ (f-op 3) rm (f-ext 10) rn rd (f-rsvd 0))
1229 (slice-long-unop -mshardl))
1231 (define-pmacro (-mshardw arg) (sra arg (and rn 15)))
1232 (dshmi mshardw "Multimedia arithmetic right shift (word)"
1234 "mshard.w $rm, $rn, $rd"
1235 (+ (f-op 3) rm (f-ext 9) rn rd (f-rsvd 0))
1236 (slice-word-unop -mshardw))
1238 (dshmi mshardsq "Multimedia saturating arithmetic right shift (quad word)"
1240 "mshards.q $rm, $rn, $rd"
1241 (+ (f-op 3) rm (f-ext 11) rn rd (f-rsvd 0))
1242 (set rd (saturate DI 16 (sra rm (and rn 63)))))
1244 (dshmi mshfhib "Multimedia shuffle higher-half (byte)"
1246 "mshfhi.b $rm, $rn, $rd"
1247 (+ (f-op 11) rm (f-ext 4) rn rd (f-rsvd 0))
1248 (sequence ((QI result7) (QI result6) (QI result5) (QI result4)
1249 (QI result3) (QI result2) (QI result1) (QI result0))
1250 (set result0 (subword QI rm 4))
1251 (set result1 (subword QI rn 4))
1252 (set result2 (subword QI rm 5))
1253 (set result3 (subword QI rn 5))
1254 (set result4 (subword QI rm 6))
1255 (set result5 (subword QI rn 6))
1256 (set result6 (subword QI rm 7))
1257 (set result7 (subword QI rn 7))
1258 (set rd (-join-qi result7 result6 result5 result4 result3
1259 result2 result1 result0))))
1261 (dshmi mshfhil "Multimedia shuffle higher-half (long)"
1263 "mshfhi.l $rm, $rn, $rd"
1264 (+ (f-op 11) rm (f-ext 6) rn rd (f-rsvd 0))
1265 (sequence ((SI result1) (SI result0))
1266 (set result0 (subword SI rm 1))
1267 (set result1 (subword SI rn 1))
1268 (set rd (-join-si result1 result0))))
1270 (dshmi mshfhiw "Multimedia shuffle higher-half (word)"
1272 "mshfhi.w $rm, $rn, $rd"
1273 (+ (f-op 11) rm (f-ext 5) rn rd (f-rsvd 0))
1274 (sequence ((HI result3) (HI result2) (HI result1) (HI result0))
1275 (set result0 (subword HI rm 2))
1276 (set result1 (subword HI rn 2))
1277 (set result2 (subword HI rm 3))
1278 (set result3 (subword HI rn 3))
1279 (set rd (-join-hi result3 result2 result1 result0))))
1281 (dshmi mshflob "Multimedia shuffle lower-half (byte)"
1283 "mshflo.b $rm, $rn, $rd"
1284 (+ (f-op 11) rm (f-ext 0) rn rd (f-rsvd 0))
1285 (sequence ((QI result7) (QI result6) (QI result5) (QI result4)
1286 (QI result3) (QI result2) (QI result1) (QI result0))
1287 (set result0 (subword QI rm 0))
1288 (set result1 (subword QI rn 0))
1289 (set result2 (subword QI rm 1))
1290 (set result3 (subword QI rn 1))
1291 (set result4 (subword QI rm 2))
1292 (set result5 (subword QI rn 2))
1293 (set result6 (subword QI rm 3))
1294 (set result7 (subword QI rn 3))
1295 (set rd (-join-qi result7 result6 result5 result4 result3
1296 result2 result1 result0))))
1298 (dshmi mshflol "Multimedia shuffle lower-half (long)"
1300 "mshflo.l $rm, $rn, $rd"
1301 (+ (f-op 11) rm (f-ext 2) rn rd (f-rsvd 0))
1302 (sequence ((SI result1) (SI result0))
1303 (set result0 (subword SI rm 0))
1304 (set result1 (subword SI rn 0))
1305 (set rd (-join-si result1 result0))))
1307 (dshmi mshflow "Multimedia shuffle lower-half (word)"
1309 "mshflo.w $rm, $rn, $rd"
1310 (+ (f-op 11) rm (f-ext 1) rn rd (f-rsvd 0))
1311 (sequence ((HI result3) (HI result2) (HI result1) (HI result0))
1312 (set result0 (subword HI rm 0))
1313 (set result1 (subword HI rn 0))
1314 (set result2 (subword HI rm 1))
1315 (set result3 (subword HI rn 1))
1316 (set rd (-join-hi result3 result2 result1 result0))))
1318 (define-pmacro (-mshlldl arg) (sll arg (and rn 31)))
1319 (dshmi mshlldl "Multimedia logical left shift (long word)"
1321 "mshlld.l $rm, $rn, $rd"
1322 (+ (f-op 3) rm (f-ext 2) rn rd (f-rsvd 0))
1323 (slice-long-unop -mshlldl))
1325 (define-pmacro (-mshlldw arg) (sll arg (and rn 15)))
1326 (dshmi mshlldw "Multimedia logical left shift (word)"
1328 "mshlld.w $rm, $rn, $rd"
1329 (+ (f-op 3) rm (f-ext 1) rn rd (f-rsvd 0))
1330 (slice-word-unop -mshlldw))
1332 (define-pmacro (-mshlrdl arg) (srl arg (and rn 31)))
1333 (dshmi mshlrdl "Multimedia logical right shift (long word)"
1335 "mshlrd.l $rm, $rn, $rd"
1336 (+ (f-op 3) rm (f-ext 14) rn rd (f-rsvd 0))
1337 (slice-long-unop -mshlrdl))
1339 (define-pmacro (-mshlrdw arg) (srl arg (and rn 15)))
1340 (dshmi mshlrdw "Multimedia logical right shift (word)"
1342 "mshlrd.w $rm, $rn, $rd"
1343 (+ (f-op 3) rm (f-ext 13) rn rd (f-rsvd 0))
1344 (slice-word-unop -mshlrdw))
1346 (dshmi msubl "Multimedia subtract (long word)"
1348 "msub.l $rm, $rn, $rd"
1349 (+ (f-op 2) rm (f-ext 10) rn rd (f-rsvd 0))
1352 (dshmi msubw "Multimedia add (word)"
1354 "msub.w $rm, $rn, $rd"
1355 (+ (f-op 2) rm (f-ext 9) rn rd (f-rsvd 0))
1358 (define-pmacro (-msubsl arg1 arg2) (saturate SI 32 (sub arg1 arg2)))
1359 (dshmi msubsl "Multimedia subtract (saturating long)"
1361 "msubs.l $rm, $rn, $rd"
1362 (+ (f-op 2) rm (f-ext 14) rn rd (f-rsvd 0))
1363 (slice-long -msubsl))
1365 (define-pmacro (-msubsub arg1 arg2) (usaturate QI 8 (sub arg1 arg2)))
1366 (dshmi msubsub "Multimedia subtract (saturating byte)"
1368 "msubs.ub $rm, $rn, $rd"
1369 (+ (f-op 2) rm (f-ext 12) rn rd (f-rsvd 0))
1370 (slice-byte -msubsub))
1372 (define-pmacro (-msubsw arg1 arg2) (saturate HI 16 (sub arg1 arg2)))
1373 (dshmi msubsw "Multimedia subtract (saturating word)"
1375 "msubs.w $rm, $rn, $rd"
1376 (+ (f-op 2) rm (f-ext 13) rn rd (f-rsvd 0))
1377 (slice-byte -msubsw))
1379 (dshmi mulsl "Multiply signed long"
1381 "muls.l $rm, $rn, $rd"
1382 (+ (f-op 1) rm (f-ext 14) rn rd (f-rsvd 0))
1383 (set rd (mul (ext DI (subword SI rm 1)) (ext DI (subword SI rn 1)))))
1385 (dshmi mulul "Multiply unsigned long"
1387 "mulu.l $rm, $rn, $rd"
1388 (+ (f-op 0) rm (f-ext 14) rn rd (f-rsvd 0))
1389 (set rd (mul (zext DI (subword SI rm 1)) (zext DI (subword SI rn 1)))))
1391 (dshmi nop "No operation"
1394 (+ (f-op 27) (f-left 63) (f-ext 0) (f-right 63) (f-dest 63) (f-rsvd 0))
1397 (dshmi nsb "Number of consecutive sign bits"
1400 (+ (f-op 0) rm (f-ext 13) (f-right 63) rd (f-rsvd 0))
1401 ; Semantics requires a loop construct, so punt to C.
1402 (set rd (c-call DI "sh64_nsb" rm)))
1404 (dshmi ocbi "Invalidate operand cache block"
1406 "ocbi $rm, $disp6x32"
1407 (+ (f-op 56) rm (f-ext 9) disp6x32 (f-dest 63) (f-rsvd 0))
1410 (dshmi ocbp "Purge operand cache block"
1412 "ocbp $rm, $disp6x32"
1413 (+ (f-op 56) rm (f-ext 8) disp6x32 (f-dest 63) (f-rsvd 0))
1416 (dshmi ocbwb "Write-back operand cache block"
1418 "ocbwb $rm, $disp6x32"
1419 (+ (f-op 56) rm (f-ext 12) disp6x32 (f-dest 63) (f-rsvd 0))
1425 (+ (f-op 1) rm (f-ext 9) rn rd (f-rsvd 0))
1426 (set rd (or rm rn)))
1428 (dshmi ori "OR immediate"
1430 "ori $rm, $imm10, $rd"
1431 (+ (f-op 55) rm imm10 rd (f-rsvd 0))
1432 (set rd (or rm (ext DI imm10))))
1434 (dshmi prefi "Prefetch instruction"
1436 "prefi $rm, $disp6x32"
1437 (+ (f-op 56) rm (f-ext 1) disp6x32 (f-right 63) (f-rsvd 0))
1440 (dshmi pta "Prepare target register for SHmedia target"
1442 "pta$likely $disp16, $tra"
1443 (+ (f-op 58) disp16 likely (f-8-2 0) tra (f-rsvd 0))
1444 (set tra (add disp16 1)))
1446 (dshmi ptabs "Prepare target register with absolute value from register"
1448 "ptabs$likely $rn, $tra"
1449 (+ (f-op 26) (f-left 63) (f-ext 1) rn likely (f-8-2 0) tra (f-rsvd 0))
1452 (dshmi ptb "Prepare target register for SHcompact target"
1454 "ptb$likely $disp16, $tra"
1455 (+ (f-op 59) disp16 likely (f-8-2 0) tra (f-rsvd 0))
1458 (dshmi ptrel "Prepare target register with relative value from register"
1460 "ptrel$likely $rn, $tra"
1461 (+ (f-op 26) (f-left 63) (f-ext 5) rn likely (f-8-2 0) tra (f-rsvd 0))
1462 (set tra (add pc rn)))
1464 (dshmi putcfg "Put configuration register"
1466 "putcfg $rm, $disp6, $rd"
1467 (+ (f-op 56) rm (f-ext 15) disp6 rd (f-rsvd 0))
1470 (dshmi putcon "Put control register"
1473 (+ (f-op 27) rm (f-ext 15) (f-right 63) crj (f-rsvd 0))
1476 (dshmi rte "Return from exception"
1479 (+ (f-op 27) (f-left 63) (f-ext 3) (f-right 63) (f-dest 63) (f-rsvd 0))
1482 (dshmi shard "Arithmetic right shift"
1484 "shard $rm, $rn, $rd"
1485 (+ (f-op 1) rm (f-ext 7) rn rd (f-rsvd 0))
1486 (set rd (sra rm (and rn 63))))
1488 (dshmi shardl "Arithmetic right shift (long word)"
1490 "shard.l $rm, $rn, $rd"
1491 (+ (f-op 1) rm (f-ext 6) rn rd (f-rsvd 0))
1492 (set rd (ext DI (sra (subword SI rm 1) (and rn 63)))))
1494 (dshmi shari "Arithmetic right shift (immediate count)"
1496 "shari $rm, $uimm6, $rd"
1497 (+ (f-op 49) rm (f-ext 7) uimm6 rd (f-rsvd 0))
1498 (set rd (sra rm uimm6)))
1500 (dshmi sharil "Arithmetic right shift (long word, immediate count)"
1502 "shari.l $rm, $uimm6, $rd"
1503 (+ (f-op 49) rm (f-ext 6) uimm6 rd (f-rsvd 0))
1504 (set rd (ext DI (sra (subword SI rm 1) (and uimm6 63)))))
1506 (dshmi shlld "Logical left shift"
1508 "shlld $rm, $rn, $rd"
1509 (+ (f-op 1) rm (f-ext 1) rn rd (f-rsvd 0))
1510 (set rd (sll rm (and rn 63))))
1512 (dshmi shlldl "Logical left shift (long word)"
1514 "shlld.l $rm, $rn, $rd"
1515 (+ (f-op 1) rm (f-ext 0) rn rd (f-rsvd 0))
1516 (set rd (ext DI (sll (subword SI rm 1) (and rn 63)))))
1518 (dshmi shlli "Logical left shift (immediate count)"
1520 "shlli $rm, $uimm6, $rd"
1521 (+ (f-op 49) rm (f-ext 1) uimm6 rd (f-rsvd 0))
1522 (set rd (sll rm uimm6)))
1524 (dshmi shllil "Logical left shift (long word, immediate count)"
1526 "shlli.l $rm, $uimm6, $rd"
1527 (+ (f-op 49) rm (f-ext 0) uimm6 rd (f-rsvd 0))
1528 (set rd (ext DI (sll (subword SI rm 1) (and uimm6 63)))))
1530 (dshmi shlrd "Logical right shift"
1532 "shlrd $rm, $rn, $rd"
1533 (+ (f-op 1) rm (f-ext 3) rn rd (f-rsvd 0))
1534 (set rd (srl rm (and rn 63))))
1536 (dshmi shlrdl "Logical right shift (long word)"
1538 "shlrd.l $rm, $rn, $rd"
1539 (+ (f-op 1) rm (f-ext 2) rn rd (f-rsvd 0))
1540 (set rd (ext DI (srl (subword SI rm 1) (and rn 63)))))
1542 (dshmi shlri "Logical right shift (immediate count)"
1544 "shlri $rm, $uimm6, $rd"
1545 (+ (f-op 49) rm (f-ext 3) uimm6 rd (f-rsvd 0))
1546 (set rd (srl rm uimm6)))
1548 (dshmi shlril "Logical right shift (long word, immediate count)"
1550 "shlri.l $rm, $uimm6, $rd"
1551 (+ (f-op 49) rm (f-ext 2) uimm6 rd (f-rsvd 0))
1552 (set rd (ext DI (srl (subword SI rm 1) (and uimm6 63)))))
1554 (dshmi shori "Shift-or immediate"
1556 "shori $uimm16, $rd"
1557 (+ (f-op 50) uimm16 rd (f-rsvd 0))
1558 (set rd (or (sll rd 16) (zext DI uimm16))))
1560 (dshmi sleep "Sleep"
1563 (+ (f-op 27) (f-left 63) (f-ext 7) (f-right 63) (f-dest 63) (f-rsvd 0))
1566 (dshmi stb "Store byte"
1568 "st.b $rm, $disp10, $rd"
1569 (+ (f-op 40) rm disp10 rd (f-rsvd 0))
1570 (set (mem UQI (add rm (ext DI disp10))) (and QI rd #xff)))
1572 (dshmi stl "Store long word"
1574 "st.l $rm, $disp10x4, $rd"
1575 (+ (f-op 42) rm disp10x4 rd (f-rsvd 0))
1576 (set (mem SI (add rm (ext DI disp10x4))) (and SI rd #xffffffff)))
1578 (dshmi stq "Store quad word"
1580 "st.q $rm, $disp10x8, $rd"
1581 (+ (f-op 43) rm disp10x8 rd (f-rsvd 0))
1582 (set (mem DI (add rm (ext DI disp10x8))) rd))
1584 (dshmi stw "Store word"
1586 "st.w $rm, $disp10x2, $rd"
1587 (+ (f-op 41) rm disp10x2 rd (f-rsvd 0))
1588 (set (mem HI (add rm (ext DI disp10x2))) (and HI rd #xffff)))
1590 (define-pmacro (-sthi-byte)
1592 (set (mem UQI addr) (and QI val #xff))
1593 (set val (srl val 8))
1594 (set addr (add addr 1))))
1596 (dshmi sthil "Store high part (long word)"
1598 "sthi.l $rm, $disp6, $rd"
1599 (+ (f-op 56) rm (f-ext 6) disp6 rd (f-rsvd 0))
1600 (sequence ((DI addr) (QI bytecount) (DI val))
1601 (set addr (add rm disp6))
1602 (set bytecount (add (and addr 3) 1))
1605 (set val (srl rd (sub 32 (mul 8 bytecount)))))
1606 (set addr (add (sub addr bytecount) 1))
1607 (if (gt bytecount 3)
1609 (if (gt bytecount 2)
1611 (if (gt bytecount 1)
1613 (if (gt bytecount 0)
1616 (dshmi sthiq "Store high part (quad word)"
1618 "sthi.q $rm, $disp6, $rd"
1619 (+ (f-op 56) rm (f-ext 7) disp6 rd (f-rsvd 0))
1620 (sequence ((DI addr) (QI bytecount) (DI val))
1621 (set addr (add rm disp6))
1622 (set bytecount (add (and addr 7) 1))
1625 (set val (srl rd (sub 64 (mul 8 bytecount)))))
1626 (set addr (add (sub addr bytecount) 1))
1627 (if (gt bytecount 7)
1629 (if (gt bytecount 6)
1631 (if (gt bytecount 5)
1633 (if (gt bytecount 4)
1635 (if (gt bytecount 3)
1637 (if (gt bytecount 2)
1639 (if (gt bytecount 1)
1641 (if (gt bytecount 0)
1644 (dshmi stlol "Store low part (long word)"
1646 "stlo.l $rm, $disp6, $rd"
1647 (+ (f-op 56) rm (f-ext 2) disp6 rd (f-rsvd 0))
1651 (dshmi stloq "Store low part (quad word)"
1653 "stlo.q $rm, $disp6, $rd"
1654 (+ (f-op 56) rm (f-ext 3) disp6 rd (f-rsvd 0))
1658 (dshmi stxb "Store byte (extended displacement)"
1660 "stx.b $rm, $rn, $rd"
1661 (+ (f-op 24) rm (f-ext 0) rn rd (f-rsvd 0))
1662 (set (mem UQI (add rm rn)) (subword QI rd 7)))
1664 (dshmi stxl "Store long (extended displacement)"
1666 "stx.l $rm, $rn, $rd"
1667 (+ (f-op 24) rm (f-ext 2) rn rd (f-rsvd 0))
1668 (set (mem SI (add rm rn)) (subword SI rd 1)))
1670 (dshmi stxq "Store quad word (extended displacement)"
1672 "stx.q $rm, $rn, $rd"
1673 (+ (f-op 24) rm (f-ext 3) rn rd (f-rsvd 0))
1674 (set (mem DI (add rm rn)) rd))
1676 (dshmi stxw "Store word (extended displacement)"
1678 "stx.w $rm, $rn, $rd"
1679 (+ (f-op 24) rm (f-ext 1) rn rd (f-rsvd 0))
1680 (set (mem HI (add rm rn)) (subword HI rd 3)))
1682 (dshmi sub "Subtract"
1685 (+ (f-op 0) rm (f-ext 11) rn rd (f-rsvd 0))
1686 (set rd (sub rm rn)))
1688 (dshmi subl "Subtract long"
1690 "sub.l $rm, $rn, $rd"
1691 (+ (f-op 0) rm (f-ext 10) rn rd (f-rsvd 0))
1692 (set rd (ext DI (sub (subword SI rm 1) (subword SI rn 1)))))
1694 (dshmi swapq "Swap quad words"
1696 "swap.q $rm, $rn, $rd"
1697 (+ (f-op 8) rm (f-ext 3) rn rd (f-rsvd 0))
1698 (sequence ((DI addr) (DI temp))
1699 (set addr (add rm rn))
1700 (set temp (mem DI addr))
1701 (set (mem DI addr) rd)
1704 (dshmi synci "Synchronise instruction fetch"
1707 (+ (f-op 27) (f-left 63) (f-ext 2) (f-right 63) (f-dest 63) (f-rsvd 0))
1710 (dshmi synco "Synchronise data operations"
1713 (+ (f-op 27) (f-left 63) (f-ext 6) (f-right 63) (f-dest 63) (f-rsvd 0))
1719 (+ (f-op 27) rm (f-ext 1) (f-right 63) (f-dest 63) (f-rsvd 0))
1720 (c-call "sh64_trapa" rm pc))
1722 (dshmi xor "Exclusive OR"
1725 (+ (f-op 1) rm (f-ext 13) rn rd (f-rsvd 0))
1726 (set rd (xor rm rn)))
1728 (dshmi xori "Exclusive OR immediate"
1730 "xori $rm, $imm6, $rd"
1731 (+ (f-op 49) rm (f-ext 13) rn rd (f-rsvd 0))
1732 (set rd (xor rm (ext DI imm6))))