1 ; Renesas M32C CPU description. -*- Scheme -*-
3 ; Copyright 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
5 ; Contributed by Red Hat Inc; developed under contract from Renesas.
7 ; This file is part of the GNU Binutils.
9 ; This program is free software; you can redistribute it and/or modify
10 ; it under the terms of the GNU General Public License as published by
11 ; the Free Software Foundation; either version 3 of the License, or
12 ; (at your option) any later version.
14 ; This program is distributed in the hope that it will be useful,
15 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ; GNU General Public License for more details.
19 ; You should have received a copy of the GNU General Public License
20 ; along with this program; if not, write to the Free Software
21 ; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
24 (include "simplify.inc")
28 (comment "Renesas M32C")
29 (default-alignment forced)
38 (default-insn-bitsize 32)
40 ; Number of bytes of insn we can initially fetch.
41 (base-insn-bitsize 32)
43 ; Used in computing bit numbers.
44 (default-insn-word-bitsize 32)
46 (decode-assist (0 1 2 3 4 5 6 7)) ; Initial bitnumbers to decode insns by.
48 ; fetches 1 insn at a time.
51 ; executes 1 insn at a time.
58 (default-insn-bitsize 32)
60 ; Number of bytes of insn we can initially fetch.
61 (base-insn-bitsize 32)
63 ; Used in computing bit numbers.
64 (default-insn-word-bitsize 32)
66 (decode-assist (0 1 2 3 4 5 6 7)) ; Initial bitnumbers to decode insns by.
68 ; fetches 1 insn at a time.
71 ; executes 1 insn at a time.
76 ; cpu names must be distinct from the architecture name and machine names.
77 ; The "b" suffix stands for "base" and is the convention.
78 ; The "f" suffix stands for "family" and is the convention.
80 (comment "Renesas M16C base family")
87 ; cpu names must be distinct from the architecture name and machine names.
88 ; The "b" suffix stands for "base" and is the convention.
89 ; The "f" suffix stands for "family" and is the convention.
91 (comment "Renesas M32C base family")
99 (comment "Generic M16C cpu")
105 (comment "Generic M32C cpu")
109 ; Model descriptions.
113 (comment "m16c") (attrs)
116 ; `state' is a list of variables for recording model state
118 (unit u-exec "Execution Unit" ()
123 () ; profile action (default)
129 (comment "m32c") (attrs)
132 ; `state' is a list of variables for recording model state
134 (unit u-exec "Execution Unit" ()
139 () ; profile action (default)
146 (values NONE JUMP 1ADDR 2ADDR)
150 ; Macros to simplify MACH attribute specification.
152 (define-pmacro all-isas () (ISA m16c,m32c))
153 (define-pmacro m16c-isa () (ISA m16c))
154 (define-pmacro m32c-isa () (ISA m32c))
156 (define-pmacro MACH16 (MACH m16c))
157 (define-pmacro MACH32 (MACH m32c))
159 (define-pmacro (machine size)
160 (MACH (.sym m size c)) (ISA (.sym m size c)))
162 (define-pmacro RL_JUMP (RL_TYPE JUMP))
163 (define-pmacro RL_1ADDR (RL_TYPE 1ADDR))
164 (define-pmacro RL_2ADDR (RL_TYPE 2ADDR))
167 ;=============================================================
169 ;-------------------------------------------------------------
172 (dnf f-0-1 "opcode" (all-isas) 0 1)
173 (dnf f-0-2 "opcode" (all-isas) 0 2)
174 (dnf f-0-3 "opcode" (all-isas) 0 3)
175 (dnf f-0-4 "opcode" (all-isas) 0 4)
176 (dnf f-1-3 "opcode" (all-isas) 1 3)
177 (dnf f-2-2 "opcode" (all-isas) 2 2)
178 (dnf f-3-4 "opcode" (all-isas) 3 4)
179 (dnf f-3-1 "opcode" (all-isas) 3 1)
180 (dnf f-4-1 "opcode" (all-isas) 4 1)
181 (dnf f-4-3 "opcode" (all-isas) 4 3)
182 (dnf f-4-4 "opcode" (all-isas) 4 4)
183 (dnf f-4-6 "opcode" (all-isas) 4 6)
184 (dnf f-5-1 "opcode" (all-isas) 5 1)
185 (dnf f-5-3 "opcode" (all-isas) 5 3)
186 (dnf f-6-2 "opcode" (all-isas) 6 2)
187 (dnf f-7-1 "opcode" (all-isas) 7 1)
188 (dnf f-8-1 "opcode" (all-isas) 8 1)
189 (dnf f-8-2 "opcode" (all-isas) 8 2)
190 (dnf f-8-3 "opcode" (all-isas) 8 3)
191 (dnf f-8-4 "opcode" (all-isas) 8 4)
192 (dnf f-8-8 "opcode" (all-isas) 8 8)
193 (dnf f-9-3 "opcode" (all-isas) 9 3)
194 (dnf f-9-1 "opcode" (all-isas) 9 1)
195 (dnf f-10-1 "opcode" (all-isas) 10 1)
196 (dnf f-10-2 "opcode" (all-isas) 10 2)
197 (dnf f-10-3 "opcode" (all-isas) 10 3)
198 (dnf f-11-1 "opcode" (all-isas) 11 1)
199 (dnf f-12-1 "opcode" (all-isas) 12 1)
200 (dnf f-12-2 "opcode" (all-isas) 12 2)
201 (dnf f-12-3 "opcode" (all-isas) 12 3)
202 (dnf f-12-4 "opcode" (all-isas) 12 4)
203 (dnf f-12-6 "opcode" (all-isas) 12 6)
204 (dnf f-13-3 "opcode" (all-isas) 13 3)
205 (dnf f-14-1 "opcode" (all-isas) 14 1)
206 (dnf f-14-2 "opcode" (all-isas) 14 2)
207 (dnf f-15-1 "opcode" (all-isas) 15 1)
208 (dnf f-16-1 "opcode" (all-isas) 16 1)
209 (dnf f-16-2 "opcode" (all-isas) 16 2)
210 (dnf f-16-4 "opcode" (all-isas) 16 4)
211 (dnf f-16-8 "opcode" (all-isas) 16 8)
212 (dnf f-18-1 "opcode" (all-isas) 18 1)
213 (dnf f-18-2 "opcode" (all-isas) 18 2)
214 (dnf f-18-3 "opcode" (all-isas) 18 3)
215 (dnf f-20-1 "opcode" (all-isas) 20 1)
216 (dnf f-20-3 "opcode" (all-isas) 20 3)
217 (dnf f-20-2 "opcode" (all-isas) 20 2)
218 (dnf f-20-4 "opcode" (all-isas) 20 4)
219 (dnf f-21-3 "opcode" (all-isas) 21 3)
220 (dnf f-24-2 "opcode" (all-isas) 24 2)
221 (dnf f-24-8 "opcode" (all-isas) 24 8)
222 (dnf f-32-16 "opcode" (all-isas) 32 16)
224 ;-------------------------------------------------------------
226 ;-------------------------------------------------------------
228 (dnf f-src16-rn "source Rn for m16c" (MACH16 m16c-isa) 10 2)
229 (dnf f-src16-an "source An for m16c" (MACH16 m16c-isa) 11 1)
231 (dnf f-src32-an-unprefixed "destination An for m32c" (MACH32 m32c-isa) 11 1)
232 (dnf f-src32-an-prefixed "destination An for m32c" (MACH32 m32c-isa) 19 1)
234 ; QI mode gr encoding for m32c is different than for m16c. The hardware
235 ; is indexed using the m16c encoding, so perform the transformation here.
237 ; ----------------------
242 (df f-src32-rn-unprefixed-QI "source Rn QI for m32c" (MACH32 m32c-isa) 10 2 UINT
243 ((value pc) (or USI (and (sll (inv value) 1) 2) (and (srl value 1) 1))) ; insert
244 ((value pc) (or USI (and (inv (srl value 1)) 1) (and (sll value 1) 2))) ; extract
246 ; QI mode gr encoding for m32c is different than for m16c. The hardware
247 ; is indexed using the m16c encoding, so perform the transformation here.
249 ; ----------------------
254 (df f-src32-rn-prefixed-QI "source Rn QI for m32c" (MACH32 m32c-isa) 18 2 UINT
255 ((value pc) (or USI (and (sll (inv value) 1) 2) (and (srl value 1) 1))) ; insert
256 ((value pc) (or USI (and (inv (srl value 1)) 1) (and (sll value 1) 2))) ; extract
258 ; HI mode gr encoding for m32c is different than for m16c. The hardware
259 ; is indexed using the m16c encoding, so perform the transformation here.
261 ; ----------------------
266 (df f-src32-rn-unprefixed-HI "source Rn HI for m32c" (MACH32 m32c-isa) 10 2 UINT
267 ((value pc) (mod USI (add value 2) 4)) ; insert
268 ((value pc) (mod USI (add value 2) 4)) ; extract
271 ; HI mode gr encoding for m32c is different than for m16c. The hardware
272 ; is indexed using the m16c encoding, so perform the transformation here.
274 ; ----------------------
279 (df f-src32-rn-prefixed-HI "source Rn HI for m32c" (MACH32 m32c-isa) 18 2 UINT
280 ((value pc) (mod USI (add value 2) 4)) ; insert
281 ((value pc) (mod USI (add value 2) 4)) ; extract
284 ; SI mode gr encoding for m32c is as follows:
285 ; register encoding index
286 ; -------------------------
289 (df f-src32-rn-unprefixed-SI "source Rn SI for m32c" (MACH32 m32c-isa) 10 2 UINT
290 ((value pc) (add USI value 2)) ; insert
291 ((value pc) (sub USI value 2)) ; extract
293 (df f-src32-rn-prefixed-SI "source Rn SI for m32c" (MACH32 m32c-isa) 18 2 UINT
294 ((value pc) (add USI value 2)) ; insert
295 ((value pc) (sub USI value 2)) ; extract
298 (dnf f-dst32-rn-ext-unprefixed "destination Rn for m32c" (MACH32 m32c-isa) 9 1)
300 (dnf f-dst16-rn "destination Rn for m16c" (MACH16 m16c-isa) 14 2)
301 (dnf f-dst16-rn-ext "destination Rn for m16c" (MACH16 m16c-isa) 14 1)
302 (dnf f-dst16-rn-QI-s "destination Rn for m16c" (MACH16 m16c-isa) 5 1)
304 (dnf f-dst16-an "destination An for m16c" (MACH16 m16c-isa) 15 1)
305 (dnf f-dst16-an-s "destination An for m16c" (MACH16 m16c-isa) 4 1)
307 (dnf f-dst32-an-unprefixed "destination An for m32c" (MACH32 m32c-isa) 9 1)
308 (dnf f-dst32-an-prefixed "destination An for m32c" (MACH32 m32c-isa) 17 1)
310 ; QI mode gr encoding for m32c is different than for m16c. The hardware
311 ; is indexed using the m16c encoding, so perform the transformation here.
313 ; ----------------------
318 (df f-dst32-rn-unprefixed-QI "destination Rn QI for m32c" (MACH32 m32c-isa) 8 2 UINT
319 ((value pc) (or USI (and (sll (inv value) 1) 2) (and (srl value 1) 1))) ; insert
320 ((value pc) (or USI (and (inv (srl value 1)) 1) (and (sll value 1) 2))) ; extract
322 (df f-dst32-rn-prefixed-QI "destination Rn QI for m32c" (MACH32 m32c-isa) 16 2 UINT
323 ((value pc) (or USI (and (sll (inv value) 1) 2) (and (srl value 1) 1))) ; insert
324 ((value pc) (or USI (and (inv (srl value 1)) 1) (and (sll value 1) 2))) ; extract
326 ; HI mode gr encoding for m32c is different than for m16c. The hardware
327 ; is indexed using the m16c encoding, so perform the transformation here.
329 ; ----------------------
334 (df f-dst32-rn-unprefixed-HI "destination Rn HI for m32c" (MACH32 m32c-isa) 8 2 UINT
335 ((value pc) (mod USI (add value 2) 4)) ; insert
336 ((value pc) (mod USI (add value 2) 4)) ; extract
338 (df f-dst32-rn-prefixed-HI "destination Rn HI for m32c" (MACH32 m32c-isa) 16 2 UINT
339 ((value pc) (mod USI (add value 2) 4)) ; insert
340 ((value pc) (mod USI (add value 2) 4)) ; extract
342 ; SI mode gr encoding for m32c is as follows:
343 ; register encoding index
344 ; -------------------------
347 (df f-dst32-rn-unprefixed-SI "destination Rn SI for m32c" (MACH32 m32c-isa) 8 2 UINT
348 ((value pc) (add USI value 2)) ; insert
349 ((value pc) (sub USI value 2)) ; extract
351 (df f-dst32-rn-prefixed-SI "destination Rn SI for m32c" (MACH32 m32c-isa) 16 2 UINT
352 ((value pc) (add USI value 2)) ; insert
353 ((value pc) (sub USI value 2)) ; extract
356 (dnf f-dst16-1-S "destination R0[hl] for m16c" (MACH16 m16c-isa) 5 1)
358 ;-------------------------------------------------------------
359 ; Immediates embedded in the base insn
360 ;-------------------------------------------------------------
362 (df f-imm-8-s4 "4 bit signed" (all-isas) 8 4 INT #f #f)
363 (df f-imm-12-s4 "4 bit signed" (all-isas) 12 4 INT #f #f)
364 (df f-imm-13-u3 "3 bit unsigned" (all-isas) 13 3 UINT #f #f)
365 (df f-imm-20-s4 "4 bit signed" (all-isas) 20 4 INT #f #f)
367 (df f-imm1-S "1 bit immediate for short format binary insns" (MACH32 m32c-isa) 2 1 UINT
368 ((value pc) (sub USI value 1)) ; insert
369 ((value pc) (add USI value 1)) ; extract
372 (dnmf f-imm3-S "3 bit unsigned for short format insns" (all-isas) UINT
374 (sequence () ; insert
375 (set (ifield f-7-1) (and (sub (ifield f-imm3-S) 1) 1))
376 (set (ifield f-2-2) (and (srl (sub (ifield f-imm3-S) 1) 1) #x3))
378 (sequence () ; extract
379 (set (ifield f-imm3-S) (add (or (sll (ifield f-2-2) 1)
385 ;-------------------------------------------------------------
386 ; Immediates and displacements beyond the base insn
387 ;-------------------------------------------------------------
389 (df f-dsp-8-u6 "6 bit unsigned" (all-isas) 8 6 UINT #f #f)
390 (df f-dsp-8-u8 "8 bit unsigned" (all-isas) 8 8 UINT #f #f)
391 (df f-dsp-8-s8 "8 bit signed" (all-isas) 8 8 INT #f #f)
392 (df f-dsp-10-u6 "6 bit unsigned" (all-isas) 10 6 UINT #f #f)
393 (df f-dsp-16-u8 "8 bit unsigned" (all-isas) 16 8 UINT #f #f)
394 (df f-dsp-16-s8 "8 bit signed" (all-isas) 16 8 INT #f #f)
395 (df f-dsp-24-u8 "8 bit unsigned" (all-isas) 24 8 UINT #f #f)
396 (df f-dsp-24-s8 "8 bit signed" (all-isas) 24 8 INT #f #f)
397 (df f-dsp-32-u8 "8 bit unsigned" (all-isas) 32 8 UINT #f #f)
398 (df f-dsp-32-s8 "8 bit signed" (all-isas) 32 8 INT #f #f)
399 (df f-dsp-40-u8 "8 bit unsigned" (all-isas) 40 8 UINT #f #f)
400 (df f-dsp-40-s8 "8 bit signed" (all-isas) 40 8 INT #f #f)
401 (df f-dsp-48-u8 "8 bit unsigned" (all-isas) 48 8 UINT #f #f)
402 (df f-dsp-48-s8 "8 bit signed" (all-isas) 48 8 INT #f #f)
403 (df f-dsp-56-u8 "8 bit unsigned" (all-isas) 56 8 UINT #f #f)
404 (df f-dsp-56-s8 "8 bit signed" (all-isas) 56 8 INT #f #f)
405 (df f-dsp-64-u8 "8 bit unsigned" (all-isas) 64 8 UINT #f #f)
406 (df f-dsp-64-s8 "8 bit signed" (all-isas) 64 8 INT #f #f)
408 ; Insn opcode endianness is big, but the immediate fields are stored
409 ; in little endian. Handle this here at the field level for all immediate
410 ; fields longer that 1 byte.
412 ; CGEN can't handle a field which spans a 32 bit word boundary, so
413 ; handle those as multi ifields.
415 ; Take care in expressions using 'srl' or 'sll' as part of some larger
416 ; expression meant to yield sign-extended values. CGEN translates
417 ; uses of those operators into C expressions whose type is 'unsigned
418 ; int', which tends to make the whole expression 'unsigned int'.
419 ; Expressions like (set (ifield foo) X), however, just take X and
420 ; store it in some member of 'struct cgen_fields', all of whose
421 ; members are 'long'. On machines where 'long' is larger than
422 ; 'unsigned int', assigning a "sign-extended" unsigned int to a long
423 ; just produces a very large positive value. insert_normal will
424 ; range-check the field's value and produce odd error messages like
427 ; Error: operand out of range (4160684031 not between -2147483648 and 2147483647) `add.l #-265,-270[fb]'
429 ; Annoyingly, the code will work fine on machines where 'long' and
430 ; 'unsigned int' are the same size: the assignment will produce a
433 ; Just tell yourself over and over: overflow detection is expensive,
434 ; and you're glad C doesn't do it, because it never happens in real
437 (df f-dsp-8-u16 "16 bit unsigned" (all-isas) 8 16 UINT
439 (and (srl value 8) #x00ff)
440 (and (sll value 8) #xff00))) ; insert
442 (and UHI (srl UHI value 8) #x00ff)
443 (and UHI (sll UHI value 8) #xff00))) ; extract
446 (df f-dsp-8-s16 "8 bit signed" (all-isas) 8 16 INT
449 (or (and (srl value 8) #x00ff)
450 (and (sll value 8) #xff00))))) ; insert
453 (or (and (srl value 8) #x00ff)
454 (and (sll value 8) #xff00))))) ; extract
457 (df f-dsp-16-u16 "16 bit unsigned" (all-isas) 16 16 UINT
459 (and (srl value 8) #x00ff)
460 (and (sll value 8) #xff00))) ; insert
462 (and UHI (srl UHI value 8) #x00ff)
463 (and UHI (sll UHI value 8) #xff00))) ; extract
466 (df f-dsp-16-s16 "16 bit signed" (all-isas) 16 16 INT
469 (or (and (srl value 8) #x00ff)
470 (and (sll value 8) #xff00))))) ; insert
473 (or (and (srl value 8) #x00ff)
474 (and (sll value 8) #xff00))))) ; extract
477 (dnmf f-dsp-24-u16 "16 bit unsigned" (all-isas) UINT
478 (f-dsp-24-u8 f-dsp-32-u8)
479 (sequence () ; insert
480 (set (ifield f-dsp-24-u8) (and (ifield f-dsp-24-u16) #xff))
481 (set (ifield f-dsp-32-u8) (and (srl (ifield f-dsp-24-u16) 8) #xff))
483 (sequence () ; extract
484 (set (ifield f-dsp-24-u16) (or (sll (ifield f-dsp-32-u8) 8)
485 (ifield f-dsp-24-u8)))
489 (dnmf f-dsp-24-s16 "16 bit signed" (all-isas) INT
490 (f-dsp-24-u8 f-dsp-32-u8)
491 (sequence () ; insert
492 (set (ifield f-dsp-24-u8)
493 (and (ifield f-dsp-24-s16) #xff))
494 (set (ifield f-dsp-32-u8)
495 (and (srl (ifield f-dsp-24-s16) 8) #xff))
497 (sequence () ; extract
498 (set (ifield f-dsp-24-s16)
500 (trunc HI (or (sll (ifield f-dsp-32-u8) 8)
501 (ifield f-dsp-24-u8)))))
505 (df f-dsp-32-u16 "16 bit unsigned" (all-isas) 32 16 UINT
507 (and (srl value 8) #x00ff)
508 (and (sll value 8) #xff00))) ; insert
510 (and UHI (srl UHI value 8) #x00ff)
511 (and UHI (sll UHI value 8) #xff00))) ; extract
514 (df f-dsp-32-s16 "16 bit signed" (all-isas) 32 16 INT
517 (or (and (srl value 8) #x00ff)
518 (and (sll value 8) #xff00))))) ; insert
521 (or (and (srl value 8) #x00ff)
522 (and (sll value 8) #xff00))))) ; extract
525 (df f-dsp-40-u16 "16 bit unsigned" (all-isas) 40 16 UINT
527 (and (srl value 8) #x00ff)
528 (and (sll value 8) #xff00))) ; insert
530 (and UHI (srl UHI value 8) #x00ff)
531 (and UHI (sll UHI value 8) #xff00))) ; extract
534 (df f-dsp-40-s16 "16 bit signed" (all-isas) 40 16 INT
537 (or (and (srl value 8) #x00ff)
538 (and (sll value 8) #xff00))))) ; insert
541 (or (and (srl value 8) #x00ff)
542 (and (sll value 8) #xff00))))) ; extract
545 (df f-dsp-48-u16 "16 bit unsigned" (all-isas) 48 16 UINT
547 (and (srl value 8) #x00ff)
548 (and (sll value 8) #xff00))) ; insert
550 (and UHI (srl UHI value 8) #x00ff)
551 (and UHI (sll UHI value 8) #xff00))) ; extract
554 (df f-dsp-48-s16 "16 bit signed" (all-isas) 48 16 INT
557 (or (and (srl value 8) #x00ff)
558 (and (sll value 8) #xff00))))) ; insert
561 (or (and (srl value 8) #x00ff)
562 (and (sll value 8) #xff00))))) ; extract
565 (df f-dsp-64-u16 "16 bit unsigned" (all-isas) 64 16 UINT
567 (and (srl value 8) #x00ff)
568 (and (sll value 8) #xff00))) ; insert
570 (and UHI (srl UHI value 8) #x00ff)
571 (and UHI (sll UHI value 8) #xff00))) ; extract
573 (df f-dsp-8-s24 "24 bit signed" (all-isas) 8 24 INT
575 (or (srl value 16) (and value #xff00))
576 (sll (ext INT (trunc QI (and value #xff))) 16)))
578 (or (srl value 16) (and value #xff00))
579 (sll (ext INT (trunc QI (and value #xff))) 16)))
582 (df f-dsp-8-u24 "24 bit unsigned" (all-isas) 8 24 UINT
584 (or (srl value 16) (and value #xff00))
585 (sll (and value #xff) 16)))
587 (or (srl value 16) (and value #xff00))
588 (sll (and value #xff) 16)))
591 (dnmf f-dsp-16-u24 "24 bit unsigned" (all-isas) UINT
592 (f-dsp-16-u16 f-dsp-32-u8)
593 (sequence () ; insert
594 (set (ifield f-dsp-16-u16) (and (ifield f-dsp-16-u24) #xffff))
595 (set (ifield f-dsp-32-u8) (and (srl (ifield f-dsp-16-u24) 16) #xff))
597 (sequence () ; extract
598 (set (ifield f-dsp-16-u24) (or (sll (ifield f-dsp-32-u8) 16)
599 (ifield f-dsp-16-u16)))
603 (dnmf f-dsp-24-u24 "24 bit unsigned" (all-isas) UINT
604 (f-dsp-24-u8 f-dsp-32-u16)
605 (sequence () ; insert
606 (set (ifield f-dsp-24-u8) (and (ifield f-dsp-24-u24) #xff))
607 (set (ifield f-dsp-32-u16) (and (srl (ifield f-dsp-24-u24) 8) #xffff))
609 (sequence () ; extract
610 (set (ifield f-dsp-24-u24) (or (sll (ifield f-dsp-32-u16) 8)
611 (ifield f-dsp-24-u8)))
615 (df f-dsp-32-u24 "24 bit unsigned" (all-isas) 32 24 UINT
618 (and (srl value 16) #x0000ff)
619 (and value #x00ff00))
620 (and (sll value 16) #xff0000))) ; insert
623 (and USI (srl value 16) #x0000ff)
624 (and USI value #x00ff00))
625 (and USI (sll value 16) #xff0000))) ; extract
628 (df f-dsp-40-u20 "20 bit unsigned" (all-isas) 40 20 UINT
631 (and (srl value 16) #x0000ff)
632 (and value #x00ff00))
633 (and (sll value 16) #x0f0000))) ; insert
636 (and USI (srl value 16) #x0000ff)
637 (and USI value #x00ff00))
638 (and USI (sll value 16) #x0f0000))) ; extract
641 (df f-dsp-40-u24 "24 bit unsigned" (all-isas) 40 24 UINT
644 (and (srl value 16) #x0000ff)
645 (and value #x00ff00))
646 (and (sll value 16) #xff0000))) ; insert
649 (and USI (srl value 16) #x0000ff)
650 (and USI value #x00ff00))
651 (and USI (sll value 16) #xff0000))) ; extract
654 (dnmf f-dsp-40-s32 "32 bit signed" (all-isas) INT
655 (f-dsp-40-u24 f-dsp-64-u8)
656 (sequence () ; insert
657 (set (ifield f-dsp-64-u8) (and (srl (ifield f-dsp-40-s32) 24) #xff))
658 (set (ifield f-dsp-40-u24) (and (ifield f-dsp-40-s32) #xffffff))
660 (sequence () ; extract
661 (set (ifield f-dsp-40-s32) (or (and (ifield f-dsp-40-u24) #xffffff)
662 (and (sll (ifield f-dsp-64-u8) 24) #xff000000)))
666 (dnmf f-dsp-48-u20 "20 bit unsigned" (all-isas) UINT
667 (f-dsp-48-u16 f-dsp-64-u8)
668 (sequence () ; insert
669 (set (ifield f-dsp-64-u8) (and (srl (ifield f-dsp-48-u20) 16) #x0f))
670 (set (ifield f-dsp-48-u16) (and (ifield f-dsp-48-u20) #xffff))
672 (sequence () ; extract
673 (set (ifield f-dsp-48-u20) (or (and (ifield f-dsp-48-u16) #xffff)
674 (and (sll (ifield f-dsp-64-u8) 16) #x0f0000)))
677 (dnmf f-dsp-48-u24 "24 bit unsigned" (all-isas) UINT
678 (f-dsp-48-u16 f-dsp-64-u8)
679 (sequence () ; insert
680 (set (ifield f-dsp-64-u8) (and (srl (ifield f-dsp-48-u24) 16) #xff))
681 (set (ifield f-dsp-48-u16) (and (ifield f-dsp-48-u24) #xffff))
683 (sequence () ; extract
684 (set (ifield f-dsp-48-u24) (or (and (ifield f-dsp-48-u16) #xffff)
685 (and (sll (ifield f-dsp-64-u8) 16) #xff0000)))
689 (dnmf f-dsp-16-s32 "32 bit signed" (all-isas) INT
690 (f-dsp-16-u16 f-dsp-32-u16)
691 (sequence () ; insert
692 (set (ifield f-dsp-32-u16) (and (srl (ifield f-dsp-16-s32) 16) #xffff))
693 (set (ifield f-dsp-16-u16) (and (ifield f-dsp-16-s32) #xffff))
695 (sequence () ; extract
696 (set (ifield f-dsp-16-s32) (or (and (ifield f-dsp-16-u16) #xffff)
697 (and (sll (ifield f-dsp-32-u16) 16) #xffff0000)))
701 (dnmf f-dsp-24-s32 "32 bit signed" (all-isas) INT
702 (f-dsp-24-u8 f-dsp-32-u24)
703 (sequence () ; insert
704 (set (ifield f-dsp-32-u24) (and (srl (ifield f-dsp-24-s32) 8) #xffffff))
705 (set (ifield f-dsp-24-u8) (and (ifield f-dsp-24-s32) #xff))
707 (sequence () ; extract
708 (set (ifield f-dsp-24-s32) (or (and (ifield f-dsp-24-u8) #xff)
709 (and (sll (ifield f-dsp-32-u24) 8) #xffffff00)))
713 (df f-dsp-32-s32 "32 bit signed" (all-isas) 32 32 INT
720 (and (srl value 24) #x000000ff)
721 (and (srl value 8) #x0000ff00))
723 (and (sll value 8) #x00ff0000)
724 (and (sll value 24) #xff000000)))))
731 (and (srl value 24) #x000000ff)
732 (and (srl value 8) #x0000ff00))
734 (and (sll value 8) #x00ff0000)
735 (and (sll value 24) #xff000000)))))
738 (dnmf f-dsp-48-u32 "32 bit unsigned" (all-isas) UINT
739 (f-dsp-48-u16 f-dsp-64-u16)
740 (sequence () ; insert
741 (set (ifield f-dsp-64-u16) (and (srl (ifield f-dsp-48-u32) 16) #xffff))
742 (set (ifield f-dsp-48-u16) (and (ifield f-dsp-48-u32) #xffff))
744 (sequence () ; extract
745 (set (ifield f-dsp-48-u32) (or (and (ifield f-dsp-48-u16) #xffff)
746 (and (sll (ifield f-dsp-64-u16) 16) #xffff0000)))
750 (dnmf f-dsp-48-s32 "32 bit signed" (all-isas) INT
751 (f-dsp-48-u16 f-dsp-64-u16)
752 (sequence () ; insert
753 (set (ifield f-dsp-64-u16) (and (srl (ifield f-dsp-48-s32) 16) #xffff))
754 (set (ifield f-dsp-48-u16) (and (ifield f-dsp-48-s32) #xffff))
756 (sequence () ; extract
757 (set (ifield f-dsp-48-s32) (or (and (ifield f-dsp-48-u16) #xffff)
758 (and (sll (ifield f-dsp-64-u16) 16) #xffff0000)))
762 (dnmf f-dsp-56-s16 "16 bit signed" (all-isas) INT
763 (f-dsp-56-u8 f-dsp-64-u8)
764 (sequence () ; insert
765 (set (ifield f-dsp-56-u8)
766 (and (ifield f-dsp-56-s16) #xff))
767 (set (ifield f-dsp-64-u8)
768 (and (srl (ifield f-dsp-56-s16) 8) #xff))
770 (sequence () ; extract
771 (set (ifield f-dsp-56-s16)
773 (trunc HI (or (sll (ifield f-dsp-64-u8) 8)
774 (ifield f-dsp-56-u8)))))
778 (df f-dsp-64-s16 " 16 bit signed" (all-isas) 64 16 INT
781 (or (and (srl value 8) #x00ff)
782 (and (sll value 8) #xff00))))) ; insert
785 (or (and (srl value 8) #x00ff)
786 (and (sll value 8) #xff00))))) ; extract
789 ;-------------------------------------------------------------
791 ;-------------------------------------------------------------
793 (dnf f-bitno16-S "bit index for m16c" (all-isas) 5 3)
794 (dnf f-bitno32-prefixed "bit index for m32c" (all-isas) 21 3)
795 (dnf f-bitno32-unprefixed "bit index for m32c" (all-isas) 13 3)
797 (dnmf f-bitbase16-u11-S "unsigned bit,base:11" (all-isas) UINT
798 (f-bitno16-S f-dsp-8-u8)
799 (sequence () ; insert
800 (set (ifield f-bitno16-S) (and f-bitbase16-u11-S #x7))
801 (set (ifield f-dsp-8-u8) (and (srl (ifield f-bitbase16-u11-S) 3) #xff))
803 (sequence () ; extract
804 (set (ifield f-bitbase16-u11-S) (or (sll (ifield f-dsp-8-u8) 3)
805 (ifield f-bitno16-S)))
809 (dnmf f-bitbase32-16-u11-unprefixed "unsigned bit,base:11" (all-isas) UINT
810 (f-bitno32-unprefixed f-dsp-16-u8)
811 (sequence () ; insert
812 (set (ifield f-bitno32-unprefixed) (and f-bitbase32-16-u11-unprefixed #x7))
813 (set (ifield f-dsp-16-u8) (and (srl (ifield f-bitbase32-16-u11-unprefixed) 3) #xff))
815 (sequence () ; extract
816 (set (ifield f-bitbase32-16-u11-unprefixed) (or (sll (ifield f-dsp-16-u8) 3)
817 (ifield f-bitno32-unprefixed)))
820 (dnmf f-bitbase32-16-s11-unprefixed "signed bit,base:11" (all-isas) INT
821 (f-bitno32-unprefixed f-dsp-16-s8)
822 (sequence () ; insert
823 (set (ifield f-bitno32-unprefixed) (and f-bitbase32-16-s11-unprefixed #x7))
824 (set (ifield f-dsp-16-s8) (sra INT (ifield f-bitbase32-16-s11-unprefixed) 3))
826 (sequence () ; extract
827 (set (ifield f-bitbase32-16-s11-unprefixed) (or (sll (ifield f-dsp-16-s8) 3)
828 (ifield f-bitno32-unprefixed)))
831 (dnmf f-bitbase32-16-u19-unprefixed "unsigned bit,base:19" (all-isas) UINT
832 (f-bitno32-unprefixed f-dsp-16-u16)
833 (sequence () ; insert
834 (set (ifield f-bitno32-unprefixed) (and f-bitbase32-16-u19-unprefixed #x7))
835 (set (ifield f-dsp-16-u16) (and (srl (ifield f-bitbase32-16-u19-unprefixed) 3) #xffff))
837 (sequence () ; extract
838 (set (ifield f-bitbase32-16-u19-unprefixed) (or (sll (ifield f-dsp-16-u16) 3)
839 (ifield f-bitno32-unprefixed)))
842 (dnmf f-bitbase32-16-s19-unprefixed "signed bit,base:11" (all-isas) INT
843 (f-bitno32-unprefixed f-dsp-16-s16)
844 (sequence () ; insert
845 (set (ifield f-bitno32-unprefixed) (and f-bitbase32-16-s19-unprefixed #x7))
846 (set (ifield f-dsp-16-s16) (sra INT (ifield f-bitbase32-16-s19-unprefixed) 3))
848 (sequence () ; extract
849 (set (ifield f-bitbase32-16-s19-unprefixed) (or (sll (ifield f-dsp-16-s16) 3)
850 (ifield f-bitno32-unprefixed)))
853 ; SID decoder doesn't handle multi-ifield referencing another multi-ifield :-(
854 (dnmf f-bitbase32-16-u27-unprefixed "unsigned bit,base:27" (all-isas) UINT
855 (f-bitno32-unprefixed f-dsp-16-u16 f-dsp-32-u8)
856 (sequence () ; insert
857 (set (ifield f-bitno32-unprefixed) (and f-bitbase32-16-u27-unprefixed #x7))
858 (set (ifield f-dsp-16-u16) (and (srl (ifield f-bitbase32-16-u27-unprefixed) 3) #xffff))
859 (set (ifield f-dsp-32-u8) (and (srl (ifield f-bitbase32-16-u27-unprefixed) 19) #xff))
861 (sequence () ; extract
862 (set (ifield f-bitbase32-16-u27-unprefixed) (or (sll (ifield f-dsp-16-u16) 3)
863 (or (sll (ifield f-dsp-32-u8) 19)
864 (ifield f-bitno32-unprefixed))))
867 (dnmf f-bitbase32-24-u11-prefixed "unsigned bit,base:11" (all-isas) UINT
868 (f-bitno32-prefixed f-dsp-24-u8)
869 (sequence () ; insert
870 (set (ifield f-bitno32-prefixed) (and f-bitbase32-24-u11-prefixed #x7))
871 (set (ifield f-dsp-24-u8) (and (srl (ifield f-bitbase32-24-u11-prefixed) 3) #xff))
873 (sequence () ; extract
874 (set (ifield f-bitbase32-24-u11-prefixed) (or (sll (ifield f-dsp-24-u8) 3)
875 (ifield f-bitno32-prefixed)))
878 (dnmf f-bitbase32-24-s11-prefixed "signed bit,base:11" (all-isas) INT
879 (f-bitno32-prefixed f-dsp-24-s8)
880 (sequence () ; insert
881 (set (ifield f-bitno32-prefixed) (and f-bitbase32-24-s11-prefixed #x7))
882 (set (ifield f-dsp-24-s8) (sra INT (ifield f-bitbase32-24-s11-prefixed) 3))
884 (sequence () ; extract
885 (set (ifield f-bitbase32-24-s11-prefixed) (or (sll (ifield f-dsp-24-s8) 3)
886 (ifield f-bitno32-prefixed)))
889 ; SID decoder doesn't handle multi-ifield referencing another multi-ifield :-(
890 (dnmf f-bitbase32-24-u19-prefixed "unsigned bit,base:19" (all-isas) UINT
891 (f-bitno32-prefixed f-dsp-24-u8 f-dsp-32-u8)
892 (sequence () ; insert
893 (set (ifield f-bitno32-prefixed) (and f-bitbase32-24-u19-prefixed #x7))
894 (set (ifield f-dsp-24-u8) (and (srl (ifield f-bitbase32-24-u19-prefixed) 3) #xff))
895 (set (ifield f-dsp-32-u8) (and (srl (ifield f-bitbase32-24-u19-prefixed) 11) #xff))
897 (sequence () ; extract
898 (set (ifield f-bitbase32-24-u19-prefixed) (or (sll (ifield f-dsp-24-u8) 3)
899 (or (sll (ifield f-dsp-32-u8) 11)
900 (ifield f-bitno32-prefixed))))
903 ; SID decoder doesn't handle multi-ifield referencing another multi-ifield :-(
904 (dnmf f-bitbase32-24-s19-prefixed "signed bit,base:11" (all-isas) INT
905 (f-bitno32-prefixed f-dsp-24-u8 f-dsp-32-s8)
906 (sequence () ; insert
907 (set (ifield f-bitno32-prefixed) (and f-bitbase32-24-s19-prefixed #x7))
908 (set (ifield f-dsp-24-u8) (and (srl (ifield f-bitbase32-24-s19-prefixed) 3) #xff))
909 (set (ifield f-dsp-32-s8) (sra INT (ifield f-bitbase32-24-s19-prefixed) 11))
911 (sequence () ; extract
912 (set (ifield f-bitbase32-24-s19-prefixed) (or (sll (ifield f-dsp-24-u8) 3)
913 (or (sll (ifield f-dsp-32-s8) 11)
914 (ifield f-bitno32-prefixed))))
917 ; SID decoder doesn't handle multi-ifield referencing another multi-ifield :-(
918 (dnmf f-bitbase32-24-u27-prefixed "unsigned bit,base:27" (all-isas) UINT
919 (f-bitno32-prefixed f-dsp-24-u8 f-dsp-32-u16)
920 (sequence () ; insert
921 (set (ifield f-bitno32-prefixed) (and f-bitbase32-24-u27-prefixed #x7))
922 (set (ifield f-dsp-24-u8) (and (srl (ifield f-bitbase32-24-u27-prefixed) 3) #xff))
923 (set (ifield f-dsp-32-u16) (and (srl (ifield f-bitbase32-24-u27-prefixed) 11) #xffff))
925 (sequence () ; extract
926 (set (ifield f-bitbase32-24-u27-prefixed) (or (sll (ifield f-dsp-24-u8) 3)
927 (or (sll (ifield f-dsp-32-u16) 11)
928 (ifield f-bitno32-prefixed))))
932 ;-------------------------------------------------------------
934 ;-------------------------------------------------------------
936 (df f-lab-5-3 "3 bit pc relative unsigned offset" (PCREL-ADDR all-isas) 5 3 UINT
937 ((value pc) (sub SI value (add SI pc 2))) ; insert
938 ((value pc) (add SI value (add SI pc 2))) ; extract
940 (dnmf f-lab32-jmp-s "unsigned 3 bit pc relative offset" (PCREL-ADDR all-isas) UINT
942 (sequence ((SI val)) ; insert
943 (set val (sub (sub (ifield f-lab32-jmp-s) pc) 2))
944 (set (ifield f-7-1) (and val #x1))
945 (set (ifield f-2-2) (srl val 1))
947 (sequence () ; extract
948 (set (ifield f-lab32-jmp-s) (add pc (add (or (sll (ifield f-2-2) 1)
953 (df f-lab-8-8 "8 bit pc relative signed offset" (PCREL-ADDR all-isas) 8 8 INT
954 ((value pc) (sub SI value (add SI pc 1))) ; insert
955 ((value pc) (add SI value (add SI pc 1))) ; extract
957 (df f-lab-8-16 "16 bit pc relative signed offset" (PCREL-ADDR SIGN-OPT all-isas) 8 16 UINT
958 ((value pc) (or SI (sll (and (sub value (add pc 1)) #xff) 8)
959 (srl (and (sub value (add pc 1)) #xffff) 8)))
960 ((value pc) (add SI (or (srl (and value #xffff) 8)
961 (sra (sll (and value #xff) 24) 16)) (add pc 1)))
963 (df f-lab-8-24 "24 bit absolute" (all-isas ABS-ADDR) 8 24 UINT
965 (or (srl value 16) (and value #xff00))
966 (sll (and value #xff) 16)))
968 (or (srl value 16) (and value #xff00))
969 (sll (and value #xff) 16)))
971 (df f-lab-16-8 "8 bit pc relative signed offset" (PCREL-ADDR all-isas) 16 8 INT
972 ((value pc) (sub SI value (add SI pc 2))) ; insert
973 ((value pc) (add SI value (add SI pc 2))) ; extract
975 (df f-lab-24-8 "8 bit pc relative signed offset" (PCREL-ADDR all-isas) 24 8 INT
976 ((value pc) (sub SI value (add SI pc 2))) ; insert
977 ((value pc) (add SI value (add SI pc 2))) ; extract
979 (df f-lab-32-8 "8 bit pc relative signed offset" (PCREL-ADDR all-isas) 32 8 INT
980 ((value pc) (sub SI value (add SI pc 2))) ; insert
981 ((value pc) (add SI value (add SI pc 2))) ; extract
983 (df f-lab-40-8 "8 bit pc relative signed offset" (PCREL-ADDR all-isas) 40 8 INT
984 ((value pc) (sub SI value (add SI pc 2))) ; insert
985 ((value pc) (add SI value (add SI pc 2))) ; extract
988 ;-------------------------------------------------------------
990 ;-------------------------------------------------------------
992 (dnf f-cond16 "condition code" (all-isas) 12 4)
993 (dnf f-cond16j-5 "condition code" (all-isas) 5 3)
995 (dnmf f-cond32 "condition code" (all-isas) UINT
997 (sequence () ; insert
998 (set (ifield f-9-1) (and (srl (ifield f-cond32) 3) 1))
999 (set (ifield f-13-3) (and (ifield f-cond32) #x7))
1001 (sequence () ; extract
1002 (set (ifield f-cond32) (or (sll (ifield f-9-1) 3)
1007 (dnmf f-cond32j "condition code" (all-isas) UINT
1009 (sequence () ; insert
1010 (set (ifield f-1-3) (and (srl (ifield f-cond32j) 1) #x7))
1011 (set (ifield f-7-1) (and (ifield f-cond32j) #x1))
1013 (sequence () ; extract
1014 (set (ifield f-cond32j) (or (sll (ifield f-1-3) 1)
1019 ;=============================================================
1022 (dnh h-pc "program counter" (PC all-isas) (pc USI) () () ())
1024 ;-------------------------------------------------------------
1026 ; The actual registers are 16 bits
1027 ;-------------------------------------------------------------
1031 (comment "general 16 bit registers")
1032 (attrs all-isas CACHE-ADDR)
1033 (type register HI (4))
1034 (indices keyword "" (("r0" 0) ("r1" 1) ("r2" 2) ("r3" 3))))
1036 ; Define different views of the grs as VIRTUAL with getter/setter specs
1040 (comment "general 8 bit registers")
1041 (attrs all-isas VIRTUAL)
1042 (type register QI (4))
1043 (indices keyword "" (("r0l" 0) ("r0h" 1) ("r1l" 2) ("r1h" 3)))
1044 (get (index) (and (if SI (mod index 2)
1045 (srl (reg h-gr (div index 2)) 8)
1046 (reg h-gr (div index 2)))
1048 (set (index newval) (set (reg h-gr (div index 2))
1049 (if SI (mod index 2)
1050 (or (and (reg h-gr (div index 2)) #xff)
1051 (sll (and newval #xff) 8))
1052 (or (and (reg h-gr (div index 2)) #xff00)
1053 (and newval #xff))))))
1057 (comment "general 16 bit registers")
1058 (attrs all-isas VIRTUAL)
1059 (type register HI (4))
1060 (indices keyword "" (("r0" 0) ("r1" 1) ("r2" 2) ("r3" 3)))
1061 (get (index) (reg h-gr index))
1062 (set (index newval) (set (reg h-gr index) newval)))
1066 (comment "general 32 bit registers")
1067 (attrs all-isas VIRTUAL)
1068 (type register SI (2))
1069 (indices keyword "" (("r2r0" 0) ("r3r1" 1)))
1071 (and (reg h-gr index) #xffff)
1072 (and (sll (reg h-gr (add index 2)) 16) #xffff0000)))
1073 (set (index newval) (sequence ()
1074 (set (reg h-gr index) (and newval #xffff))
1075 (set (reg h-gr (add index 2)) (srl newval 16)))))
1079 (comment "general 16 bit registers")
1080 (attrs all-isas VIRTUAL)
1081 (type register HI (2))
1082 (indices keyword "" (("r0l" 0) ("r1l" 1)))
1083 (get (index) (reg h-gr-QI (mul index 2)))
1084 (set (index newval) (set (reg h-gr (mul index 2)) newval)))
1088 (comment "general 16 bit registers")
1089 (attrs all-isas VIRTUAL)
1090 (type register SI (2))
1091 (indices keyword "" (("r0" 0) ("r1" 1)))
1092 (get (index) (reg h-gr (mul index 2)))
1093 (set (index newval) (set (reg h-gr-SI index) newval)))
1097 (comment "r0l register")
1098 (attrs all-isas VIRTUAL)
1100 (indices keyword "" (("r0l" 0)))
1101 (get () (reg h-gr-QI 0))
1102 (set (newval) (set (reg h-gr-QI 0) newval)))
1106 (comment "r0h register")
1107 (attrs all-isas VIRTUAL)
1109 (indices keyword "" (("r0h" 0)))
1110 (get () (reg h-gr-QI 1))
1111 (set (newval) (set (reg h-gr-QI 1) newval)))
1115 (comment "r1l register")
1116 (attrs all-isas VIRTUAL)
1118 (indices keyword "" (("r1l" 0)))
1119 (get () (reg h-gr-QI 2))
1120 (set (newval) (set (reg h-gr-QI 2) newval)))
1124 (comment "r1h register")
1125 (attrs all-isas VIRTUAL)
1127 (indices keyword "" (("r1h" 0)))
1128 (get () (reg h-gr-QI 3))
1129 (set (newval) (set (reg h-gr-QI 3) newval)))
1133 (comment "r0 register")
1134 (attrs all-isas VIRTUAL)
1136 (indices keyword "" (("r0" 0)))
1137 (get () (reg h-gr 0))
1138 (set (newval) (set (reg h-gr 0) newval)))
1142 (comment "r1 register")
1143 (attrs all-isas VIRTUAL)
1145 (indices keyword "" (("r1" 0)))
1146 (get () (reg h-gr 1))
1147 (set (newval) (set (reg h-gr 1) newval)))
1151 (comment "r2 register")
1152 (attrs all-isas VIRTUAL)
1154 (indices keyword "" (("r2" 0)))
1155 (get () (reg h-gr 2))
1156 (set (newval) (set (reg h-gr 2) newval)))
1160 (comment "r3 register")
1161 (attrs all-isas VIRTUAL)
1163 (indices keyword "" (("r3" 0)))
1164 (get () (reg h-gr 3))
1165 (set (newval) (set (reg h-gr 3) newval)))
1169 (comment "r0l or r0h")
1170 (attrs all-isas VIRTUAL)
1171 (type register QI (2))
1172 (indices keyword "" (("r0l" 0) ("r0h" 1)))
1173 (get (index) (reg h-gr-QI index))
1174 (set (index newval) (set (reg h-gr-QI index) newval)))
1178 (comment "r2r0 register")
1179 (attrs all-isas VIRTUAL)
1181 (indices keyword "" (("r2r0" 0)))
1182 (get () (or (sll (reg h-gr 2) 16) (reg h-gr 0)))
1185 (set (reg h-gr 0) newval)
1186 (set (reg h-gr 2) (sra newval 16)))))
1190 (comment "r3r1 register")
1191 (attrs all-isas VIRTUAL)
1193 (indices keyword "" (("r3r1" 0)))
1194 (get () (or (sll (reg h-gr 3) 16) (reg h-gr 1)))
1197 (set (reg h-gr 1) newval)
1198 (set (reg h-gr 3) (sra newval 16)))))
1202 (comment "r1r2r0 register")
1203 (attrs all-isas VIRTUAL)
1205 (indices keyword "" (("r1r2r0" 0)))
1206 (get () (or DI (sll DI (reg h-gr 1) 32) (or (sll (reg h-gr 2) 16) (reg h-gr 0))))
1209 (set (reg h-gr 0) newval)
1210 (set (reg h-gr 2) (sra newval 16))
1211 (set (reg h-gr 1) (sra newval 32)))))
1213 ;-------------------------------------------------------------
1215 ;-------------------------------------------------------------
1219 (comment "address registers")
1221 (type register USI (2))
1222 (indices keyword "" (("a0" 0) ("a1" 1)))
1223 (get (index) (c-call USI "h_ar_get_handler" index))
1224 (set (index newval) (c-call VOID "h_ar_set_handler" index newval)))
1226 ; Define different views of the ars as VIRTUAL with getter/setter specs
1229 (comment "8 bit view of address register")
1230 (attrs all-isas VIRTUAL)
1231 (type register QI (2))
1232 (indices keyword "" (("a0" 0) ("a1" 1)))
1233 (get (index) (reg h-ar index))
1234 (set (index newval) (set (reg h-ar index) newval)))
1238 (comment "16 bit view of address register")
1239 (attrs all-isas VIRTUAL)
1240 (type register HI (2))
1241 (indices keyword "" (("a0" 0) ("a1" 1)))
1242 (get (index) (reg h-ar index))
1243 (set (index newval) (set (reg h-ar index) newval)))
1247 (comment "32 bit view of address register")
1248 (attrs all-isas VIRTUAL)
1250 (indices keyword "" (("a1a0" 0)))
1251 (get () (or SI (sll SI (ext SI (reg h-ar 1)) 16) (ext SI (reg h-ar 0))))
1252 (set (newval) (sequence ()
1253 (set (reg h-ar 0) (and newval #xffff))
1254 (set (reg h-ar 1) (and (srl newval 16) #xffff)))))
1258 (comment "16 bit view of address register")
1259 (attrs all-isas VIRTUAL)
1261 (indices keyword "" (("a0" 0)))
1262 (get () (reg h-ar 0))
1263 (set (newval) (set (reg h-ar 0) newval)))
1267 (comment "16 bit view of address register")
1268 (attrs all-isas VIRTUAL)
1270 (indices keyword "" (("a1" 1)))
1271 (get () (reg h-ar 1))
1272 (set (newval) (set (reg h-ar 1) newval)))
1277 (comment "SB register")
1280 (get () (c-call USI "h_sb_get_handler"))
1281 (set (newval) (c-call VOID "h_sb_set_handler" newval))
1287 (comment "FB register")
1290 (get () (c-call USI "h_fb_get_handler"))
1291 (set (newval) (c-call VOID "h_fb_set_handler" newval))
1297 (comment "SP register")
1300 (get () (c-call USI "h_sp_get_handler"))
1301 (set (newval) (c-call VOID "h_sp_set_handler" newval))
1304 ;-------------------------------------------------------------
1305 ; condition-code bits
1306 ;-------------------------------------------------------------
1310 (comment "sign bit")
1317 (comment "zero bit")
1324 (comment "overflow bit")
1331 (comment "carry bit")
1338 (comment "stack pointer select bit")
1345 (comment "interrupt enable bit")
1352 (comment "register bank select bit")
1359 (comment "debug bit")
1366 (comment "dma transfer count 000")
1372 (comment "dma transfer count 001")
1378 (comment "save flag 011")
1384 (comment "dma transfer count reload 100")
1390 (comment "dma transfer count reload 101")
1396 (comment "dma mode 110")
1402 (comment "dma mode 111")
1408 (comment "interrupt table 000")
1414 (comment "save pc 100")
1420 (comment "vector 101")
1426 (comment "interrupt stack ptr 111")
1432 (comment "dma mem addr 010")
1438 (comment "dma mem addr 011")
1444 (comment "dma mem addr reload 100")
1450 (comment "dma mem addr reload 101")
1456 (comment "dma sfr addr 110")
1462 (comment "dma sfr addr 111")
1467 ;-------------------------------------------------------------
1468 ; Condition code operand hardware
1469 ;-------------------------------------------------------------
1473 (comment "condition code hardware for m16c")
1474 (attrs m16c-isa MACH16)
1475 (type immediate UQI)
1477 (("geu" #x00) ("c" #x00)
1479 ("eq" #x02) ("z" #x02)
1484 ("ltu" #xf8) ("nc" #xf8)
1486 ("ne" #xfa) ("nz" #xfa)
1496 (comment "condition code hardware for m16c")
1497 (attrs m16c-isa MACH16)
1498 (type immediate UQI)
1500 (("geu" #x00) ("c" #x00)
1502 ("eq" #x02) ("z" #x02)
1504 ("ltu" #x04) ("nc" #x04)
1506 ("ne" #x06) ("nz" #x06)
1519 (comment "condition code hardware for m16c")
1520 (attrs m16c-isa MACH16)
1521 (type immediate UQI)
1534 (comment "condition code hardware for m16c")
1535 (attrs m16c-isa MACH16)
1536 (type immediate UQI)
1538 (("geu" #x00) ("c" #x00)
1540 ("eq" #x02) ("z" #x02)
1542 ("ltu" #x04) ("nc" #x04)
1544 ("ne" #x06) ("nz" #x06)
1552 (comment "condition code hardware for m32c")
1553 (attrs m32c-isa MACH32)
1554 (type immediate UQI)
1556 (("ltu" #x00) ("nc" #x00)
1558 ("ne" #x02) ("nz" #x02)
1563 ("geu" #x08) ("c" #x08)
1565 ("eq" #x0a) ("z" #x0a)
1576 (comment "control registers")
1577 (attrs m32c-isa MACH32)
1578 (type immediate UQI)
1579 (values keyword "" (("dct0" 0) ("dct1" 1) ("flg" 2) ("svf" 3) ("drc0" 4)
1580 ("drc1" 5) ("dmd0" 6) ("dmd1" 7))))
1583 (comment "control registers")
1584 (attrs m32c-isa MACH32)
1585 (type immediate UQI)
1586 (values keyword "" (("intb" 0) ("sp" 1) ("sb" 2) ("fb" 3) ("svp" 4)
1587 ("vct" 5) ("isp" 7))))
1591 (comment "control registers")
1592 (attrs m32c-isa MACH32)
1593 (type immediate UQI)
1594 (values keyword "" (("dma0" 2) ("dma1" 3) ("dra0" 4)
1595 ("dra1" 5) ("dsa0" 6) ("dsa1" 7))))
1598 (comment "control registers")
1599 (attrs m16c-isa MACH16)
1600 (type immediate UQI)
1601 (values keyword "" (("intbl" 1) ("intbh" 2) ("flg" 3) ("isp" 4)
1602 ("sp" 5) ("sb" 6) ("fb" 7))))
1606 (comment "flag hardware for m32c")
1608 (type immediate UQI)
1622 ;-------------------------------------------------------------
1623 ; Misc helper hardware
1624 ;-------------------------------------------------------------
1628 (comment "shift immediate")
1630 (type immediate (INT 4))
1631 (values keyword "" (("1" 0) ("2" 1) ("3" 2) ("4" 3) ("5" 4) ("6" 5) ("7" 6)
1632 ("8" 7) ("-1" -8) ("-2" -7) ("-3" -6) ("-4" -5) ("-5" -4)
1633 ("-6" -3) ("-7" -2) ("-8" -1)
1637 (comment "bit index for the next insn")
1638 (attrs m32c-isa MACH32)
1643 (comment "source index for the next insn")
1644 (attrs m32c-isa MACH32)
1649 (comment "destination index for the next insn")
1650 (attrs m32c-isa MACH32)
1654 (name h-src-indirect)
1655 (comment "indirect src for the next insn")
1660 (name h-dst-indirect)
1661 (comment "indirect dst for the next insn")
1667 (comment "for storing unused values")
1668 (attrs m32c-isa MACH32)
1672 ;=============================================================
1674 ;-------------------------------------------------------------
1676 ;-------------------------------------------------------------
1678 (dnop Src16RnQI "general register QI view" (MACH16 m16c-isa) h-gr-QI f-src16-rn)
1679 (dnop Src16RnHI "general register QH view" (MACH16 m16c-isa) h-gr-HI f-src16-rn)
1681 (dnop Src32RnUnprefixedQI "general register QI view" (MACH32 m32c-isa) h-gr-QI f-src32-rn-unprefixed-QI)
1682 (dnop Src32RnUnprefixedHI "general register HI view" (MACH32 m32c-isa) h-gr-HI f-src32-rn-unprefixed-HI)
1683 (dnop Src32RnUnprefixedSI "general register SI view" (MACH32 m32c-isa) h-gr-SI f-src32-rn-unprefixed-SI)
1685 (dnop Src32RnPrefixedQI "general register QI view" (MACH32 m32c-isa) h-gr-QI f-src32-rn-prefixed-QI)
1686 (dnop Src32RnPrefixedHI "general register HI view" (MACH32 m32c-isa) h-gr-HI f-src32-rn-prefixed-HI)
1687 (dnop Src32RnPrefixedSI "general register SI view" (MACH32 m32c-isa) h-gr-SI f-src32-rn-prefixed-SI)
1689 (dnop Src16An "address register" (MACH16 m16c-isa) h-ar f-src16-an)
1690 (dnop Src16AnQI "address register QI view" (MACH16 m16c-isa) h-ar-QI f-src16-an)
1691 (dnop Src16AnHI "address register HI view" (MACH16 m16c-isa) h-ar-HI f-src16-an)
1693 (dnop Src32AnUnprefixed "address register" (MACH32 m32c-isa) h-ar f-src32-an-unprefixed)
1694 (dnop Src32AnUnprefixedQI "address register QI view" (MACH32 m32c-isa) h-ar-QI f-src32-an-unprefixed)
1695 (dnop Src32AnUnprefixedHI "address register HI view" (MACH32 m32c-isa) h-ar-HI f-src32-an-unprefixed)
1696 (dnop Src32AnUnprefixedSI "address register SI view" (MACH32 m32c-isa) h-ar f-src32-an-unprefixed)
1698 (dnop Src32AnPrefixed "address register" (MACH32 m32c-isa) h-ar f-src32-an-prefixed)
1699 (dnop Src32AnPrefixedQI "address register QI view" (MACH32 m32c-isa) h-ar-QI f-src32-an-prefixed)
1700 (dnop Src32AnPrefixedHI "address register HI view" (MACH32 m32c-isa) h-ar-HI f-src32-an-prefixed)
1701 (dnop Src32AnPrefixedSI "address register SI view" (MACH32 m32c-isa) h-ar f-src32-an-prefixed)
1703 ; Destination Registers
1705 (dnop Dst16RnQI "general register QI view" (MACH16 m16c-isa) h-gr-QI f-dst16-rn)
1706 (dnop Dst16RnHI "general register HI view" (MACH16 m16c-isa) h-gr-HI f-dst16-rn)
1707 (dnop Dst16RnSI "general register SI view" (MACH16 m16c-isa) h-gr-SI f-dst16-rn)
1708 (dnop Dst16RnExtQI "general register QI/HI view for 'ext' insns" (MACH16 m16c-isa) h-gr-ext-QI f-dst16-rn-ext)
1710 (dnop Dst32R0QI-S "general register QI view" (MACH32 m32c-isa) h-r0l f-nil)
1711 (dnop Dst32R0HI-S "general register HI view" (MACH32 m32c-isa) h-r0 f-nil)
1713 (dnop Dst32RnUnprefixedQI "general register QI view" (MACH32 m32c-isa) h-gr-QI f-dst32-rn-unprefixed-QI)
1714 (dnop Dst32RnUnprefixedHI "general register HI view" (MACH32 m32c-isa) h-gr-HI f-dst32-rn-unprefixed-HI)
1715 (dnop Dst32RnUnprefixedSI "general register SI view" (MACH32 m32c-isa) h-gr-SI f-dst32-rn-unprefixed-SI)
1716 (dnop Dst32RnExtUnprefixedQI "general register QI view" (MACH32 m32c-isa) h-gr-ext-QI f-dst32-rn-ext-unprefixed)
1717 (dnop Dst32RnExtUnprefixedHI "general register HI view" (MACH32 m32c-isa) h-gr-ext-HI f-dst32-rn-ext-unprefixed)
1719 (dnop Dst32RnPrefixedQI "general register QI view" (MACH32 m32c-isa) h-gr-QI f-dst32-rn-prefixed-QI)
1720 (dnop Dst32RnPrefixedHI "general register HI view" (MACH32 m32c-isa) h-gr-HI f-dst32-rn-prefixed-HI)
1721 (dnop Dst32RnPrefixedSI "general register SI view" (MACH32 m32c-isa) h-gr-SI f-dst32-rn-prefixed-SI)
1723 (dnop Dst16RnQI-S "general register QI view" (MACH16 m16c-isa) h-r0l-r0h f-dst16-rn-QI-s)
1725 (dnop Dst16AnQI-S "address register QI view" (MACH16 m16c-isa) h-ar-QI f-dst16-rn-QI-s)
1727 (dnop Bit16Rn "general register bit view" (MACH16 m16c-isa) h-gr-HI f-dst16-rn)
1729 (dnop Bit32RnPrefixed "general register bit view" (MACH32 m32c-isa) h-gr-QI f-dst32-rn-prefixed-QI)
1730 (dnop Bit32RnUnprefixed "general register bit view" (MACH32 m32c-isa) h-gr-QI f-dst32-rn-unprefixed-QI)
1732 (dnop R0 "r0" (all-isas) h-r0 f-nil)
1733 (dnop R1 "r1" (all-isas) h-r1 f-nil)
1734 (dnop R2 "r2" (all-isas) h-r2 f-nil)
1735 (dnop R3 "r3" (all-isas) h-r3 f-nil)
1736 (dnop R0l "r0l" (all-isas) h-r0l f-nil)
1737 (dnop R0h "r0h" (all-isas) h-r0h f-nil)
1738 (dnop R2R0 "r2r0" (all-isas) h-r2r0 f-nil)
1739 (dnop R3R1 "r3r1" (all-isas) h-r3r1 f-nil)
1740 (dnop R1R2R0 "r1r2r0" (all-isas) h-r1r2r0 f-nil)
1742 (dnop Dst16An "address register" (MACH16 m16c-isa) h-ar f-dst16-an)
1743 (dnop Dst16AnQI "address register QI view" (MACH16 m16c-isa) h-ar-QI f-dst16-an)
1744 (dnop Dst16AnHI "address register HI view" (MACH16 m16c-isa) h-ar-HI f-dst16-an)
1745 (dnop Dst16AnSI "address register SI view" (MACH16 m16c-isa) h-ar-SI f-dst16-an)
1746 (dnop Dst16An-S "address register HI view" (MACH16 m16c-isa) h-ar-HI f-dst16-an-s)
1748 (dnop Dst32AnUnprefixed "address register" (MACH32 m32c-isa) h-ar f-dst32-an-unprefixed)
1749 (dnop Dst32AnUnprefixedQI "address register QI view" (MACH32 m32c-isa) h-ar-QI f-dst32-an-unprefixed)
1750 (dnop Dst32AnUnprefixedHI "address register HI view" (MACH32 m32c-isa) h-ar-HI f-dst32-an-unprefixed)
1751 (dnop Dst32AnUnprefixedSI "address register SI view" (MACH32 m32c-isa) h-ar f-dst32-an-unprefixed)
1753 (dnop Dst32AnExtUnprefixed "address register" (MACH32 m32c-isa) h-ar f-dst32-an-unprefixed)
1755 (dnop Dst32AnPrefixed "address register" (MACH32 m32c-isa) h-ar f-dst32-an-prefixed)
1756 (dnop Dst32AnPrefixedQI "address register QI view" (MACH32 m32c-isa) h-ar-QI f-dst32-an-prefixed)
1757 (dnop Dst32AnPrefixedHI "address register HI view" (MACH32 m32c-isa) h-ar-HI f-dst32-an-prefixed)
1758 (dnop Dst32AnPrefixedSI "address register SI view" (MACH32 m32c-isa) h-ar f-dst32-an-prefixed)
1760 (dnop Bit16An "address register bit view" (MACH16 m16c-isa) h-ar f-dst16-an)
1762 (dnop Bit32AnPrefixed "address register bit" (MACH32 m32c-isa) h-ar f-dst32-an-prefixed)
1763 (dnop Bit32AnUnprefixed "address register bit" (MACH32 m32c-isa) h-ar f-dst32-an-unprefixed)
1765 (dnop A0 "a0" (all-isas) h-a0 f-nil)
1766 (dnop A1 "a1" (all-isas) h-a1 f-nil)
1768 (dnop sb "SB register" (all-isas SEM-ONLY) h-sb f-nil)
1769 (dnop fb "FB register" (all-isas SEM-ONLY) h-fb f-nil)
1770 (dnop sp "SP register" (all-isas SEM-ONLY) h-sp f-nil)
1772 (define-full-operand SrcDst16-r0l-r0h-S-normal "r0l/r0h pair" (MACH16 m16c-isa)
1774 ((parse "r0l_r0h") (print "r0l_r0h")) () ()
1777 (define-full-operand Regsetpop "popm regset" (all-isas) h-uint
1778 DFLT f-8-8 ((parse "pop_regset") (print "pop_regset")) () ())
1779 (define-full-operand Regsetpush "pushm regset" (all-isas) h-uint
1780 DFLT f-8-8 ((parse "push_regset") (print "push_regset")) () ())
1782 (dnop Rn16-push-S "r0[lh]" (MACH16 m16c-isa) h-gr-QI f-4-1)
1783 (dnop An16-push-S "a[01]" (MACH16 m16c-isa) h-ar-HI f-4-1)
1785 ;-------------------------------------------------------------
1786 ; Offsets and absolutes
1787 ;-------------------------------------------------------------
1789 (define-full-operand Dsp-8-u6 "unsigned 6 bit displacement at offset 8 bits" (all-isas)
1790 h-uint DFLT f-dsp-8-u6
1791 ((parse "unsigned6")) () ()
1793 (define-full-operand Dsp-8-u8 "unsigned 8 bit displacement at offset 8 bits" (all-isas)
1794 h-uint DFLT f-dsp-8-u8
1795 ((parse "unsigned8")) () ()
1797 (define-full-operand Dsp-8-u16 "unsigned 16 bit displacement at offset 8 bits" (all-isas)
1798 h-uint DFLT f-dsp-8-u16
1799 ((parse "unsigned16")) () ()
1801 (define-full-operand Dsp-8-s8 "signed 8 bit displacement at offset 8 bits" (all-isas)
1802 h-sint DFLT f-dsp-8-s8
1803 ((parse "signed8")) () ()
1805 (define-full-operand Dsp-8-s24 "signed 24 bit displacement at offset 8 bits" (all-isas)
1806 h-sint DFLT f-dsp-8-s24
1807 ((parse "signed24")) () ()
1809 (define-full-operand Dsp-8-u24 "unsigned 24 bit displacement at offset 8 bits" (all-isas)
1810 h-uint DFLT f-dsp-8-u24
1811 ((parse "unsigned24")) () ()
1813 (define-full-operand Dsp-10-u6 "unsigned 6 bit displacement at offset 10 bits" (all-isas)
1814 h-uint DFLT f-dsp-10-u6
1815 ((parse "unsigned6")) () ()
1817 (define-full-operand Dsp-16-u8 "unsigned 8 bit displacement at offset 16 bits" (all-isas)
1818 h-uint DFLT f-dsp-16-u8
1819 ((parse "unsigned8")) () ()
1821 (define-full-operand Dsp-16-u16 "unsigned 16 bit displacement at offset 16 bits" (all-isas)
1822 h-uint DFLT f-dsp-16-u16
1823 ((parse "unsigned16")) () ()
1825 (define-full-operand Dsp-16-u20 "unsigned 20 bit displacement at offset 16 bits" (all-isas)
1826 h-uint DFLT f-dsp-16-u24
1827 ((parse "unsigned20")) () ()
1829 (define-full-operand Dsp-16-u24 "unsigned 24 bit displacement at offset 16 bits" (all-isas)
1830 h-uint DFLT f-dsp-16-u24
1831 ((parse "unsigned24")) () ()
1833 (define-full-operand Dsp-16-s8 "signed 8 bit displacement at offset 16 bits" (all-isas)
1834 h-sint DFLT f-dsp-16-s8
1835 ((parse "signed8")) () ()
1837 (define-full-operand Dsp-16-s16 "signed 16 bit displacement at offset 16 bits" (all-isas)
1838 h-sint DFLT f-dsp-16-s16
1839 ((parse "signed16")) () ()
1841 (define-full-operand Dsp-24-u8 "unsigned 8 bit displacement at offset 24 bits" (all-isas)
1842 h-uint DFLT f-dsp-24-u8
1843 ((parse "unsigned8")) () ()
1845 (define-full-operand Dsp-24-u16 "unsigned 16 bit displacement at offset 24 bits" (all-isas)
1846 h-uint DFLT f-dsp-24-u16
1847 ((parse "unsigned16")) () ()
1849 (define-full-operand Dsp-24-u20 "unsigned 20 bit displacement at offset 24 bits" (all-isas)
1850 h-uint DFLT f-dsp-24-u24
1851 ((parse "unsigned20")) () ()
1853 (define-full-operand Dsp-24-u24 "unsigned 24 bit displacement at offset 24 bits" (all-isas)
1854 h-uint DFLT f-dsp-24-u24
1855 ((parse "unsigned24")) () ()
1857 (define-full-operand Dsp-24-s8 "signed 8 bit displacement at offset 24 bits" (all-isas)
1858 h-sint DFLT f-dsp-24-s8
1859 ((parse "signed8")) () ()
1861 (define-full-operand Dsp-24-s16 "signed 16 bit displacement at offset 24 bits" (all-isas)
1862 h-sint DFLT f-dsp-24-s16
1863 ((parse "signed16")) () ()
1865 (define-full-operand Dsp-32-u8 "unsigned 8 bit displacement at offset 32 bits" (all-isas)
1866 h-uint DFLT f-dsp-32-u8
1867 ((parse "unsigned8")) () ()
1869 (define-full-operand Dsp-32-u16 "unsigned 16 bit displacement at offset 32 bits" (all-isas)
1870 h-uint DFLT f-dsp-32-u16
1871 ((parse "unsigned16")) () ()
1873 (define-full-operand Dsp-32-u24 "unsigned 24 bit displacement at offset 32 bits" (all-isas)
1874 h-uint DFLT f-dsp-32-u24
1875 ((parse "unsigned24")) () ()
1877 (define-full-operand Dsp-32-u20 "unsigned 20 bit displacement at offset 32 bits" (all-isas)
1878 h-uint DFLT f-dsp-32-u24
1879 ((parse "unsigned20")) () ()
1881 (define-full-operand Dsp-32-s8 "signed 8 bit displacement at offset 32 bits" (all-isas)
1882 h-sint DFLT f-dsp-32-s8
1883 ((parse "signed8")) () ()
1885 (define-full-operand Dsp-32-s16 "signed 16 bit displacement at offset 32 bits" (all-isas)
1886 h-sint DFLT f-dsp-32-s16
1887 ((parse "signed16")) () ()
1889 (define-full-operand Dsp-40-u8 "unsigned 8 bit displacement at offset 40 bits" (all-isas)
1890 h-uint DFLT f-dsp-40-u8
1891 ((parse "unsigned8")) () ()
1893 (define-full-operand Dsp-40-s8 "signed 8 bit displacement at offset 40 bits" (all-isas)
1894 h-sint DFLT f-dsp-40-s8
1895 ((parse "signed8")) () ()
1897 (define-full-operand Dsp-40-u16 "unsigned 16 bit displacement at offset 40 bits" (all-isas)
1898 h-uint DFLT f-dsp-40-u16
1899 ((parse "unsigned16")) () ()
1901 (define-full-operand Dsp-40-s16 "signed 16 bit displacement at offset 40 bits" (all-isas)
1902 h-sint DFLT f-dsp-40-s16
1903 ((parse "signed16")) () ()
1905 (define-full-operand Dsp-40-u20 "unsigned 20 bit displacement at offset 40 bits" (all-isas)
1906 h-uint DFLT f-dsp-40-u20
1907 ((parse "unsigned20")) () ()
1909 (define-full-operand Dsp-40-u24 "unsigned 24 bit displacement at offset 40 bits" (all-isas)
1910 h-uint DFLT f-dsp-40-u24
1911 ((parse "unsigned24")) () ()
1913 (define-full-operand Dsp-48-u8 "unsigned 8 bit displacement at offset 48 bits" (all-isas)
1914 h-uint DFLT f-dsp-48-u8
1915 ((parse "unsigned8")) () ()
1917 (define-full-operand Dsp-48-s8 "signed 8 bit displacement at offset 48 bits" (all-isas)
1918 h-sint DFLT f-dsp-48-s8
1919 ((parse "signed8")) () ()
1921 (define-full-operand Dsp-48-u16 "unsigned 16 bit displacement at offset 48 bits" (all-isas)
1922 h-uint DFLT f-dsp-48-u16
1923 ((parse "unsigned16")) () ()
1925 (define-full-operand Dsp-48-s16 "signed 16 bit displacement at offset 48 bits" (all-isas)
1926 h-sint DFLT f-dsp-48-s16
1927 ((parse "signed16")) () ()
1929 (define-full-operand Dsp-48-u20 "unsigned 24 bit displacement at offset 40 bits" (all-isas)
1930 h-uint DFLT f-dsp-48-u20
1931 ((parse "unsigned24")) () ()
1933 (define-full-operand Dsp-48-u24 "unsigned 24 bit displacement at offset 48 bits" (all-isas)
1934 h-uint DFLT f-dsp-48-u24
1935 ((parse "unsigned24")) () ()
1938 (define-full-operand Imm-8-s4 "signed 4 bit immediate at offset 8 bits" (all-isas)
1939 h-sint DFLT f-imm-8-s4
1940 ((parse "signed4")) () ()
1942 (define-full-operand Imm-8-s4n "negated 4 bit immediate at offset 8 bits" (all-isas)
1943 h-sint DFLT f-imm-8-s4
1944 ((parse "signed4n") (print "signed4n")) () ()
1946 (define-full-operand Imm-sh-8-s4 "signed 4 bit shift immediate at offset 8 bits" (all-isas)
1947 h-shimm DFLT f-imm-8-s4
1950 (define-full-operand Imm-8-QI "signed 8 bit immediate at offset 8 bits" (all-isas)
1951 h-sint DFLT f-dsp-8-s8
1952 ((parse "signed8")) () ()
1954 (define-full-operand Imm-8-HI "signed 16 bit immediate at offset 8 bits" (all-isas)
1955 h-sint DFLT f-dsp-8-s16
1956 ((parse "signed16")) () ()
1958 (define-full-operand Imm-12-s4 "signed 4 bit immediate at offset 12 bits" (all-isas)
1959 h-sint DFLT f-imm-12-s4
1960 ((parse "signed4")) () ()
1962 (define-full-operand Imm-12-s4n "negated 4 bit immediate at offset 12 bits" (all-isas)
1963 h-sint DFLT f-imm-12-s4
1964 ((parse "signed4n") (print "signed4n")) () ()
1966 (define-full-operand Imm-sh-12-s4 "signed 4 bit shift immediate at offset 12 bits" (all-isas)
1967 h-shimm DFLT f-imm-12-s4
1970 (define-full-operand Imm-13-u3 "signed 3 bit immediate at offset 13 bits" (all-isas)
1971 h-sint DFLT f-imm-13-u3
1972 ((parse "signed4")) () ()
1974 (define-full-operand Imm-20-s4 "signed 4 bit immediate at offset 20 bits" (all-isas)
1975 h-sint DFLT f-imm-20-s4
1976 ((parse "signed4")) () ()
1978 (define-full-operand Imm-sh-20-s4 "signed 4 bit shift immediate at offset 12 bits" (all-isas)
1979 h-shimm DFLT f-imm-20-s4
1982 (define-full-operand Imm-16-QI "signed 8 bit immediate at offset 16 bits" (all-isas)
1983 h-sint DFLT f-dsp-16-s8
1984 ((parse "signed8")) () ()
1986 (define-full-operand Imm-16-HI "signed 16 bit immediate at offset 16 bits" (all-isas)
1987 h-sint DFLT f-dsp-16-s16
1988 ((parse "signed16")) () ()
1990 (define-full-operand Imm-16-SI "signed 32 bit immediate at offset 16 bits" (all-isas)
1991 h-sint DFLT f-dsp-16-s32
1992 ((parse "signed32")) () ()
1994 (define-full-operand Imm-24-QI "signed 8 bit immediate at offset 24 bits" (all-isas)
1995 h-sint DFLT f-dsp-24-s8
1996 ((parse "signed8")) () ()
1998 (define-full-operand Imm-24-HI "signed 16 bit immediate at offset 24 bits" (all-isas)
1999 h-sint DFLT f-dsp-24-s16
2000 ((parse "signed16")) () ()
2002 (define-full-operand Imm-24-SI "signed 32 bit immediate at offset 24 bits" (all-isas)
2003 h-sint DFLT f-dsp-24-s32
2004 ((parse "signed32")) () ()
2006 (define-full-operand Imm-32-QI "signed 8 bit immediate at offset 32 bits" (all-isas)
2007 h-sint DFLT f-dsp-32-s8
2008 ((parse "signed8")) () ()
2010 (define-full-operand Imm-32-SI "signed 32 bit immediate at offset 32 bits" (all-isas)
2011 h-sint DFLT f-dsp-32-s32
2012 ((parse "signed32")) () ()
2014 (define-full-operand Imm-32-HI "signed 16 bit immediate at offset 32 bits" (all-isas)
2015 h-sint DFLT f-dsp-32-s16
2016 ((parse "signed16")) () ()
2018 (define-full-operand Imm-40-QI "signed 8 bit immediate at offset 40 bits" (all-isas)
2019 h-sint DFLT f-dsp-40-s8
2020 ((parse "signed8")) () ()
2022 (define-full-operand Imm-40-HI "signed 16 bit immediate at offset 40 bits" (all-isas)
2023 h-sint DFLT f-dsp-40-s16
2024 ((parse "signed16")) () ()
2026 (define-full-operand Imm-40-SI "signed 32 bit immediate at offset 40 bits" (all-isas)
2027 h-sint DFLT f-dsp-40-s32
2028 ((parse "signed32")) () ()
2030 (define-full-operand Imm-48-QI "signed 8 bit immediate at offset 48 bits" (all-isas)
2031 h-sint DFLT f-dsp-48-s8
2032 ((parse "signed8")) () ()
2034 (define-full-operand Imm-48-HI "signed 16 bit immediate at offset 48 bits" (all-isas)
2035 h-sint DFLT f-dsp-48-s16
2036 ((parse "signed16")) () ()
2038 (define-full-operand Imm-48-SI "signed 32 bit immediate at offset 48 bits" (all-isas)
2039 h-sint DFLT f-dsp-48-s32
2040 ((parse "signed32")) () ()
2042 (define-full-operand Imm-56-QI "signed 8 bit immediate at offset 56 bits" (all-isas)
2043 h-sint DFLT f-dsp-56-s8
2044 ((parse "signed8")) () ()
2046 (define-full-operand Imm-56-HI "signed 16 bit immediate at offset 56 bits" (all-isas)
2047 h-sint DFLT f-dsp-56-s16
2048 ((parse "signed16")) () ()
2050 (define-full-operand Imm-64-HI "signed 16 bit immediate at offset 64 bits" (all-isas)
2051 h-sint DFLT f-dsp-64-s16
2052 ((parse "signed16")) () ()
2054 (define-full-operand Imm1-S "signed 1 bit immediate for short format binary insns" (m32c-isa)
2055 h-sint DFLT f-imm1-S
2056 ((parse "imm1_S")) () ()
2058 (define-full-operand Imm3-S "signed 3 bit immediate for short format binary insns" (m32c-isa)
2059 h-sint DFLT f-imm3-S
2060 ((parse "imm3_S")) () ()
2062 (define-full-operand Bit3-S "3 bit bit number" (m32c-isa)
2063 h-sint DFLT f-imm3-S
2064 ((parse "bit3_S")) () ()
2067 ;-------------------------------------------------------------
2069 ;-------------------------------------------------------------
2071 (define-full-operand Bitno16R "bit number for indexing registers" (m16c-isa)
2072 h-uint DFLT f-dsp-16-u8
2073 ((parse "Bitno16R")) () ()
2075 (dnop Bitno32Prefixed "bit number for indexing objects" (m32c-isa) h-uint f-bitno32-prefixed)
2076 (dnop Bitno32Unprefixed "bit number for indexing objects" (m32c-isa) h-uint f-bitno32-unprefixed)
2078 (define-full-operand BitBase16-16-u8 "unsigned bit,base:8 at offset 16for m16c" (m16c-isa)
2079 h-uint DFLT f-dsp-16-u8
2080 ((parse "unsigned_bitbase8") (print "unsigned_bitbase")) () ()
2082 (define-full-operand BitBase16-16-s8 "signed bit,base:8 at offset 16for m16c" (m16c-isa)
2083 h-sint DFLT f-dsp-16-s8
2084 ((parse "signed_bitbase8") (print "signed_bitbase")) () ()
2086 (define-full-operand BitBase16-16-u16 "unsigned bit,base:16 at offset 16 for m16c" (m16c-isa)
2087 h-uint DFLT f-dsp-16-u16
2088 ((parse "unsigned_bitbase16") (print "unsigned_bitbase")) () ()
2090 (define-full-operand BitBase16-8-u11-S "signed bit,base:11 at offset 16 for m16c" (m16c-isa)
2091 h-uint DFLT f-bitbase16-u11-S
2092 ((parse "unsigned_bitbase11") (print "unsigned_bitbase")) () ()
2095 (define-full-operand BitBase32-16-u11-Unprefixed "unsigned bit,base:11 at offset 16 for m32c" (m32c-isa)
2096 h-uint DFLT f-bitbase32-16-u11-unprefixed
2097 ((parse "unsigned_bitbase11") (print "unsigned_bitbase")) () ()
2099 (define-full-operand BitBase32-16-s11-Unprefixed "signed bit,base:11 at offset 16 for m32c" (m32c-isa)
2100 h-sint DFLT f-bitbase32-16-s11-unprefixed
2101 ((parse "signed_bitbase11") (print "signed_bitbase")) () ()
2103 (define-full-operand BitBase32-16-u19-Unprefixed "unsigned bit,base:19 at offset 16 for m32c" (m32c-isa)
2104 h-uint DFLT f-bitbase32-16-u19-unprefixed
2105 ((parse "unsigned_bitbase19") (print "unsigned_bitbase")) () ()
2107 (define-full-operand BitBase32-16-s19-Unprefixed "signed bit,base:19 at offset 16 for m32c" (m32c-isa)
2108 h-sint DFLT f-bitbase32-16-s19-unprefixed
2109 ((parse "signed_bitbase19") (print "signed_bitbase")) () ()
2111 (define-full-operand BitBase32-16-u27-Unprefixed "unsigned bit,base:27 at offset 16 for m32c" (m32c-isa)
2112 h-uint DFLT f-bitbase32-16-u27-unprefixed
2113 ((parse "unsigned_bitbase27") (print "unsigned_bitbase")) () ()
2115 (define-full-operand BitBase32-24-u11-Prefixed "unsigned bit,base:11 at offset 24 for m32c" (m32c-isa)
2116 h-uint DFLT f-bitbase32-24-u11-prefixed
2117 ((parse "unsigned_bitbase11") (print "unsigned_bitbase")) () ()
2119 (define-full-operand BitBase32-24-s11-Prefixed "signed bit,base:11 at offset 24 for m32c" (m32c-isa)
2120 h-sint DFLT f-bitbase32-24-s11-prefixed
2121 ((parse "signed_bitbase11") (print "signed_bitbase")) () ()
2123 (define-full-operand BitBase32-24-u19-Prefixed "unsigned bit,base:19 at offset 24 for m32c" (m32c-isa)
2124 h-uint DFLT f-bitbase32-24-u19-prefixed
2125 ((parse "unsigned_bitbase19") (print "unsigned_bitbase")) () ()
2127 (define-full-operand BitBase32-24-s19-Prefixed "signed bit,base:19 at offset 24 for m32c" (m32c-isa)
2128 h-sint DFLT f-bitbase32-24-s19-prefixed
2129 ((parse "signed_bitbase19") (print "signed_bitbase")) () ()
2131 (define-full-operand BitBase32-24-u27-Prefixed "unsigned bit,base:27 at offset 24 for m32c" (m32c-isa)
2132 h-uint DFLT f-bitbase32-24-u27-prefixed
2133 ((parse "unsigned_bitbase27") (print "unsigned_bitbase")) () ()
2135 ;-------------------------------------------------------------
2137 ;-------------------------------------------------------------
2139 (define-full-operand Lab-5-3 "3 bit label" (all-isas RELAX)
2140 h-iaddr DFLT f-lab-5-3
2141 ((parse "lab_5_3")) () () )
2143 (define-full-operand Lab32-jmp-s "3 bit label" (all-isas RELAX)
2144 h-iaddr DFLT f-lab32-jmp-s
2145 ((parse "lab_5_3")) () () )
2147 (dnop Lab-8-8 "8 bit label" (all-isas RELAX) h-iaddr f-lab-8-8)
2148 (dnop Lab-8-16 "16 bit label" (all-isas RELAX) h-iaddr f-lab-8-16)
2149 (dnop Lab-8-24 "24 bit label" (all-isas RELAX) h-iaddr f-lab-8-24)
2150 (dnop Lab-16-8 "8 bit label" (all-isas RELAX) h-iaddr f-lab-16-8)
2151 (dnop Lab-24-8 "8 bit label" (all-isas RELAX) h-iaddr f-lab-24-8)
2152 (dnop Lab-32-8 "8 bit label" (all-isas RELAX) h-iaddr f-lab-32-8)
2153 (dnop Lab-40-8 "8 bit label" (all-isas RELAX) h-iaddr f-lab-40-8)
2155 ;-------------------------------------------------------------
2156 ; Condition code bits
2157 ;-------------------------------------------------------------
2159 (dnop sbit "negative bit" (SEM-ONLY all-isas) h-sbit f-nil)
2160 (dnop obit "overflow bit" (SEM-ONLY all-isas) h-obit f-nil)
2161 (dnop zbit "zero bit" (SEM-ONLY all-isas) h-zbit f-nil)
2162 (dnop cbit "carry bit" (SEM-ONLY all-isas) h-cbit f-nil)
2163 (dnop ubit "stack ptr select bit" (SEM-ONLY all-isas) h-ubit f-nil)
2164 (dnop ibit "interrupt enable bit" (SEM-ONLY all-isas) h-ibit f-nil)
2165 (dnop bbit "reg bank select bit" (SEM-ONLY all-isas) h-bbit f-nil)
2166 (dnop dbit "debug bit" (SEM-ONLY all-isas) h-dbit f-nil)
2168 ;-------------------------------------------------------------
2169 ; Condition operands
2170 ;-------------------------------------------------------------
2172 (define-pmacro (cond-operand mach offset)
2173 (dnop (.sym cond mach - offset) "condition" ((.sym m mach c-isa)) (.sym h-cond mach) (.sym f-dsp- offset -u8))
2176 (cond-operand 16 16)
2177 (cond-operand 16 24)
2178 (cond-operand 16 32)
2179 (cond-operand 32 16)
2180 (cond-operand 32 24)
2181 (cond-operand 32 32)
2182 (cond-operand 32 40)
2184 (dnop cond16c "condition" (m16c-isa) h-cond16c f-cond16)
2185 (dnop cond16j "condition" (m16c-isa) h-cond16j f-cond16)
2186 (dnop cond16j5 "condition" (m16c-isa) h-cond16j-5 f-cond16j-5)
2187 (dnop cond32 "condition" (m32c-isa) h-cond32 f-cond32)
2188 (dnop cond32j "condition" (m32c-isa) h-cond32 f-cond32j)
2189 (dnop sccond32 "scCND condition" (m32c-isa) h-cond32 f-cond16)
2190 (dnop flags16 "flags" (m16c-isa) h-flags f-9-3)
2191 (dnop flags32 "flags" (m32c-isa) h-flags f-13-3)
2192 (dnop cr16 "control" (m16c-isa) h-cr-16 f-9-3)
2193 (dnop cr1-Unprefixed-32 "control" (m32c-isa) h-cr1-32 f-13-3)
2194 (dnop cr1-Prefixed-32 "control" (m32c-isa) h-cr1-32 f-21-3)
2195 (dnop cr2-32 "control" (m32c-isa) h-cr2-32 f-13-3)
2196 (dnop cr3-Unprefixed-32 "control" (m32c-isa) h-cr3-32 f-13-3)
2197 (dnop cr3-Prefixed-32 "control" (m32c-isa) h-cr3-32 f-21-3)
2199 ;-------------------------------------------------------------
2201 ;-------------------------------------------------------------
2203 (define-full-operand Z "Suffix for zero format insns" (all-isas)
2205 ((parse "Z") (print "Z")) () ()
2207 (define-full-operand S "Suffix for short format insns" (all-isas)
2209 ((parse "S") (print "S")) () ()
2211 (define-full-operand Q "Suffix for quick format insns" (all-isas)
2213 ((parse "Q") (print "Q")) () ()
2215 (define-full-operand G "Suffix for general format insns" (all-isas)
2217 ((parse "G") (print "G")) () ()
2219 (define-full-operand X "Empty suffix" (all-isas)
2221 ((parse "X") (print "X")) () ()
2223 (define-full-operand size "any size specifier" (all-isas)
2225 ((parse "size") (print "size")) () ()
2227 ;-------------------------------------------------------------
2229 ;-------------------------------------------------------------
2231 (dnop BitIndex "Bit Index for the next insn" (SEM-ONLY MACH32 m32c-isa) h-bit-index f-nil)
2232 (dnop SrcIndex "Source Index for the next insn" (SEM-ONLY MACH32 m32c-isa) h-src-index f-nil)
2233 (dnop DstIndex "Destination Index for the next insn" (SEM-ONLY MACH32 m32c-isa) h-dst-index f-nil)
2234 (dnop NoRemainder "Place holder for when the remainder is not kept" (SEM-ONLY MACH32 m32c-isa) h-none f-nil)
2236 ;=============================================================
2239 ; Memory reference macros that clip addresses appropriately. Refer to
2240 ; memory at ADDRESS in MODE, clipped appropriately for either the m16c
2242 (define-pmacro (mem16 mode address)
2243 (mem mode (and #xffff address)))
2245 (define-pmacro (mem20 mode address)
2246 (mem mode (and #xfffff address)))
2248 (define-pmacro (mem32 mode address)
2249 (mem mode (and #xffffff address)))
2251 ; Like mem16 and mem32, but takes MACH as a parameter. MACH must be
2253 (define-pmacro (mem-mach mach mode address)
2254 ((.sym mem mach) mode address))
2256 ;-------------------------------------------------------------
2258 ;-------------------------------------------------------------
2260 ;-------------------------------------------------------------
2262 (define-pmacro (src16-Rn-direct-operand xmode)
2264 (define-derived-operand
2265 (name (.sym src16-Rn-direct- xmode))
2266 (comment (.str "m16c Rn direct source " xmode))
2267 (attrs (machine 16))
2269 (args ((.sym Src16Rn xmode)))
2270 (syntax (.str "$Src16Rn" xmode))
2272 (encoding (+ (f-8-2 0) (.sym Src16Rn xmode)))
2273 (ifield-assertion (eq f-8-2 0))
2274 (getter (trunc xmode (.sym Src16Rn xmode)))
2275 (setter (set (.sym Src16Rn xmode) newval))
2279 (src16-Rn-direct-operand QI)
2280 (src16-Rn-direct-operand HI)
2282 (define-pmacro (src32-Rn-direct-operand group base xmode)
2284 (define-derived-operand
2285 (name (.sym src32-Rn-direct- group - xmode))
2286 (comment (.str "m32c Rn direct source " xmode))
2287 (attrs (machine 32))
2289 (args ((.sym Src32Rn group xmode)))
2290 (syntax (.str "$Src32Rn" group xmode))
2291 (base-ifield (.sym f- base -11))
2292 (encoding (+ ((.sym f- base -3) 4) (.sym Src32Rn group xmode)))
2293 (ifield-assertion (eq (.sym f- base -3) 4))
2294 (getter (trunc xmode (.sym Src32Rn group xmode)))
2295 (setter (set (.sym Src32Rn group xmode) newval))
2300 (src32-Rn-direct-operand Unprefixed 1 QI)
2301 (src32-Rn-direct-operand Prefixed 9 QI)
2302 (src32-Rn-direct-operand Unprefixed 1 HI)
2303 (src32-Rn-direct-operand Prefixed 9 HI)
2304 (src32-Rn-direct-operand Unprefixed 1 SI)
2305 (src32-Rn-direct-operand Prefixed 9 SI)
2307 ;-------------------------------------------------------------
2309 ;-------------------------------------------------------------
2311 (define-pmacro (src16-An-direct-operand xmode)
2313 (define-derived-operand
2314 (name (.sym src16-An-direct- xmode))
2315 (comment (.str "m16c An direct destination " xmode))
2316 (attrs (machine 16))
2318 (args ((.sym Src16An xmode)))
2319 (syntax (.str "$Src16An" xmode))
2321 (encoding (+ (f-8-2 1) (f-10-1 0) (.sym Src16An xmode)))
2322 (ifield-assertion (andif (eq f-8-2 1) (eq f-10-1 0)))
2323 (getter (trunc xmode (.sym Src16An xmode)))
2324 (setter (set (.sym Src16An xmode) newval))
2328 (src16-An-direct-operand QI)
2329 (src16-An-direct-operand HI)
2331 (define-pmacro (src32-An-direct-operand group base1 base2 xmode)
2333 (define-derived-operand
2334 (name (.sym src32-An-direct- group - xmode))
2335 (comment (.str "m32c An direct destination " xmode))
2336 (attrs (machine 32))
2338 (args ((.sym Src32An group xmode)))
2339 (syntax (.str "$Src32An" group xmode))
2340 (base-ifield (.sym f- base1 -11))
2341 (encoding (+ ((.sym f- base1 -3) 0) ((.sym f- base2 -1) 1) (.sym Src32An group xmode)))
2342 (ifield-assertion (andif (eq (.sym f- base1 -3) 0) (eq (.sym f- base2 -1) 1)))
2343 (getter (trunc xmode (.sym Src32An group xmode)))
2344 (setter (set (.sym Src32An group xmode) newval))
2349 (src32-An-direct-operand Unprefixed 1 10 QI)
2350 (src32-An-direct-operand Unprefixed 1 10 HI)
2351 (src32-An-direct-operand Unprefixed 1 10 SI)
2352 (src32-An-direct-operand Prefixed 9 18 QI)
2353 (src32-An-direct-operand Prefixed 9 18 HI)
2354 (src32-An-direct-operand Prefixed 9 18 SI)
2356 ;-------------------------------------------------------------
2358 ;-------------------------------------------------------------
2360 (define-pmacro (src16-An-indirect-operand xmode)
2362 (define-derived-operand
2363 (name (.sym src16-An-indirect- xmode))
2364 (comment (.str "m16c An indirect destination " xmode))
2365 (attrs (machine 16))
2368 (syntax "[$Src16An]")
2370 (encoding (+ (f-8-2 1) (f-10-1 1) Src16An))
2371 (ifield-assertion (andif (eq f-8-2 1) (eq f-10-1 1)))
2372 (getter (mem16 xmode Src16An))
2373 (setter (set (mem16 xmode Src16An) newval))
2377 (src16-An-indirect-operand QI)
2378 (src16-An-indirect-operand HI)
2380 (define-pmacro (src32-An-indirect-operand group base1 base2 xmode)
2382 (define-derived-operand
2383 (name (.sym src32-An-indirect- group - xmode))
2384 (comment (.str "m32c An indirect destination " xmode))
2385 (attrs (machine 32))
2387 (args ((.sym Src32An group)))
2388 (syntax (.str "[$Src32An" group "]"))
2389 (base-ifield (.sym f- base1 -11))
2390 (encoding (+ ((.sym f- base1 -3) 0) ((.sym f- base2 -1) 0) (.sym Src32An group)))
2391 (ifield-assertion (andif (eq (.sym f- base1 -3) 0) (eq (.sym f- base2 -1) 0)))
2392 (getter (c-call xmode (.str "operand_getter_" xmode) (.sym Src32An group)
2394 (setter (c-call DFLT (.str "operand_setter_" xmode) newval
2395 (.sym Src32An group) (const 0)))
2396 ; (getter (mem32 xmode (.sym Src32An group)))
2397 ; (setter (set (mem32 xmode (.sym Src32An group)) newval))
2402 (src32-An-indirect-operand Unprefixed 1 10 QI)
2403 (src32-An-indirect-operand Unprefixed 1 10 HI)
2404 (src32-An-indirect-operand Unprefixed 1 10 SI)
2405 (src32-An-indirect-operand Prefixed 9 18 QI)
2406 (src32-An-indirect-operand Prefixed 9 18 HI)
2407 (src32-An-indirect-operand Prefixed 9 18 SI)
2409 ;-------------------------------------------------------------
2411 ;-------------------------------------------------------------
2413 (define-pmacro (src16-relative-operand xmode)
2415 (define-derived-operand
2416 (name (.sym src16-16-8-SB-relative- xmode))
2417 (comment (.str "m16c dsp:8[sb] relative destination " xmode))
2418 (attrs (machine 16))
2421 (syntax "${Dsp-16-u8}[sb]")
2423 (encoding (+ (f-8-4 #xA) Dsp-16-u8))
2424 (ifield-assertion (eq f-8-4 #xA))
2425 (getter (mem16 xmode (add Dsp-16-u8 (reg h-sb))))
2426 (setter (set (mem16 xmode (add Dsp-16-u8 (reg h-sb))) newval))
2428 (define-derived-operand
2429 (name (.sym src16-16-16-SB-relative- xmode))
2430 (comment (.str "m16c dsp:16[sb] relative destination " xmode))
2431 (attrs (machine 16))
2434 (syntax "${Dsp-16-u16}[sb]")
2436 (encoding (+ (f-8-4 #xE) Dsp-16-u16))
2437 (ifield-assertion (eq f-8-4 #xE))
2438 (getter (mem16 xmode (add Dsp-16-u16 (reg h-sb))))
2439 (setter (set (mem16 xmode (add Dsp-16-u16 (reg h-sb))) newval))
2441 (define-derived-operand
2442 (name (.sym src16-16-8-FB-relative- xmode))
2443 (comment (.str "m16c dsp:8[fb] relative destination " xmode))
2444 (attrs (machine 16))
2447 (syntax "${Dsp-16-s8}[fb]")
2449 (encoding (+ (f-8-4 #xB) Dsp-16-s8))
2450 (ifield-assertion (eq f-8-4 #xB))
2451 (getter (mem16 xmode (add Dsp-16-s8 (reg h-fb))))
2452 (setter (set (mem16 xmode (add Dsp-16-s8 (reg h-fb))) newval))
2454 (define-derived-operand
2455 (name (.sym src16-16-8-An-relative- xmode))
2456 (comment (.str "m16c dsp:8[An] relative destination " xmode))
2457 (attrs (machine 16))
2459 (args (Src16An Dsp-16-u8))
2460 (syntax "${Dsp-16-u8}[$Src16An]")
2462 (encoding (+ (f-8-2 2) (f-10-1 0) Dsp-16-u8 Src16An))
2463 (ifield-assertion (andif (eq f-8-2 2) (eq f-10-1 0)))
2464 (getter (mem16 xmode (add Dsp-16-u8 Src16An)))
2465 (setter (set (mem16 xmode (add Dsp-16-u8 Src16An)) newval))
2467 (define-derived-operand
2468 (name (.sym src16-16-16-An-relative- xmode))
2469 (comment (.str "m16c dsp:16[An] relative destination " xmode))
2470 (attrs (machine 16))
2472 (args (Src16An Dsp-16-u16))
2473 (syntax "${Dsp-16-u16}[$Src16An]")
2475 (encoding (+ (f-8-2 3) (f-10-1 0) Dsp-16-u16 Src16An))
2476 (ifield-assertion (andif (eq f-8-2 3) (eq f-10-1 0)))
2477 (getter (mem16 xmode (add Dsp-16-u16 Src16An)))
2478 (setter (set (mem16 xmode (add Dsp-16-u16 Src16An)) newval))
2480 (define-derived-operand
2481 (name (.sym src16-16-20-An-relative- xmode))
2482 (comment (.str "m16c dsp:20[An] relative destination " xmode))
2483 (attrs (machine 16))
2485 (args (Src16An Dsp-16-u20))
2486 (syntax "${Dsp-16-u20}[$Src16An]")
2488 (encoding (+ (f-8-2 3) (f-10-1 0) Dsp-16-u20 Src16An))
2489 (ifield-assertion (andif (eq f-8-2 3) (eq f-10-1 0)))
2490 (getter (mem20 xmode (add Dsp-16-u20 Src16An)))
2491 (setter (set (mem20 xmode (add Dsp-16-u20 Src16An)) newval))
2496 (src16-relative-operand QI)
2497 (src16-relative-operand HI)
2499 (define-pmacro (src32-relative-operand offset group base1 base2 xmode)
2501 (define-derived-operand
2502 (name (.sym src32- offset -8-SB-relative- group - xmode))
2503 (comment (.str "m32c dsp:8[sb] relative destination " xmode))
2504 (attrs (machine 32))
2506 (args ((.sym Dsp- offset -u8)))
2507 (syntax (.str "${Dsp-" offset "-u8}[sb]"))
2508 (base-ifield (.sym f- base1 -11))
2509 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -2) 2) (.sym Dsp- offset -u8)))
2510 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -2) 2)))
2511 (getter (c-call xmode (.str "operand_getter_" xmode) sb (.sym Dsp- offset -u8)))
2512 (setter (c-call DFLT (.str "operand_setter_" xmode) newval sb (.sym Dsp- offset -u8)))
2513 ; (getter (mem32 xmode (add (.sym Dsp- offset -u8) (reg h-sb))))
2514 ; (setter (set (mem32 xmode (add (.sym Dsp- offset -u8) (reg h-sb))) newval))
2516 (define-derived-operand
2517 (name (.sym src32- offset -16-SB-relative- group - xmode))
2518 (comment (.str "m32c dsp:16[sb] relative destination " xmode))
2519 (attrs (machine 32))
2521 (args ((.sym Dsp- offset -u16)))
2522 (syntax (.str "${Dsp-" offset "-u16}[sb]"))
2523 (base-ifield (.sym f- base1 -11))
2524 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -2) 2) (.sym Dsp- offset -u16)))
2525 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -2) 2)))
2526 (getter (c-call xmode (.str "operand_getter_" xmode) sb (.sym Dsp- offset -u16)))
2527 (setter (c-call DFLT (.str "operand_setter_" xmode) newval sb (.sym Dsp- offset -u16)))
2528 ; (getter (mem32 xmode (add (.sym Dsp- offset -u16) (reg h-sb))))
2529 ; (setter (set (mem32 xmode (add (.sym Dsp- offset -u16) (reg h-sb))) newval))
2531 (define-derived-operand
2532 (name (.sym src32- offset -8-FB-relative- group - xmode))
2533 (comment (.str "m32c dsp:8[fb] relative destination " xmode))
2534 (attrs (machine 32))
2536 (args ((.sym Dsp- offset -s8)))
2537 (syntax (.str "${Dsp-" offset "-s8}[fb]"))
2538 (base-ifield (.sym f- base1 -11))
2539 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -2) 3) (.sym Dsp- offset -s8)))
2540 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -2) 3)))
2541 (getter (c-call xmode (.str "operand_getter_" xmode) fb (.sym Dsp- offset -s8)))
2542 (setter (c-call DFLT (.str "operand_setter_" xmode) newval fb (.sym Dsp- offset -s8)))
2543 ; (getter (mem32 xmode (add (.sym Dsp- offset -s8) (reg h-fb))))
2544 ; (setter (set (mem32 xmode (add (.sym Dsp- offset -s8) (reg h-fb))) newval))
2546 (define-derived-operand
2547 (name (.sym src32- offset -16-FB-relative- group - xmode))
2548 (comment (.str "m32c dsp:16[fb] relative destination " xmode))
2549 (attrs (machine 32))
2551 (args ((.sym Dsp- offset -s16)))
2552 (syntax (.str "${Dsp-" offset "-s16}[fb]"))
2553 (base-ifield (.sym f- base1 -11))
2554 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -2) 3) (.sym Dsp- offset -s16)))
2555 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -2) 3)))
2556 (getter (c-call xmode (.str "operand_getter_" xmode) fb (.sym Dsp- offset -s16)))
2557 (setter (c-call DFLT (.str "operand_setter_" xmode) newval fb (.sym Dsp- offset -s16)))
2558 ; (getter (mem32 xmode (add (.sym Dsp- offset -s16) (reg h-fb))))
2559 ; (setter (set (mem32 xmode (add (.sym Dsp- offset -s16) (reg h-fb))) newval))
2561 (define-derived-operand
2562 (name (.sym src32- offset -8-An-relative- group - xmode))
2563 (comment (.str "m32c dsp:8[An] relative destination " xmode))
2564 (attrs (machine 32))
2566 (args ((.sym Src32An group) (.sym Dsp- offset -u8)))
2567 (syntax (.str "${Dsp-" offset "-u8}[$Src32An" group "]"))
2568 (base-ifield (.sym f- base1 -11))
2569 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -1) 0) (.sym Dsp- offset -u8) (.sym Src32An group)))
2570 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -1) 0)))
2571 (getter (c-call xmode (.str "operand_getter_" xmode) (.sym Src32An group) (.sym Dsp- offset -u8)))
2572 (setter (c-call DFLT (.str "operand_setter_" xmode) newval (.sym Src32An group) (.sym Dsp- offset -u8)))
2573 ; (getter (mem32 xmode (add (.sym Dsp- offset -u8) (.sym Src32An group))))
2574 ; (setter (set (mem32 xmode (add (.sym Dsp- offset -u8) (.sym Src32An group))) newval))
2576 (define-derived-operand
2577 (name (.sym src32- offset -16-An-relative- group - xmode))
2578 (comment (.str "m32c dsp:16[An] relative destination " xmode))
2579 (attrs (machine 32))
2581 (args ((.sym Src32An group) (.sym Dsp- offset -u16)))
2582 (syntax (.str "${Dsp-" offset "-u16}[$Src32An" group "]"))
2583 (base-ifield (.sym f- base1 -11))
2584 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -1) 0) (.sym Dsp- offset -u16) (.sym Src32An group)))
2585 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -1) 0)))
2586 (getter (c-call xmode (.str "operand_getter_" xmode) (.sym Src32An group) (.sym Dsp- offset -u16)))
2587 (setter (c-call DFLT (.str "operand_setter_" xmode) newval (.sym Src32An group) (.sym Dsp- offset -u16)))
2588 ; (getter (mem32 xmode (add (.sym Dsp- offset -u16) (.sym Src32An group))))
2589 ; (setter (set (mem32 xmode (add (.sym Dsp- offset -u16) (.sym Src32An group))) newval))
2591 (define-derived-operand
2592 (name (.sym src32- offset -24-An-relative- group - xmode))
2593 (comment (.str "m32c dsp:16[An] relative destination " xmode))
2594 (attrs (machine 32))
2596 (args ((.sym Src32An group) (.sym Dsp- offset -u24)))
2597 (syntax (.str "${Dsp-" offset "-u24}[$Src32An" group "]"))
2598 (base-ifield (.sym f- base1 -11))
2599 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -1) 0) (.sym Dsp- offset -u24) (.sym Src32An group)))
2600 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -1) 0)))
2601 (getter (c-call xmode (.str "operand_getter_" xmode) (.sym Src32An group) (.sym Dsp- offset -u24) ))
2602 (setter (c-call DFLT (.str "operand_setter_" xmode) newval (.sym Src32An group) (.sym Dsp- offset -u24)))
2603 ; (getter (mem32 xmode (add (.sym Dsp- offset -u24) (.sym Src32An group))))
2604 ; (setter (set (mem32 xmode (add (.sym Dsp- offset -u24) (.sym Src32An group))) newval))
2609 (src32-relative-operand 16 Unprefixed 1 10 QI)
2610 (src32-relative-operand 16 Unprefixed 1 10 HI)
2611 (src32-relative-operand 16 Unprefixed 1 10 SI)
2612 (src32-relative-operand 24 Prefixed 9 18 QI)
2613 (src32-relative-operand 24 Prefixed 9 18 HI)
2614 (src32-relative-operand 24 Prefixed 9 18 SI)
2616 ;-------------------------------------------------------------
2618 ;-------------------------------------------------------------
2620 (define-pmacro (src16-absolute xmode)
2622 (define-derived-operand
2623 (name (.sym src16-16-16-absolute- xmode))
2624 (comment (.str "m16c absolute address " xmode))
2625 (attrs (machine 16))
2628 (syntax (.str "${Dsp-16-u16}"))
2630 (encoding (+ (f-8-4 #xF) Dsp-16-u16))
2631 (ifield-assertion (eq f-8-4 #xF))
2632 (getter (mem16 xmode Dsp-16-u16))
2633 (setter (set (mem16 xmode Dsp-16-u16) newval))
2641 (define-pmacro (src32-absolute offset group base1 base2 xmode)
2643 (define-derived-operand
2644 (name (.sym src32- offset -16-absolute- group - xmode))
2645 (comment (.str "m32c absolute address " xmode))
2646 (attrs (machine 32))
2648 (args ((.sym Dsp- offset -u16)))
2649 (syntax (.str "${Dsp-" offset "-u16}"))
2650 (base-ifield (.sym f- base1 -11))
2651 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -2) 3) (.sym Dsp- offset -u16)))
2652 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -2) 3)))
2653 (getter (c-call xmode (.str "operand_getter_" xmode) (const 0) (.sym Dsp- offset -u16)))
2654 (setter (c-call DFLT (.str "operand_setter_" xmode) newval (const 0) (.sym Dsp- offset -u16)))
2655 ; (getter (mem32 xmode (.sym Dsp- offset -u16)))
2656 ; (setter (set (mem32 xmode (.sym Dsp- offset -u16)) newval))
2658 (define-derived-operand
2659 (name (.sym src32- offset -24-absolute- group - xmode))
2660 (comment (.str "m32c absolute address " xmode))
2661 (attrs (machine 32))
2663 (args ((.sym Dsp- offset -u24)))
2664 (syntax (.str "${Dsp-" offset "-u24}"))
2665 (base-ifield (.sym f- base1 -11))
2666 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -2) 2) (.sym Dsp- offset -u24)))
2667 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -2) 2)))
2668 (getter (c-call xmode (.str "operand_getter_" xmode) (const 0) (.sym Dsp- offset -u24)))
2669 (setter (c-call DFLT (.str "operand_setter_" xmode) newval (const 0) (.sym Dsp- offset -u24)))
2670 ; (getter (mem32 xmode (.sym Dsp- offset -u24)))
2671 ; (setter (set (mem32 xmode (.sym Dsp- offset -u24)) newval))
2676 (src32-absolute 16 Unprefixed 1 10 QI)
2677 (src32-absolute 16 Unprefixed 1 10 HI)
2678 (src32-absolute 16 Unprefixed 1 10 SI)
2679 (src32-absolute 24 Prefixed 9 18 QI)
2680 (src32-absolute 24 Prefixed 9 18 HI)
2681 (src32-absolute 24 Prefixed 9 18 SI)
2683 ;-------------------------------------------------------------
2684 ; An indirect indirect
2686 ; Double indirect addressing uses the lower 3 bytes of the value stored
2687 ; at the address referenced by 'op' as the effective address.
2688 ;-------------------------------------------------------------
2690 (define-pmacro (indirect-addr op) (and USI (mem32 USI op) #x00ffffff))
2692 ; (define-pmacro (src-An-indirect-indirect-operand xmode)
2693 ; (define-derived-operand
2694 ; (name (.sym src32-An-indirect-indirect- xmode))
2695 ; (comment (.str "m32c An indirect indirect destination " xmode))
2696 ; (attrs (machine 32))
2698 ; (args (Src32AnPrefixed))
2699 ; (syntax (.str "[[$Src32AnPrefixed]]"))
2700 ; (base-ifield f-9-11)
2701 ; (encoding (+ (f-9-3 0) (f-18-1 0) Src32AnPrefixed))
2702 ; (ifield-assertion (andif (eq f-9-3 0) (eq f-18-1 0)))
2703 ; (getter (mem32 xmode (indirect-addr Src32AnPrefixed)))
2704 ; (setter (set (mem32 xmode (indirect-addr Src32AnPrefixed)) newval))
2708 ; (src-An-indirect-indirect-operand QI)
2709 ; (src-An-indirect-indirect-operand HI)
2710 ; (src-An-indirect-indirect-operand SI)
2712 ;-------------------------------------------------------------
2714 ;-------------------------------------------------------------
2716 (define-pmacro (src-relative-indirect-operand xmode)
2718 ; (define-derived-operand
2719 ; (name (.sym src32-24-8-SB-relative-indirect- xmode))
2720 ; (comment (.str "m32c dsp:8[sb] relative source " xmode))
2721 ; (attrs (machine 32))
2723 ; (args (Dsp-24-u8))
2724 ; (syntax "[${Dsp-24-u8}[sb]]")
2725 ; (base-ifield f-9-11)
2726 ; (encoding (+ (f-9-3 1) (f-18-2 2) Dsp-24-u8))
2727 ; (ifield-assertion (andif (eq f-9-3 1) (eq f-18-2 2)))
2728 ; (getter (mem32 xmode (indirect-addr (add Dsp-24-u8 (reg h-sb)))))
2729 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-24-u8 (reg h-sb)))) newval))
2731 ; (define-derived-operand
2732 ; (name (.sym src32-24-16-SB-relative-indirect- xmode))
2733 ; (comment (.str "m32c dsp:16[sb] relative source " xmode))
2734 ; (attrs (machine 32))
2736 ; (args (Dsp-24-u16))
2737 ; (syntax "[${Dsp-24-u16}[sb]]")
2738 ; (base-ifield f-9-11)
2739 ; (encoding (+ (f-9-3 2) (f-18-2 2) Dsp-24-u16))
2740 ; (ifield-assertion (andif (eq f-9-3 2) (eq f-18-2 2)))
2741 ; (getter (mem32 xmode (indirect-addr (add Dsp-24-u16 (reg h-sb)))))
2742 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-24-u16 (reg h-sb)))) newval))
2744 ; (define-derived-operand
2745 ; (name (.sym src32-24-8-FB-relative-indirect- xmode))
2746 ; (comment (.str "m32c dsp:8[fb] relative source " xmode))
2747 ; (attrs (machine 32))
2749 ; (args (Dsp-24-s8))
2750 ; (syntax "[${Dsp-24-s8}[fb]]")
2751 ; (base-ifield f-9-11)
2752 ; (encoding (+ (f-9-3 1) (f-18-2 3) Dsp-24-s8))
2753 ; (ifield-assertion (andif (eq f-9-3 1) (eq f-18-2 3)))
2754 ; (getter (mem32 xmode (indirect-addr (add Dsp-24-s8 (reg h-fb)))))
2755 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-24-s8 (reg h-fb)))) newval))
2757 ; (define-derived-operand
2758 ; (name (.sym src32-24-16-FB-relative-indirect- xmode))
2759 ; (comment (.str "m32c dsp:16[fb] relative source " xmode))
2760 ; (attrs (machine 32))
2762 ; (args (Dsp-24-s16))
2763 ; (syntax "[${Dsp-24-s16}[fb]]")
2764 ; (base-ifield f-9-11)
2765 ; (encoding (+ (f-9-3 2) (f-18-2 3) Dsp-24-s16))
2766 ; (ifield-assertion (andif (eq f-9-3 2) (eq f-18-2 3)))
2767 ; (getter (mem32 xmode (indirect-addr (add Dsp-24-s16 (reg h-fb)))))
2768 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-24-s16 (reg h-fb)))) newval))
2770 ; (define-derived-operand
2771 ; (name (.sym src32-24-8-An-relative-indirect- xmode))
2772 ; (comment (.str "m32c dsp:8[An] relative indirect source " xmode))
2773 ; (attrs (machine 32))
2775 ; (args (Src32AnPrefixed Dsp-24-u8))
2776 ; (syntax "[${Dsp-24-u8}[$Src32AnPrefixed]]")
2777 ; (base-ifield f-9-11)
2778 ; (encoding (+ (f-9-3 1) (f-18-1 0) Dsp-24-u8 Src32AnPrefixed))
2779 ; (ifield-assertion (andif (eq f-9-3 1) (eq f-18-1 0)))
2780 ; (getter (mem32 xmode (indirect-addr (add Dsp-24-u8 Src32AnPrefixed))))
2781 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-24-u8 Src32AnPrefixed))) newval))
2783 ; (define-derived-operand
2784 ; (name (.sym src32-24-16-An-relative-indirect- xmode))
2785 ; (comment (.str "m32c dsp:16[An] relative source " xmode))
2786 ; (attrs (machine 32))
2788 ; (args (Src32AnPrefixed Dsp-24-u16))
2789 ; (syntax "[${Dsp-24-u16}[$Src32AnPrefixed]]")
2790 ; (base-ifield f-9-11)
2791 ; (encoding (+ (f-9-3 2) (f-18-1 0) Dsp-24-u16 Src32AnPrefixed))
2792 ; (ifield-assertion (andif (eq f-9-3 2) (eq f-18-1 0)))
2793 ; (getter (mem32 xmode (indirect-addr (add Dsp-24-u16 Src32AnPrefixed))))
2794 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-24-u16 Src32AnPrefixed))) newval))
2796 ; (define-derived-operand
2797 ; (name (.sym src32-24-24-An-relative-indirect- xmode))
2798 ; (comment (.str "m32c dsp:24[An] relative source " xmode))
2799 ; (attrs (machine 32))
2801 ; (args (Src32AnPrefixed Dsp-24-u24))
2802 ; (syntax "[${Dsp-24-u24}[$Src32AnPrefixed]]")
2803 ; (base-ifield f-9-11)
2804 ; (encoding (+ (f-9-3 3) (f-18-1 0) Dsp-24-u24 Src32AnPrefixed))
2805 ; (ifield-assertion (andif (eq f-9-3 3) (eq f-18-1 0)))
2806 ; (getter (mem32 xmode (indirect-addr (add Dsp-24-u24 Src32AnPrefixed))))
2807 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-24-u24 Src32AnPrefixed))) newval))
2812 ; (src-relative-indirect-operand QI)
2813 ; (src-relative-indirect-operand HI)
2814 ; (src-relative-indirect-operand SI)
2816 ;-------------------------------------------------------------
2817 ; Absolute Indirect address
2818 ;-------------------------------------------------------------
2820 (define-pmacro (src32-absolute-indirect offset base1 base2 xmode)
2822 ; (define-derived-operand
2823 ; (name (.sym src32- offset -16-absolute-indirect-derived- xmode))
2824 ; (comment (.str "m32c absolute indirect address " xmode))
2825 ; (attrs (machine 32))
2827 ; (args ((.sym Dsp- offset -u16)))
2828 ; (syntax (.str "[${Dsp-" offset "-u16}]"))
2829 ; (base-ifield (.sym f- base1 -11))
2830 ; (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -2) 3) (.sym Dsp- offset -u16)))
2831 ; (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -2) 3)))
2832 ; (getter (mem32 xmode (indirect-addr (.sym Dsp- offset -u16))))
2833 ; (setter (set (mem32 xmode (indirect-addr (.sym Dsp- offset -u16))) newval))
2835 ; (define-derived-operand
2836 ; (name (.sym src32- offset -24-absolute-indirect-derived- xmode))
2837 ; (comment (.str "m32c absolute indirect address " xmode))
2838 ; (attrs (machine 32))
2840 ; (args ((.sym Dsp- offset -u24)))
2841 ; (syntax (.str "[${Dsp-" offset "-u24}]"))
2842 ; (base-ifield (.sym f- base1 -11))
2843 ; (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -2) 2) (.sym Dsp- offset -u24)))
2844 ; (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -2) 2)))
2845 ; (getter (mem32 xmode (indirect-addr (.sym Dsp- offset -u24))))
2846 ; (setter (set (mem32 xmode (indirect-addr (.sym Dsp- offset -u24))) newval))
2851 (src32-absolute-indirect 24 9 18 QI)
2852 (src32-absolute-indirect 24 9 18 HI)
2853 (src32-absolute-indirect 24 9 18 SI)
2855 ;-------------------------------------------------------------
2856 ; Register relative source operands for short format insns
2857 ;-------------------------------------------------------------
2859 (define-pmacro (src-2-S-operands mach xmode base opc1 opc2 opc3)
2861 (define-derived-operand
2862 (name (.sym src mach -2-S-8-SB-relative- xmode))
2863 (comment (.str "m" mach "c SB relative address"))
2864 (attrs (machine mach))
2867 (syntax "${Dsp-8-u8}[sb]")
2868 (base-ifield (.sym f- base -2))
2869 (encoding (+ ((.sym f- base -2) opc1) Dsp-8-u8))
2870 (ifield-assertion (eq (.sym f- base -2) opc1))
2871 (getter (c-call xmode (.str "operand_getter_" xmode) sb Dsp-8-u8))
2872 (setter (c-call DFLT (.str "operand_setter_" xmode) newval sb Dsp-8-u8))
2873 ; (getter (mem-mach mach xmode (indirect-addr (add (reg h-sb) Dsp-8-u8))))
2874 ; (setter (set (mem-mach mach xmode (indirect-addr (add (reg h-sb) Dsp-8-u8))) newval))
2876 (define-derived-operand
2877 (name (.sym src mach -2-S-8-FB-relative- xmode))
2878 (comment (.str "m" mach "c FB relative address"))
2879 (attrs (machine mach))
2882 (syntax "${Dsp-8-s8}[fb]")
2883 (base-ifield (.sym f- base -2))
2884 (encoding (+ ((.sym f- base -2) opc2) Dsp-8-s8))
2885 (ifield-assertion (eq (.sym f- base -2) opc2))
2886 (getter (c-call xmode (.str "operand_getter_" xmode) fb Dsp-8-s8))
2887 (setter (c-call DFLT (.str "operand_setter_" xmode) newval fb Dsp-8-s8))
2888 ; (getter (mem-mach mach xmode (indirect-addr (add (reg h-fb) Dsp-8-s8))))
2889 ; (setter (set (mem-mach mach xmode (indirect-addr (add (reg h-fb) Dsp-8-s8))) newval))
2891 (define-derived-operand
2892 (name (.sym src mach -2-S-16-absolute- xmode))
2893 (comment (.str "m" mach "c absolute address"))
2894 (attrs (machine mach))
2897 (syntax "${Dsp-8-u16}")
2898 (base-ifield (.sym f- base -2))
2899 (encoding (+ ((.sym f- base -2) opc3) Dsp-8-u16))
2900 (ifield-assertion (eq (.sym f- base -2) opc3))
2901 (getter (c-call xmode (.str "operand_getter_" xmode) (const 0) Dsp-8-u16))
2902 (setter (c-call DFLT (.str "operand_setter_" xmode) newval (const 0) Dsp-8-u16))
2903 ; (getter (mem-mach mach xmode Dsp-8-u16))
2904 ; (setter (set (mem-mach mach xmode Dsp-8-u16) newval))
2909 (src-2-S-operands 16 QI 6 1 2 3)
2910 (src-2-S-operands 32 QI 2 2 3 1)
2911 (src-2-S-operands 32 HI 2 2 3 1)
2913 ;=============================================================
2915 ;-------------------------------------------------------------
2917 ;-------------------------------------------------------------
2919 ;-------------------------------------------------------------
2921 (define-pmacro (dst16-Rn-direct-operand xmode)
2923 (define-derived-operand
2924 (name (.sym dst16-Rn-direct- xmode))
2925 (comment (.str "m16c Rn direct destination " xmode))
2926 (attrs (machine 16))
2928 (args ((.sym Dst16Rn xmode)))
2929 (syntax (.str "$Dst16Rn" xmode))
2930 (base-ifield f-12-4)
2931 (encoding (+ (f-12-2 0) (.sym Dst16Rn xmode)))
2932 (ifield-assertion (eq f-12-2 0))
2933 (getter (trunc xmode (.sym Dst16Rn xmode)))
2934 (setter (set (.sym Dst16Rn xmode) newval))
2939 (dst16-Rn-direct-operand QI)
2940 (dst16-Rn-direct-operand HI)
2941 (dst16-Rn-direct-operand SI)
2943 (define-derived-operand
2944 (name dst16-Rn-direct-Ext-QI)
2945 (comment "m16c Rn direct destination QI")
2946 (attrs (machine 16))
2948 (args (Dst16RnExtQI))
2949 (syntax "$Dst16RnExtQI")
2950 (base-ifield f-12-4)
2951 (encoding (+ (f-12-2 0) Dst16RnExtQI (f-15-1 0)))
2952 (ifield-assertion (andif (eq f-12-2 0) (eq f-15-1 0)))
2953 (getter (trunc QI (.sym Dst16RnExtQI)))
2954 (setter (set Dst16RnExtQI newval))
2957 (define-pmacro (dst32-Rn-direct-operand group base xmode)
2959 (define-derived-operand
2960 (name (.sym dst32-Rn-direct- group - xmode))
2961 (comment (.str "m32c Rn direct destination " xmode))
2962 (attrs (machine 32))
2964 (args ((.sym Dst32Rn group xmode)))
2965 (syntax (.str "$Dst32Rn" group xmode))
2966 (base-ifield (.sym f- base -6))
2967 (encoding (+ ((.sym f- base -3) 4) (.sym Dst32Rn group xmode)))
2968 (ifield-assertion (eq (.sym f- base -3) 4))
2969 (getter (trunc xmode (.sym Dst32Rn group xmode)))
2970 (setter (set (.sym Dst32Rn group xmode) newval))
2975 (dst32-Rn-direct-operand Unprefixed 4 QI)
2976 (dst32-Rn-direct-operand Prefixed 12 QI)
2977 (dst32-Rn-direct-operand Unprefixed 4 HI)
2978 (dst32-Rn-direct-operand Prefixed 12 HI)
2979 (dst32-Rn-direct-operand Unprefixed 4 SI)
2980 (dst32-Rn-direct-operand Prefixed 12 SI)
2982 (define-pmacro (dst32-Rn-direct-Ext-operand group base1 base2 smode dmode)
2984 (define-derived-operand
2985 (name (.sym dst32-Rn-direct- group - smode))
2986 (comment (.str "m32c Rn direct destination " smode))
2987 (attrs (machine 32))
2989 (args ((.sym Dst32Rn group smode)))
2990 (syntax (.str "$Dst32Rn" group smode))
2991 (base-ifield (.sym f- base1 -6))
2992 (encoding (+ ((.sym f- base1 -3) 4) ((.sym f- base2 -1) 1) (.sym Dst32Rn group smode)))
2993 (ifield-assertion (andif (eq (.sym f- base1 -3) 4) (eq (.sym f- base2 -1) 1)))
2994 (getter (trunc smode (.sym Dst32Rn group smode)))
2995 (setter (set (.sym Dst32Rn group smode) newval))
3000 (dst32-Rn-direct-Ext-operand ExtUnprefixed 4 8 QI HI)
3001 (dst32-Rn-direct-Ext-operand ExtUnprefixed 4 8 HI SI)
3003 (define-derived-operand
3004 (name dst32-R3-direct-Unprefixed-HI)
3005 (comment "m32c R3 direct HI")
3006 (attrs (machine 32))
3011 (encoding (+ (f-4-3 4) (f-8-2 #x1)))
3012 (ifield-assertion (andif (eq f-4-3 4) (eq f-8-2 #x1)))
3013 (getter (trunc HI R3))
3014 (setter (set R3 newval))
3016 ;-------------------------------------------------------------
3018 ;-------------------------------------------------------------
3020 (define-pmacro (dst16-An-direct-operand xmode)
3022 (define-derived-operand
3023 (name (.sym dst16-An-direct- xmode))
3024 (comment (.str "m16c An direct destination " xmode))
3025 (attrs (machine 16))
3027 (args ((.sym Dst16An xmode)))
3028 (syntax (.str "$Dst16An" xmode))
3029 (base-ifield f-12-4)
3030 (encoding (+ (f-12-2 1) (f-14-1 0) (.sym Dst16An xmode)))
3031 (ifield-assertion (andif (eq f-12-2 1) (eq f-14-1 0)))
3032 (getter (trunc xmode (.sym Dst16An xmode)))
3033 (setter (set (.sym Dst16An xmode) newval))
3038 (dst16-An-direct-operand QI)
3039 (dst16-An-direct-operand HI)
3040 (dst16-An-direct-operand SI)
3042 (define-pmacro (dst32-An-direct-operand group base1 base2 xmode)
3044 (define-derived-operand
3045 (name (.sym dst32-An-direct- group - xmode))
3046 (comment (.str "m32c An direct destination " xmode))
3047 (attrs (machine 32))
3049 (args ((.sym Dst32An group xmode)))
3050 (syntax (.str "$Dst32An" group xmode))
3051 (base-ifield (.sym f- base1 -6))
3052 (encoding (+ ((.sym f- base1 -3) 0) ((.sym f- base2 -1) 1) (.sym Dst32An group xmode)))
3053 (ifield-assertion (andif (eq (.sym f- base1 -3) 0) (eq (.sym f- base2 -1) 1)))
3054 (getter (trunc xmode (.sym Dst32An group xmode)))
3055 (setter (set (.sym Dst32An group xmode) newval))
3060 (dst32-An-direct-operand Unprefixed 4 8 QI)
3061 (dst32-An-direct-operand Prefixed 12 16 QI)
3062 (dst32-An-direct-operand Unprefixed 4 8 HI)
3063 (dst32-An-direct-operand Prefixed 12 16 HI)
3064 (dst32-An-direct-operand Unprefixed 4 8 SI)
3065 (dst32-An-direct-operand Prefixed 12 16 SI)
3067 ;-------------------------------------------------------------
3069 ;-------------------------------------------------------------
3071 (define-pmacro (dst16-An-indirect-operand xmode)
3073 (define-derived-operand
3074 (name (.sym dst16-An-indirect- xmode))
3075 (comment (.str "m16c An indirect destination " xmode))
3076 (attrs (machine 16))
3079 (syntax "[$Dst16An]")
3080 (base-ifield f-12-4)
3081 (encoding (+ (f-12-2 1) (f-14-1 1) Dst16An))
3082 (ifield-assertion (andif (eq f-12-2 1) (eq f-14-1 1)))
3083 (getter (mem16 xmode Dst16An))
3084 (setter (set (mem16 xmode Dst16An) newval))
3089 (dst16-An-indirect-operand QI)
3090 (dst16-An-indirect-operand HI)
3091 (dst16-An-indirect-operand SI)
3093 (define-derived-operand
3094 (name dst16-An-indirect-Ext-QI)
3095 (comment "m16c An indirect destination QI")
3096 (attrs (machine 16))
3099 (syntax "[$Dst16An]")
3100 (base-ifield f-12-4)
3101 (encoding (+ (f-12-2 1) (f-14-1 1) Dst16An))
3102 (ifield-assertion (andif (eq f-12-2 1) (eq f-14-1 1)))
3103 (getter (mem16 QI Dst16An))
3104 (setter (set (mem16 HI Dst16An) newval))
3107 (define-pmacro (dst32-An-indirect-operand group base1 base2 smode dmode)
3109 (define-derived-operand
3110 (name (.sym dst32-An-indirect- group - smode))
3111 (comment (.str "m32c An indirect destination " smode))
3112 (attrs (machine 32))
3114 (args ((.sym Dst32An group)))
3115 (syntax (.str "[$Dst32An" group "]"))
3116 (base-ifield (.sym f- base1 -6))
3117 (encoding (+ ((.sym f- base1 -3) 0) ((.sym f- base2 -1) 0) (.sym Dst32An group)))
3118 (ifield-assertion (andif (eq (.sym f- base1 -3) 0) (eq (.sym f- base2 -1) 0)))
3119 (getter (c-call dmode (.str "operand_getter_" dmode) (.sym Dst32An group)
3121 (setter (c-call DFLT (.str "operand_setter_" dmode) newval
3122 (.sym Dst32An group) (const 0)))
3123 ; (getter (mem32 smode (.sym Dst32An group)))
3124 ; (setter (set (mem32 dmode (.sym Dst32An group)) newval))
3129 (dst32-An-indirect-operand Unprefixed 4 8 QI QI)
3130 (dst32-An-indirect-operand Prefixed 12 16 QI QI)
3131 (dst32-An-indirect-operand Unprefixed 4 8 HI HI)
3132 (dst32-An-indirect-operand Prefixed 12 16 HI HI)
3133 (dst32-An-indirect-operand Unprefixed 4 8 SI SI)
3134 (dst32-An-indirect-operand Prefixed 12 16 SI SI)
3135 (dst32-An-indirect-operand ExtUnprefixed 4 8 QI HI)
3136 (dst32-An-indirect-operand ExtUnprefixed 4 8 HI SI)
3138 ;-------------------------------------------------------------
3140 ;-------------------------------------------------------------
3142 (define-pmacro (dst16-relative-operand offset xmode)
3144 (define-derived-operand
3145 (name (.sym dst16- offset -8-SB-relative- xmode))
3146 (comment (.str "m16c dsp:8[sb] relative destination " xmode))
3147 (attrs (machine 16))
3149 (args ((.sym Dsp- offset -u8)))
3150 (syntax (.str "${Dsp-" offset "-u8}[sb]"))
3151 (base-ifield f-12-4)
3152 (encoding (+ (f-12-4 #xA) (.sym Dsp- offset -u8)))
3153 (ifield-assertion (eq f-12-4 #xA))
3154 (getter (mem16 xmode (add (.sym Dsp- offset -u8) (reg h-sb))))
3155 (setter (set (mem16 xmode (add (.sym Dsp- offset -u8) (reg h-sb))) newval))
3157 (define-derived-operand
3158 (name (.sym dst16- offset -16-SB-relative- xmode))
3159 (comment (.str "m16c dsp:16[sb] relative destination " xmode))
3160 (attrs (machine 16))
3162 (args ((.sym Dsp- offset -u16)))
3163 (syntax (.str "${Dsp-" offset "-u16}[sb]"))
3164 (base-ifield f-12-4)
3165 (encoding (+ (f-12-4 #xE) (.sym Dsp- offset -u16)))
3166 (ifield-assertion (eq f-12-4 #xE))
3167 (getter (mem16 xmode (add (.sym Dsp- offset -u16) (reg h-sb))))
3168 (setter (set (mem16 xmode (add (.sym Dsp- offset -u16) (reg h-sb))) newval))
3170 (define-derived-operand
3171 (name (.sym dst16- offset -8-FB-relative- xmode))
3172 (comment (.str "m16c dsp:8[fb] relative destination " xmode))
3173 (attrs (machine 16))
3175 (args ((.sym Dsp- offset -s8)))
3176 (syntax (.str "${Dsp-" offset "-s8}[fb]"))
3177 (base-ifield f-12-4)
3178 (encoding (+ (f-12-4 #xB) (.sym Dsp- offset -s8)))
3179 (ifield-assertion (eq f-12-4 #xB))
3180 (getter (mem16 xmode (add (.sym Dsp- offset -s8) (reg h-fb))))
3181 (setter (set (mem16 xmode (add (.sym Dsp- offset -s8) (reg h-fb))) newval))
3183 (define-derived-operand
3184 (name (.sym dst16- offset -8-An-relative- xmode))
3185 (comment (.str "m16c dsp:8[An] relative destination " xmode))
3186 (attrs (machine 16))
3188 (args (Dst16An (.sym Dsp- offset -u8)))
3189 (syntax (.str "${Dsp-" offset "-u8}[$Dst16An]"))
3190 (base-ifield f-12-4)
3191 (encoding (+ (f-12-2 2) (f-14-1 0) (.sym Dsp- offset -u8) Dst16An))
3192 (ifield-assertion (andif (eq f-12-2 2) (eq f-14-1 0)))
3193 (getter (mem16 xmode (add (.sym Dsp- offset -u8) Dst16An)))
3194 (setter (set (mem16 xmode (add (.sym Dsp- offset -u8) Dst16An)) newval))
3196 (define-derived-operand
3197 (name (.sym dst16- offset -16-An-relative- xmode))
3198 (comment (.str "m16c dsp:16[An] relative destination " xmode))
3199 (attrs (machine 16))
3201 (args (Dst16An (.sym Dsp- offset -u16)))
3202 (syntax (.str "${Dsp-" offset "-u16}[$Dst16An]"))
3203 (base-ifield f-12-4)
3204 (encoding (+ (f-12-2 3) (f-14-1 0) (.sym Dsp- offset -u16) Dst16An))
3205 (ifield-assertion (andif (eq f-12-2 3) (eq f-14-1 0)))
3206 (getter (mem16 xmode (add (.sym Dsp- offset -u16) Dst16An)))
3207 (setter (set (mem16 xmode (add (.sym Dsp- offset -u16) Dst16An)) newval))
3209 (define-derived-operand
3210 (name (.sym dst16- offset -20-An-relative- xmode))
3211 (comment (.str "m16c dsp:20[An] relative destination " xmode))
3212 (attrs (machine 16))
3214 (args (Dst16An (.sym Dsp- offset -u20)))
3215 (syntax (.str "${Dsp-" offset "-u20}[$Dst16An]"))
3216 (base-ifield f-12-4)
3217 (encoding (+ (f-12-2 3) (f-14-1 0) (.sym Dsp- offset -u20) Dst16An))
3218 (ifield-assertion (andif (eq f-12-2 3) (eq f-14-1 0)))
3219 (getter (mem16 xmode (add (.sym Dsp- offset -u20) Dst16An)))
3220 (setter (set (mem16 xmode (add (.sym Dsp- offset -u20) Dst16An)) newval))
3225 (dst16-relative-operand 16 QI)
3226 (dst16-relative-operand 24 QI)
3227 (dst16-relative-operand 32 QI)
3228 (dst16-relative-operand 40 QI)
3229 (dst16-relative-operand 48 QI)
3230 (dst16-relative-operand 16 HI)
3231 (dst16-relative-operand 24 HI)
3232 (dst16-relative-operand 32 HI)
3233 (dst16-relative-operand 40 HI)
3234 (dst16-relative-operand 48 HI)
3235 (dst16-relative-operand 16 SI)
3236 (dst16-relative-operand 24 SI)
3237 (dst16-relative-operand 32 SI)
3238 (dst16-relative-operand 40 SI)
3239 (dst16-relative-operand 48 SI)
3241 (define-pmacro (dst16-relative-Ext-operand offset smode dmode)
3243 (define-derived-operand
3244 (name (.sym dst16- offset -8-SB-relative-Ext- smode))
3245 (comment (.str "m16c dsp:8[sb] relative destination " smode))
3246 (attrs (machine 16))
3248 (args ((.sym Dsp- offset -u8)))
3249 (syntax (.str "${Dsp-" offset "-u8}[sb]"))
3250 (base-ifield f-12-4)
3251 (encoding (+ (f-12-4 #xA) (.sym Dsp- offset -u8)))
3252 (ifield-assertion (eq f-12-4 #xA))
3253 (getter (mem16 smode (add (.sym Dsp- offset -u8) (reg h-sb))))
3254 (setter (set (mem16 dmode (add (.sym Dsp- offset -u8) (reg h-sb))) newval))
3256 (define-derived-operand
3257 (name (.sym dst16- offset -16-SB-relative-Ext- smode))
3258 (comment (.str "m16c dsp:16[sb] relative destination " smode))
3259 (attrs (machine 16))
3261 (args ((.sym Dsp- offset -u16)))
3262 (syntax (.str "${Dsp-" offset "-u16}[sb]"))
3263 (base-ifield f-12-4)
3264 (encoding (+ (f-12-4 #xE) (.sym Dsp- offset -u16)))
3265 (ifield-assertion (eq f-12-4 #xE))
3266 (getter (mem16 smode (add (.sym Dsp- offset -u16) (reg h-sb))))
3267 (setter (set (mem16 dmode (add (.sym Dsp- offset -u16) (reg h-sb))) newval))
3269 (define-derived-operand
3270 (name (.sym dst16- offset -8-FB-relative-Ext- smode))
3271 (comment (.str "m16c dsp:8[fb] relative destination " smode))
3272 (attrs (machine 16))
3274 (args ((.sym Dsp- offset -s8)))
3275 (syntax (.str "${Dsp-" offset "-s8}[fb]"))
3276 (base-ifield f-12-4)
3277 (encoding (+ (f-12-4 #xB) (.sym Dsp- offset -s8)))
3278 (ifield-assertion (eq f-12-4 #xB))
3279 (getter (mem16 smode (add (.sym Dsp- offset -s8) (reg h-fb))))
3280 (setter (set (mem16 dmode (add (.sym Dsp- offset -s8) (reg h-fb))) newval))
3282 (define-derived-operand
3283 (name (.sym dst16- offset -8-An-relative-Ext- smode))
3284 (comment (.str "m16c dsp:8[An] relative destination " smode))
3285 (attrs (machine 16))
3287 (args (Dst16An (.sym Dsp- offset -u8)))
3288 (syntax (.str "${Dsp-" offset "-u8}[$Dst16An]"))
3289 (base-ifield f-12-4)
3290 (encoding (+ (f-12-2 2) (f-14-1 0) (.sym Dsp- offset -u8) Dst16An))
3291 (ifield-assertion (andif (eq f-12-2 2) (eq f-14-1 0)))
3292 (getter (mem16 smode (add (.sym Dsp- offset -u8) Dst16An)))
3293 (setter (set (mem16 dmode (add (.sym Dsp- offset -u8) Dst16An)) newval))
3295 (define-derived-operand
3296 (name (.sym dst16- offset -16-An-relative-Ext- smode))
3297 (comment (.str "m16c dsp:16[An] relative destination " smode))
3298 (attrs (machine 16))
3300 (args (Dst16An (.sym Dsp- offset -u16)))
3301 (syntax (.str "${Dsp-" offset "-u16}[$Dst16An]"))
3302 (base-ifield f-12-4)
3303 (encoding (+ (f-12-2 3) (f-14-1 0) (.sym Dsp- offset -u16) Dst16An))
3304 (ifield-assertion (andif (eq f-12-2 3) (eq f-14-1 0)))
3305 (getter (mem16 smode (add (.sym Dsp- offset -u16) Dst16An)))
3306 (setter (set (mem16 dmode (add (.sym Dsp- offset -u16) Dst16An)) newval))
3311 (dst16-relative-Ext-operand 16 QI HI)
3313 (define-pmacro (dst32-relative-operand offset group base1 base2 smode dmode)
3315 (define-derived-operand
3316 (name (.sym dst32- offset -8-SB-relative- group - smode))
3317 (comment (.str "m32c dsp:8[sb] relative destination " smode))
3318 (attrs (machine 32))
3320 (args ((.sym Dsp- offset -u8)))
3321 (syntax (.str "${Dsp-" offset "-u8}[sb]"))
3322 (base-ifield (.sym f- base1 -6))
3323 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -2) 2) (.sym Dsp- offset -u8)))
3324 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -2) 2)))
3325 (getter (c-call dmode (.str "operand_getter_" dmode) sb (.sym Dsp- offset -u8)))
3326 (setter (c-call DFLT (.str "operand_setter_" dmode) newval sb (.sym Dsp- offset -u8)))
3327 ; (getter (mem32 smode (add (.sym Dsp- offset -u8) (reg h-sb))))
3328 ; (setter (set (mem32 dmode (add (.sym Dsp- offset -u8) (reg h-sb))) newval))
3330 (define-derived-operand
3331 (name (.sym dst32- offset -16-SB-relative- group - smode))
3332 (comment (.str "m32c dsp:16[sb] relative destination " smode))
3333 (attrs (machine 32))
3335 (args ((.sym Dsp- offset -u16)))
3336 (syntax (.str "${Dsp-" offset "-u16}[sb]"))
3337 (base-ifield (.sym f- base1 -6))
3338 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -2) 2) (.sym Dsp- offset -u16)))
3339 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -2) 2)))
3340 (getter (c-call dmode (.str "operand_getter_" dmode) sb (.sym Dsp- offset -u16)))
3341 (setter (c-call DFLT (.str "operand_setter_" dmode) newval sb (.sym Dsp- offset -u16)))
3342 ; (getter (mem32 smode (add (.sym Dsp- offset -u16) (reg h-sb))))
3343 ; (setter (set (mem32 dmode (add (.sym Dsp- offset -u16) (reg h-sb))) newval))
3345 (define-derived-operand
3346 (name (.sym dst32- offset -8-FB-relative- group - smode))
3347 (comment (.str "m32c dsp:8[fb] relative destination " smode))
3348 (attrs (machine 32))
3350 (args ((.sym Dsp- offset -s8)))
3351 (syntax (.str "${Dsp-" offset "-s8}[fb]"))
3352 (base-ifield (.sym f- base1 -6))
3353 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -2) 3) (.sym Dsp- offset -s8)))
3354 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -2) 3)))
3355 (getter (c-call dmode (.str "operand_getter_" dmode) fb (.sym Dsp- offset -s8)))
3356 (setter (c-call DFLT (.str "operand_setter_" dmode) newval fb (.sym Dsp- offset -s8)))
3357 ; (getter (mem32 smode (add (.sym Dsp- offset -s8) (reg h-fb))))
3358 ; (setter (set (mem32 dmode (add (.sym Dsp- offset -s8) (reg h-fb))) newval))
3360 (define-derived-operand
3361 (name (.sym dst32- offset -16-FB-relative- group - smode))
3362 (comment (.str "m32c dsp:16[fb] relative destination " smode))
3363 (attrs (machine 32))
3365 (args ((.sym Dsp- offset -s16)))
3366 (syntax (.str "${Dsp-" offset "-s16}[fb]"))
3367 (base-ifield (.sym f- base1 -6))
3368 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -2) 3) (.sym Dsp- offset -s16)))
3369 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -2) 3)))
3370 (getter (c-call dmode (.str "operand_getter_" dmode) fb (.sym Dsp- offset -s16)))
3371 (setter (c-call DFLT (.str "operand_setter_" dmode) newval fb (.sym Dsp- offset -s16)))
3372 ; (getter (mem32 smode (add (.sym Dsp- offset -s16) (reg h-fb))))
3373 ; (setter (set (mem32 dmode (add (.sym Dsp- offset -s16) (reg h-fb))) newval))
3375 (define-derived-operand
3376 (name (.sym dst32- offset -8-An-relative- group - smode))
3377 (comment (.str "m32c dsp:8[An] relative destination " smode))
3378 (attrs (machine 32))
3380 (args ((.sym Dst32An group) (.sym Dsp- offset -u8)))
3381 (syntax (.str "${Dsp-" offset "-u8}[$Dst32An" group "]"))
3382 (base-ifield (.sym f- base1 -6))
3383 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -1) 0) (.sym Dsp- offset -u8) (.sym Dst32An group)))
3384 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -1) 0)))
3385 (getter (c-call dmode (.str "operand_getter_" dmode) (.sym Dst32An group) (.sym Dsp- offset -u8)))
3386 (setter (c-call DFLT (.str "operand_setter_" dmode) newval (.sym Dst32An group) (.sym Dsp- offset -u8)))
3387 ; (getter (mem32 smode (add (.sym Dsp- offset -u8) (.sym Dst32An group))))
3388 ; (setter (set (mem32 dmode (add (.sym Dsp- offset -u8) (.sym Dst32An group))) newval))
3390 (define-derived-operand
3391 (name (.sym dst32- offset -16-An-relative- group - smode))
3392 (comment (.str "m32c dsp:16[An] relative destination " smode))
3393 (attrs (machine 32))
3395 (args ((.sym Dst32An group) (.sym Dsp- offset -u16)))
3396 (syntax (.str "${Dsp-" offset "-u16}[$Dst32An" group "]"))
3397 (base-ifield (.sym f- base1 -6))
3398 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -1) 0) (.sym Dsp- offset -u16) (.sym Dst32An group)))
3399 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -1) 0)))
3400 (getter (c-call dmode (.str "operand_getter_" dmode) (.sym Dst32An group) (.sym Dsp- offset -u16)))
3401 (setter (c-call DFLT (.str "operand_setter_" dmode) newval (.sym Dst32An group) (.sym Dsp- offset -u16)))
3402 ; (getter (mem32 smode (add (.sym Dsp- offset -u16) (.sym Dst32An group))))
3403 ; (setter (set (mem32 dmode (add (.sym Dsp- offset -u16) (.sym Dst32An group))) newval))
3405 (define-derived-operand
3406 (name (.sym dst32- offset -24-An-relative- group - smode))
3407 (comment (.str "m32c dsp:16[An] relative destination " smode))
3408 (attrs (machine 32))
3410 (args ((.sym Dst32An group) (.sym Dsp- offset -u24)))
3411 (syntax (.str "${Dsp-" offset "-u24}[$Dst32An" group "]"))
3412 (base-ifield (.sym f- base1 -6))
3413 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -1) 0) (.sym Dsp- offset -u24) (.sym Dst32An group)))
3414 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -1) 0)))
3415 (getter (c-call dmode (.str "operand_getter_" dmode) (.sym Dst32An group) (.sym Dsp- offset -u24)))
3416 (setter (c-call DFLT (.str "operand_setter_" dmode) newval (.sym Dst32An group) (.sym Dsp- offset -u24)))
3417 ; (getter (mem32 smode (add (.sym Dsp- offset -u24) (.sym Dst32An group))))
3418 ; (setter (set (mem32 dmode (add (.sym Dsp- offset -u24) (.sym Dst32An group))) newval))
3423 (dst32-relative-operand 16 Unprefixed 4 8 QI QI)
3424 (dst32-relative-operand 24 Unprefixed 4 8 QI QI)
3425 (dst32-relative-operand 32 Unprefixed 4 8 QI QI)
3426 (dst32-relative-operand 40 Unprefixed 4 8 QI QI)
3427 (dst32-relative-operand 16 Unprefixed 4 8 HI HI)
3428 (dst32-relative-operand 24 Unprefixed 4 8 HI HI)
3429 (dst32-relative-operand 32 Unprefixed 4 8 HI HI)
3430 (dst32-relative-operand 40 Unprefixed 4 8 HI HI)
3431 (dst32-relative-operand 16 Unprefixed 4 8 SI SI)
3432 (dst32-relative-operand 24 Unprefixed 4 8 SI SI)
3433 (dst32-relative-operand 32 Unprefixed 4 8 SI SI)
3434 (dst32-relative-operand 40 Unprefixed 4 8 SI SI)
3436 (dst32-relative-operand 24 Prefixed 12 16 QI QI)
3437 (dst32-relative-operand 32 Prefixed 12 16 QI QI)
3438 (dst32-relative-operand 40 Prefixed 12 16 QI QI)
3439 (dst32-relative-operand 48 Prefixed 12 16 QI QI)
3440 (dst32-relative-operand 24 Prefixed 12 16 HI HI)
3441 (dst32-relative-operand 32 Prefixed 12 16 HI HI)
3442 (dst32-relative-operand 40 Prefixed 12 16 HI HI)
3443 (dst32-relative-operand 48 Prefixed 12 16 HI HI)
3444 (dst32-relative-operand 24 Prefixed 12 16 SI SI)
3445 (dst32-relative-operand 32 Prefixed 12 16 SI SI)
3446 (dst32-relative-operand 40 Prefixed 12 16 SI SI)
3447 (dst32-relative-operand 48 Prefixed 12 16 SI SI)
3449 (dst32-relative-operand 16 ExtUnprefixed 4 8 QI HI)
3450 (dst32-relative-operand 16 ExtUnprefixed 4 8 HI SI)
3452 ;-------------------------------------------------------------
3454 ;-------------------------------------------------------------
3456 (define-pmacro (dst16-absolute offset xmode)
3458 (define-derived-operand
3459 (name (.sym dst16- offset -16-absolute- xmode))
3460 (comment (.str "m16c absolute address " xmode))
3461 (attrs (machine 16))
3463 (args ((.sym Dsp- offset -u16)))
3464 (syntax (.str "${Dsp-" offset "-u16}"))
3465 (base-ifield f-12-4)
3466 (encoding (+ (f-12-4 #xF) (.sym Dsp- offset -u16)))
3467 (ifield-assertion (eq f-12-4 #xF))
3468 (getter (mem16 xmode (.sym Dsp- offset -u16)))
3469 (setter (set (mem16 xmode (.sym Dsp- offset -u16)) newval))
3474 (dst16-absolute 16 QI)
3475 (dst16-absolute 24 QI)
3476 (dst16-absolute 32 QI)
3477 (dst16-absolute 40 QI)
3478 (dst16-absolute 48 QI)
3479 (dst16-absolute 16 HI)
3480 (dst16-absolute 24 HI)
3481 (dst16-absolute 32 HI)
3482 (dst16-absolute 40 HI)
3483 (dst16-absolute 48 HI)
3484 (dst16-absolute 16 SI)
3485 (dst16-absolute 24 SI)
3486 (dst16-absolute 32 SI)
3487 (dst16-absolute 40 SI)
3488 (dst16-absolute 48 SI)
3490 (define-derived-operand
3491 (name dst16-16-16-absolute-Ext-QI)
3492 (comment "m16c absolute address QI")
3493 (attrs (machine 16))
3496 (syntax "${Dsp-16-u16}")
3497 (base-ifield f-12-4)
3498 (encoding (+ (f-12-4 #xF) Dsp-16-u16))
3499 (ifield-assertion (eq f-12-4 #xF))
3500 (getter (mem16 QI Dsp-16-u16))
3501 (setter (set (mem16 HI Dsp-16-u16) newval))
3504 (define-pmacro (dst32-absolute offset group base1 base2 smode dmode)
3506 (define-derived-operand
3507 (name (.sym dst32- offset -16-absolute- group - smode))
3508 (comment (.str "m32c absolute address " smode))
3509 (attrs (machine 32))
3511 (args ((.sym Dsp- offset -u16)))
3512 (syntax (.str "${Dsp-" offset "-u16}"))
3513 (base-ifield (.sym f- base1 -6))
3514 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -2) 3) (.sym Dsp- offset -u16)))
3515 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -2) 3)))
3516 (getter (c-call smode (.str "operand_getter_" smode) (const 0) (.sym Dsp- offset -u16)))
3517 (setter (c-call DFLT (.str "operand_setter_" dmode) newval (const 0) (.sym Dsp- offset -u16)))
3518 ; (getter (mem32 smode (.sym Dsp- offset -u16)))
3519 ; (setter (set (mem32 dmode (.sym Dsp- offset -u16)) newval))
3521 (define-derived-operand
3522 (name (.sym dst32- offset -24-absolute- group - smode))
3523 (comment (.str "m32c absolute address " smode))
3524 (attrs (machine 32))
3526 (args ((.sym Dsp- offset -u24)))
3527 (syntax (.str "${Dsp-" offset "-u24}"))
3528 (base-ifield (.sym f- base1 -6))
3529 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -2) 2) (.sym Dsp- offset -u24)))
3530 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -2) 2)))
3531 (getter (c-call smode (.str "operand_getter_" smode) (const 0) (.sym Dsp- offset -u24)))
3532 (setter (c-call DFLT (.str "operand_setter_" dmode) newval (const 0) (.sym Dsp- offset -u24)))
3533 ; (getter (mem32 smode (.sym Dsp- offset -u24)))
3534 ; (setter (set (mem32 dmode (.sym Dsp- offset -u24)) newval))
3539 (dst32-absolute 16 Unprefixed 4 8 QI QI)
3540 (dst32-absolute 24 Unprefixed 4 8 QI QI)
3541 (dst32-absolute 32 Unprefixed 4 8 QI QI)
3542 (dst32-absolute 40 Unprefixed 4 8 QI QI)
3543 (dst32-absolute 16 Unprefixed 4 8 HI HI)
3544 (dst32-absolute 24 Unprefixed 4 8 HI HI)
3545 (dst32-absolute 32 Unprefixed 4 8 HI HI)
3546 (dst32-absolute 40 Unprefixed 4 8 HI HI)
3547 (dst32-absolute 16 Unprefixed 4 8 SI SI)
3548 (dst32-absolute 24 Unprefixed 4 8 SI SI)
3549 (dst32-absolute 32 Unprefixed 4 8 SI SI)
3550 (dst32-absolute 40 Unprefixed 4 8 SI SI)
3552 (dst32-absolute 24 Prefixed 12 16 QI QI)
3553 (dst32-absolute 32 Prefixed 12 16 QI QI)
3554 (dst32-absolute 40 Prefixed 12 16 QI QI)
3555 (dst32-absolute 48 Prefixed 12 16 QI QI)
3556 (dst32-absolute 24 Prefixed 12 16 HI HI)
3557 (dst32-absolute 32 Prefixed 12 16 HI HI)
3558 (dst32-absolute 40 Prefixed 12 16 HI HI)
3559 (dst32-absolute 48 Prefixed 12 16 HI HI)
3560 (dst32-absolute 24 Prefixed 12 16 SI SI)
3561 (dst32-absolute 32 Prefixed 12 16 SI SI)
3562 (dst32-absolute 40 Prefixed 12 16 SI SI)
3563 (dst32-absolute 48 Prefixed 12 16 SI SI)
3565 (dst32-absolute 16 ExtUnprefixed 4 8 QI HI)
3566 (dst32-absolute 16 ExtUnprefixed 4 8 HI SI)
3568 ;-------------------------------------------------------------
3569 ; An indirect indirect
3570 ;-------------------------------------------------------------
3572 ;(define-pmacro (dst-An-indirect-indirect-operand xmode)
3573 ; (define-derived-operand
3574 ; (name (.sym dst32-An-indirect-indirect- xmode))
3575 ; (comment (.str "m32c An indirect indirect destination " xmode))
3576 ; (attrs (machine 32))
3578 ; (args (Dst32AnPrefixed))
3579 ; (syntax (.str "[[$Dst32AnPrefixed]]"))
3580 ; (base-ifield f-12-6)
3581 ; (encoding (+ (f-12-3 0) (f-16-1 0) Dst32AnPrefixed))
3582 ; (ifield-assertion (andif (eq f-12-3 0) (eq f-16-1 0)))
3583 ; (getter (mem32 xmode (indirect-addr Dst32AnPrefixed)))
3584 ; (setter (set (mem32 xmode (indirect-addr Dst32AnPrefixed)) newval))
3588 ; (dst-An-indirect-indirect-operand QI)
3589 ; (dst-An-indirect-indirect-operand HI)
3590 ; (dst-An-indirect-indirect-operand SI)
3592 ;-------------------------------------------------------------
3594 ;-------------------------------------------------------------
3596 (define-pmacro (dst-relative-indirect-operand offset xmode)
3598 ; (define-derived-operand
3599 ; (name (.sym dst32- offset -8-SB-relative-indirect- xmode))
3600 ; (comment (.str "m32c dsp:8[sb] relative destination " xmode))
3601 ; (attrs (machine 32))
3603 ; (args ((.sym Dsp- offset -u8)))
3604 ; (syntax (.str "[${Dsp-" offset "-u8}[sb]]"))
3605 ; (base-ifield f-12-6)
3606 ; (encoding (+ (f-12-3 1) (f-16-2 2) (.sym Dsp- offset -u8)))
3607 ; (ifield-assertion (andif (eq f-12-3 1) (eq f-16-2 2)))
3608 ; (getter (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u8) (reg h-sb)))))
3609 ; (setter (set (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u8) (reg h-sb)))) newval))
3611 ; (define-derived-operand
3612 ; (name (.sym dst32- offset -16-SB-relative-indirect- xmode))
3613 ; (comment (.str "m32c dsp:16[sb] relative destination " xmode))
3614 ; (attrs (machine 32))
3616 ; (args ((.sym Dsp- offset -u16)))
3617 ; (syntax (.str "[${Dsp-" offset "-u16}[sb]]"))
3618 ; (base-ifield f-12-6)
3619 ; (encoding (+ (f-12-3 2) (f-16-2 2) (.sym Dsp- offset -u16)))
3620 ; (ifield-assertion (andif (eq f-12-3 2) (eq f-16-2 2)))
3621 ; (getter (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u16) (reg h-sb)))))
3622 ; (setter (set (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u16) (reg h-sb)))) newval))
3624 ; (define-derived-operand
3625 ; (name (.sym dst32- offset -8-FB-relative-indirect- xmode))
3626 ; (comment (.str "m32c dsp:8[fb] relative destination " xmode))
3627 ; (attrs (machine 32))
3629 ; (args ((.sym Dsp- offset -s8)))
3630 ; (syntax (.str "[${Dsp-" offset "-s8}[fb]]"))
3631 ; (base-ifield f-12-6)
3632 ; (encoding (+ (f-12-3 1) (f-16-2 3) (.sym Dsp- offset -s8)))
3633 ; (ifield-assertion (andif (eq f-12-3 1) (eq f-16-2 3)))
3634 ; (getter (mem32 xmode (indirect-addr (add (.sym Dsp- offset -s8) (reg h-fb)))))
3635 ; (setter (set (mem32 xmode (indirect-addr (add (.sym Dsp- offset -s8) (reg h-fb)))) newval))
3637 ; (define-derived-operand
3638 ; (name (.sym dst32- offset -16-FB-relative-indirect- xmode))
3639 ; (comment (.str "m32c dsp:16[fb] relative destination " xmode))
3640 ; (attrs (machine 32))
3642 ; (args ((.sym Dsp- offset -s16)))
3643 ; (syntax (.str "[${Dsp-" offset "-s16}[fb]]"))
3644 ; (base-ifield f-12-6)
3645 ; (encoding (+ (f-12-3 2) (f-16-2 3) (.sym Dsp- offset -s16)))
3646 ; (ifield-assertion (andif (eq f-12-3 2) (eq f-16-2 3)))
3647 ; (getter (mem32 xmode (indirect-addr (add (.sym Dsp- offset -s16) (reg h-fb)))))
3648 ; (setter (set (mem32 xmode (indirect-addr (add (.sym Dsp- offset -s16) (reg h-fb)))) newval))
3650 ; (define-derived-operand
3651 ; (name (.sym dst32- offset -8-An-relative-indirect- xmode))
3652 ; (comment (.str "m32c dsp:8[An] relative indirect destination " xmode))
3653 ; (attrs (machine 32))
3655 ; (args (Dst32AnPrefixed (.sym Dsp- offset -u8)))
3656 ; (syntax (.str "[${Dsp-" offset "-u8}[$Dst32AnPrefixed]]"))
3657 ; (base-ifield f-12-6)
3658 ; (encoding (+ (f-12-3 1) (f-16-1 0) (.sym Dsp- offset -u8) Dst32AnPrefixed))
3659 ; (ifield-assertion (andif (eq f-12-3 1) (eq f-16-1 0)))
3660 ; (getter (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u8) Dst32AnPrefixed))))
3661 ; (setter (set (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u8) Dst32AnPrefixed))) newval))
3663 ; (define-derived-operand
3664 ; (name (.sym dst32- offset -16-An-relative-indirect- xmode))
3665 ; (comment (.str "m32c dsp:16[An] relative destination " xmode))
3666 ; (attrs (machine 32))
3668 ; (args (Dst32AnPrefixed (.sym Dsp- offset -u16)))
3669 ; (syntax (.str "[${Dsp-" offset "-u16}[$Dst32AnPrefixed]]"))
3670 ; (base-ifield f-12-6)
3671 ; (encoding (+ (f-12-3 2) (f-16-1 0) (.sym Dsp- offset -u16) Dst32AnPrefixed))
3672 ; (ifield-assertion (andif (eq f-12-3 2) (eq f-16-1 0)))
3673 ; (getter (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u16) Dst32AnPrefixed))))
3674 ; (setter (set (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u16) Dst32AnPrefixed))) newval))
3676 ; (define-derived-operand
3677 ; (name (.sym dst32- offset -24-An-relative-indirect- xmode))
3678 ; (comment (.str "m32c dsp:24[An] relative destination " xmode))
3679 ; (attrs (machine 32))
3681 ; (args (Dst32AnPrefixed (.sym Dsp- offset -u24)))
3682 ; (syntax (.str "[${Dsp-" offset "-u24}[$Dst32AnPrefixed]]"))
3683 ; (base-ifield f-12-6)
3684 ; (encoding (+ (f-12-3 3) (f-16-1 0) (.sym Dsp- offset -u24) Dst32AnPrefixed))
3685 ; (ifield-assertion (andif (eq f-12-3 3) (eq f-16-1 0)))
3686 ; (getter (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u24) Dst32AnPrefixed))))
3687 ; (setter (set (mem32 xmode (indirect-addr (add (.sym Dsp- offset -u24) Dst32AnPrefixed))) newval))
3692 ; (dst-relative-indirect-operand 24 QI)
3693 ; (dst-relative-indirect-operand 32 QI)
3694 ; (dst-relative-indirect-operand 40 QI)
3695 ; (dst-relative-indirect-operand 48 QI)
3696 ; (dst-relative-indirect-operand 24 HI)
3697 ; (dst-relative-indirect-operand 32 HI)
3698 ; (dst-relative-indirect-operand 40 HI)
3699 ; (dst-relative-indirect-operand 48 HI)
3700 ; (dst-relative-indirect-operand 24 SI)
3701 ; (dst-relative-indirect-operand 32 SI)
3702 ; (dst-relative-indirect-operand 40 SI)
3703 ; (dst-relative-indirect-operand 48 SI)
3705 ;-------------------------------------------------------------
3707 ;-------------------------------------------------------------
3709 (define-pmacro (dst-absolute-indirect offset xmode)
3711 ; (define-derived-operand
3712 ; (name (.sym dst32- offset -16-absolute-indirect-derived- xmode))
3713 ; (comment (.str "m32c absolute indirect address " xmode))
3714 ; (attrs (machine 32))
3716 ; (args ((.sym Dsp- offset -u16)))
3717 ; (syntax (.str "[${Dsp-" offset "-u16}]"))
3718 ; (base-ifield f-12-6)
3719 ; (encoding (+ (f-12-3 3) (f-16-2 3) (.sym Dsp- offset -u16)))
3720 ; (ifield-assertion (andif (eq f-12-3 3) (eq f-16-2 3)))
3721 ; (getter (mem32 xmode (indirect-addr (.sym Dsp- offset -u16))))
3722 ; (setter (set (mem32 xmode (indirect-addr (.sym Dsp- offset -u16))) newval))
3724 ; (define-derived-operand
3725 ; (name (.sym dst32- offset -24-absolute-indirect-derived- xmode))
3726 ; (comment (.str "m32c absolute indirect address " xmode))
3727 ; (attrs (machine 32))
3729 ; (args ((.sym Dsp- offset -u24)))
3730 ; (syntax (.str "[${Dsp-" offset "-u24}]"))
3731 ; (base-ifield f-12-6)
3732 ; (encoding (+ (f-12-3 3) (f-16-2 2) (.sym Dsp- offset -u24)))
3733 ; (ifield-assertion (andif (eq f-12-3 3) (eq f-16-2 2)))
3734 ; (getter (mem32 xmode (indirect-addr (.sym Dsp- offset -u24))))
3735 ; (setter (set (mem32 xmode (indirect-addr (.sym Dsp- offset -u24))) newval))
3740 (dst-absolute-indirect 24 QI)
3741 (dst-absolute-indirect 32 QI)
3742 (dst-absolute-indirect 40 QI)
3743 (dst-absolute-indirect 48 QI)
3744 (dst-absolute-indirect 24 HI)
3745 (dst-absolute-indirect 32 HI)
3746 (dst-absolute-indirect 40 HI)
3747 (dst-absolute-indirect 48 HI)
3748 (dst-absolute-indirect 24 SI)
3749 (dst-absolute-indirect 32 SI)
3750 (dst-absolute-indirect 40 SI)
3751 (dst-absolute-indirect 48 SI)
3753 ;-------------------------------------------------------------
3755 ;-------------------------------------------------------------
3756 (define-pmacro (get-register-bit reg bitno)
3757 (and (srl reg bitno) 1)
3760 (define-pmacro (set-register-bit reg bitno value)
3761 (set reg (or (and reg (inv (sll 1 bitno)))
3762 (sll (and QI value 1) bitno)))
3765 (define-pmacro (get-memory-bit mach base bitno)
3766 (and (srl (mem-mach mach QI (add base (div bitno 8)))
3771 (define-pmacro (set-memory-bit mach base bitno value)
3772 (sequence ((USI addr))
3773 (set addr (add base (div bitno 8)))
3774 (set (mem-mach mach QI addr)
3775 (or (and (mem-mach mach QI addr)
3776 (inv (sll 1 (mod bitno 8))))
3777 (sll (and QI value 1) (mod bitno 8)))))
3780 ;-------------------------------------------------------------
3782 ;-------------------------------------------------------------
3784 (define-derived-operand
3785 (name bit16-Rn-direct)
3786 (comment "m16c Rn direct bit")
3787 (attrs (machine 16))
3789 (args (Bitno16R Bit16Rn))
3790 (syntax "$Bitno16R,$Bit16Rn")
3791 (base-ifield f-12-4)
3792 (encoding (+ (f-12-2 0) Bit16Rn Bitno16R))
3793 (ifield-assertion (eq f-12-2 0))
3794 (getter (get-register-bit Bit16Rn Bitno16R))
3795 (setter (set-register-bit Bit16Rn Bitno16R newval))
3798 (define-pmacro (bit32-Rn-direct-operand group base)
3800 (define-derived-operand
3801 (name (.sym bit32-Rn-direct- group))
3802 (comment "m32c Rn direct bit")
3803 (attrs (machine 32))
3805 (args ((.sym Bitno32 group) (.sym Bit32Rn group)))
3806 (syntax (.str "$Bitno32" group ",$Bit32Rn" group))
3807 (base-ifield (.sym f- base -6))
3808 (encoding (+ ((.sym f- base -3) 4) (.sym Bit32Rn group) (.sym Bitno32 group)))
3809 (ifield-assertion (eq (.sym f- base -3) 4))
3810 (getter (get-register-bit (.sym Bit32Rn group) (.sym Bitno32 group)))
3811 (setter (set-register-bit (.sym Bit32Rn group) (.sym Bitno32 group) newval))
3816 (bit32-Rn-direct-operand Unprefixed 4)
3817 (bit32-Rn-direct-operand Prefixed 12)
3819 ;-------------------------------------------------------------
3821 ;-------------------------------------------------------------
3823 (define-derived-operand
3824 (name bit16-An-direct)
3825 (comment "m16c An direct bit")
3826 (attrs (machine 16))
3828 (args (Bitno16R Bit16An))
3829 (syntax "$Bitno16R,$Bit16An")
3830 (base-ifield f-12-4)
3831 (encoding (+ (f-12-2 1) (f-14-1 0) Bit16An Bitno16R))
3832 (ifield-assertion (andif (eq f-12-2 1) (eq f-14-1 0)))
3833 (getter (get-register-bit Bit16An Bitno16R))
3834 (setter (set-register-bit Bit16An Bitno16R newval))
3837 (define-pmacro (bit32-An-direct-operand group base1 base2)
3839 (define-derived-operand
3840 (name (.sym bit32-An-direct- group))
3841 (comment "m32c An direct bit")
3842 (attrs (machine 32))
3844 (args ((.sym Bitno32 group) (.sym Bit32An group)))
3845 (syntax (.str "$Bitno32" group ",$Bit32An" group))
3846 (base-ifield (.sym f- base1 -6))
3847 (encoding (+ ((.sym f- base1 -3) 0) ((.sym f- base2 -1) 1) (.sym Bit32An group) (.sym Bitno32 group)))
3848 (ifield-assertion (andif (eq (.sym f- base1 -3) 0) (eq (.sym f- base2 -1) 1)))
3849 (getter (get-register-bit (.sym Bit32An group) (.sym Bitno32 group)))
3850 (setter (set-register-bit (.sym Bit32An group) (.sym Bitno32 group) newval))
3855 (bit32-An-direct-operand Unprefixed 4 8)
3856 (bit32-An-direct-operand Prefixed 12 16)
3858 ;-------------------------------------------------------------
3860 ;-------------------------------------------------------------
3862 (define-derived-operand
3863 (name bit16-An-indirect)
3864 (comment "m16c An indirect bit")
3865 (attrs (machine 16))
3868 (syntax "[$Bit16An]")
3869 (base-ifield f-12-4)
3870 (encoding (+ (f-12-2 1) (f-14-1 1) Bit16An))
3871 (ifield-assertion (andif (eq f-12-2 1) (eq f-14-1 1)))
3872 (getter (get-memory-bit 16 0 Bit16An))
3873 (setter (set-memory-bit 16 0 Bit16An newval))
3876 (define-pmacro (bit32-An-indirect-operand group base1 base2)
3878 (define-derived-operand
3879 (name (.sym bit32-An-indirect- group))
3880 (comment "m32c An indirect destination ")
3881 (attrs (machine 32))
3883 (args ((.sym Bitno32 group) (.sym Bit32An group)))
3884 (syntax (.str "$Bitno32" group ",[$Bit32An" group "]"))
3885 (base-ifield (.sym f- base1 -6))
3886 (encoding (+ ((.sym f- base1 -3) 0) ((.sym f- base2 -1) 0) (.sym Bit32An group) (.sym Bitno32 group)))
3887 (ifield-assertion (andif (eq (.sym f- base1 -3) 0) (eq (.sym f- base2 -1) 0)))
3888 (getter (get-memory-bit 32 (.sym Bit32An group) (.sym Bitno32 group)))
3889 (setter (set-memory-bit 32 (.sym Bit32An group) (.sym Bitno32 group) newval))
3894 (bit32-An-indirect-operand Unprefixed 4 8)
3895 (bit32-An-indirect-operand Prefixed 12 16)
3897 ;-------------------------------------------------------------
3899 ;-------------------------------------------------------------
3901 (define-pmacro (bit16-relative-operand offset)
3903 (define-derived-operand
3904 (name (.sym bit16- offset -8-SB-relative))
3905 (comment (.str "m16c dsp:8[sb] relative bit " xmode))
3906 (attrs (machine 16))
3908 (args ((.sym BitBase16- offset -u8)))
3909 (syntax (.str "${BitBase16-" offset "-u8}[sb]"))
3910 (base-ifield f-12-4)
3911 (encoding (+ (f-12-4 #xA) (.sym BitBase16- offset -u8)))
3912 (ifield-assertion (eq f-12-4 #xA))
3913 (getter (get-memory-bit 16 (reg h-sb) (.sym BitBase16- offset -u8)))
3914 (setter (set-memory-bit 16 (reg h-sb) (.sym BitBase16- offset -u8) newval))
3916 (define-derived-operand
3917 (name (.sym bit16- offset -16-SB-relative))
3918 (comment (.str "m16c dsp:16[sb] relative bit " xmode))
3919 (attrs (machine 16))
3921 (args ((.sym BitBase16- offset -u16)))
3922 (syntax (.str "${BitBase16-" offset "-u16}[sb]"))
3923 (base-ifield f-12-4)
3924 (encoding (+ (f-12-4 #xE) (.sym BitBase16- offset -u16)))
3925 (ifield-assertion (eq f-12-4 #xE))
3926 (getter (get-memory-bit 16 (reg h-sb) (.sym BitBase16- offset -u16)))
3927 (setter (set-memory-bit 16 (reg h-sb) (.sym BitBase16- offset -u16) newval))
3929 (define-derived-operand
3930 (name (.sym bit16- offset -8-FB-relative))
3931 (comment (.str "m16c dsp:8[fb] relative bit " xmode))
3932 (attrs (machine 16))
3934 (args ((.sym BitBase16- offset -s8)))
3935 (syntax (.str "${BitBase16-" offset "-s8}[fb]"))
3936 (base-ifield f-12-4)
3937 (encoding (+ (f-12-4 #xB) (.sym BitBase16- offset -s8)))
3938 (ifield-assertion (eq f-12-4 #xB))
3939 (getter (get-memory-bit 16 (reg h-fb) (.sym BitBase16- offset -s8)))
3940 (setter (set-memory-bit 16 (reg h-fb) (.sym BitBase16- offset -s8) newval))
3942 (define-derived-operand
3943 (name (.sym bit16- offset -8-An-relative))
3944 (comment (.str "m16c dsp:8[An] relative bit " xmode))
3945 (attrs (machine 16))
3947 (args (Bit16An (.sym Dsp- offset -u8)))
3948 (syntax (.str "${Dsp-" offset "-u8}[$Bit16An]"))
3949 (base-ifield f-12-4)
3950 (encoding (+ (f-12-2 2) (f-14-1 0) (.sym Dsp- offset -u8) Bit16An))
3951 (ifield-assertion (andif (eq f-12-2 2) (eq f-14-1 0)))
3952 (getter (get-memory-bit 16 (.sym Dsp- offset -u8) Bit16An))
3953 (setter (set-memory-bit 16 (.sym Dsp- offset -u8) Bit16An newval))
3955 (define-derived-operand
3956 (name (.sym bit16- offset -16-An-relative))
3957 (comment (.str "m16c dsp:16[An] relative bit " xmode))
3958 (attrs (machine 16))
3960 (args (Bit16An (.sym Dsp- offset -u16)))
3961 (syntax (.str "${Dsp-" offset "-u16}[$Bit16An]"))
3962 (base-ifield f-12-4)
3963 (encoding (+ (f-12-2 3) (f-14-1 0) (.sym Dsp- offset -u16) Bit16An))
3964 (ifield-assertion (andif (eq f-12-2 3) (eq f-14-1 0)))
3965 (getter (get-memory-bit 16 (.sym Dsp- offset -u16) Bit16An))
3966 (setter (set-memory-bit 16 (.sym Dsp- offset -u16) Bit16An newval))
3971 (bit16-relative-operand 16)
3973 (define-pmacro (bit32-relative-operand offset group base1 base2)
3975 (define-derived-operand
3976 (name (.sym bit32- offset -11-SB-relative- group))
3977 (comment "m32c bit,base:11[sb] relative bit")
3978 (attrs (machine 32))
3980 (args ((.sym BitBase32- offset -u11- group)))
3981 (syntax (.str "${BitBase32-" offset "-u11-" group "}[sb]"))
3982 (base-ifield (.sym f- base1 -12))
3983 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -2) 2) (.sym BitBase32- offset -u11- group)))
3984 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -2) 2)))
3985 (getter (get-memory-bit 32 (reg h-sb) (.sym BitBase32- offset -u11- group)))
3986 (setter (set-memory-bit 32 (reg h-sb) (.sym BitBase32- offset -u11- group) newval))
3988 (define-derived-operand
3989 (name (.sym bit32- offset -19-SB-relative- group))
3990 (comment "m32c bit,base:19[sb] relative bit")
3991 (attrs (machine 32))
3993 (args ((.sym BitBase32- offset -u19- group)))
3994 (syntax (.str "${BitBase32-" offset "-u19-" group "}[sb]"))
3995 (base-ifield (.sym f- base1 -12))
3996 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -2) 2) (.sym BitBase32- offset -u19- group)))
3997 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -2) 2)))
3998 (getter (get-memory-bit 32 (reg h-sb) (.sym BitBase32- offset -u19- group)))
3999 (setter (set-memory-bit 32 (reg h-sb) (.sym BitBase32- offset -u19- group) newval))
4001 (define-derived-operand
4002 (name (.sym bit32- offset -11-FB-relative- group))
4003 (comment "m32c bit,base:11[fb] relative bit")
4004 (attrs (machine 32))
4006 (args ((.sym BitBase32- offset -s11- group)))
4007 (syntax (.str "${BitBase32-" offset "-s11-" group "}[fb]"))
4008 (base-ifield (.sym f- base1 -12))
4009 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -2) 3) (.sym BitBase32- offset -s11- group)))
4010 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -2) 3)))
4011 (getter (get-memory-bit 32 (reg h-fb) (.sym BitBase32- offset -s11- group)))
4012 (setter (set-memory-bit 32 (reg h-fb) (.sym BitBase32- offset -s11- group) newval))
4014 (define-derived-operand
4015 (name (.sym bit32- offset -19-FB-relative- group))
4016 (comment "m32c bit,base:19[fb] relative bit")
4017 (attrs (machine 32))
4019 (args ((.sym BitBase32- offset -s19- group)))
4020 (syntax (.str "${BitBase32-" offset "-s19-" group "}[fb]"))
4021 (base-ifield (.sym f- base1 -12))
4022 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -2) 3) (.sym BitBase32- offset -s19- group)))
4023 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -2) 3)))
4024 (getter (get-memory-bit 32 (reg h-fb) (.sym BitBase32- offset -s19- group)))
4025 (setter (set-memory-bit 32 (reg h-fb) (.sym BitBase32- offset -s19- group) newval))
4027 (define-derived-operand
4028 (name (.sym bit32- offset -11-An-relative- group))
4029 (comment "m32c bit,base:11[An] relative bit")
4030 (attrs (machine 32))
4032 (args ((.sym BitBase32- offset -u11- group) (.sym Bit32An group)))
4033 (syntax (.str "${BitBase32-" offset "-u11-" group "}[$Bit32An" group "]"))
4034 (base-ifield (.sym f- base1 -12))
4035 (encoding (+ ((.sym f- base1 -3) 1) ((.sym f- base2 -1) 0) (.sym BitBase32- offset -u11- group) (.sym Bit32An group)))
4036 (ifield-assertion (andif (eq (.sym f- base1 -3) 1) (eq (.sym f- base2 -1) 0)))
4037 (getter (get-memory-bit 32 (.sym Bit32An group) (.sym BitBase32- offset -u11- group)))
4038 (setter (set-memory-bit 32 (.sym Bit32An group) (.sym BitBase32- offset -u11- group) newval))
4040 (define-derived-operand
4041 (name (.sym bit32- offset -19-An-relative- group))
4042 (comment "m32c bit,base:19[An] relative bit")
4043 (attrs (machine 32))
4045 (args ((.sym BitBase32- offset -u19- group) (.sym Bit32An group)))
4046 (syntax (.str "${BitBase32-" offset "-u19-" group "}[$Bit32An" group "]"))
4047 (base-ifield (.sym f- base1 -12))
4048 (encoding (+ ((.sym f- base1 -3) 2) ((.sym f- base2 -1) 0) (.sym BitBase32- offset -u19- group) (.sym Bit32An group)))
4049 (ifield-assertion (andif (eq (.sym f- base1 -3) 2) (eq (.sym f- base2 -1) 0)))
4050 (getter (get-memory-bit 32 (.sym Bit32An group) (.sym BitBase32- offset -u19- group)))
4051 (setter (set-memory-bit 32 (.sym Bit32An group) (.sym BitBase32- offset -u19- group) newval))
4053 (define-derived-operand
4054 (name (.sym bit32- offset -27-An-relative- group))
4055 (comment "m32c bit,base:27[An] relative bit")
4056 (attrs (machine 32))
4058 (args ((.sym BitBase32- offset -u27- group) (.sym Bit32An group)))
4059 (syntax (.str "${BitBase32-" offset "-u27-" group "}[$Bit32An" group "]"))
4060 (base-ifield (.sym f- base1 -12))
4061 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -1) 0) (.sym BitBase32- offset -u27- group) (.sym Bit32An group)))
4062 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -1) 0)))
4063 (getter (get-memory-bit 32 (.sym Bit32An group) (.sym BitBase32- offset -u27- group)))
4064 (setter (set-memory-bit 32 (.sym Bit32An group) (.sym BitBase32- offset -u27- group) newval))
4069 (bit32-relative-operand 16 Unprefixed 4 8)
4070 (bit32-relative-operand 24 Prefixed 12 16)
4072 (define-derived-operand
4073 (name bit16-11-SB-relative-S)
4074 (comment "m16c bit,base:11[sb] relative bit")
4075 (attrs (machine 16))
4077 (args (BitBase16-8-u11-S))
4078 (syntax "${BitBase16-8-u11-S}[sb]")
4079 (base-ifield (.sym f-5-3))
4080 (encoding (+ BitBase16-8-u11-S))
4081 ; (ifield-assertion (#t))
4082 (getter (get-memory-bit 16 (reg h-sb) BitBase16-8-u11-S))
4083 (setter (set-memory-bit 16 (reg h-sb) BitBase16-8-u11-S newval))
4086 (define-derived-operand
4087 (name Rn16-push-S-derived)
4088 (comment "m16c r0[lh] for push,pop short version")
4089 (attrs (machine 16))
4091 (args (Rn16-push-S))
4092 (syntax "${Rn16-push-S}")
4093 (base-ifield (.sym f-4-1))
4094 (encoding (+ Rn16-push-S))
4095 ; (ifield-assertion (#t))
4096 (getter (trunc QI Rn16-push-S))
4097 (setter (set Rn16-push-S newval))
4100 (define-derived-operand
4101 (name An16-push-S-derived)
4102 (comment "m16c r0[lh] for push,pop short version")
4103 (attrs (machine 16))
4105 (args (An16-push-S))
4106 (syntax "${An16-push-S}")
4107 (base-ifield (.sym f-4-1))
4108 (encoding (+ An16-push-S))
4109 ; (ifield-assertion (#t))
4110 (getter (trunc QI An16-push-S))
4111 (setter (set An16-push-S newval))
4114 ;-------------------------------------------------------------
4116 ;-------------------------------------------------------------
4118 (define-pmacro (bit16-absolute offset)
4120 (define-derived-operand
4121 (name (.sym bit16- offset -16-absolute))
4122 (comment "m16c absolute address")
4123 (attrs (machine 16))
4125 (args ((.sym BitBase16- offset -u16)))
4126 (syntax (.str "${BitBase16-" offset "-u16}"))
4127 (base-ifield f-12-4)
4128 (encoding (+ (f-12-4 #xF) (.sym BitBase16- offset -u16)))
4129 (ifield-assertion (eq f-12-4 #xF))
4130 (getter (get-memory-bit 16 0 (.sym BitBase16- offset -u16)))
4131 (setter (set-memory-bit 16 0 (.sym BitBase16- offset -u16) newval))
4138 (define-pmacro (bit32-absolute offset group base1 base2)
4140 (define-derived-operand
4141 (name (.sym bit32- offset -19-absolute- group))
4142 (comment "m32c absolute address bit")
4143 (attrs (machine 32))
4145 (args ((.sym BitBase32- offset -u19- group)))
4146 (syntax (.str "${BitBase32-" offset "-u19-" group "}"))
4147 (base-ifield (.sym f- base1 -12))
4148 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -2) 3) (.sym BitBase32- offset -u19- group)))
4149 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -2) 3)))
4150 (getter (get-memory-bit 32 0 (.sym BitBase32- offset -u19- group)))
4151 (setter (set-memory-bit 32 0 (.sym BitBase32- offset -u19- group) newval))
4153 (define-derived-operand
4154 (name (.sym bit32- offset -27-absolute- group))
4155 (comment "m32c absolute address bit")
4156 (attrs (machine 32))
4158 (args ((.sym BitBase32- offset -u27- group)))
4159 (syntax (.str "${BitBase32-" offset "-u27-" group "}"))
4160 (base-ifield (.sym f- base1 -12))
4161 (encoding (+ ((.sym f- base1 -3) 3) ((.sym f- base2 -2) 2) (.sym BitBase32- offset -u27- group)))
4162 (ifield-assertion (andif (eq (.sym f- base1 -3) 3) (eq (.sym f- base2 -2) 2)))
4163 (getter (get-memory-bit 32 0 (.sym BitBase32- offset -u27- group)))
4164 (setter (set-memory-bit 32 0 (.sym BitBase32- offset -u27- group) newval))
4169 (bit32-absolute 16 Unprefixed 4 8)
4170 (bit32-absolute 24 Prefixed 12 16)
4172 ;-------------------------------------------------------------
4173 ; Destination operands for short fomat insns
4174 ;-------------------------------------------------------------
4176 (define-derived-operand
4177 (name dst16-3-S-R0l-direct-QI)
4178 (comment "m16c R0l direct QI")
4179 (attrs (machine 16))
4184 (encoding (+ (f-5-3 4)))
4185 (ifield-assertion (eq f-5-3 4))
4186 (getter (trunc QI R0l))
4187 (setter (set R0l newval))
4189 (define-derived-operand
4190 (name dst16-3-S-R0h-direct-QI)
4191 (comment "m16c R0h direct QI")
4192 (attrs (machine 16))
4197 (encoding (+ (f-5-3 3)))
4198 (ifield-assertion (eq f-5-3 3))
4199 (getter (trunc QI R0h))
4200 (setter (set R0h newval))
4202 (define-derived-operand
4203 (name dst16-3-S-8-8-SB-relative-QI)
4204 (comment "m16c SB relative QI")
4205 (attrs (machine 16))
4208 (syntax "${Dsp-8-u8}[sb]")
4210 (encoding (+ (f-5-3 5) Dsp-8-u8))
4211 (ifield-assertion (eq f-5-3 5))
4212 (getter (mem16 QI (add Dsp-8-u8 (reg h-sb))))
4213 (setter (set (mem16 QI (add Dsp-8-u8 (reg h-sb))) newval))
4215 (define-derived-operand
4216 (name dst16-3-S-8-8-FB-relative-QI)
4217 (comment "m16c FB relative QI")
4218 (attrs (machine 16))
4221 (syntax "${Dsp-8-s8}[fb]")
4223 (encoding (+ (f-5-3 6) Dsp-8-s8))
4224 (ifield-assertion (eq f-5-3 6))
4225 (getter (mem16 QI (add Dsp-8-s8 (reg h-fb))))
4226 (setter (set (mem16 QI (add Dsp-8-s8 (reg h-fb))) newval))
4228 (define-derived-operand
4229 (name dst16-3-S-8-16-absolute-QI)
4230 (comment "m16c absolute address QI")
4231 (attrs (machine 16))
4234 (syntax "${Dsp-8-u16}")
4236 (encoding (+ (f-5-3 7) Dsp-8-u16))
4237 (ifield-assertion (eq f-5-3 7))
4238 (getter (mem16 QI Dsp-8-u16))
4239 (setter (set (mem16 QI Dsp-8-u16) newval))
4241 (define-derived-operand
4242 (name dst16-3-S-16-8-SB-relative-QI)
4243 (comment "m16c SB relative QI")
4244 (attrs (machine 16))
4247 (syntax "${Dsp-16-u8}[sb]")
4249 (encoding (+ (f-5-3 5) Dsp-16-u8))
4250 (ifield-assertion (eq f-5-3 5))
4251 (getter (mem16 QI (add Dsp-16-u8 (reg h-sb))))
4252 (setter (set (mem16 QI (add Dsp-16-u8 (reg h-sb))) newval))
4254 (define-derived-operand
4255 (name dst16-3-S-16-8-FB-relative-QI)
4256 (comment "m16c FB relative QI")
4257 (attrs (machine 16))
4260 (syntax "${Dsp-16-s8}[fb]")
4262 (encoding (+ (f-5-3 6) Dsp-16-s8))
4263 (ifield-assertion (eq f-5-3 6))
4264 (getter (mem16 QI (add Dsp-16-s8 (reg h-fb))))
4265 (setter (set (mem16 QI (add Dsp-16-s8 (reg h-fb))) newval))
4267 (define-derived-operand
4268 (name dst16-3-S-16-16-absolute-QI)
4269 (comment "m16c absolute address QI")
4270 (attrs (machine 16))
4273 (syntax "${Dsp-16-u16}")
4275 (encoding (+ (f-5-3 7) Dsp-16-u16))
4276 (ifield-assertion (eq f-5-3 7))
4277 (getter (mem16 QI Dsp-16-u16))
4278 (setter (set (mem16 QI Dsp-16-u16) newval))
4280 (define-derived-operand
4281 (name srcdst16-r0l-r0h-S-derived)
4282 (comment "m16c r0l/r0h operand for short format insns")
4283 (attrs (machine 16))
4285 (args (SrcDst16-r0l-r0h-S-normal))
4286 (syntax "${SrcDst16-r0l-r0h-S-normal}")
4288 (encoding (+ (f-6-2 0) SrcDst16-r0l-r0h-S-normal))
4289 (ifield-assertion (eq f-6-2 0))
4290 (getter (trunc SI SrcDst16-r0l-r0h-S-normal))
4291 (setter ()) ; no setter
4293 (define-derived-operand
4294 (name dst32-2-S-R0l-direct-QI)
4295 (comment "m32c R0l direct QI")
4296 (attrs (machine 32))
4301 (encoding (+ (f-2-2 0)))
4302 (ifield-assertion (eq f-2-2 0))
4303 (getter (trunc QI R0l))
4304 (setter (set R0l newval))
4306 (define-derived-operand
4307 (name dst32-2-S-R0-direct-HI)
4308 (comment "m32c R0 direct HI")
4309 (attrs (machine 32))
4314 (encoding (+ (f-2-2 0)))
4315 (ifield-assertion (eq f-2-2 0))
4316 (getter (trunc HI R0))
4317 (setter (set R0 newval))
4319 (define-derived-operand
4320 (name dst32-1-S-A0-direct-HI)
4321 (comment "m32c A0 direct HI")
4322 (attrs (machine 32))
4327 (encoding (+ (f-7-1 0)))
4328 (ifield-assertion (eq f-7-1 0))
4329 (getter (trunc HI A0))
4330 (setter (set A0 newval))
4332 (define-derived-operand
4333 (name dst32-1-S-A1-direct-HI)
4334 (comment "m32c A1 direct HI")
4335 (attrs (machine 32))
4340 (encoding (+ (f-7-1 1)))
4341 (ifield-assertion (eq f-7-1 1))
4342 (getter (trunc HI A1))
4343 (setter (set A1 newval))
4345 (define-pmacro (dst32-2-S-operands xmode)
4347 (define-derived-operand
4348 (name (.sym dst32-2-S-8-SB-relative- xmode))
4349 (comment "m32c SB relative for short binary insns")
4350 (attrs (machine 32))
4353 (syntax "${Dsp-8-u8}[sb]")
4355 (encoding (+ (f-2-2 2) Dsp-8-u8))
4356 (ifield-assertion (eq f-2-2 2))
4357 (getter (c-call xmode (.str "operand_getter_" xmode) sb Dsp-8-u8))
4358 (setter (c-call DFLT (.str "operand_setter_" xmode) newval sb Dsp-8-u8))
4359 ; (getter (mem32 xmode (add Dsp-8-u8 (reg h-sb))))
4360 ; (setter (set (mem32 xmode (add Dsp-8-u8 (reg h-sb))) newval))
4362 (define-derived-operand
4363 (name (.sym dst32-2-S-8-FB-relative- xmode))
4364 (comment "m32c FB relative for short binary insns")
4365 (attrs (machine 32))
4368 (syntax "${Dsp-8-s8}[fb]")
4370 (encoding (+ (f-2-2 3) Dsp-8-s8))
4371 (ifield-assertion (eq f-2-2 3))
4372 (getter (c-call xmode (.str "operand_getter_" xmode) fb Dsp-8-s8))
4373 (setter (c-call DFLT (.str "operand_setter_" xmode) newval fb Dsp-8-s8))
4374 ; (getter (mem32 xmode (add Dsp-8-s8 (reg h-fb))))
4375 ; (setter (set (mem32 xmode (add Dsp-8-s8 (reg h-fb))) newval))
4377 (define-derived-operand
4378 (name (.sym dst32-2-S-16-absolute- xmode))
4379 (comment "m32c absolute address for short binary insns")
4380 (attrs (machine 32))
4383 (syntax "${Dsp-8-u16}")
4385 (encoding (+ (f-2-2 1) Dsp-8-u16))
4386 (ifield-assertion (eq f-2-2 1))
4387 (getter (c-call xmode (.str "operand_getter_" xmode) (const 0) Dsp-8-u16))
4388 (setter (c-call DFLT (.str "operand_setter_" xmode) newval (const 0) Dsp-8-u16))
4389 ; (getter (mem32 xmode Dsp-8-u16))
4390 ; (setter (set (mem32 xmode Dsp-8-u16) newval))
4392 ; (define-derived-operand
4393 ; (name (.sym dst32-2-S-8-SB-relative-indirect- xmode))
4394 ; (comment "m32c SB relative for short binary insns")
4395 ; (attrs (machine 32))
4397 ; (args (Dsp-16-u8))
4398 ; (syntax "[${Dsp-16-u8}[sb]]")
4399 ; (base-ifield f-10-2)
4400 ; (encoding (+ (f-10-2 2) Dsp-16-u8))
4401 ; (ifield-assertion (eq f-10-2 2))
4402 ; (getter (mem32 xmode (indirect-addr (add Dsp-16-u8 (reg h-sb)))))
4403 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-16-u8 (reg h-sb)))) newval))
4405 ; (define-derived-operand
4406 ; (name (.sym dst32-2-S-8-FB-relative-indirect- xmode))
4407 ; (comment "m32c FB relative for short binary insns")
4408 ; (attrs (machine 32))
4410 ; (args (Dsp-16-s8))
4411 ; (syntax "[${Dsp-16-s8}[fb]]")
4412 ; (base-ifield f-10-2)
4413 ; (encoding (+ (f-10-2 3) Dsp-16-s8))
4414 ; (ifield-assertion (eq f-10-2 3))
4415 ; (getter (mem32 xmode (indirect-addr (add Dsp-16-s8 (reg h-fb)))))
4416 ; (setter (set (mem32 xmode (indirect-addr (add Dsp-16-s8 (reg h-fb)))) newval))
4418 ; (define-derived-operand
4419 ; (name (.sym dst32-2-S-16-absolute-indirect- xmode))
4420 ; (comment "m32c absolute address for short binary insns")
4421 ; (attrs (machine 32))
4423 ; (args (Dsp-16-u16))
4424 ; (syntax "[${Dsp-16-u16}]")
4425 ; (base-ifield f-10-2)
4426 ; (encoding (+ (f-10-2 1) Dsp-16-u16))
4427 ; (ifield-assertion (eq f-10-2 1))
4428 ; (getter (mem32 xmode (indirect-addr Dsp-16-u16)))
4429 ; (setter (set (mem32 xmode (indirect-addr Dsp-16-u16)) newval))
4434 (dst32-2-S-operands QI)
4435 (dst32-2-S-operands HI)
4436 (dst32-2-S-operands SI)
4438 ;=============================================================
4440 ;-------------------------------------------------------------
4441 ; Source operands with no additional fields
4442 ;-------------------------------------------------------------
4444 (define-pmacro (src16-basic-operand xmode)
4446 (define-anyof-operand
4447 (name (.sym src16-basic- xmode))
4448 (comment (.str "m16c source operand of size " xmode " with no additional fields"))
4449 (attrs (machine 16))
4452 (.sym src16-Rn-direct- xmode)
4453 (.sym src16-An-direct- xmode)
4454 (.sym src16-An-indirect- xmode)
4459 (src16-basic-operand QI)
4460 (src16-basic-operand HI)
4462 (define-pmacro (src32-basic-operand xmode)
4464 (define-anyof-operand
4465 (name (.sym src32-basic-Unprefixed- xmode))
4466 (comment (.str "m32c destination operand of size " xmode " with no additional fields"))
4467 (attrs (machine 32))
4470 (.sym src32-Rn-direct-Unprefixed- xmode)
4471 (.sym src32-An-direct-Unprefixed- xmode)
4472 (.sym src32-An-indirect-Unprefixed- xmode)
4475 (define-anyof-operand
4476 (name (.sym src32-basic-Prefixed- xmode))
4477 (comment (.str "m32c destination operand of size " xmode " with no additional fields"))
4478 (attrs (machine 32))
4481 (.sym src32-Rn-direct-Prefixed- xmode)
4482 (.sym src32-An-direct-Prefixed- xmode)
4483 (.sym src32-An-indirect-Prefixed- xmode)
4486 ; (define-anyof-operand
4487 ; (name (.sym src32-basic-indirect- xmode))
4488 ; (comment (.str "m32c destination operand of size " xmode " indirect with no additional fields"))
4489 ; (attrs (machine 32))
4492 ; (.sym src32-An-indirect-indirect- xmode)
4498 (src32-basic-operand QI)
4499 (src32-basic-operand HI)
4500 (src32-basic-operand SI)
4502 (define-anyof-operand
4503 (name src32-basic-ExtPrefixed-QI)
4504 (comment "m32c source operand of size QI with no additional fields")
4505 (attrs (machine 32))
4508 src32-Rn-direct-Prefixed-QI
4509 src32-An-indirect-Prefixed-QI
4513 ;-------------------------------------------------------------
4514 ; Source operands with additional fields at offset 16 bits
4515 ;-------------------------------------------------------------
4517 (define-pmacro (src16-16-operand xmode)
4519 (define-anyof-operand
4520 (name (.sym src16-16-8- xmode))
4521 (comment (.str "m16c source operand of size " xmode " with additional 8 bit fields at offset 16"))
4522 (attrs (machine 16))
4525 (.sym src16-16-8-An-relative- xmode)
4526 (.sym src16-16-8-SB-relative- xmode)
4527 (.sym src16-16-8-FB-relative- xmode)
4530 (define-anyof-operand
4531 (name (.sym src16-16-16- xmode))
4532 (comment (.str "m16c source operand of size " xmode " with additional 16 bit fields at offset 16"))
4533 (attrs (machine 16))
4536 (.sym src16-16-16-An-relative- xmode)
4537 (.sym src16-16-16-SB-relative- xmode)
4538 (.sym src16-16-16-absolute- xmode)
4543 (src16-16-operand QI)
4544 (src16-16-operand HI)
4546 (define-pmacro (src32-16-operand xmode)
4548 (define-anyof-operand
4549 (name (.sym src32-16-8-Unprefixed- xmode))
4550 (comment (.str "m32c source operand of size " xmode " with additional 8 bit fields at offset 16"))
4551 (attrs (machine 32))
4554 (.sym src32-16-8-An-relative-Unprefixed- xmode)
4555 (.sym src32-16-8-SB-relative-Unprefixed- xmode)
4556 (.sym src32-16-8-FB-relative-Unprefixed- xmode)
4559 (define-anyof-operand
4560 (name (.sym src32-16-16-Unprefixed- xmode))
4561 (comment (.str "m32c source operand of size " xmode " with additional 16 bit fields at offset 16"))
4562 (attrs (machine 32))
4565 (.sym src32-16-16-An-relative-Unprefixed- xmode)
4566 (.sym src32-16-16-SB-relative-Unprefixed- xmode)
4567 (.sym src32-16-16-FB-relative-Unprefixed- xmode)
4568 (.sym src32-16-16-absolute-Unprefixed- xmode)
4571 (define-anyof-operand
4572 (name (.sym src32-16-24-Unprefixed- xmode))
4573 (comment (.str "m32c source operand of size " xmode " with additional 24 bit fields at offset 16"))
4574 (attrs (machine 32))
4577 (.sym src32-16-24-An-relative-Unprefixed- xmode)
4578 (.sym src32-16-24-absolute-Unprefixed- xmode)
4584 (src32-16-operand QI)
4585 (src32-16-operand HI)
4586 (src32-16-operand SI)
4588 ;-------------------------------------------------------------
4589 ; Source operands with additional fields at offset 24 bits
4590 ;-------------------------------------------------------------
4592 (define-pmacro (src-24-operand group xmode)
4594 (define-anyof-operand
4595 (name (.sym src32-24-8- group - xmode))
4596 (comment (.str "m32c source operand of size " xmode " with additional 8 bit fields at offset 24"))
4597 (attrs (machine 32))
4600 (.sym src32-24-8-An-relative- group - xmode)
4601 (.sym src32-24-8-SB-relative- group - xmode)
4602 (.sym src32-24-8-FB-relative- group - xmode)
4605 (define-anyof-operand
4606 (name (.sym src32-24-16- group - xmode))
4607 (comment (.str "m32c source operand of size " xmode " with additional 16 bit fields at offset 16"))
4608 (attrs (machine 32))
4611 (.sym src32-24-16-An-relative- group - xmode)
4612 (.sym src32-24-16-SB-relative- group - xmode)
4613 (.sym src32-24-16-FB-relative- group - xmode)
4614 (.sym src32-24-16-absolute- group - xmode)
4617 (define-anyof-operand
4618 (name (.sym src32-24-24- group - xmode))
4619 (comment (.str "m32c source operand of size " xmode " with additional 24 bit fields at offset 16"))
4620 (attrs (machine 32))
4623 (.sym src32-24-24-An-relative- group - xmode)
4624 (.sym src32-24-24-absolute- group - xmode)
4630 (src-24-operand Prefixed QI)
4631 (src-24-operand Prefixed HI)
4632 (src-24-operand Prefixed SI)
4634 (define-pmacro (src-24-indirect-operand xmode)
4636 ; (define-anyof-operand
4637 ; (name (.sym src32-24-8-indirect- xmode))
4638 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
4639 ; (attrs (machine 32))
4642 ; (.sym src32-24-8-An-relative-indirect- xmode)
4643 ; (.sym src32-24-8-SB-relative-indirect- xmode)
4644 ; (.sym src32-24-8-FB-relative-indirect- xmode)
4647 ; (define-anyof-operand
4648 ; (name (.sym src32-24-16-indirect- xmode))
4649 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
4650 ; (attrs (machine 32))
4653 ; (.sym src32-24-16-An-relative-indirect- xmode)
4654 ; (.sym src32-24-16-SB-relative-indirect- xmode)
4655 ; (.sym src32-24-16-FB-relative-indirect- xmode)
4658 ; (define-anyof-operand
4659 ; (name (.sym src32-24-24-indirect- xmode))
4660 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
4661 ; (attrs (machine 32))
4664 ; (.sym src32-24-24-An-relative-indirect- xmode)
4667 ; (define-anyof-operand
4668 ; (name (.sym src32-24-16-absolute-indirect- xmode))
4669 ; (comment (.str "m32c source operand of size " xmode " 16 bit absolute indirect"))
4670 ; (attrs (machine 32))
4673 ; (.sym src32-24-16-absolute-indirect-derived- xmode)
4676 ; (define-anyof-operand
4677 ; (name (.sym src32-24-24-absolute-indirect- xmode))
4678 ; (comment (.str "m32c source operand of size " xmode " 24 bit absolute indirect"))
4679 ; (attrs (machine 32))
4682 ; (.sym src32-24-24-absolute-indirect-derived- xmode)
4688 ; (src-24-indirect-operand QI)
4689 ; (src-24-indirect-operand HI)
4690 ; (src-24-indirect-operand SI)
4692 ;-------------------------------------------------------------
4693 ; Destination operands with no additional fields
4694 ;-------------------------------------------------------------
4696 (define-pmacro (dst16-basic-operand xmode)
4698 (define-anyof-operand
4699 (name (.sym dst16-basic- xmode))
4700 (comment (.str "m16c destination operand of size " xmode " with no additional fields"))
4701 (attrs (machine 16))
4704 (.sym dst16-Rn-direct- xmode)
4705 (.sym dst16-An-direct- xmode)
4706 (.sym dst16-An-indirect- xmode)
4712 (dst16-basic-operand QI)
4713 (dst16-basic-operand HI)
4714 (dst16-basic-operand SI)
4716 (define-pmacro (dst32-basic-operand xmode)
4718 (define-anyof-operand
4719 (name (.sym dst32-basic-Unprefixed- xmode))
4720 (comment (.str "m32c destination operand of size " xmode " with no additional fields"))
4721 (attrs (machine 32))
4724 (.sym dst32-Rn-direct-Unprefixed- xmode)
4725 (.sym dst32-An-direct-Unprefixed- xmode)
4726 (.sym dst32-An-indirect-Unprefixed- xmode)
4729 (define-anyof-operand
4730 (name (.sym dst32-basic-Prefixed- xmode))
4731 (comment (.str "m32c destination operand of size " xmode " with no additional fields"))
4732 (attrs (machine 32))
4735 (.sym dst32-Rn-direct-Prefixed- xmode)
4736 (.sym dst32-An-direct-Prefixed- xmode)
4737 (.sym dst32-An-indirect-Prefixed- xmode)
4743 (dst32-basic-operand QI)
4744 (dst32-basic-operand HI)
4745 (dst32-basic-operand SI)
4747 ;-------------------------------------------------------------
4748 ; Destination operands with possible additional fields at offset 16 bits
4749 ;-------------------------------------------------------------
4751 (define-pmacro (dst16-16-operand xmode)
4753 (define-anyof-operand
4754 (name (.sym dst16-16- xmode))
4755 (comment (.str "m16c destination operand of size " xmode " with additional fields at offset 16"))
4756 (attrs (machine 16))
4759 (.sym dst16-Rn-direct- xmode)
4760 (.sym dst16-An-direct- xmode)
4761 (.sym dst16-An-indirect- xmode)
4762 (.sym dst16-16-8-An-relative- xmode)
4763 (.sym dst16-16-16-An-relative- xmode)
4764 (.sym dst16-16-8-SB-relative- xmode)
4765 (.sym dst16-16-16-SB-relative- xmode)
4766 (.sym dst16-16-8-FB-relative- xmode)
4767 (.sym dst16-16-16-absolute- xmode)
4770 (define-anyof-operand
4771 (name (.sym dst16-16-8- xmode))
4772 (comment (.str "m16c destination operand of size " xmode " with additional fields at offset 16"))
4773 (attrs (machine 16))
4776 (.sym dst16-16-8-An-relative- xmode)
4777 (.sym dst16-16-8-SB-relative- xmode)
4778 (.sym dst16-16-8-FB-relative- xmode)
4781 (define-anyof-operand
4782 (name (.sym dst16-16-16- xmode))
4783 (comment (.str "m16c destination operand of size " xmode " with additional fields at offset 16"))
4784 (attrs (machine 16))
4787 (.sym dst16-16-16-An-relative- xmode)
4788 (.sym dst16-16-16-SB-relative- xmode)
4789 (.sym dst16-16-16-absolute- xmode)
4792 (define-anyof-operand
4793 (name (.sym dst16-16-16sa- xmode))
4794 (comment (.str "m16c destination operand of size " xmode " with additional fields at offset 16"))
4795 (attrs (machine 16))
4798 (.sym dst16-16-16-SB-relative- xmode)
4799 (.sym dst16-16-16-absolute- xmode)
4802 (define-anyof-operand
4803 (name (.sym dst16-16-20ar- xmode))
4804 (comment (.str "m16c destination operand of size " xmode " with additional fields at offset 16"))
4805 (attrs (machine 16))
4808 (.sym dst16-16-20-An-relative- xmode)
4814 (dst16-16-operand QI)
4815 (dst16-16-operand HI)
4816 (dst16-16-operand SI)
4818 (define-anyof-operand
4819 (name dst16-16-Ext-QI)
4820 (comment "m16c destination operand of size QI for 'ext' insns with additional fields at offset 16")
4821 (attrs (machine 16))
4824 dst16-Rn-direct-Ext-QI
4825 dst16-An-indirect-Ext-QI
4826 dst16-16-8-An-relative-Ext-QI
4827 dst16-16-16-An-relative-Ext-QI
4828 dst16-16-8-SB-relative-Ext-QI
4829 dst16-16-16-SB-relative-Ext-QI
4830 dst16-16-8-FB-relative-Ext-QI
4831 dst16-16-16-absolute-Ext-QI
4835 (define-derived-operand
4836 (name dst16-An-indirect-Mova-HI)
4837 (comment "m16c addressof An indirect destination HI")
4841 (syntax "[$Dst16An]")
4842 (base-ifield f-12-4)
4843 (encoding (+ (f-12-2 1) (f-14-1 1) Dst16An))
4845 (andif (eq f-12-2 1) (eq f-14-1 1)))
4850 (define-derived-operand
4851 (name dst16-16-8-An-relative-Mova-HI)
4853 "m16c addressof dsp:8[An] relative destination HI")
4856 (args (Dst16An Dsp-16-u8))
4857 (syntax "${Dsp-16-u8}[$Dst16An]")
4858 (base-ifield f-12-4)
4860 (+ (f-12-2 2) (f-14-1 0) Dsp-16-u8 Dst16An))
4862 (andif (eq f-12-2 2) (eq f-14-1 0)))
4863 (getter (add Dsp-16-u8 Dst16An))
4866 (define-derived-operand
4867 (name dst16-16-16-An-relative-Mova-HI)
4869 "m16c addressof dsp:16[An] relative destination HI")
4872 (args (Dst16An Dsp-16-u16))
4873 (syntax "${Dsp-16-u16}[$Dst16An]")
4874 (base-ifield f-12-4)
4876 (+ (f-12-2 3) (f-14-1 0) Dsp-16-u16 Dst16An))
4878 (andif (eq f-12-2 3) (eq f-14-1 0)))
4879 (getter (add Dsp-16-u16 Dst16An))
4882 (define-derived-operand
4883 (name dst16-16-8-SB-relative-Mova-HI)
4885 "m16c addressof dsp:8[sb] relative destination HI")
4889 (syntax "${Dsp-16-u8}[sb]")
4890 (base-ifield f-12-4)
4891 (encoding (+ (f-12-4 10) Dsp-16-u8))
4892 (ifield-assertion (eq f-12-4 10))
4893 (getter (add Dsp-16-u8 (reg h-sb)))
4896 (define-derived-operand
4897 (name dst16-16-16-SB-relative-Mova-HI)
4899 "m16c addressof dsp:16[sb] relative destination HI")
4903 (syntax "${Dsp-16-u16}[sb]")
4904 (base-ifield f-12-4)
4905 (encoding (+ (f-12-4 14) Dsp-16-u16))
4906 (ifield-assertion (eq f-12-4 14))
4907 (getter (add Dsp-16-u16 (reg h-sb)))
4910 (define-derived-operand
4911 (name dst16-16-8-FB-relative-Mova-HI)
4913 "m16c addressof dsp:8[fb] relative destination HI")
4917 (syntax "${Dsp-16-s8}[fb]")
4918 (base-ifield f-12-4)
4919 (encoding (+ (f-12-4 11) Dsp-16-s8))
4920 (ifield-assertion (eq f-12-4 11))
4921 (getter (add Dsp-16-s8 (reg h-fb)))
4924 (define-derived-operand
4925 (name dst16-16-16-absolute-Mova-HI)
4926 (comment "m16c addressof absolute address HI")
4930 (syntax "${Dsp-16-u16}")
4931 (base-ifield f-12-4)
4932 (encoding (+ (f-12-4 15) Dsp-16-u16))
4933 (ifield-assertion (eq f-12-4 15))
4938 (define-anyof-operand
4939 (name dst16-16-Mova-HI)
4940 (comment "m16c addressof destination operand of size HI with additional fields at offset 16")
4941 (attrs (machine 16))
4944 dst16-An-indirect-Mova-HI
4945 dst16-16-8-An-relative-Mova-HI
4946 dst16-16-16-An-relative-Mova-HI
4947 dst16-16-8-SB-relative-Mova-HI
4948 dst16-16-16-SB-relative-Mova-HI
4949 dst16-16-8-FB-relative-Mova-HI
4950 dst16-16-16-absolute-Mova-HI
4954 (define-derived-operand
4955 (name dst32-An-indirect-Unprefixed-Mova-SI)
4956 (comment "m32c addressof An indirect destination SI")
4959 (args (Dst32AnUnprefixed))
4960 (syntax "[$Dst32AnUnprefixed]")
4963 (+ (f-4-3 0) (f-8-1 0) Dst32AnUnprefixed))
4965 (andif (eq f-4-3 0) (eq f-8-1 0)))
4966 (getter Dst32AnUnprefixed)
4970 (define-derived-operand
4971 (name dst32-16-8-An-relative-Unprefixed-Mova-SI)
4972 (comment "m32c addressof dsp:8[An] relative destination SI")
4975 (args (Dst32AnUnprefixed Dsp-16-u8))
4976 (syntax "${Dsp-16-u8}[$Dst32AnUnprefixed]")
4984 (andif (eq f-4-3 1) (eq f-8-1 0)))
4985 (getter (add Dsp-16-u8 Dst32AnUnprefixed))
4989 (define-derived-operand
4990 (name dst32-16-16-An-relative-Unprefixed-Mova-SI)
4992 "m32c addressof dsp:16[An] relative destination SI")
4995 (args (Dst32AnUnprefixed Dsp-16-u16))
4996 (syntax "${Dsp-16-u16}[$Dst32AnUnprefixed]")
5004 (andif (eq f-4-3 2) (eq f-8-1 0)))
5005 (getter (add Dsp-16-u16 Dst32AnUnprefixed))
5009 (define-derived-operand
5010 (name dst32-16-24-An-relative-Unprefixed-Mova-SI)
5011 (comment "addressof m32c dsp:16[An] relative destination SI")
5014 (args (Dst32AnUnprefixed Dsp-16-u24))
5015 (syntax "${Dsp-16-u24}[$Dst32AnUnprefixed]")
5023 (andif (eq f-4-3 3) (eq f-8-1 0)))
5024 (getter (add Dsp-16-u24 Dst32AnUnprefixed))
5028 (define-derived-operand
5029 (name dst32-16-8-SB-relative-Unprefixed-Mova-SI)
5030 (comment "m32c addressof dsp:8[sb] relative destination SI")
5034 (syntax "${Dsp-16-u8}[sb]")
5036 (encoding (+ (f-4-3 1) (f-8-2 2) Dsp-16-u8))
5038 (andif (eq f-4-3 1) (eq f-8-2 2)))
5039 (getter (add Dsp-16-u8 (reg h-sb)))
5043 (define-derived-operand
5044 (name dst32-16-16-SB-relative-Unprefixed-Mova-SI)
5045 (comment "m32c addressof dsp:16[sb] relative destination SI")
5049 (syntax "${Dsp-16-u16}[sb]")
5051 (encoding (+ (f-4-3 2) (f-8-2 2) Dsp-16-u16))
5053 (andif (eq f-4-3 2) (eq f-8-2 2)))
5054 (getter (add Dsp-16-u16 (reg h-sb)))
5058 (define-derived-operand
5059 (name dst32-16-8-FB-relative-Unprefixed-Mova-SI)
5060 (comment "m32c addressof dsp:8[fb] relative destination SI")
5064 (syntax "${Dsp-16-s8}[fb]")
5066 (encoding (+ (f-4-3 1) (f-8-2 3) Dsp-16-s8))
5068 (andif (eq f-4-3 1) (eq f-8-2 3)))
5069 (getter (add Dsp-16-s8 (reg h-fb)))
5073 (define-derived-operand
5074 (name dst32-16-16-FB-relative-Unprefixed-Mova-SI)
5075 (comment "m32c addressof dsp:16[fb] relative destination SI")
5079 (syntax "${Dsp-16-s16}[fb]")
5081 (encoding (+ (f-4-3 2) (f-8-2 3) Dsp-16-s16))
5083 (andif (eq f-4-3 2) (eq f-8-2 3)))
5084 (getter (add Dsp-16-s16 (reg h-fb)))
5088 (define-derived-operand
5089 (name dst32-16-16-absolute-Unprefixed-Mova-SI)
5090 (comment "m32c addressof absolute address SI") (attrs (ISA m32c))
5093 (syntax "${Dsp-16-u16}")
5095 (encoding (+ (f-4-3 3) (f-8-2 3) Dsp-16-u16))
5097 (andif (eq f-4-3 3) (eq f-8-2 3)))
5102 (define-derived-operand
5103 (name dst32-16-24-absolute-Unprefixed-Mova-SI)
5104 (comment "m32c addressof absolute address SI") (attrs (ISA m32c))
5107 (syntax "${Dsp-16-u24}")
5109 (encoding (+ (f-4-3 3) (f-8-2 2) Dsp-16-u24))
5111 (andif (eq f-4-3 3) (eq f-8-2 2)))
5116 (define-anyof-operand
5117 (name dst32-16-Unprefixed-Mova-SI)
5119 "m32c addressof destination operand of size SI with additional fields at offset 16")
5123 dst32-An-indirect-Unprefixed-Mova-SI
5124 dst32-16-8-An-relative-Unprefixed-Mova-SI
5125 dst32-16-16-An-relative-Unprefixed-Mova-SI
5126 dst32-16-24-An-relative-Unprefixed-Mova-SI
5127 dst32-16-8-SB-relative-Unprefixed-Mova-SI
5128 dst32-16-16-SB-relative-Unprefixed-Mova-SI
5129 dst32-16-8-FB-relative-Unprefixed-Mova-SI
5130 dst32-16-16-FB-relative-Unprefixed-Mova-SI
5131 dst32-16-16-absolute-Unprefixed-Mova-SI
5132 dst32-16-24-absolute-Unprefixed-Mova-SI))
5134 (define-pmacro (dst32-16-operand xmode)
5136 (define-anyof-operand
5137 (name (.sym dst32-16-Unprefixed- xmode))
5138 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 16"))
5139 (attrs (machine 32))
5142 (.sym dst32-Rn-direct-Unprefixed- xmode)
5143 (.sym dst32-An-direct-Unprefixed- xmode)
5144 (.sym dst32-An-indirect-Unprefixed- xmode)
5145 (.sym dst32-16-8-An-relative-Unprefixed- xmode)
5146 (.sym dst32-16-16-An-relative-Unprefixed- xmode)
5147 (.sym dst32-16-24-An-relative-Unprefixed- xmode)
5148 (.sym dst32-16-8-SB-relative-Unprefixed- xmode)
5149 (.sym dst32-16-16-SB-relative-Unprefixed- xmode)
5150 (.sym dst32-16-8-FB-relative-Unprefixed- xmode)
5151 (.sym dst32-16-16-FB-relative-Unprefixed- xmode)
5152 (.sym dst32-16-16-absolute-Unprefixed- xmode)
5153 (.sym dst32-16-24-absolute-Unprefixed- xmode)
5156 (define-anyof-operand
5157 (name (.sym dst32-16-8-Unprefixed- xmode))
5158 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 16"))
5159 (attrs (machine 32))
5162 (.sym dst32-16-8-An-relative-Unprefixed- xmode)
5163 (.sym dst32-16-8-SB-relative-Unprefixed- xmode)
5164 (.sym dst32-16-8-FB-relative-Unprefixed- xmode)
5167 (define-anyof-operand
5168 (name (.sym dst32-16-16-Unprefixed- xmode))
5169 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 16"))
5170 (attrs (machine 32))
5173 (.sym dst32-16-16-An-relative-Unprefixed- xmode)
5174 (.sym dst32-16-16-SB-relative-Unprefixed- xmode)
5175 (.sym dst32-16-16-FB-relative-Unprefixed- xmode)
5176 (.sym dst32-16-16-absolute-Unprefixed- xmode)
5179 (define-anyof-operand
5180 (name (.sym dst32-16-16sa-Unprefixed- xmode))
5181 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 16"))
5182 (attrs (machine 32))
5185 (.sym dst32-16-16-SB-relative-Unprefixed- xmode)
5186 (.sym dst32-16-16-FB-relative-Unprefixed- xmode)
5187 (.sym dst32-16-16-absolute-Unprefixed- xmode)
5190 (define-anyof-operand
5191 (name (.sym dst32-16-24-Unprefixed- xmode))
5192 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 16"))
5193 (attrs (machine 32))
5196 (.sym dst32-16-24-An-relative-Unprefixed- xmode)
5197 (.sym dst32-16-24-absolute-Unprefixed- xmode)
5203 (dst32-16-operand QI)
5204 (dst32-16-operand HI)
5205 (dst32-16-operand SI)
5207 (define-pmacro (dst32-16-Ext-operand smode dmode)
5209 (define-anyof-operand
5210 (name (.sym dst32-16-ExtUnprefixed- smode))
5211 (comment (.str "m32c destination operand of size " smode " with additional fields at offset 16"))
5212 (attrs (machine 32))
5215 (.sym dst32-Rn-direct-ExtUnprefixed- smode)
5216 (.sym dst32-An-direct-Unprefixed- dmode) ; ExtUnprefixed mode not required for this operand -- use the normal dmode version
5217 (.sym dst32-An-indirect-ExtUnprefixed- smode)
5218 (.sym dst32-16-8-An-relative-ExtUnprefixed- smode)
5219 (.sym dst32-16-16-An-relative-ExtUnprefixed- smode)
5220 (.sym dst32-16-24-An-relative-ExtUnprefixed- smode)
5221 (.sym dst32-16-8-SB-relative-ExtUnprefixed- smode)
5222 (.sym dst32-16-16-SB-relative-ExtUnprefixed- smode)
5223 (.sym dst32-16-8-FB-relative-ExtUnprefixed- smode)
5224 (.sym dst32-16-16-FB-relative-ExtUnprefixed- smode)
5225 (.sym dst32-16-16-absolute-ExtUnprefixed- smode)
5226 (.sym dst32-16-24-absolute-ExtUnprefixed- smode)
5232 (dst32-16-Ext-operand QI HI)
5233 (dst32-16-Ext-operand HI SI)
5235 (define-anyof-operand
5236 (name dst32-16-Unprefixed-Mulex-HI)
5237 (comment "m32c destination operand of size HI with additional fields at offset 16")
5238 (attrs (machine 32))
5241 dst32-R3-direct-Unprefixed-HI
5242 dst32-An-direct-Unprefixed-HI
5243 dst32-An-indirect-Unprefixed-HI
5244 dst32-16-8-An-relative-Unprefixed-HI
5245 dst32-16-16-An-relative-Unprefixed-HI
5246 dst32-16-24-An-relative-Unprefixed-HI
5247 dst32-16-8-SB-relative-Unprefixed-HI
5248 dst32-16-16-SB-relative-Unprefixed-HI
5249 dst32-16-8-FB-relative-Unprefixed-HI
5250 dst32-16-16-FB-relative-Unprefixed-HI
5251 dst32-16-16-absolute-Unprefixed-HI
5252 dst32-16-24-absolute-Unprefixed-HI
5255 ;-------------------------------------------------------------
5256 ; Destination operands with possible additional fields at offset 24 bits
5257 ;-------------------------------------------------------------
5259 (define-pmacro (dst16-24-operand xmode)
5261 (define-anyof-operand
5262 (name (.sym dst16-24- xmode))
5263 (comment (.str "m16c destination operand of size " xmode " with additional fields at offset 24"))
5264 (attrs (machine 16))
5267 (.sym dst16-Rn-direct- xmode)
5268 (.sym dst16-An-direct- xmode)
5269 (.sym dst16-An-indirect- xmode)
5270 (.sym dst16-24-8-An-relative- xmode)
5271 (.sym dst16-24-16-An-relative- xmode)
5272 (.sym dst16-24-8-SB-relative- xmode)
5273 (.sym dst16-24-16-SB-relative- xmode)
5274 (.sym dst16-24-8-FB-relative- xmode)
5275 (.sym dst16-24-16-absolute- xmode)
5281 (dst16-24-operand QI)
5282 (dst16-24-operand HI)
5284 (define-pmacro (dst32-24-operand xmode)
5286 (define-anyof-operand
5287 (name (.sym dst32-24-Unprefixed- xmode))
5288 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5289 (attrs (machine 32))
5292 (.sym dst32-Rn-direct-Unprefixed- xmode)
5293 (.sym dst32-An-direct-Unprefixed- xmode)
5294 (.sym dst32-An-indirect-Unprefixed- xmode)
5295 (.sym dst32-24-8-An-relative-Unprefixed- xmode)
5296 (.sym dst32-24-16-An-relative-Unprefixed- xmode)
5297 (.sym dst32-24-24-An-relative-Unprefixed- xmode)
5298 (.sym dst32-24-8-SB-relative-Unprefixed- xmode)
5299 (.sym dst32-24-16-SB-relative-Unprefixed- xmode)
5300 (.sym dst32-24-8-FB-relative-Unprefixed- xmode)
5301 (.sym dst32-24-16-FB-relative-Unprefixed- xmode)
5302 (.sym dst32-24-16-absolute-Unprefixed- xmode)
5303 (.sym dst32-24-24-absolute-Unprefixed- xmode)
5306 (define-anyof-operand
5307 (name (.sym dst32-24-Prefixed- xmode))
5308 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5309 (attrs (machine 32))
5312 (.sym dst32-Rn-direct-Prefixed- xmode)
5313 (.sym dst32-An-direct-Prefixed- xmode)
5314 (.sym dst32-An-indirect-Prefixed- xmode)
5315 (.sym dst32-24-8-An-relative-Prefixed- xmode)
5316 (.sym dst32-24-16-An-relative-Prefixed- xmode)
5317 (.sym dst32-24-24-An-relative-Prefixed- xmode)
5318 (.sym dst32-24-8-SB-relative-Prefixed- xmode)
5319 (.sym dst32-24-16-SB-relative-Prefixed- xmode)
5320 (.sym dst32-24-8-FB-relative-Prefixed- xmode)
5321 (.sym dst32-24-16-FB-relative-Prefixed- xmode)
5322 (.sym dst32-24-16-absolute-Prefixed- xmode)
5323 (.sym dst32-24-24-absolute-Prefixed- xmode)
5326 (define-anyof-operand
5327 (name (.sym dst32-24-8-Prefixed- xmode))
5328 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5329 (attrs (machine 32))
5332 (.sym dst32-24-8-An-relative-Prefixed- xmode)
5333 (.sym dst32-24-8-SB-relative-Prefixed- xmode)
5334 (.sym dst32-24-8-FB-relative-Prefixed- xmode)
5337 (define-anyof-operand
5338 (name (.sym dst32-24-16-Prefixed- xmode))
5339 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5340 (attrs (machine 32))
5343 (.sym dst32-24-16-An-relative-Prefixed- xmode)
5344 (.sym dst32-24-16-SB-relative-Prefixed- xmode)
5345 (.sym dst32-24-16-FB-relative-Prefixed- xmode)
5346 (.sym dst32-24-16-absolute-Prefixed- xmode)
5349 (define-anyof-operand
5350 (name (.sym dst32-24-24-Prefixed- xmode))
5351 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5352 (attrs (machine 32))
5355 (.sym dst32-24-24-An-relative-Prefixed- xmode)
5356 (.sym dst32-24-24-absolute-Prefixed- xmode)
5359 ; (define-anyof-operand
5360 ; (name (.sym dst32-24-indirect- xmode))
5361 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5362 ; (attrs (machine 32))
5365 ; (.sym dst32-An-indirect-indirect- xmode)
5366 ; (.sym dst32-24-8-An-relative-indirect- xmode)
5367 ; (.sym dst32-24-16-An-relative-indirect- xmode)
5368 ; (.sym dst32-24-24-An-relative-indirect- xmode)
5369 ; (.sym dst32-24-8-SB-relative-indirect- xmode)
5370 ; (.sym dst32-24-16-SB-relative-indirect- xmode)
5371 ; (.sym dst32-24-8-FB-relative-indirect- xmode)
5372 ; (.sym dst32-24-16-FB-relative-indirect- xmode)
5375 ; (define-anyof-operand
5376 ; (name (.sym dst32-basic-indirect- xmode))
5377 ; (comment (.str "m32c destination operand of size " xmode " with no additional fields"))
5378 ; (attrs (machine 32))
5381 ; (.sym dst32-An-indirect-indirect- xmode)
5384 ; (define-anyof-operand
5385 ; (name (.sym dst32-24-8-indirect- xmode))
5386 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5387 ; (attrs (machine 32))
5390 ; (.sym dst32-24-8-An-relative-indirect- xmode)
5391 ; (.sym dst32-24-8-SB-relative-indirect- xmode)
5392 ; (.sym dst32-24-8-FB-relative-indirect- xmode)
5395 ; (define-anyof-operand
5396 ; (name (.sym dst32-24-16-indirect- xmode))
5397 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5398 ; (attrs (machine 32))
5401 ; (.sym dst32-24-16-An-relative-indirect- xmode)
5402 ; (.sym dst32-24-16-SB-relative-indirect- xmode)
5403 ; (.sym dst32-24-16-FB-relative-indirect- xmode)
5406 ; (define-anyof-operand
5407 ; (name (.sym dst32-24-24-indirect- xmode))
5408 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 24"))
5409 ; (attrs (machine 32))
5412 ; (.sym dst32-24-24-An-relative-indirect- xmode)
5415 ; (define-anyof-operand
5416 ; (name (.sym dst32-24-absolute-indirect- xmode))
5417 ; (comment (.str "m32c destination operand of size " xmode " absolute indirect"))
5418 ; (attrs (machine 32))
5421 ; (.sym dst32-24-16-absolute-indirect-derived- xmode)
5422 ; (.sym dst32-24-24-absolute-indirect-derived- xmode)
5425 ; (define-anyof-operand
5426 ; (name (.sym dst32-24-16-absolute-indirect- xmode))
5427 ; (comment (.str "m32c destination operand of size " xmode " absolute indirect"))
5428 ; (attrs (machine 32))
5431 ; (.sym dst32-24-16-absolute-indirect-derived- xmode)
5434 ; (define-anyof-operand
5435 ; (name (.sym dst32-24-24-absolute-indirect- xmode))
5436 ; (comment (.str "m32c destination operand of size " xmode " absolute indirect"))
5437 ; (attrs (machine 32))
5440 ; (.sym dst32-24-24-absolute-indirect-derived- xmode)
5446 (dst32-24-operand QI)
5447 (dst32-24-operand HI)
5448 (dst32-24-operand SI)
5450 ;-------------------------------------------------------------
5451 ; Destination operands with possible additional fields at offset 32 bits
5452 ;-------------------------------------------------------------
5454 (define-pmacro (dst16-32-operand xmode)
5456 (define-anyof-operand
5457 (name (.sym dst16-32- xmode))
5458 (comment (.str "m16c destination operand of size " xmode " with additional fields at offset 32"))
5459 (attrs (machine 16))
5462 (.sym dst16-Rn-direct- xmode)
5463 (.sym dst16-An-direct- xmode)
5464 (.sym dst16-An-indirect- xmode)
5465 (.sym dst16-32-8-An-relative- xmode)
5466 (.sym dst16-32-16-An-relative- xmode)
5467 (.sym dst16-32-8-SB-relative- xmode)
5468 (.sym dst16-32-16-SB-relative- xmode)
5469 (.sym dst16-32-8-FB-relative- xmode)
5470 (.sym dst16-32-16-absolute- xmode)
5475 (dst16-32-operand QI)
5476 (dst16-32-operand HI)
5478 ; This macro actually handles operands at offset 32, 40 and 48 bits
5479 (define-pmacro (dst32-32plus-operand offset xmode)
5481 (define-anyof-operand
5482 (name (.sym dst32- offset -Unprefixed- xmode))
5483 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 32"))
5484 (attrs (machine 32))
5487 (.sym dst32-Rn-direct-Unprefixed- xmode)
5488 (.sym dst32-An-direct-Unprefixed- xmode)
5489 (.sym dst32-An-indirect-Unprefixed- xmode)
5490 (.sym dst32- offset -8-An-relative-Unprefixed- xmode)
5491 (.sym dst32- offset -16-An-relative-Unprefixed- xmode)
5492 (.sym dst32- offset -24-An-relative-Unprefixed- xmode)
5493 (.sym dst32- offset -8-SB-relative-Unprefixed- xmode)
5494 (.sym dst32- offset -16-SB-relative-Unprefixed- xmode)
5495 (.sym dst32- offset -8-FB-relative-Unprefixed- xmode)
5496 (.sym dst32- offset -16-FB-relative-Unprefixed- xmode)
5497 (.sym dst32- offset -16-absolute-Unprefixed- xmode)
5498 (.sym dst32- offset -24-absolute-Unprefixed- xmode)
5501 (define-anyof-operand
5502 (name (.sym dst32- offset -Prefixed- xmode))
5503 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 32"))
5504 (attrs (machine 32))
5507 (.sym dst32-Rn-direct-Prefixed- xmode)
5508 (.sym dst32-An-direct-Prefixed- xmode)
5509 (.sym dst32-An-indirect-Prefixed- xmode)
5510 (.sym dst32- offset -8-An-relative-Prefixed- xmode)
5511 (.sym dst32- offset -16-An-relative-Prefixed- xmode)
5512 (.sym dst32- offset -24-An-relative-Prefixed- xmode)
5513 (.sym dst32- offset -8-SB-relative-Prefixed- xmode)
5514 (.sym dst32- offset -16-SB-relative-Prefixed- xmode)
5515 (.sym dst32- offset -8-FB-relative-Prefixed- xmode)
5516 (.sym dst32- offset -16-FB-relative-Prefixed- xmode)
5517 (.sym dst32- offset -16-absolute-Prefixed- xmode)
5518 (.sym dst32- offset -24-absolute-Prefixed- xmode)
5521 ; (define-anyof-operand
5522 ; (name (.sym dst32- offset -indirect- xmode))
5523 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 32"))
5524 ; (attrs (machine 32))
5527 ; (.sym dst32-An-indirect-indirect- xmode)
5528 ; (.sym dst32- offset -8-An-relative-indirect- xmode)
5529 ; (.sym dst32- offset -16-An-relative-indirect- xmode)
5530 ; (.sym dst32- offset -24-An-relative-indirect- xmode)
5531 ; (.sym dst32- offset -8-SB-relative-indirect- xmode)
5532 ; (.sym dst32- offset -16-SB-relative-indirect- xmode)
5533 ; (.sym dst32- offset -8-FB-relative-indirect- xmode)
5534 ; (.sym dst32- offset -16-FB-relative-indirect- xmode)
5537 ; (define-anyof-operand
5538 ; (name (.sym dst32- offset -absolute-indirect- xmode))
5539 ; (comment (.str "m32c destination operand of size " xmode " absolute indirect"))
5540 ; (attrs (machine 32))
5543 ; (.sym dst32- offset -16-absolute-indirect-derived- xmode)
5544 ; (.sym dst32- offset -24-absolute-indirect-derived- xmode)
5550 (dst32-32plus-operand 32 QI)
5551 (dst32-32plus-operand 32 HI)
5552 (dst32-32plus-operand 32 SI)
5553 (dst32-32plus-operand 40 QI)
5554 (dst32-32plus-operand 40 HI)
5555 (dst32-32plus-operand 40 SI)
5557 ;-------------------------------------------------------------
5558 ; Destination operands with possible additional fields at offset 48 bits
5559 ;-------------------------------------------------------------
5561 (define-pmacro (dst32-48-operand offset xmode)
5563 (define-anyof-operand
5564 (name (.sym dst32- offset -Prefixed- xmode))
5565 (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 32"))
5566 (attrs (machine 32))
5569 (.sym dst32-Rn-direct-Prefixed- xmode)
5570 (.sym dst32-An-direct-Prefixed- xmode)
5571 (.sym dst32-An-indirect-Prefixed- xmode)
5572 (.sym dst32- offset -8-An-relative-Prefixed- xmode)
5573 (.sym dst32- offset -16-An-relative-Prefixed- xmode)
5574 (.sym dst32- offset -24-An-relative-Prefixed- xmode)
5575 (.sym dst32- offset -8-SB-relative-Prefixed- xmode)
5576 (.sym dst32- offset -16-SB-relative-Prefixed- xmode)
5577 (.sym dst32- offset -8-FB-relative-Prefixed- xmode)
5578 (.sym dst32- offset -16-FB-relative-Prefixed- xmode)
5579 (.sym dst32- offset -16-absolute-Prefixed- xmode)
5580 (.sym dst32- offset -24-absolute-Prefixed- xmode)
5583 ; (define-anyof-operand
5584 ; (name (.sym dst32- offset -indirect- xmode))
5585 ; (comment (.str "m32c destination operand of size " xmode " with additional fields at offset 32"))
5586 ; (attrs (machine 32))
5589 ; (.sym dst32-An-indirect-indirect- xmode)
5590 ; (.sym dst32- offset -8-An-relative-indirect- xmode)
5591 ; (.sym dst32- offset -16-An-relative-indirect- xmode)
5592 ; (.sym dst32- offset -24-An-relative-indirect- xmode)
5593 ; (.sym dst32- offset -8-SB-relative-indirect- xmode)
5594 ; (.sym dst32- offset -16-SB-relative-indirect- xmode)
5595 ; (.sym dst32- offset -8-FB-relative-indirect- xmode)
5596 ; (.sym dst32- offset -16-FB-relative-indirect- xmode)
5599 ; (define-anyof-operand
5600 ; (name (.sym dst32- offset -absolute-indirect- xmode))
5601 ; (comment (.str "m32c destination operand of size " xmode " absolute indirect"))
5602 ; (attrs (machine 32))
5605 ; (.sym dst32- offset -16-absolute-indirect-derived- xmode)
5606 ; (.sym dst32- offset -24-absolute-indirect-derived- xmode)
5612 (dst32-48-operand 48 QI)
5613 (dst32-48-operand 48 HI)
5614 (dst32-48-operand 48 SI)
5616 ;-------------------------------------------------------------
5617 ; Bit operands for m16c
5618 ;-------------------------------------------------------------
5620 (define-pmacro (bit16-operand offset)
5622 (define-anyof-operand
5623 (name (.sym bit16- offset))
5624 (comment (.str "m16c bit operand with possible additional fields at offset 24"))
5625 (attrs (machine 16))
5631 (.sym bit16- offset -8-An-relative)
5632 (.sym bit16- offset -16-An-relative)
5633 (.sym bit16- offset -8-SB-relative)
5634 (.sym bit16- offset -16-SB-relative)
5635 (.sym bit16- offset -8-FB-relative)
5636 (.sym bit16- offset -16-absolute)
5639 (define-anyof-operand
5640 (name (.sym bit16- offset -basic))
5641 (comment (.str "m16c bit operand with no additional fields"))
5642 (attrs (machine 16))
5648 (define-anyof-operand
5649 (name (.sym bit16- offset -8))
5650 (comment (.str "m16c bit operand with possible additional fields at offset 24"))
5651 (attrs (machine 16))
5656 (.sym bit16- offset -8-An-relative)
5657 (.sym bit16- offset -8-SB-relative)
5658 (.sym bit16- offset -8-FB-relative)
5661 (define-anyof-operand
5662 (name (.sym bit16- offset -16))
5663 (comment (.str "m16c bit operand with possible additional fields at offset 24"))
5664 (attrs (machine 16))
5667 (.sym bit16- offset -16-An-relative)
5668 (.sym bit16- offset -16-SB-relative)
5669 (.sym bit16- offset -16-absolute)
5677 ;-------------------------------------------------------------
5678 ; Bit operands for m32c
5679 ;-------------------------------------------------------------
5681 (define-pmacro (bit32-operand offset group)
5683 (define-anyof-operand
5684 (name (.sym bit32- offset - group))
5685 (comment (.str "m32c bit operand with possible additional fields at offset 24"))
5686 (attrs (machine 32))
5689 (.sym bit32-Rn-direct- group)
5690 (.sym bit32-An-direct- group)
5691 (.sym bit32-An-indirect- group)
5692 (.sym bit32- offset -11-An-relative- group)
5693 (.sym bit32- offset -19-An-relative- group)
5694 (.sym bit32- offset -27-An-relative- group)
5695 (.sym bit32- offset -11-SB-relative- group)
5696 (.sym bit32- offset -19-SB-relative- group)
5697 (.sym bit32- offset -11-FB-relative- group)
5698 (.sym bit32- offset -19-FB-relative- group)
5699 (.sym bit32- offset -19-absolute- group)
5700 (.sym bit32- offset -27-absolute- group)
5706 (bit32-operand 16 Unprefixed)
5707 (bit32-operand 24 Prefixed)
5709 (define-anyof-operand
5710 (name bit32-basic-Unprefixed)
5711 (comment "m32c bit operand with no additional fields")
5712 (attrs (machine 32))
5715 bit32-Rn-direct-Unprefixed
5716 bit32-An-direct-Unprefixed
5717 bit32-An-indirect-Unprefixed
5721 (define-anyof-operand
5722 (name bit32-16-8-Unprefixed)
5723 (comment "m32c bit operand with 8 bit additional fields")
5724 (attrs (machine 32))
5727 bit32-16-11-An-relative-Unprefixed
5728 bit32-16-11-SB-relative-Unprefixed
5729 bit32-16-11-FB-relative-Unprefixed
5733 (define-anyof-operand
5734 (name bit32-16-16-Unprefixed)
5735 (comment "m32c bit operand with 16 bit additional fields")
5736 (attrs (machine 32))
5739 bit32-16-19-An-relative-Unprefixed
5740 bit32-16-19-SB-relative-Unprefixed
5741 bit32-16-19-FB-relative-Unprefixed
5742 bit32-16-19-absolute-Unprefixed
5746 (define-anyof-operand
5747 (name bit32-16-24-Unprefixed)
5748 (comment "m32c bit operand with 24 bit additional fields")
5749 (attrs (machine 32))
5752 bit32-16-27-An-relative-Unprefixed
5753 bit32-16-27-absolute-Unprefixed
5757 ;-------------------------------------------------------------
5758 ; Operands for short format binary insns
5759 ;-------------------------------------------------------------
5761 (define-anyof-operand
5763 (comment "m16c source operand of size QI for short format insns")
5764 (attrs (machine 16))
5767 src16-2-S-8-SB-relative-QI
5768 src16-2-S-8-FB-relative-QI
5769 src16-2-S-16-absolute-QI
5773 (define-anyof-operand
5775 (comment "m32c source operand of size QI for short format insns")
5776 (attrs (machine 32))
5779 src32-2-S-8-SB-relative-QI
5780 src32-2-S-8-FB-relative-QI
5781 src32-2-S-16-absolute-QI
5785 (define-anyof-operand
5787 (comment "m32c source operand of size QI for short format insns")
5788 (attrs (machine 32))
5791 src32-2-S-8-SB-relative-HI
5792 src32-2-S-8-FB-relative-HI
5793 src32-2-S-16-absolute-HI
5797 (define-anyof-operand
5799 (comment "m16c destination operand of size QI for short format insns")
5800 (attrs (machine 16))
5803 dst16-3-S-R0l-direct-QI
5804 dst16-3-S-R0h-direct-QI
5805 dst16-3-S-8-8-SB-relative-QI
5806 dst16-3-S-8-8-FB-relative-QI
5807 dst16-3-S-8-16-absolute-QI
5811 (define-anyof-operand
5813 (comment "m16c destination operand of size QI for short format insns")
5814 (attrs (machine 16))
5817 dst16-3-S-R0l-direct-QI
5818 dst16-3-S-R0h-direct-QI
5819 dst16-3-S-16-8-SB-relative-QI
5820 dst16-3-S-16-8-FB-relative-QI
5821 dst16-3-S-16-16-absolute-QI
5825 (define-anyof-operand
5826 (name srcdst16-r0l-r0h-S)
5827 (comment "m16c r0l/r0h operand of size QI for short format insns")
5828 (attrs (machine 16))
5831 srcdst16-r0l-r0h-S-derived
5835 (define-anyof-operand
5836 (name dst32-2-S-basic-QI)
5837 (comment "m32c r0l operand of size QI for short format binary insns")
5838 (attrs (machine 32))
5841 dst32-2-S-R0l-direct-QI
5845 (define-anyof-operand
5846 (name dst32-2-S-basic-HI)
5847 (comment "m32c r0 operand of size HI for short format binary insns")
5848 (attrs (machine 32))
5851 dst32-2-S-R0-direct-HI
5855 (define-pmacro (dst32-2-S-operands xmode)
5857 (define-anyof-operand
5858 (name (.sym dst32-2-S-8- xmode))
5859 (comment "m32c operand of size " xmode " for short format binary insns")
5860 (attrs (machine 32))
5863 (.sym dst32-2-S-8-SB-relative- xmode)
5864 (.sym dst32-2-S-8-FB-relative- xmode)
5867 (define-anyof-operand
5868 (name (.sym dst32-2-S-16- xmode))
5869 (comment "m32c operand of size " xmode " for short format binary insns")
5870 (attrs (machine 32))
5873 (.sym dst32-2-S-16-absolute- xmode)
5876 ; (define-anyof-operand
5877 ; (name (.sym dst32-2-S-8-indirect- xmode))
5878 ; (comment "m32c operand of size " xmode " for short format binary insns")
5879 ; (attrs (machine 32))
5882 ; (.sym dst32-2-S-8-SB-relative-indirect- xmode)
5883 ; (.sym dst32-2-S-8-FB-relative-indirect- xmode)
5886 ; (define-anyof-operand
5887 ; (name (.sym dst32-2-S-absolute-indirect- xmode))
5888 ; (comment "m32c operand of size " xmode " for short format binary insns")
5889 ; (attrs (machine 32))
5892 ; (.sym dst32-2-S-16-absolute-indirect- xmode)
5898 (dst32-2-S-operands QI)
5899 (dst32-2-S-operands HI)
5900 (dst32-2-S-operands SI)
5902 (define-anyof-operand
5904 (comment "m32c An operand for short format binary insns")
5905 (attrs (machine 32))
5908 dst32-1-S-A0-direct-HI
5909 dst32-1-S-A1-direct-HI
5913 (define-anyof-operand
5915 (comment "m16c bit operand for short format insns")
5916 (attrs (machine 16))
5919 bit16-11-SB-relative-S
5923 (define-anyof-operand
5924 (name Rn16-push-S-anyof)
5925 (comment "m16c bit operand for short format insns")
5926 (attrs (machine 16))
5933 (define-anyof-operand
5934 (name An16-push-S-anyof)
5935 (comment "m16c bit operand for short format insns")
5936 (attrs (machine 16))
5943 ;=============================================================
5944 ; Common macros for instruction definitions
5946 (define-pmacro (set-z x)
5948 (set zbit (zflag x)))
5952 (define-pmacro (set-s x)
5954 (set sbit (nflag x)))
5957 (define-pmacro (set-z-and-s x)
5963 ;=============================================================
5965 ;-------------------------------------------------------------
5967 (define-pmacro (unary-insn-defn-g mach group mode wstr op encoding sem opg)
5968 (dni (.sym op mach wstr - group)
5969 (.str op wstr opg " dst" mach "-" group "-" mode)
5970 ((machine mach) RL_1ADDR)
5971 (.str op wstr opg " ${dst" mach "-" group "-" mode "}")
5973 (sem mode (.sym dst mach - group - mode))
5977 (define-pmacro (unary-insn-defn mach group mode wstr op encoding sem)
5978 (unary-insn-defn-g mach group mode wstr op encoding sem "")
5982 (define-pmacro (unary16-defn-g mode wstr wbit op opc1 opc2 opc3 sem opg)
5983 (unary-insn-defn-g 16 16 mode wstr op
5984 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16- mode))
5987 (define-pmacro (unary16-defn mode wstr wbit op opc1 opc2 opc3 sem)
5988 (unary-16-defn-g mode wstr wbit op opc1 opc2 opc3 sem "")
5991 (define-pmacro (unary32-defn-g mode wstr wbit op opc1 opc2 opc3 sem opg)
5993 ; Multi insns are tried for assembly in the reverse order in which they appear here, so
5994 ; define the absolute-indirect insns first in order to prevent them from being selected
5995 ; when the mode is register-indirect
5996 ; (unary-insn-defn 32 24-absolute-indirect mode wstr op
5997 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-15-1 wbit) (.sym dst32-24-absolute-indirect- mode) (f-18-2 opc2) (f-20-4 opc3))
5999 (unary-insn-defn-g 32 16-Unprefixed mode wstr op
6000 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3))
6002 ; (unary-insn-defn 32 24-indirect mode wstr op
6003 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-15-1 wbit) (.sym dst32-24-indirect- mode) (f-18-2 opc2) (f-20-4 opc3))
6007 (define-pmacro (unary32-defn mode wstr wbit op opc1 opc2 opc3 sem)
6008 (unary32-defn-g mode wstr wbit op opc1 opc2 opc3 sem "")
6011 (define-pmacro (unary-insn-mach-g mach op opc1 opc2 opc3 sem opg)
6013 (.apply (.sym unary mach -defn-g) (QI .b 0 op opc1 opc2 opc3 sem opg))
6014 (.apply (.sym unary mach -defn-g) (HI .w 1 op opc1 opc2 opc3 sem opg))
6017 (define-pmacro (unary-insn-mach mach op opc1 opc2 opc3 sem)
6018 (unary-insn-mach-g mach op opc1 opc2 opc3 sem "")
6021 (define-pmacro (unary-insn op opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
6023 (unary-insn-mach-g 16 op opc16-1 opc16-2 opc16-3 sem "")
6024 (unary-insn-mach-g 32 op opc32-1 opc32-2 opc32-3 sem "")
6028 (define-pmacro (unary-insn-g op opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
6030 (unary-insn-mach-g 16 op opc16-1 opc16-2 opc16-3 sem "$G")
6031 (unary-insn-mach-g 32 op opc32-1 opc32-2 opc32-3 sem "$G")
6035 ;-------------------------------------------------------------
6036 ; Sign/zero extension macros
6037 ;-------------------------------------------------------------
6039 (define-pmacro (ext-insn-defn mach group smode dmode wstr op encoding sem)
6040 (dni (.sym op mach wstr - group)
6041 (.str op wstr " dst" mach "-" group "-" smode)
6043 (.str op wstr " ${dst" mach "-" group "-" smode "}")
6045 (sem smode dmode (.sym dst mach - group - smode) (.sym dst mach - group - smode))
6049 (define-pmacro (ext16-defn smode dmode wstr wbit op opc1 opc2 opc3 sem)
6050 (ext-insn-defn 16 16-Ext smode dmode wstr op
6051 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16-Ext- smode))
6055 (define-pmacro (ext32-defn smode dmode wstr wbit op opc1 opc2 opc3 sem)
6056 (ext-insn-defn 32 16-ExtUnprefixed smode dmode wstr op
6057 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst32-16-ExtUnprefixed- smode))
6061 (define-pmacro (ext32-binary-insn src-group dst-group op wstr encoding sem)
6062 (dni (.sym op 32 wstr - src-group - dst-group)
6063 (.str op 32 wstr " src32-" src-group "-QI,dst32-" dst-group "-HI")
6065 (.str op wstr " ${src32-" src-group "-QI},${dst32-" dst-group "-HI}")
6067 (sem QI HI (.sym src32- src-group -QI) (.sym dst32 - dst-group -HI))
6071 (define-pmacro (ext32-binary-defn op wstr opc1 opc2 sem)
6073 (ext32-binary-insn basic-ExtPrefixed 24-Prefixed op wstr
6074 (+ (f-0-4 0) (f-4-4 1) (f-8-1 opc1) (f-15-1 0) src32-basic-ExtPrefixed-QI dst32-24-Prefixed-HI (f-20-4 opc2))
6076 (ext32-binary-insn 24-24-Prefixed 48-Prefixed op wstr
6077 (+ (f-0-4 0) (f-4-4 1) (f-8-1 opc1) (f-15-1 0) src32-24-24-Prefixed-QI dst32-48-Prefixed-HI (f-20-4 opc2))
6079 (ext32-binary-insn 24-16-Prefixed 40-Prefixed op wstr
6080 (+ (f-0-4 0) (f-4-4 1) (f-8-1 opc1) (f-15-1 0) src32-24-16-Prefixed-QI dst32-40-Prefixed-HI (f-20-4 opc2))
6082 (ext32-binary-insn 24-8-Prefixed 32-Prefixed op wstr
6083 (+ (f-0-4 0) (f-4-4 1) (f-8-1 opc1) (f-15-1 0) src32-24-8-Prefixed-QI dst32-32-Prefixed-HI (f-20-4 opc2))
6088 ;=============================================================
6089 ; Binary Arithmetic macros
6091 ;-------------------------------------------------------------
6092 ;<arith>.size:S src2,r0[l] -- for m32c
6093 ;-------------------------------------------------------------
6095 (define-pmacro (binary-arith32-S-src2 op xmode wstr wbit opc1 opc2 sem)
6096 (dni (.sym op 32 wstr .S-src2-r0- xmode)
6097 (.str op 32 wstr ":S src2,r0[l]")
6099 (.str op wstr"$S ${src32-2-S-" xmode "},${Dst32R0" xmode "-S}")
6100 (+ opc1 opc2 (.sym src32-2-S- xmode) (f-7-1 wbit))
6101 (sem xmode (.sym src32-2-S- xmode) (.sym Dst32R0 xmode -S))
6105 ;-------------------------------------------------------------
6106 ;<arith>.b:S src2,r0l/r0h -- for m16c
6107 ;-------------------------------------------------------------
6109 (define-pmacro (binary-arith16-b-S-src2 op opc1 opc2 sem)
6111 (dni (.sym op 16 .b.S-src2)
6112 (.str op ".b:S src2,r0[lh]")
6114 (.str op ".b$S ${src16-2-S},${Dst16RnQI-S}")
6115 (+ opc1 opc2 Dst16RnQI-S src16-2-S)
6116 (sem QI src16-2-S Dst16RnQI-S)
6118 (dni (.sym op 16 .b.S-r0l-r0h)
6119 (.str op ".b:S r0l/r0h")
6121 (.str op ".b$S ${srcdst16-r0l-r0h-S}")
6122 (+ opc1 opc2 srcdst16-r0l-r0h-S)
6123 (if (eq srcdst16-r0l-r0h-S 0)
6130 ;-------------------------------------------------------------
6131 ;<arith>.b:S #imm8,dst3 -- for m16c
6132 ;-------------------------------------------------------------
6134 (define-pmacro (binary-arith16-b-S-imm8-dst3 op sz opc1 opc2 sem)
6135 (dni (.sym op 16 .b.S-imm8-dst3)
6136 (.str op sz ":S imm8,dst3")
6138 (.str op sz "$S #${Imm-8-QI},${Dst16-3-S-16}")
6139 (+ opc1 opc2 Dst16-3-S-16 Imm-8-QI)
6140 (sem QI Imm-8-QI Dst16-3-S-16)
6144 ;-------------------------------------------------------------
6145 ;<arith>.size:Q #imm4,sp -- for m16c
6146 ;-------------------------------------------------------------
6148 (define-pmacro (binary-arith16-Q-sp op opc1 opc2 opc3 sem)
6149 (dni (.sym op 16 -wQ-sp)
6150 (.str op ".w:q #imm4,sp")
6152 (.str op ".w$Q #${Imm-12-s4},sp")
6153 (+ opc1 opc2 opc3 Imm-12-s4)
6154 (sem QI Imm-12-s4 sp)
6158 ;-------------------------------------------------------------
6159 ;<arith>.size:G #imm,sp -- for m16c
6160 ;-------------------------------------------------------------
6162 (define-pmacro (binary-arith16-G-sp-defn mode wstr wbit op opc1 opc2 opc3 opc4 sem)
6163 (dni (.sym op 16 wstr - G-sp)
6164 (.str op wstr " imm-sp " mode)
6166 (.str op wstr "$G #${Imm-16-" mode "},sp")
6167 (+ opc1 opc2 (f-7-1 wbit) opc3 opc4 (.sym Imm-16- mode))
6168 (sem mode (.sym Imm-16- mode) sp)
6172 (define-pmacro (binary-arith16-G-sp op opc1 opc2 opc3 opc4 sem)
6174 (binary-arith16-G-sp-defn QI .b 0 op opc1 opc2 opc3 opc4 sem)
6175 (binary-arith16-G-sp-defn HI .w 1 op opc1 opc2 opc3 opc4 sem)
6179 ;-------------------------------------------------------------
6180 ;<arith>.size:G #imm,dst -- for m16c and m32c
6181 ;-------------------------------------------------------------
6183 (define-pmacro (binary-arith-imm-dst-defn mach src dstgroup dmode wstr op suffix encoding sem)
6184 (dni (.sym op mach wstr - imm-G - dstgroup)
6185 (.str op wstr " " mach "-imm-G-" dstgroup "-" dmode)
6186 ((machine mach) RL_1ADDR)
6187 (.str op wstr "$"suffix " #${" src "},${dst" mach "-" dstgroup "-" dmode "}")
6189 (sem dmode src (.sym dst mach - dstgroup - dmode))
6194 (define-pmacro (binary-arith16-imm-dst-defn smode dmode wstr wbit op suffix opc1 opc2 opc3 sem)
6196 (binary-arith-imm-dst-defn 16 (.sym Imm-32- smode) 16-16 dmode wstr op suffix
6197 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16-16- dmode) (.sym Imm-32- smode))
6199 (binary-arith-imm-dst-defn 16 (.sym Imm-24- smode) 16-8 dmode wstr op suffix
6200 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16-8- dmode) (.sym Imm-24- smode))
6202 (binary-arith-imm-dst-defn 16 (.sym Imm-16- smode) basic dmode wstr op suffix
6203 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-basic- dmode) (.sym Imm-16- smode))
6208 ; m32c Unprefixed variants
6209 (define-pmacro (binary-arith32-imm-dst-Unprefixed smode dmode wstr wbit op suffix opc1 opc2 opc3 sem)
6211 (binary-arith-imm-dst-defn 32 (.sym Imm-40- smode) 16-24-Unprefixed dmode wstr op suffix
6212 (+ (f-0-4 opc1) (f-10-2 opc2) (f-7-1 wbit) (f-12-4 opc3) (.sym dst32-16-24-Unprefixed- dmode) (.sym Imm-40- smode))
6214 (binary-arith-imm-dst-defn 32 (.sym Imm-32- smode) 16-16-Unprefixed dmode wstr op suffix
6215 (+ (f-0-4 opc1) (f-10-2 opc2) (f-7-1 wbit) (f-12-4 opc3) (.sym dst32-16-16-Unprefixed- dmode) (.sym Imm-32- smode))
6217 (binary-arith-imm-dst-defn 32 (.sym Imm-24- smode) 16-8-Unprefixed dmode wstr op suffix
6218 (+ (f-0-4 opc1) (f-10-2 opc2) (f-7-1 wbit) (f-12-4 opc3) (.sym dst32-16-8-Unprefixed- dmode) (.sym Imm-24- smode))
6220 (binary-arith-imm-dst-defn 32 (.sym Imm-16- smode) basic-Unprefixed dmode wstr op suffix
6221 (+ (f-0-4 opc1) (f-10-2 opc2) (f-7-1 wbit) (f-12-4 opc3) (.sym dst32-basic-Unprefixed- dmode) (.sym Imm-16- smode))
6226 ; m32c Prefixed variants
6227 (define-pmacro (binary-arith32-imm-dst-Prefixed smode dmode wstr wbit op suffix opc1 opc2 opc3 sem)
6229 (binary-arith-imm-dst-defn 32 (.sym Imm-48- smode) 24-24-Prefixed dmode wstr op suffix
6230 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-24-24-Prefixed- dmode) (.sym Imm-48- smode))
6232 (binary-arith-imm-dst-defn 32 (.sym Imm-40- smode) 24-16-Prefixed dmode wstr op suffix
6233 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-24-16-Prefixed- dmode) (.sym Imm-40- smode))
6235 (binary-arith-imm-dst-defn 32 (.sym Imm-32- smode) 24-8-Prefixed dmode wstr op suffix
6236 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-24-8-Prefixed- dmode) (.sym Imm-32- smode))
6238 (binary-arith-imm-dst-defn 32 (.sym Imm-24- smode) basic-Prefixed dmode wstr op suffix
6239 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-basic-Prefixed- dmode) (.sym Imm-24- smode))
6245 (define-pmacro (binary-arith32-imm-dst-defn smode dmode wstr wbit op suffix opc1 opc2 opc3 sem)
6247 ; Multi insns are tried for assembly in the reverse order in which they appear here, so
6248 ; define the absolute-indirect insns first in order to prevent them from being selected
6249 ; when the mode is register-indirect
6250 ; (binary-arith-imm-dst-defn 32 (.sym Imm-48- smode) 24-24-absolute-indirect dmode wstr op suffix
6251 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-24-24-absolute-indirect- dmode) (.sym Imm-48- smode))
6253 ; (binary-arith-imm-dst-defn 32 (.sym Imm-40- smode) 24-16-absolute-indirect dmode wstr op suffix
6254 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-24-16-absolute-indirect- dmode) (.sym Imm-40- smode))
6256 ; Unprefixed modes next
6257 (binary-arith32-imm-dst-Unprefixed smode dmode wstr wbit op suffix opc1 opc2 opc3 sem)
6259 ; Remaining indirect modes
6260 ; (binary-arith-imm-dst-defn 32 (.sym Imm-24- smode) basic-indirect dmode wstr op suffix
6261 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-basic-indirect- dmode) (.sym Imm-24- smode))
6263 ; (binary-arith-imm-dst-defn 32 (.sym Imm-48- smode) 24-24-indirect dmode wstr op suffix
6264 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-24-24-indirect- dmode) (.sym Imm-48- smode))
6266 ; (binary-arith-imm-dst-defn 32 (.sym Imm-40- smode) 24-16-indirect dmode wstr op suffix
6267 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-24-16-indirect- dmode) (.sym Imm-40- smode))
6269 ; (binary-arith-imm-dst-defn 32 (.sym Imm-32- smode) 24-8-indirect dmode wstr op suffix
6270 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3) (.sym dst32-24-8-indirect- dmode) (.sym Imm-32- smode))
6275 (define-pmacro (binary-arith-imm-dst-mach mach op suffix opc1 opc2 opc3 sem)
6277 (.apply (.sym binary-arith mach -imm-dst-defn) (QI QI .b 0 op suffix opc1 opc2 opc3 sem))
6278 (.apply (.sym binary-arith mach -imm-dst-defn) (HI HI .w 1 op suffix opc1 opc2 opc3 sem))
6282 (define-pmacro (binary-arith-imm-dst op suffix opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
6284 (binary-arith-imm-dst-mach 16 op suffix opc16-1 opc16-2 opc16-3 sem)
6285 (binary-arith-imm-dst-mach 32 op suffix opc32-1 opc32-2 opc32-3 sem)
6289 ;-------------------------------------------------------------
6290 ;<arith>.size:Q #imm4,dst -- for m16c and m32c
6291 ;-------------------------------------------------------------
6293 (define-pmacro (binary-arith-imm4-dst-defn mach src dstgroup mode wstr op encoding sem)
6294 (dni (.sym op mach wstr - imm4-Q - dstgroup)
6295 (.str op wstr " " mach "-imm4-Q-" dstgroup "-" mode)
6296 ((machine mach) RL_1ADDR)
6297 (.str op wstr "$Q #${" src "},${dst" mach "-" dstgroup "-" mode "}")
6299 (sem mode src (.sym dst mach - dstgroup - mode))
6304 (define-pmacro (binary-arith16-imm4-dst-defn mode wstr wbit1 wbit2 op opc1 opc2 sem)
6305 (binary-arith-imm4-dst-defn 16 Imm-8-s4 16 mode wstr op
6306 (+ opc1 opc2 (f-7-1 wbit2) Imm-8-s4 (.sym dst16-16- mode))
6310 (define-pmacro (binary-arith16-shimm4-dst-defn mode wstr wbit1 wbit2 op opc1 opc2 sem)
6311 (binary-arith-imm4-dst-defn 16 Imm-sh-8-s4 16 mode wstr op
6312 (+ opc1 opc2 (f-7-1 wbit2) Imm-sh-8-s4 (.sym dst16-16- mode))
6317 (define-pmacro (binary-arith32-imm4-dst-defn mode wstr wbit1 wbit2 op opc1 opc2 sem)
6319 ; Multi insns are tried for assembly in the reverse order in which they appear here, so
6320 ; define the absolute-indirect insns first in order to prevent them from being selected
6321 ; when the mode is register-indirect
6322 ; (binary-arith-imm4-dst-defn 32 Imm-20-s4 24-absolute-indirect mode wstr op
6323 ; (+ (f-0-4 0) (f-4-4 9) (f-8-3 opc1) (f-11-1 wbit1) (f-15-1 wbit2) (.sym dst32-24-absolute-indirect- mode) (f-18-2 opc2) Imm-20-s4)
6325 (binary-arith-imm4-dst-defn 32 Imm-12-s4 16-Unprefixed mode wstr op
6326 (+ (f-0-3 opc1) (f-3-1 wbit1) (f-7-1 wbit2) (.sym dst32-16-Unprefixed- mode) (f-10-2 opc2) Imm-12-s4)
6328 ; (binary-arith-imm4-dst-defn 32 Imm-20-s4 24-indirect mode wstr op
6329 ; (+ (f-0-4 0) (f-4-4 9) (f-8-3 opc1) (f-11-1 wbit1) (f-15-1 wbit2) (.sym dst32-24-indirect- mode) (f-18-2 opc2) Imm-20-s4)
6334 (define-pmacro (binary-arith32-shimm4-dst-defn mode wstr wbit1 wbit2 op opc1 opc2 sem)
6336 ; Multi insns are tried for assembly in the reverse order in which they appear here, so
6337 ; define the absolute-indirect insns first in order to prevent them from being selected
6338 ; when the mode is register-indirect
6339 ; (binary-arith-imm4-dst-defn 32 Imm-sh-20-s4 24-absolute-indirect mode wstr op
6340 ; (+ (f-0-4 0) (f-4-4 9) (f-8-3 opc1) (f-11-1 wbit1) (f-15-1 wbit2) (.sym dst32-24-absolute-indirect- mode) (f-18-2 opc2) Imm-sh-20-s4)
6342 (binary-arith-imm4-dst-defn 32 Imm-sh-12-s4 16-Unprefixed mode wstr op
6343 (+ (f-0-3 opc1) (f-3-1 wbit1) (f-7-1 wbit2) (.sym dst32-16-Unprefixed- mode) (f-10-2 opc2) Imm-sh-12-s4)
6345 ; (binary-arith-imm4-dst-defn 32 Imm-sh-20-s4 24-indirect mode wstr op
6346 ; (+ (f-0-4 0) (f-4-4 9) (f-8-3 opc1) (f-11-1 wbit1) (f-15-1 wbit2) (.sym dst32-24-indirect- mode) (f-18-2 opc2) Imm-sh-20-s4)
6351 (define-pmacro (binary-arith-imm4-dst-mach mach op opc1 opc2 sem)
6353 (.apply (.sym binary-arith mach -imm4-dst-defn) (QI .b 0 0 op opc1 opc2 sem))
6354 (.apply (.sym binary-arith mach -imm4-dst-defn) (HI .w 0 1 op opc1 opc2 sem))
6358 (define-pmacro (binary-arith-imm4-dst op opc16-1 opc16-2 opc32-1 opc32-2 sem)
6360 (binary-arith-imm4-dst-mach 16 op opc16-1 opc16-2 sem)
6361 (binary-arith-imm4-dst-mach 32 op opc32-1 opc32-2 sem)
6365 ;-------------------------------------------------------------
6366 ;<arith>.size:G src,dst -- for m16c and m32c
6367 ;-------------------------------------------------------------
6369 (define-pmacro (binary-arith-src-dst-defn mach srcgroup dstgroup smode dmode wstr op suffix encoding sem)
6370 (dni (.sym op mach wstr - srcgroup - dstgroup)
6371 (.str op wstr " dst" mach "-" srcgroup "-" dstgroup "-" dmode)
6372 ((machine mach) RL_2ADDR)
6373 (.str op wstr "$" suffix " ${src" mach "-" srcgroup "-" smode "},${dst" mach "-" dstgroup "-" dmode "}")
6375 (sem dmode (.sym src mach - srcgroup - smode) (.sym dst mach - dstgroup - dmode))
6380 (define-pmacro (binary-arith16-src-dst-defn smode dmode wstr wbit op suffix opc1 opc2 sem)
6382 (binary-arith-src-dst-defn 16 basic 16 smode dmode wstr op suffix
6383 (+ opc1 opc2 (f-7-1 wbit) (.sym src16-basic- smode) (.sym dst16-16- dmode))
6385 (binary-arith-src-dst-defn 16 16-16 32 smode dmode wstr op suffix
6386 (+ opc1 opc2 (f-7-1 wbit) (.sym src16-16-16- smode) (.sym dst16-32- dmode))
6388 (binary-arith-src-dst-defn 16 16-8 24 smode dmode wstr op suffix
6389 (+ opc1 opc2 (f-7-1 wbit) (.sym src16-16-8- smode) (.sym dst16-24- dmode))
6394 ; m32c Prefixed variants
6395 (define-pmacro (binary-arith32-src-dst-Prefixed smode dmode wstr wbit op suffix opc1 opc2 sem)
6397 (binary-arith-src-dst-defn 32 basic-Prefixed 24-Prefixed smode dmode wstr op suffix
6398 (+ (f-0-4 0) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit) (.sym src32-basic-Prefixed- smode) (.sym dst32-24-Prefixed- dmode) (f-20-4 opc2))
6400 (binary-arith-src-dst-defn 32 24-24-Prefixed 48-Prefixed smode dmode wstr op suffix
6401 (+ (f-0-4 0) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit) (.sym src32-24-24-Prefixed- smode) (.sym dst32-48-Prefixed- dmode) (f-20-4 opc2))
6403 (binary-arith-src-dst-defn 32 24-16-Prefixed 40-Prefixed smode dmode wstr op suffix
6404 (+ (f-0-4 0) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit) (.sym src32-24-16-Prefixed- smode) (.sym dst32-40-Prefixed- dmode) (f-20-4 opc2))
6406 (binary-arith-src-dst-defn 32 24-8-Prefixed 32-Prefixed smode dmode wstr op suffix
6407 (+ (f-0-4 0) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit) (.sym src32-24-8-Prefixed- smode) (.sym dst32-32-Prefixed- dmode) (f-20-4 opc2))
6413 (define-pmacro (binary-arith32-src-dst-defn smode dmode wstr wbit op suffix opc1 opc2 sem)
6415 ; Multi insns are tried for assembly in the reverse order in which they appear here, so
6416 ; define the absolute-indirect insns first in order to prevent them from being selected
6417 ; when the mode is register-indirect
6418 ; (binary-arith-src-dst-defn 32 24-24-absolute-indirect 48-absolute-indirect smode dmode wstr op suffix
6419 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6420 ; (.sym src32-24-24-absolute-indirect- smode) (.sym dst32-48-absolute-indirect- dmode) (f-20-4 opc2))
6422 ; (binary-arith-src-dst-defn 32 24-16-absolute-indirect 40-absolute-indirect smode dmode wstr op suffix
6423 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6424 ; (.sym src32-24-16-absolute-indirect- smode) (.sym dst32-40-absolute-indirect- dmode) (f-20-4 opc2))
6426 ; (binary-arith-src-dst-defn 32 24-24-absolute-indirect 48-Prefixed smode dmode wstr op suffix
6427 ; (+ (f-0-4 4) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit)
6428 ; (.sym src32-24-24-absolute-indirect- smode) (.sym dst32-48-Prefixed- dmode) (f-20-4 opc2))
6430 ; (binary-arith-src-dst-defn 32 24-16-absolute-indirect 40-Prefixed smode dmode wstr op suffix
6431 ; (+ (f-0-4 4) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit)
6432 ; (.sym src32-24-16-absolute-indirect- smode) (.sym dst32-40-Prefixed- dmode) (f-20-4 opc2))
6434 ; (binary-arith-src-dst-defn 32 24-24-absolute-indirect 48-indirect smode dmode wstr op suffix
6435 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6436 ; (.sym src32-24-24-absolute-indirect- smode) (.sym dst32-48-indirect- dmode) (f-20-4 opc2))
6438 ; (binary-arith-src-dst-defn 32 24-16-absolute-indirect 40-indirect smode dmode wstr op suffix
6439 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6440 ; (.sym src32-24-16-absolute-indirect- smode) (.sym dst32-40-indirect- dmode) (f-20-4 opc2))
6442 ; (binary-arith-src-dst-defn 32 basic-Prefixed 24-absolute-indirect smode dmode wstr op suffix
6443 ; (+ (f-0-4 0) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6444 ; (.sym src32-basic-Prefixed- smode) (.sym dst32-24-absolute-indirect- dmode) (f-20-4 opc2))
6446 ; (binary-arith-src-dst-defn 32 24-24-Prefixed 48-absolute-indirect smode dmode wstr op suffix
6447 ; (+ (f-0-4 0) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6448 ; (.sym src32-24-24-Prefixed- smode) (.sym dst32-48-absolute-indirect- dmode) (f-20-4 opc2))
6450 ; (binary-arith-src-dst-defn 32 24-16-Prefixed 40-absolute-indirect smode dmode wstr op suffix
6451 ; (+ (f-0-4 0) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6452 ; (.sym src32-24-16-Prefixed- smode) (.sym dst32-40-absolute-indirect- dmode) (f-20-4 opc2))
6454 ; (binary-arith-src-dst-defn 32 24-8-Prefixed 32-absolute-indirect smode dmode wstr op suffix
6455 ; (+ (f-0-4 0) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6456 ; (.sym src32-24-8-Prefixed- smode) (.sym dst32-32-absolute-indirect- dmode) (f-20-4 opc2))
6458 ; (binary-arith-src-dst-defn 32 basic-indirect 24-absolute-indirect smode dmode wstr op suffix
6459 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6460 ; (.sym src32-basic-indirect- smode) (.sym dst32-24-absolute-indirect- dmode) (f-20-4 opc2))
6462 ; (binary-arith-src-dst-defn 32 24-24-indirect 48-absolute-indirect smode dmode wstr op suffix
6463 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6464 ; (.sym src32-24-24-indirect- smode) (.sym dst32-48-absolute-indirect- dmode) (f-20-4 opc2))
6466 ; (binary-arith-src-dst-defn 32 24-16-indirect 40-absolute-indirect smode dmode wstr op suffix
6467 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6468 ; (.sym src32-24-16-indirect- smode) (.sym dst32-40-absolute-indirect- dmode) (f-20-4 opc2))
6470 ; (binary-arith-src-dst-defn 32 24-8-indirect 32-absolute-indirect smode dmode wstr op suffix
6471 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6472 ; (.sym src32-24-8-indirect- smode) (.sym dst32-32-absolute-indirect- dmode) (f-20-4 opc2))
6474 (binary-arith-src-dst-defn 32 basic-Unprefixed 16-Unprefixed smode dmode wstr op suffix
6475 (+ (f-0-1 opc1) (f-7-1 wbit) (.sym src32-basic-Unprefixed- smode) (.sym dst32-16-Unprefixed- dmode) (f-12-4 opc2))
6477 (binary-arith-src-dst-defn 32 16-24-Unprefixed 40-Unprefixed smode dmode wstr op suffix
6478 (+ (f-0-1 opc1) (f-7-1 wbit) (.sym src32-16-24-Unprefixed- smode) (.sym dst32-40-Unprefixed- dmode) (f-12-4 opc2))
6480 (binary-arith-src-dst-defn 32 16-16-Unprefixed 32-Unprefixed smode dmode wstr op suffix
6481 (+ (f-0-1 opc1) (f-7-1 wbit) (.sym src32-16-16-Unprefixed- smode) (.sym dst32-32-Unprefixed- dmode) (f-12-4 opc2))
6483 (binary-arith-src-dst-defn 32 16-8-Unprefixed 24-Unprefixed smode dmode wstr op suffix
6484 (+ (f-0-1 opc1) (f-7-1 wbit) (.sym src32-16-8-Unprefixed- smode) (.sym dst32-24-Unprefixed- dmode) (f-12-4 opc2))
6486 ; (binary-arith-src-dst-defn 32 basic-indirect 24-Prefixed smode dmode wstr op suffix
6487 ; (+ (f-0-4 4) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit)
6488 ; (.sym src32-basic-indirect- smode) (.sym dst32-24-Prefixed- dmode) (f-20-4 opc2))
6490 ; (binary-arith-src-dst-defn 32 24-24-indirect 48-Prefixed smode dmode wstr op suffix
6491 ; (+ (f-0-4 4) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit)
6492 ; (.sym src32-24-24-indirect- smode) (.sym dst32-48-Prefixed- dmode) (f-20-4 opc2))
6494 ; (binary-arith-src-dst-defn 32 24-16-indirect 40-Prefixed smode dmode wstr op suffix
6495 ; (+ (f-0-4 4) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit)
6496 ; (.sym src32-24-16-indirect- smode) (.sym dst32-40-Prefixed- dmode) (f-20-4 opc2))
6498 ; (binary-arith-src-dst-defn 32 24-8-indirect 32-Prefixed smode dmode wstr op suffix
6499 ; (+ (f-0-4 4) (f-4-4 1) (f-8-1 opc1) (f-15-1 wbit)
6500 ; (.sym src32-24-8-indirect- smode) (.sym dst32-32-Prefixed- dmode) (f-20-4 opc2))
6502 ; (binary-arith-src-dst-defn 32 basic-Prefixed 24-indirect smode dmode wstr op suffix
6503 ; (+ (f-0-4 0) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6504 ; (.sym src32-basic-Prefixed- smode) (.sym dst32-24-indirect- dmode) (f-20-4 opc2))
6506 ; (binary-arith-src-dst-defn 32 24-24-Prefixed 48-indirect smode dmode wstr op suffix
6507 ; (+ (f-0-4 0) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6508 ; (.sym src32-24-24-Prefixed- smode) (.sym dst32-48-indirect- dmode) (f-20-4 opc2))
6510 ; (binary-arith-src-dst-defn 32 24-16-Prefixed 40-indirect smode dmode wstr op suffix
6511 ; (+ (f-0-4 0) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6512 ; (.sym src32-24-16-Prefixed- smode) (.sym dst32-40-indirect- dmode) (f-20-4 opc2))
6514 ; (binary-arith-src-dst-defn 32 24-8-Prefixed 32-indirect smode dmode wstr op suffix
6515 ; (+ (f-0-4 0) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6516 ; (.sym src32-24-8-Prefixed- smode) (.sym dst32-32-indirect- dmode) (f-20-4 opc2))
6518 ; (binary-arith-src-dst-defn 32 basic-indirect 24-indirect smode dmode wstr op suffix
6519 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6520 ; (.sym src32-basic-indirect- smode) (.sym dst32-24-indirect- dmode) (f-20-4 opc2))
6522 ; (binary-arith-src-dst-defn 32 24-24-indirect 48-indirect smode dmode wstr op suffix
6523 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6524 ; (.sym src32-24-24-indirect- smode) (.sym dst32-48-indirect- dmode) (f-20-4 opc2))
6526 ; (binary-arith-src-dst-defn 32 24-16-indirect 40-indirect smode dmode wstr op suffix
6527 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6528 ; (.sym src32-24-16-indirect- smode) (.sym dst32-40-indirect- dmode) (f-20-4 opc2))
6530 ; (binary-arith-src-dst-defn 32 24-8-indirect 32-indirect smode dmode wstr op suffix
6531 ; (+ (f-0-4 4) (f-4-4 9) (f-8-1 opc1) (f-15-1 wbit)
6532 ; (.sym src32-24-8-indirect- smode) (.sym dst32-32-indirect- dmode) (f-20-4 opc2))
6537 (define-pmacro (binary-arith-src-dst-mach mach op suffix opc1 opc2 sem)
6539 (.apply (.sym binary-arith mach -src-dst-defn) (QI QI .b 0 op suffix opc1 opc2 sem))
6540 (.apply (.sym binary-arith mach -src-dst-defn) (HI HI .w 1 op suffix opc1 opc2 sem))
6544 (define-pmacro (binary-arith-src-dst op suffix opc16-1 opc16-2 opc32-1 opc32-2 sem)
6546 (binary-arith-src-dst-mach 16 op suffix opc16-1 opc16-2 sem)
6547 (binary-arith-src-dst-mach 32 op suffix opc32-1 opc32-2 sem)
6551 ;-------------------------------------------------------------
6552 ;<arith>.size:S #imm,dst -- for m32c
6553 ;-------------------------------------------------------------
6555 (define-pmacro (binary-arith32-s-imm-dst-defn src dstgroup mode wstr op encoding sem)
6556 (dni (.sym op 32 wstr - imm-S - dstgroup)
6557 (.str op wstr " 32-imm-S-" dstgroup "-" mode)
6559 (.str op wstr "$S #${" src "},${dst32-" dstgroup "-" mode "}")
6561 (sem mode src (.sym dst32- dstgroup - mode))
6565 (define-pmacro (binary-arith32-z-imm-dst-defn src dstgroup mode wstr op encoding sem)
6566 (dni (.sym op 32 wstr - imm-Z - dstgroup)
6567 (.str op wstr " 32-imm-Z-" dstgroup "-" mode)
6569 (.str op wstr "$Z #0,${dst32-" dstgroup "-" mode "}")
6571 (sem mode (const 0) (.sym dst32- dstgroup - mode))
6575 (define-pmacro (binary-arith32-s-imm-dst mode wstr wbit op opc1 opc2 sem)
6577 ; (binary-arith32-s-imm-dst-defn (.sym Imm-32- mode) 2-S-absolute-indirect mode wstr op
6578 ; (+ (f-0-4 0) (f-4-4 9) (f-8-2 opc1) (.sym dst32-2-S-absolute-indirect- mode) (f-12-3 opc2) (f-15-1 wbit) (.sym Imm-32- mode))
6580 (binary-arith32-s-imm-dst-defn (.sym Imm-8- mode) 2-S-basic mode wstr op
6581 (+ (f-0-2 opc1) (.sym dst32-2-S-basic- mode) (f-4-3 opc2) (f-7-1 wbit) (.sym Imm-8- mode))
6583 (binary-arith32-s-imm-dst-defn (.sym Imm-24- mode) 2-S-16 mode wstr op
6584 (+ (f-0-2 opc1) (.sym dst32-2-S-16- mode) (f-4-3 opc2) (f-7-1 wbit) (.sym Imm-24- mode))
6586 (binary-arith32-s-imm-dst-defn (.sym Imm-16- mode) 2-S-8 mode wstr op
6587 (+ (f-0-2 opc1) (.sym dst32-2-S-8- mode) (f-4-3 opc2) (f-7-1 wbit) (.sym Imm-16- mode))
6589 ; (binary-arith32-s-imm-dst-defn (.sym Imm-24- mode) 2-S-8-indirect mode wstr op
6590 ; (+ (f-0-4 0) (f-4-4 9) (f-8-2 opc1) (.sym dst32-2-S-8-indirect- mode) (f-12-3 opc2) (f-15-1 wbit) (.sym Imm-24- mode))
6595 (define-pmacro (binary-arith32-z-imm-dst mode wstr wbit op opc1 opc2 sem)
6597 ; (binary-arith32-z-imm-dst-defn (.sym Imm-32- mode) 2-S-absolute-indirect mode wstr op
6598 ; (+ (f-0-4 0) (f-4-4 9) (f-8-2 opc1) (.sym dst32-2-S-absolute-indirect- mode) (f-12-3 opc2) (f-15-1 wbit) (.sym Imm-32- mode))
6600 (binary-arith32-z-imm-dst-defn (.sym Imm-8- mode) 2-S-basic mode wstr op
6601 (+ (f-0-2 opc1) (.sym dst32-2-S-basic- mode) (f-4-3 opc2) (f-7-1 wbit))
6603 (binary-arith32-z-imm-dst-defn (.sym Imm-24- mode) 2-S-16 mode wstr op
6604 (+ (f-0-2 opc1) (.sym dst32-2-S-16- mode) (f-4-3 opc2) (f-7-1 wbit))
6606 (binary-arith32-z-imm-dst-defn (.sym Imm-16- mode) 2-S-8 mode wstr op
6607 (+ (f-0-2 opc1) (.sym dst32-2-S-8- mode) (f-4-3 opc2) (f-7-1 wbit))
6609 ; (binary-arith32-z-imm-dst-defn (.sym Imm-24- mode) 2-S-8-indirect mode wstr op
6610 ; (+ (f-0-4 0) (f-4-4 9) (f-8-2 opc1) (.sym dst32-2-S-8-indirect- mode) (f-12-3 opc2) (f-15-1 wbit) (.sym Imm-24- mode))
6615 ;-------------------------------------------------------------
6616 ;<arith>.L:S #imm1,An -- for m32c
6617 ;-------------------------------------------------------------
6619 (define-pmacro (binary-arith32-l-s-imm1-an op opc1 opc2 sem)
6621 (dni (.sym op 32.l-s-imm1-S-an)
6622 (.str op ".l 32-imm1-S-an")
6624 (.str op ".l$S #${Imm1-S},${dst32-an-S}")
6625 (+ opc1 Imm1-S opc2 dst32-an-S)
6626 (sem SI Imm1-S dst32-an-S)
6631 ;-------------------------------------------------------------
6632 ;<arith>.L:Q #imm3,sp -- for m32c
6633 ;-------------------------------------------------------------
6635 (define-pmacro (binary-arith32-l-q-imm3-sp op opc1 opc2 sem)
6637 (dni (.sym op 32.l-imm3-Q)
6638 (.str op ".l 32-imm3-Q")
6640 (.str op ".l$Q #${Imm3-S},sp")
6641 (+ opc1 Imm3-S opc2)
6647 ;-------------------------------------------------------------
6648 ;<arith>.L:S #imm8,sp -- for m32c
6649 ;-------------------------------------------------------------
6651 (define-pmacro (binary-arith32-l-s-imm8-sp op opc1 opc2 opc3 opc4 sem)
6653 (dni (.sym op 32.l-imm8-S)
6654 (.str op ".l 32-imm8-S")
6656 (.str op ".l$S #${Imm-16-QI},sp")
6657 (+ opc1 opc2 opc3 opc4 Imm-16-QI)
6658 (sem SI Imm-16-QI sp)
6663 ;-------------------------------------------------------------
6664 ;<arith>.L:G #imm16,sp -- for m32c
6665 ;-------------------------------------------------------------
6667 (define-pmacro (binary-arith32-l-g-imm16-sp op opc1 opc2 opc3 opc4 sem)
6669 (dni (.sym op 32.l-imm16-G)
6670 (.str op ".l 32-imm16-G")
6672 (.str op ".l$G #${Imm-16-HI},sp")
6673 (+ opc1 opc2 opc3 opc4 Imm-16-HI)
6674 (sem SI Imm-16-HI sp)
6679 ;-------------------------------------------------------------
6680 ;<arith>jnz.size #imm4,dst,label -- for m16c and m32c
6681 ;-------------------------------------------------------------
6683 (define-pmacro (arith-jnz-imm4-dst-defn mach src dstgroup label mode wstr op encoding sem)
6684 (dni (.sym op mach wstr - imm4 - dstgroup)
6685 (.str op wstr " " mach "-imm4-" dstgroup "-" label "-" mode)
6686 (RL_JUMP RELAXABLE (machine mach))
6687 (.str op wstr " #${" src "},${dst" mach "-" dstgroup "-" mode "},${" label "}")
6689 (sem mode src (.sym dst mach - dstgroup - mode) label)
6694 (define-pmacro (arith-jnz16-imm4-dst-defn mode wstr wbit op i4n opc1 opc2 sem)
6696 (arith-jnz-imm4-dst-defn 16 (.sym Imm-8- i4n) basic Lab-16-8 mode wstr op
6697 (+ opc1 opc2 (f-7-1 wbit) (.sym Imm-8- i4n) (.sym dst16-basic- mode) Lab-16-8)
6699 (arith-jnz-imm4-dst-defn 16 (.sym Imm-8- i4n) 16-16 Lab-32-8 mode wstr op
6700 (+ opc1 opc2 (f-7-1 wbit) (.sym Imm-8- i4n) (.sym dst16-16-16- mode) Lab-32-8)
6702 (arith-jnz-imm4-dst-defn 16 (.sym Imm-8- i4n) 16-8 Lab-24-8 mode wstr op
6703 (+ opc1 opc2 (f-7-1 wbit) (.sym Imm-8- i4n) (.sym dst16-16-8- mode) Lab-24-8)
6709 (define-pmacro (arith-jnz32-imm4-dst-defn mode wstr wbit op i4n opc1 opc2 sem)
6711 (arith-jnz-imm4-dst-defn 32 (.sym Imm-12- i4n) basic-Unprefixed Lab-16-8 mode wstr op
6712 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-basic-Unprefixed- mode) (f-10-2 opc2) (.sym Imm-12- i4n) Lab-16-8)
6714 (arith-jnz-imm4-dst-defn 32 (.sym Imm-12- i4n) 16-24-Unprefixed Lab-40-8 mode wstr op
6715 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-24-Unprefixed- mode) (f-10-2 opc2) (.sym Imm-12- i4n) Lab-40-8)
6717 (arith-jnz-imm4-dst-defn 32 (.sym Imm-12- i4n) 16-16-Unprefixed Lab-32-8 mode wstr op
6718 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-16-Unprefixed- mode) (f-10-2 opc2) (.sym Imm-12- i4n) Lab-32-8)
6720 (arith-jnz-imm4-dst-defn 32 (.sym Imm-12- i4n) 16-8-Unprefixed Lab-24-8 mode wstr op
6721 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-8-Unprefixed- mode) (f-10-2 opc2) (.sym Imm-12- i4n) Lab-24-8)
6726 (define-pmacro (arith-jnz-imm4-dst-mach mach op i4n opc1 opc2 sem)
6728 (.apply (.sym arith-jnz mach -imm4-dst-defn) (QI .b 0 op i4n opc1 opc2 sem))
6729 (.apply (.sym arith-jnz mach -imm4-dst-defn) (HI .w 1 op i4n opc1 opc2 sem))
6733 (define-pmacro (arith-jnz-imm4-dst op i4n opc16-1 opc16-2 opc32-1 opc32-2 sem)
6735 (arith-jnz-imm4-dst-mach 16 op i4n opc16-1 opc16-2 sem)
6736 (arith-jnz-imm4-dst-mach 32 op i4n opc32-1 opc32-2 sem)
6740 ;-------------------------------------------------------------
6741 ;mov.size dsp8[sp],dst -- for m16c and m32c
6742 ;-------------------------------------------------------------
6743 (define-pmacro (mov-dspsp-dst-defn mach dstgroup dsp mode wstr op encoding sem)
6744 (dni (.sym op mach wstr -dspsp-dst- dstgroup)
6745 (.str op wstr " " mach "-dsp[sp]-" dstgroup "-" dsp "-" mode)
6747 (.str op wstr "$G ${" dsp "}[sp],${dst" mach "-" dstgroup "-" mode "}")
6749 (sem mach mode dsp (.sym dst mach - dstgroup - mode))
6752 (define-pmacro (mov-src-dspsp-defn mach dstgroup dsp mode wstr op encoding sem)
6753 (dni (.sym op mach wstr -dst-dspsp- dstgroup)
6754 (.str op wstr " " mach "-dsp[sp]-" dstgroup "-" dsp "-" mode)
6756 (.str op wstr "$G ${dst" mach "-" dstgroup "-" mode "},${" dsp "}[sp]")
6758 (sem mach mode (.sym dst mach - dstgroup - mode) dsp)
6763 (define-pmacro (mov16-dspsp-dst-defn mode wstr wbit op opc1 opc2 opc3 sem)
6765 (mov-dspsp-dst-defn 16 basic Dsp-16-s8 mode wstr op
6766 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-basic- mode) Dsp-16-s8)
6768 (mov-dspsp-dst-defn 16 16-16 Dsp-32-s8 mode wstr op
6769 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16-16- mode) Dsp-32-s8)
6771 (mov-dspsp-dst-defn 16 16-8 Dsp-24-s8 mode wstr op
6772 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16-8- mode) Dsp-24-s8)
6777 (define-pmacro (mov16-src-dspsp-defn mode wstr wbit op opc1 opc2 opc3 sem)
6779 (mov-src-dspsp-defn 16 basic Dsp-16-s8 mode wstr op
6780 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-basic- mode) Dsp-16-s8)
6782 (mov-src-dspsp-defn 16 16-16 Dsp-32-s8 mode wstr op
6783 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16-16- mode) Dsp-32-s8)
6785 (mov-src-dspsp-defn 16 16-8 Dsp-24-s8 mode wstr op
6786 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16-8- mode) Dsp-24-s8)
6792 (define-pmacro (mov32-dspsp-dst-defn mode wstr wbit op opc1 opc2 opc3 sem)
6794 (mov-dspsp-dst-defn 32 basic-Unprefixed Dsp-16-s8 mode wstr op
6795 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-basic-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3) Dsp-16-s8)
6797 (mov-dspsp-dst-defn 32 16-24-Unprefixed Dsp-40-s8 mode wstr op
6798 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-24-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3) Dsp-40-s8)
6800 (mov-dspsp-dst-defn 32 16-16-Unprefixed Dsp-32-s8 mode wstr op
6801 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-16-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3) Dsp-32-s8)
6803 (mov-dspsp-dst-defn 32 16-8-Unprefixed Dsp-24-s8 mode wstr op
6804 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-8-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3) Dsp-24-s8)
6808 (define-pmacro (mov32-src-dspsp-defn mode wstr wbit op opc1 opc2 opc3 sem)
6810 (mov-src-dspsp-defn 32 basic-Unprefixed Dsp-16-s8 mode wstr op
6811 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-basic-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3) Dsp-16-s8)
6813 (mov-src-dspsp-defn 32 16-24-Unprefixed Dsp-40-s8 mode wstr op
6814 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-24-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3) Dsp-40-s8)
6816 (mov-src-dspsp-defn 32 16-16-Unprefixed Dsp-32-s8 mode wstr op
6817 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-16-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3) Dsp-32-s8)
6819 (mov-src-dspsp-defn 32 16-8-Unprefixed Dsp-24-s8 mode wstr op
6820 (+ (f-0-4 opc1) (f-7-1 wbit) (.sym dst32-16-8-Unprefixed- mode) (f-10-2 opc2) (f-12-4 opc3) Dsp-24-s8)
6825 (define-pmacro (mov-src-dspsp-mach mach op opc1 opc2 opc3 sem)
6827 (.apply (.sym mov mach -src-dspsp-defn) (QI .b 0 op opc1 opc2 opc3 sem))
6828 (.apply (.sym mov mach -src-dspsp-defn) (HI .w 1 op opc1 opc2 opc3 sem))
6832 (define-pmacro (mov-dspsp-dst-mach mach op opc1 opc2 opc3 sem)
6834 (.apply (.sym mov mach -dspsp-dst-defn) (QI .b 0 op opc1 opc2 opc3 sem))
6835 (.apply (.sym mov mach -dspsp-dst-defn) (HI .w 1 op opc1 opc2 opc3 sem))
6839 (define-pmacro (mov-dspsp-dst op opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
6841 (mov-dspsp-dst-mach 16 op opc16-1 opc16-2 opc16-3 sem)
6842 (mov-dspsp-dst-mach 32 op opc32-1 opc32-2 opc32-3 sem)
6845 (define-pmacro (mov-src-dspsp op opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
6847 (mov-src-dspsp-mach 16 op opc16-1 opc16-2 opc16-3 sem)
6848 (mov-src-dspsp-mach 32 op opc32-1 opc32-2 opc32-3 sem)
6852 ;-------------------------------------------------------------
6853 ; lde dsp24,dst -- for m16c
6854 ;-------------------------------------------------------------
6856 (define-pmacro (lde-dst-dsp mode wstr wbit dstgroup srcdisp)
6859 (dni (.sym lde wstr - dstgroup -u20)
6860 (.str "lde" wstr "-" dstgroup "-u20")
6862 (.str "lde" wstr " ${" srcdisp "},${dst16-" dstgroup "-" mode "}")
6863 (+ (f-0-4 #x7) (f-4-3 #x2) (f-7-1 wbit) (f-8-4 #x8)
6864 (.sym dst16- dstgroup - mode) srcdisp)
6868 (dni (.sym lde wstr - dstgroup -u20a0)
6869 (.str "lde" wstr "-" dstgroup "-u20a0")
6871 (.str "lde" wstr " ${" srcdisp "}[a0],${dst16-" dstgroup "-" mode "}")
6872 (+ (f-0-4 #x7) (f-4-3 #x2) (f-7-1 wbit) (f-8-4 #x9)
6873 (.sym dst16- dstgroup - mode) srcdisp)
6877 (dni (.sym lde wstr - dstgroup -a1a0)
6878 (.str "lde" wstr "-" dstgroup "-a1a0")
6880 (.str "lde" wstr " [a1a0],${dst16-" dstgroup "-" mode "}")
6881 (+ (f-0-4 #x7) (f-4-3 #x2) (f-7-1 wbit) (f-8-4 #xa)
6882 (.sym dst16- dstgroup - mode))
6888 (define-pmacro (lde-dst mode wstr wbit)
6891 (lde-dst-dsp mode wstr wbit basic Dsp-16-u20)
6892 (lde-dst-dsp mode wstr wbit 16-8 Dsp-24-u20)
6893 (lde-dst-dsp mode wstr wbit 16-16 Dsp-32-u20)
6897 ;-------------------------------------------------------------
6898 ; ste dst,dsp24 -- for m16c
6899 ;-------------------------------------------------------------
6901 (define-pmacro (ste-dst-dsp mode wstr wbit dstgroup srcdisp)
6904 (dni (.sym ste wstr - dstgroup -u20)
6905 (.str "ste" wstr "-" dstgroup "-u20")
6907 (.str "ste" wstr " ${dst16-" dstgroup "-" mode "},${" srcdisp "}")
6908 (+ (f-0-4 #x7) (f-4-3 #x2) (f-7-1 wbit) (f-8-4 #x0)
6909 (.sym dst16- dstgroup - mode) srcdisp)
6913 (dni (.sym ste wstr - dstgroup -u20a0)
6914 (.str "ste" wstr "-" dstgroup "-u20a0")
6916 (.str "ste" wstr " ${dst16-" dstgroup "-" mode "},${" srcdisp "}[a0]")
6917 (+ (f-0-4 #x7) (f-4-3 #x2) (f-7-1 wbit) (f-8-4 #x1)
6918 (.sym dst16- dstgroup - mode) srcdisp)
6922 (dni (.sym ste wstr - dstgroup -a1a0)
6923 (.str "ste" wstr "-" dstgroup "-a1a0")
6925 (.str "ste" wstr " ${dst16-" dstgroup "-" mode "},[a1a0]")
6926 (+ (f-0-4 #x7) (f-4-3 #x2) (f-7-1 wbit) (f-8-4 #x2)
6927 (.sym dst16- dstgroup - mode))
6933 (define-pmacro (ste-dst mode wstr wbit)
6936 (ste-dst-dsp mode wstr wbit basic Dsp-16-u20)
6937 (ste-dst-dsp mode wstr wbit 16-8 Dsp-24-u20)
6938 (ste-dst-dsp mode wstr wbit 16-16 Dsp-32-u20)
6942 ;=============================================================
6944 ;-------------------------------------------------------------
6946 (define-pmacro (div-sem divop modop opmode reg src quot rem max min)
6949 (set obit (const BI 1))
6950 (sequence ((opmode quot-result) (opmode rem-result))
6951 (set quot-result (divop opmode (ext opmode reg) src))
6952 (set rem-result (modop opmode (ext opmode reg) src))
6953 (set obit (orif (gt opmode quot-result max)
6954 (lt opmode quot-result min)))
6955 (set quot quot-result)
6956 (set rem rem-result))))
6959 ;<divop>.size #imm -- for m16c and m32c
6960 (define-pmacro (div-imm-defn mach wstr op src encoding divop modop opmode reg quot rem max min sem)
6961 (dni (.sym op mach wstr - src)
6962 (.str op mach wstr "-" src)
6964 (.str op wstr " #${" src "}")
6966 (sem divop modop opmode reg src quot rem max min)
6969 (define-pmacro (div16-imm-defn smode wstr wbit op divop modop opmode reg quot rem max min opc1 opc2 opc3 opc4 sem)
6970 (div-imm-defn 16 wstr op (.sym Imm-16 - smode)
6971 (+ opc1 opc2 (f-7-1 wbit) opc3 opc4 (.sym Imm-16 - smode))
6972 divop modop opmode reg quot rem max min
6975 (define-pmacro (div32-imm-defn smode wstr wbit op divop modop opmode reg quot rem max min opc1 opc2 opc3 opc4 sem)
6976 (div-imm-defn 32 wstr op (.sym Imm-16 - smode)
6977 (+ (f-0-4 opc1) (f-4-4 opc2) (f-8-3 opc3) (f-11-1 wbit) (f-12-4 opc4) (.sym Imm-16 - smode))
6978 divop modop opmode reg quot rem max min
6981 (define-pmacro (div-imm-mach mach op divop modop opmode max-QI min-QI max-HI min-HI opc1 opc2 opc3 opc4 sem)
6983 (.apply (.sym div mach -imm-defn) (QI .b 0 op divop modop opmode R0 R0l R0h max-QI min-QI opc1 opc2 opc3 opc4 sem))
6984 (.apply (.sym div mach -imm-defn) (HI .w 1 op divop modop opmode R2R0 R0 R2 max-HI min-HI opc1 opc2 opc3 opc4 sem))
6987 (define-pmacro (div-imm op divop modop opmode max-QI min-QI max-HI min-HI opc16-1 opc16-2 opc16-3 opc16-4 opc32-1 opc32-2 opc32-3 opc32-4 sem)
6989 (div-imm-mach 16 op divop modop opmode max-QI min-QI max-HI min-HI opc16-1 opc16-2 opc16-3 opc16-4 sem)
6990 (div-imm-mach 32 op divop modop opmode max-QI min-QI max-HI min-HI opc32-1 opc32-2 opc32-3 opc32-4 sem)
6994 ;<divop>.size src -- for m16c and m32c
6995 (define-pmacro (div-src-defn mach wstr op src encoding divop modop opmode reg quot rem max min sem)
6996 (dni (.sym op mach wstr - src)
6997 (.str op mach wstr "-" src)
6999 (.str op wstr " ${" src "}")
7001 (sem divop modop opmode reg src quot rem max min)
7004 (define-pmacro (div16-src-defn smode wstr wbit op divop modop opmode reg quot rem max min opc1 opc2 opc3 sem)
7005 (div-src-defn 16 wstr op (.sym dst16-16 - smode)
7006 (+ opc1 opc2 (f-7-1 wbit) opc3 (.sym dst16-16 - smode))
7007 divop modop opmode reg quot rem max min
7010 (define-pmacro (div32-src-defn smode wstr wbit op divop modop opmode reg quot rem max min opc1 opc2 opc3 sem)
7012 ; Multi insns are tried for assembly in the reverse order in which they appear here, so
7013 ; define the absolute-indirect insns first in order to prevent them from being selected
7014 ; when the mode is register-indirect
7015 ; (div-src-defn 32 wstr op (.sym dst32-24-absolute-indirect- smode)
7016 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-15-1 wbit) (f-18-2 opc2) (f-20-4 opc3) (.sym dst32-24-absolute-indirect - smode))
7017 ; divop modop opmode reg quot rem max min
7019 (div-src-defn 32 wstr op (.sym dst32-16-Unprefixed- smode)
7020 (+ (f-0-4 opc1) (f-7-1 wbit) (f-10-2 opc2) (f-12-4 opc3) (.sym dst32-16-Unprefixed- smode))
7021 divop modop opmode reg quot rem max min
7023 ; (div-src-defn 32 wstr op (.sym dst32-24-indirect- smode)
7024 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 opc1) (f-15-1 wbit) (f-18-2 opc2) (f-20-4 opc3) (.sym dst32-24-indirect - smode))
7025 ; divop modop opmode reg quot rem max min
7029 (define-pmacro (div-src-mach mach op divop modop opmode max-QI min-QI max-HI min-HI opc1 opc2 opc3 sem)
7031 (.apply (.sym div mach -src-defn) (QI .b 0 op divop modop opmode R0 R0l R0h max-QI min-QI opc1 opc2 opc3 sem))
7032 (.apply (.sym div mach -src-defn) (HI .w 1 op divop modop opmode R2R0 R0 R2 max-HI min-HI opc1 opc2 opc3 sem))
7035 (define-pmacro (div-src op divop modop opmode max-QI min-QI max-HI min-HI opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
7037 (div-src-mach 16 op divop modop opmode max-QI min-QI max-HI min-HI opc16-1 opc16-2 opc16-3 sem)
7038 (div-src-mach 32 op divop modop opmode max-QI min-QI max-HI min-HI opc32-1 opc32-2 opc32-3 sem)
7042 ;=============================================================
7045 (define-pmacro (bit-insn-defn mach op suffix opnd encoding sem)
7046 (dni (.sym op mach - suffix - opnd)
7047 (.str op mach ":" suffix " " opnd)
7049 (.str op "$" suffix " ${" opnd "}")
7055 (define-pmacro (bitsrc16-defn op opc1 opc2 opc3 sem)
7056 (bit-insn-defn 16 op X bit16-16
7057 (+ opc1 opc2 opc3 bit16-16)
7061 (define-pmacro (bitsrc32-defn op opc1 opc2 opc3 sem)
7063 (bit-insn-defn 32 op X bit32-24-Prefixed
7064 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) bit32-24-Prefixed (f-15-1 opc2) (f-18-3 opc3))
7069 (define-pmacro (bitsrc-insn op opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
7071 (bitsrc16-defn op opc16-1 opc16-2 opc16-3 sem)
7072 (bitsrc32-defn op opc32-1 opc32-2 opc32-3 sem)
7076 (define-pmacro (bitdst16-defn op opc1 opc2 opc3 opc4 opc5 opc6 sem)
7078 (bit-insn-defn 16 op G bit16-16-basic (+ opc1 opc2 opc3 bit16-16-basic) sem)
7079 (bit-insn-defn 16 op G bit16-16-16 (+ opc1 opc2 opc3 bit16-16-16) sem)
7080 (bit-insn-defn 16 op S bit16-11-S (+ opc4 opc5 opc6 bit16-11-S) sem)
7081 (bit-insn-defn 16 op G bit16-16-8 (+ opc1 opc2 opc3 bit16-16-8) sem)
7085 (define-pmacro (bitdst32-defn op opc1 opc2 opc3 sem)
7087 (bit-insn-defn 32 op X bit32-16-Unprefixed
7088 (+ (f-0-4 opc1) bit32-16-Unprefixed (f-7-1 opc2) (f-10-3 opc3))
7093 (define-pmacro (bitdstnos-insn op opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
7095 (bitsrc16-defn op opc16-1 opc16-2 opc16-3 sem)
7096 (bitdst32-defn op opc32-1 opc32-2 opc32-3 sem)
7100 (define-pmacro (bitdst-insn op opc16-1 opc16-2 opc16-3 opc16-4 opc16-5 opc16-6 opc32-1 opc32-2 opc32-3 sem)
7102 (bitdst16-defn op opc16-1 opc16-2 opc16-3 opc16-4 opc16-5 opc16-6 sem)
7103 (bitdst32-defn op opc32-1 opc32-2 opc32-3 sem)
7107 ;=============================================================
7110 (define-pmacro (bitcond-insn-defn mach op bit-opnd cond-opnd encoding sem)
7111 (dni (.sym op mach - bit-opnd - cond-opnd)
7112 (.str op mach " " bit-opnd " " cond-opnd)
7114 (.str op "${" cond-opnd "} ${" bit-opnd "}")
7116 (sem mach bit-opnd cond-opnd)
7120 (define-pmacro (bitcond16-defn op opc1 opc2 opc3 sem)
7122 (bitcond-insn-defn 16 op bit16-16-basic cond16-16 (+ opc1 opc2 opc3 bit16-16-basic cond16-16) sem)
7123 (bitcond-insn-defn 16 op bit16-16-16 cond16-32 (+ opc1 opc2 opc3 bit16-16-16 cond16-32) sem)
7124 (bitcond-insn-defn 16 op bit16-16-8 cond16-24 (+ opc1 opc2 opc3 bit16-16-8 cond16-24) sem)
7128 (define-pmacro (bitcond32-defn op opc1 opc2 opc3 sem)
7130 (bitcond-insn-defn 32 op bit32-16-24-Unprefixed cond32-40
7131 (+ (f-0-4 opc1) bit32-16-24-Unprefixed (f-7-1 opc2) (f-10-3 opc3) cond32-40)
7133 (bitcond-insn-defn 32 op bit32-16-16-Unprefixed cond32-32
7134 (+ (f-0-4 opc1) bit32-16-16-Unprefixed (f-7-1 opc2) (f-10-3 opc3) cond32-32)
7136 (bitcond-insn-defn 32 op bit32-16-8-Unprefixed cond32-24
7137 (+ (f-0-4 opc1) bit32-16-8-Unprefixed (f-7-1 opc2) (f-10-3 opc3) cond32-24)
7139 (bitcond-insn-defn 32 op bit32-basic-Unprefixed cond32-16
7140 (+ (f-0-4 opc1) bit32-basic-Unprefixed (f-7-1 opc2) (f-10-3 opc3) cond32-16)
7145 (define-pmacro (bitcond-insn op opc16-1 opc16-2 opc16-3 opc32-1 opc32-2 opc32-3 sem)
7147 (bitcond16-defn op opc16-1 opc16-2 opc16-3 sem)
7148 (bitcond32-defn op opc32-1 opc32-2 opc32-3 sem)
7152 ;=============================================================
7153 ;<insn>.size #imm1,#imm2,dst -- for m32c
7155 (define-pmacro (insn-imm1-imm2-dst-defn src1 src2 dstgroup xmode wstr op encoding sem)
7156 (dni (.sym op 32 wstr - src1 - src2 - dstgroup)
7157 (.str op 32 wstr "-" src1 "-" src2 "-" dstgroup "-" xmode)
7159 (.str op wstr " #${" src1 "},#${" src2 "},${dst32-" dstgroup "-" xmode "}")
7161 (sem xmode src1 src2 (.sym dst32- dstgroup - xmode))
7165 ; m32c Prefixed variants
7166 (define-pmacro (insn32-imm1-imm2-dst-Prefixed-defn xmode wstr wbit base1 base2 base3 base4 op opc1 opc2 opc3 sem)
7168 (insn-imm1-imm2-dst-defn (.sym Imm-48- xmode) (.sym Imm- base4 - xmode) 24-24-Prefixed xmode wstr op
7169 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3)
7170 (.sym dst32-24-24-Prefixed- xmode) (.sym Imm-48- xmode) (.sym Imm- base4 - xmode))
7172 (insn-imm1-imm2-dst-defn (.sym Imm-40- xmode) (.sym Imm- base3 - xmode) 24-16-Prefixed xmode wstr op
7173 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3)
7174 (.sym dst32-24-16-Prefixed- xmode) (.sym Imm-40- xmode) (.sym Imm- base3 - xmode))
7176 (insn-imm1-imm2-dst-defn (.sym Imm-32- xmode) (.sym Imm- base2 - xmode) 24-8-Prefixed xmode wstr op
7177 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3)
7178 (.sym dst32-24-8-Prefixed- xmode) (.sym Imm-32- xmode) (.sym Imm- base2 - xmode))
7180 (insn-imm1-imm2-dst-defn (.sym Imm-24- xmode) (.sym Imm- base1 - xmode) basic-Prefixed xmode wstr op
7181 (+ (f-0-4 0) (f-4-4 1) (f-8-4 opc1) (f-18-2 opc2) (f-15-1 wbit) (f-20-4 opc3)
7182 (.sym dst32-basic-Prefixed- xmode) (.sym Imm-24- xmode) (.sym Imm- base1 - xmode))
7187 ; m32c Unprefixed variants
7188 (define-pmacro (insn32-imm1-imm2-dst-Unprefixed-defn xmode wstr wbit base1 base2 base3 base4 op opc1 opc2 opc3 sem)
7190 (insn-imm1-imm2-dst-defn (.sym Imm-40- xmode) (.sym Imm- base4 - xmode) 16-24-Unprefixed xmode wstr op
7191 (+ (f-0-4 opc1) (f-10-2 opc2) (f-7-1 wbit) (f-12-4 opc3)
7192 (.sym dst32-16-24-Unprefixed- xmode) (.sym Imm-40- xmode) (.sym Imm- base4 - xmode))
7194 (insn-imm1-imm2-dst-defn (.sym Imm-32- xmode) (.sym Imm- base3 - xmode) 16-16-Unprefixed xmode wstr op
7195 (+ (f-0-4 opc1) (f-10-2 opc2) (f-7-1 wbit) (f-12-4 opc3)
7196 (.sym dst32-16-16-Unprefixed- xmode) (.sym Imm-32- xmode) (.sym Imm- base3 - xmode))
7198 (insn-imm1-imm2-dst-defn (.sym Imm-24- xmode) (.sym Imm- base2 - xmode) 16-8-Unprefixed xmode wstr op
7199 (+ (f-0-4 opc1) (f-10-2 opc2) (f-7-1 wbit) (f-12-4 opc3)
7200 (.sym dst32-16-8-Unprefixed- xmode) (.sym Imm-24- xmode) (.sym Imm- base2 - xmode))
7202 (insn-imm1-imm2-dst-defn (.sym Imm-16- xmode) (.sym Imm- base1 - xmode) basic-Unprefixed xmode wstr op
7203 (+ (f-0-4 opc1) (f-10-2 opc2) (f-7-1 wbit) (f-12-4 opc3)
7204 (.sym dst32-basic-Unprefixed- xmode) (.sym Imm-16- xmode) (.sym Imm- base1 - xmode))
7209 (define-pmacro (insn-imm1-imm2-dst-Prefixed op opc32-1 opc32-2 opc32-3 sem)
7211 (insn32-imm1-imm2-dst-Prefixed-defn QI .b 0 32 40 48 56 op opc32-1 opc32-2 opc32-3 sem)
7212 (insn32-imm1-imm2-dst-Prefixed-defn HI .w 1 40 48 56 64 op opc32-1 opc32-2 opc32-3 sem)
7215 (define-pmacro (insn-imm1-imm2-dst-Unprefixed op opc32-1 opc32-2 opc32-3 sem)
7217 (insn32-imm1-imm2-dst-Unprefixed-defn QI .b 0 24 32 40 48 op opc32-1 opc32-2 opc32-3 sem)
7218 (insn32-imm1-imm2-dst-Unprefixed-defn HI .w 1 32 40 48 56 op opc32-1 opc32-2 opc32-3 sem)
7222 ;=============================================================
7224 ;-------------------------------------------------------------
7226 ;-------------------------------------------------------------
7228 (define-pmacro (abs-sem mode dst)
7229 (sequence ((mode result))
7230 (set result (abs mode dst))
7231 (set obit (eq result dst))
7232 (set-z-and-s result)
7235 (unary-insn abs (f-0-4 7) (f-4-3 3) (f-8-4 #xF) #xA #x1 #xF abs-sem)
7237 ;-------------------------------------------------------------
7238 ; adcf - addition carry flag
7239 ;-------------------------------------------------------------
7241 (define-pmacro (adcf-sem mode dst)
7242 (sequence ((mode result))
7243 (set result (addc mode dst 0 cbit))
7244 (set obit (add-oflag mode dst 0 cbit))
7245 (set cbit (add-cflag mode dst 0 cbit))
7246 (set-z-and-s result)
7249 (unary-insn adcf (f-0-4 7) (f-4-3 3) (f-8-4 #xE) #xB #x1 #xE adcf-sem)
7251 ;-------------------------------------------------------------
7252 ; add - binary addition
7253 ;-------------------------------------------------------------
7255 (define-pmacro (add-sem mode src1 dst)
7256 (sequence ((mode result))
7257 (set result (add mode src1 dst))
7258 (set obit (add-oflag mode src1 dst 0))
7259 (set cbit (add-cflag mode src1 dst 0))
7260 (set-z-and-s result)
7264 ; add.L:G #imm32,dst (m32 #2)
7265 (binary-arith32-imm-dst-defn SI SI .l 0 add G #x8 #x3 #x1 add-sem)
7266 ; add.size:G #imm,dst (m16 #1 m32 #1)
7267 (binary-arith-imm-dst add G (f-0-4 7) (f-4-3 3) (f-8-4 4) #x8 #x2 #xE add-sem)
7268 ; add.size:Q #imm4,dst (m16 #2 m32 #3)
7269 (binary-arith-imm4-dst add (f-0-4 #xC) (f-4-3 4) #x7 #x3 add-sem)
7270 (binary-arith32-imm4-dst-defn SI .l 1 0 add #x7 #x3 add-sem)
7271 ; add.b:S #imm8,dst3 (m16 #3)
7272 (binary-arith16-b-S-imm8-dst3 add ".b" (f-0-4 8) (f-4-1 0) add-sem)
7273 ; add.BW:Q #imm4,sp (m16 #7)
7274 (binary-arith16-Q-sp add (f-0-4 7) (f-4-4 #xD) (f-8-4 #xB) add-sem)
7275 (dnmi add16-bQ-sp "add16-bQ-sp" ()
7276 "add.b:q #${Imm-12-s4},sp"
7277 (emit add16-wQ-sp Imm-12-s4))
7278 ; add.BW:G #imm,sp (m16 #6)
7279 (binary-arith16-G-sp add (f-0-4 7) (f-4-3 6) (f-8-4 #xE) (f-12-4 #xB) add-sem)
7280 ; add.BW:G src,dst (m16 #4 m32 #6)
7281 (binary-arith-src-dst add G (f-0-4 #xA) (f-4-3 0) #x1 #x8 add-sem)
7282 ; add.B.S src2,r0l/r0h (m16 #5)
7283 (binary-arith16-b-S-src2 add (f-0-4 2) (f-4-1 0) add-sem)
7284 ; add.L:G src,dst (m32 #7)
7285 (binary-arith32-src-dst-defn SI SI .l 1 add G #x1 #x2 add-sem)
7286 ; add.L:S #imm{1,2},A0/A1 (m32 #5)
7287 (binary-arith32-l-s-imm1-an add (f-0-2 2) (f-3-4 6) add-sem)
7288 ; add.L:Q #imm3,sp (m32 #9)
7289 (binary-arith32-l-q-imm3-sp add (f-0-2 1) (f-4-3 1) add-sem)
7290 ; add.L:S #imm8,sp (m32 #10)
7291 (binary-arith32-l-s-imm8-sp add (f-0-4 #xb) (f-4-4 6) (f-8-4 0) (f-12-4 3) add-sem)
7292 ; add.L:G #imm16,sp (m32 #8)
7293 (binary-arith32-l-g-imm16-sp add (f-0-4 #xb) (f-4-4 6) (f-8-4 1) (f-12-4 3) add-sem)
7294 ; add.BW:S #imm,dst2 (m32 #4)
7295 (binary-arith32-s-imm-dst QI .b 0 add #x0 #x3 add-sem)
7296 (binary-arith32-s-imm-dst HI .w 1 add #x0 #x3 add-sem)
7298 ;-------------------------------------------------------------
7299 ; adc - binary add with carry
7300 ;-------------------------------------------------------------
7302 (define-pmacro (addc-sem mode src dst)
7303 (sequence ((mode result))
7304 (set result (addc mode src dst cbit))
7305 (set obit (add-oflag mode src dst cbit))
7306 (set cbit (add-cflag mode src dst cbit))
7307 (set-z-and-s result)
7311 ; adc.size:G #imm,dst
7312 (binary-arith16-imm-dst-defn QI QI .b 0 adc X (f-0-4 7) (f-4-3 3) (f-8-4 6) addc-sem)
7313 (binary-arith16-imm-dst-defn HI HI .w 1 adc X (f-0-4 7) (f-4-3 3) (f-8-4 6) addc-sem)
7314 (binary-arith32-imm-dst-Prefixed QI QI .b 0 adc X #x8 #x2 #xE addc-sem)
7315 (binary-arith32-imm-dst-Prefixed HI HI .w 1 adc X #x8 #x2 #xE addc-sem)
7318 (binary-arith16-src-dst-defn QI QI .b 0 adc X (f-0-4 #xB) (f-4-3 0) addc-sem)
7319 (binary-arith16-src-dst-defn HI HI .w 1 adc X (f-0-4 #xB) (f-4-3 0) addc-sem)
7320 (binary-arith32-src-dst-Prefixed QI QI .b 0 adc X #x1 #x4 addc-sem)
7321 (binary-arith32-src-dst-Prefixed HI HI .w 1 adc X #x1 #x4 addc-sem)
7323 ;-------------------------------------------------------------
7324 ; dadc - decimal add with carry
7325 ; dadd - decimal addition
7326 ;-------------------------------------------------------------
7328 (define-pmacro (dadc-sem mode src dst)
7329 (sequence ((mode result))
7330 (set result (subc mode dst src (not cbit)))
7331 (set cbit (sub-cflag mode dst src (not cbit)))
7332 (set-z-and-s result)
7336 (define-pmacro (decimal-subtraction16-insn op opc1 opc2)
7339 (dni (.sym op 16.b-imm8)
7340 (.str op ".b #imm8")
7342 (.str op ".b #${Imm-16-QI},r0l")
7343 (+ (f-0-4 #x7) (f-4-4 #xC) (f-8-4 #xE) (f-12-4 opc1) Imm-16-QI)
7344 ((.sym op -sem) QI Imm-16-QI R0l)
7347 (dni (.sym op 16.w-imm16)
7348 (.str op ".b #imm16")
7350 (.str op ".w #${Imm-16-HI},r0")
7351 (+ (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #xE) (f-12-4 opc1) Imm-16-HI)
7352 ((.sym op -sem) HI Imm-16-HI R0)
7355 (dni (.sym op 16.b-r0h-r0l)
7356 (.str op ".b r0h,r0l")
7358 (.str op ".b r0h,r0l")
7359 (+ (f-0-4 #x7) (f-4-4 #xC) (f-8-4 #xE) (f-12-4 opc2))
7360 ((.sym op -sem) QI R0h R0l)
7363 (dni (.sym op 16.w-r1-r0)
7364 (.str op ".b r1,r0")
7366 (.str op ".w r1,r0")
7367 (+ (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #xE) (f-12-4 opc2))
7368 ((.sym op -sem) HI R1 R0)
7374 (decimal-subtraction16-insn dadc #xE #x6 )
7376 ; dadc.size #imm,dst
7377 (binary-arith32-imm-dst-Prefixed QI QI .b 0 dadc X #x8 #x0 #xE dadc-sem)
7378 (binary-arith32-imm-dst-Prefixed HI HI .w 1 dadc X #x8 #x0 #xE dadc-sem)
7380 (binary-arith32-src-dst-Prefixed QI QI .b 0 dadc X #x1 #x8 dadc-sem)
7381 (binary-arith32-src-dst-Prefixed HI HI .w 1 dadc X #x1 #x8 dadc-sem)
7383 (define-pmacro (dadd-sem mode src dst)
7384 (sequence ((mode result))
7385 (set result (subc mode dst src 0))
7386 (set cbit (sub-cflag mode dst src 0))
7387 (set-z-and-s result)
7392 (decimal-subtraction16-insn dadd #xC #x4)
7394 ; dadd.size #imm,dst
7395 (binary-arith32-imm-dst-Prefixed QI QI .b 0 dadd X #x8 #x1 #xE dadd-sem)
7396 (binary-arith32-imm-dst-Prefixed HI HI .w 1 dadd X #x8 #x1 #xE dadd-sem)
7398 (binary-arith32-src-dst-Prefixed QI QI .b 0 dadd X #x1 #x0 dadd-sem)
7399 (binary-arith32-src-dst-Prefixed HI HI .w 1 dadd X #x1 #x0 dadd-sem)
7401 ;-------------------------------------------------------------;
7402 ; addx - Add extend sign with no carry
7403 ;-------------------------------------------------------------;
7405 (define-pmacro (addx-sem mode src dst)
7406 (sequence ((SI source) (SI result))
7407 (set source (zext SI (trunc QI src)))
7408 (set result (add SI source dst))
7409 (set obit (add-oflag SI source dst 0))
7410 (set cbit (add-cflag SI source dst 0))
7411 (set-z-and-s result)
7416 (binary-arith32-imm-dst-defn QI SI "" 0 addx X #x8 #x1 #x1 addx-sem)
7418 (binary-arith32-src-dst-defn QI SI "" 0 addx X #x1 #x2 addx-sem)
7420 ;-------------------------------------------------------------
7421 ; adjnz - Add/Sub and branch if not zero
7422 ;-------------------------------------------------------------
7424 (define-pmacro (arith-jnz-sem mode src dst label)
7425 (sequence ((mode result))
7426 (set result (add mode src dst))
7432 ; adjnz.size #imm4,dst,label
7433 (arith-jnz-imm4-dst adjnz s4 (f-0-4 #xF) (f-4-3 4) #xf #x1 arith-jnz-sem)
7435 ;-------------------------------------------------------------
7437 ;-------------------------------------------------------------
7439 (define-pmacro (and-sem mode src1 dst)
7440 (sequence ((mode result))
7441 (set result (and mode src1 dst))
7442 (set-z-and-s result)
7446 ; and.size:G #imm,dst (m16 #1 m32 #1)
7447 (binary-arith-imm-dst and G (f-0-4 7) (f-4-3 3) (f-8-4 2) #x8 #x3 #xF and-sem)
7448 ; and.b:S #imm8,dst3 (m16 #2)
7449 (binary-arith16-b-S-imm8-dst3 and ".b" (f-0-4 9) (f-4-1 0) and-sem)
7450 ; and.BW:G src,dst (m16 #3 m32 #3)
7451 (binary-arith-src-dst and G (f-0-4 #x9) (f-4-3 0) #x1 #xD and-sem)
7452 ; and.B.S src2,r0l/r0h (m16 #4)
7453 (binary-arith16-b-S-src2 and (f-0-4 1) (f-4-1 0) and-sem)
7454 ; and.BW:S #imm,dst2 (m32 #2)
7455 (binary-arith32-s-imm-dst QI .b 0 and #x1 #x6 and-sem)
7456 (binary-arith32-s-imm-dst HI .w 1 and #x1 #x6 and-sem)
7458 ;-------------------------------------------------------------
7460 ;-------------------------------------------------------------
7462 (define-pmacro (band-sem src)
7463 (set cbit (and src cbit))
7465 (bitsrc-insn band (f-0-4 7) (f-4-4 #xE) (f-8-4 4) #xD #x0 #x1 band-sem)
7467 ;-------------------------------------------------------------
7469 ;-------------------------------------------------------------
7471 (define-pmacro (bclr-sem dst)
7474 (bitdst-insn bclr (f-0-4 7) (f-4-4 #xE) (f-8-4 8) (f-0-2 1) (f-2-2 0) (f-4-1 0) #xD #x0 #x6 bclr-sem)
7476 ;-------------------------------------------------------------
7477 ; bitindex - bit index
7478 ;-------------------------------------------------------------
7480 (define-pmacro (bitindex-sem mode dst)
7483 (unary-insn-defn 32 16-Unprefixed QI .b bitindex
7484 (+ (f-0-4 #xC) (f-7-1 0) dst32-16-Unprefixed-QI (f-10-2 #x2) (f-12-4 #xE))
7486 (unary-insn-defn 32 16-Unprefixed HI .w bitindex
7487 (+ (f-0-4 #xC) (f-7-1 1) dst32-16-Unprefixed-HI (f-10-2 #x2) (f-12-4 #xE))
7490 ;-------------------------------------------------------------
7491 ; bmCnd - bit move condition
7492 ;-------------------------------------------------------------
7494 (define-pmacro (test-condition16 cond)
7496 ((#x00) (trunc BI cbit))
7497 ((#x01) (not (or cbit zbit)))
7498 ((#x02) (trunc BI zbit))
7499 ((#x03) (trunc BI sbit))
7500 ((#x04) (or zbit (xor sbit obit)))
7501 ((#x05) (trunc BI obit))
7502 ((#x06) (xor sbit obit))
7504 ((#xf9) (or cbit zbit))
7507 ((#xfc) (not (or zbit (xor sbit obit))))
7509 ((#xfe) (not (xor sbit obit)))
7514 (define-pmacro (test-condition32 cond)
7517 ((#x01) (or cbit zbit))
7521 ((#x05) (not (or zbit (xor sbit obit))))
7522 ((#x06) (not (xor sbit obit)))
7523 ((#x08) (trunc BI cbit))
7524 ((#x09) (not (or cbit zbit)))
7525 ((#x0a) (trunc BI zbit))
7526 ((#x0b) (trunc BI sbit))
7527 ((#x0c) (trunc BI obit))
7528 ((#x0d) (or zbit (xor sbit obit)))
7529 ((#x0e) (xor sbit obit))
7534 (define-pmacro (bitcond-sem mach op cond)
7535 (if ((.sym test-condition mach) cond)
7539 (bitcond-insn bm (f-0-4 7) (f-4-4 #xE) (f-8-4 2) #xD #x0 #x2 bitcond-sem)
7545 (+ (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #xD) cond16c)
7546 (bitcond-sem 16 cbit cond16c)
7553 (+ (f-0-4 #xD) (f-4-4 #x9) (f-8-1 0) (f-10-3 5) cond32)
7554 (bitcond-sem 32 cbit cond32)
7557 ;-------------------------------------------------------------
7559 ;-------------------------------------------------------------
7561 (define-pmacro (bnand-sem src)
7562 (set cbit (and (inv src) cbit))
7564 (bitsrc-insn bnand (f-0-4 7) (f-4-4 #xE) (f-8-4 5) #xD #x0 #x3 bnand-sem)
7566 ;-------------------------------------------------------------
7568 ;-------------------------------------------------------------
7570 (define-pmacro (bnor-sem src)
7571 (set cbit (or (inv src) cbit))
7573 (bitsrc-insn bnor (f-0-4 7) (f-4-4 #xE) (f-8-4 7) #xD #x0 #x6 bnor-sem)
7575 ;-------------------------------------------------------------
7577 ;-------------------------------------------------------------
7579 (define-pmacro (bnot-sem dst)
7582 (bitdst-insn bnot (f-0-4 7) (f-4-4 #xE) (f-8-4 #xA) (f-0-2 1) (f-2-2 1) (f-4-1 0) #xD #x0 #x3 bnot-sem)
7584 ;-------------------------------------------------------------
7586 ;-------------------------------------------------------------
7588 (define-pmacro (bntst-sem src)
7589 (set cbit (inv src))
7590 (set zbit (inv src))
7592 (bitsrc-insn bntst (f-0-4 7) (f-4-4 #xE) (f-8-4 3) #xD #x0 #x0 bntst-sem)
7594 ;-------------------------------------------------------------
7596 ;-------------------------------------------------------------
7598 (define-pmacro (bnxor-sem src)
7599 (set cbit (xor (inv src) cbit))
7601 (bitsrc-insn bnxor (f-0-4 7) (f-4-4 #xE) (f-8-4 #xD) #xD #x0 #x7 bnxor-sem)
7603 ;-------------------------------------------------------------
7605 ;-------------------------------------------------------------
7607 (define-pmacro (bor-sem src)
7608 (set cbit (or src cbit))
7610 (bitsrc-insn bor (f-0-4 7) (f-4-4 #xE) (f-8-4 #x6) #xD #x0 #x4 bor-sem)
7612 ;-------------------------------------------------------------
7614 ;-------------------------------------------------------------
7620 (+ (f-0-4 #x0) (f-4-4 #x0))
7628 (+ (f-0-4 #x0) (f-4-4 #x0))
7632 ;-------------------------------------------------------------
7634 ;-------------------------------------------------------------
7640 (+ (f-0-4 #x0) (f-4-4 #x8))
7644 ;-------------------------------------------------------------
7646 ;-------------------------------------------------------------
7648 (define-pmacro (bset-sem dst)
7651 (bitdst-insn bset (f-0-4 7) (f-4-4 #xE) (f-8-4 9) (f-0-2 1) (f-2-2 0) (f-4-1 1) #xD #x0 #x7 bset-sem)
7653 ;-------------------------------------------------------------
7655 ;-------------------------------------------------------------
7657 (define-pmacro (btst-sem dst)
7658 (set zbit (inv dst))
7661 (bitdst16-defn btst (f-0-4 7) (f-4-4 #xE) (f-8-4 #xB) (f-0-2 1) (f-2-2 1) (f-4-1 1) btst-sem)
7663 (bit-insn-defn 32 btst G bit32-16-Unprefixed
7664 (+ (f-0-4 #xD) bit32-16-Unprefixed (f-7-1 #x0) (f-10-3 #x0))
7667 (dni btst.s "btst:s" ((machine 32))
7668 "btst:s ${Bit3-S},${Dsp-8-u16}"
7669 (+ (f-0-2 #x0) (f-4-3 #x5) Bit3-S Dsp-8-u16)
7672 ;-------------------------------------------------------------
7674 ;-------------------------------------------------------------
7676 (define-pmacro (btstc-sem dst)
7677 (set zbit (inv dst))
7681 (bitdstnos-insn btstc (f-0-4 7) (f-4-4 #xE) (f-8-4 #x0) #xD #x0 #x4 btstc-sem)
7683 ;-------------------------------------------------------------
7685 ;-------------------------------------------------------------
7687 (define-pmacro (btsts-sem dst)
7688 (set zbit (inv dst))
7692 (bitdstnos-insn btsts (f-0-4 7) (f-4-4 #xE) (f-8-4 #x1) #xD #x0 #x5 btsts-sem)
7694 ;-------------------------------------------------------------
7696 ;-------------------------------------------------------------
7698 (define-pmacro (bxor-sem src)
7699 (set cbit (xor src cbit))
7701 (bitsrc-insn bxor (f-0-4 7) (f-4-4 #xE) (f-8-4 #xC) #xD #x0 #x5 bxor-sem)
7703 ;-------------------------------------------------------------
7705 ;-------------------------------------------------------------
7707 (define-pmacro (clip-sem mode imm1 imm2 dest)
7709 (if (gt mode imm1 dest)
7711 (if (lt mode imm2 dest)
7715 (insn-imm1-imm2-dst-Prefixed clip #x8 #x3 #xE clip-sem)
7717 ;-------------------------------------------------------------
7718 ; cmp - binary compare
7719 ;-------------------------------------------------------------
7721 (define-pmacro (cmp-sem mode src1 dst)
7722 (sequence ((mode result))
7723 (set result (sub mode dst src1))
7724 (set obit (sub-oflag mode dst src1 0))
7725 (set cbit (not (sub-cflag mode dst src1 0)))
7726 (set-z-and-s result))
7729 ; cmp.L:G #imm32,dst (m32 #2)
7730 (binary-arith32-imm-dst-defn SI SI .l 0 cmp G #xA #x3 #x1 cmp-sem)
7731 ; cmp.size:G #imm,dst (m16 #1 m32 #1)
7732 (binary-arith-imm-dst cmp G (f-0-4 7) (f-4-3 3) (f-8-4 8) #x9 #x2 #xE cmp-sem)
7733 ; cmp.size:Q #imm4,dst (m16 #2 m32 #3)
7734 (binary-arith-imm4-dst cmp (f-0-4 #xD) (f-4-3 0) #x7 #x1 cmp-sem)
7735 ; cmp.b:S #imm8,dst3 (m16 #3)
7736 (binary-arith16-b-S-imm8-dst3 cmp ".b" (f-0-4 #xE) (f-4-1 0) cmp-sem)
7737 ; cmp.BW:G src,dst (m16 #4 m32 #5)
7738 (binary-arith-src-dst cmp G (f-0-4 #xC) (f-4-3 0) #x1 #x6 cmp-sem)
7739 ; cmp.B.S src2,r0l/r0h (m16 #5)
7740 (binary-arith16-b-S-src2 cmp (f-0-4 3) (f-4-1 1) cmp-sem)
7741 ; cmp.L:G src,dst (m32 #6)
7742 (binary-arith32-src-dst-defn SI SI .l 1 cmp G #x1 #x1 cmp-sem)
7743 ; cmp.BW:S #imm,dst2 (m32 #4)
7744 (binary-arith32-s-imm-dst QI .b 0 cmp #x1 #x3 cmp-sem)
7745 (binary-arith32-s-imm-dst HI .w 1 cmp #x1 #x3 cmp-sem)
7746 ; cmp.BW:s src2,r0[l] (m32 #7)
7747 (binary-arith32-S-src2 cmp QI .b 0 (f-0-2 1) (f-4-3 0) cmp-sem)
7748 (binary-arith32-S-src2 cmp HI .w 1 (f-0-2 1) (f-4-3 0) cmp-sem)
7750 ;-------------------------------------------------------------
7751 ; cmpx - binary compare extend sign
7752 ;-------------------------------------------------------------
7754 (define-pmacro (cmpx-sem mode src1 dst)
7755 (sequence ((mode result))
7756 (set result (sub mode dst (ext mode src1)))
7757 (set obit (sub-oflag mode dst (ext mode src1) 0))
7758 (set cbit (sub-cflag mode dst (ext mode src1) 0))
7759 (set-z-and-s result))
7762 (binary-arith32-imm-dst-defn QI SI "" 0 cmpx X #xA #x1 #x1 cmpx-sem)
7764 ;-------------------------------------------------------------
7766 ;-------------------------------------------------------------
7768 (define-pmacro (dec-sem mode dest)
7769 (sequence ((mode result))
7770 (set result (sub mode dest 1))
7771 (set-z-and-s result)
7778 "dec.b ${Dst16-3-S-8}"
7779 (+ (f-0-4 #xA) (f-4-1 #x1) Dst16-3-S-8)
7780 (dec-sem QI Dst16-3-S-8)
7786 "dec.w ${Dst16An-S}"
7787 (+ (f-0-4 #xF) (f-5-3 #x2) Dst16An-S)
7788 (dec-sem HI Dst16An-S)
7791 (unary32-defn QI .b 0 dec #xB #x0 #xE dec-sem)
7792 (unary32-defn HI .w 1 dec #xB #x0 #xE dec-sem)
7794 ;-------------------------------------------------------------
7796 ; divu - divide unsigned
7797 ; divx - divide extension
7798 ;-------------------------------------------------------------
7801 (div-imm div div mod SI 127 -128 32767 -32768 (f-0-4 #x7) (f-4-3 6) (f-8-4 #xE) (f-12-4 #x1) #xB #x0 #x2 #x3 div-sem)
7802 (div-imm divu udiv umod USI 255 0 65535 0 (f-0-4 #x7) (f-4-3 6) (f-8-4 #xE) (f-12-4 #x0) #xB #x0 #x0 #x3 div-sem)
7803 (div-imm divx div mod SI 127 -128 32767 -32768 (f-0-4 #x7) (f-4-3 6) (f-8-4 #xE) (f-12-4 #x3) #xB #x2 #x2 #x3 div-sem)
7805 (div-src div div mod SI 127 -128 32767 -32768 (f-0-4 #x7) (f-4-3 3) (f-8-4 #xD) #x8 #x1 #xE div-sem)
7806 (div-src divu udiv umod USI 255 0 65535 0 (f-0-4 #x7) (f-4-3 3) (f-8-4 #xC) #x8 #x0 #xE div-sem)
7807 (div-src divx div mod SI 127 -128 32767 -32768 (f-0-4 #x7) (f-4-3 3) (f-8-4 #x9) #x9 #x1 #xE div-sem)
7809 (div-src-defn 32 .l div dst32-24-Prefixed-SI
7810 (+ (f-0-4 0) (f-4-4 1) (f-8-4 #xA) (f-15-1 1) (f-18-2 #x1) (f-20-4 #xf) dst32-24-Prefixed-SI)
7811 div mod SI R2R0 R2R0 NoRemainder #x7fffffff (neg SI #x80000000)
7813 (div-src-defn 32 .l divu dst32-24-Prefixed-SI
7814 (+ (f-0-4 0) (f-4-4 1) (f-8-4 #xA) (f-15-1 1) (f-18-2 #x0) (f-20-4 #xf) dst32-24-Prefixed-SI)
7815 udiv umod USI R2R0 R2R0 NoRemainder #x80000000 0
7817 (div-src-defn 32 .l divx dst32-24-Prefixed-SI
7818 (+ (f-0-4 0) (f-4-4 1) (f-8-4 #xA) (f-15-1 1) (f-18-2 #x2) (f-20-4 #xf) dst32-24-Prefixed-SI)
7819 div mod SI R2R0 R2R0 NoRemainder #x7fffffff (neg SI #x80000000)
7822 ;-------------------------------------------------------------
7823 ; dsbb - decimal subtraction with borrow
7824 ; dsub - decimal subtraction
7825 ;-------------------------------------------------------------
7827 (define-pmacro (dsbb-sem mode src dst)
7828 (sequence ((mode result))
7829 (set result (subc mode dst src (not cbit)))
7830 (set cbit (sub-cflag mode dst src (not cbit)))
7831 (set-z-and-s result)
7836 (decimal-subtraction16-insn dsbb #xF #x7)
7838 ; dsbb.size #imm,dst
7839 (binary-arith32-imm-dst-Prefixed QI QI .b 0 dsbb X #x9 #x0 #xE dsbb-sem)
7840 (binary-arith32-imm-dst-Prefixed HI HI .w 1 dsbb X #x9 #x0 #xE dsbb-sem)
7842 (binary-arith32-src-dst-Prefixed QI QI .b 0 dsbb X #x1 #xA dsbb-sem)
7843 (binary-arith32-src-dst-Prefixed HI HI .w 1 dsbb X #x1 #xA dsbb-sem)
7845 (define-pmacro (dsub-sem mode src dst)
7846 (sequence ((mode result))
7847 (set result (subc mode dst src 0))
7848 (set cbit (sub-cflag mode dst src 0))
7849 (set-z-and-s result)
7854 (decimal-subtraction16-insn dsub #xD #x5)
7856 ; dsub.size #imm,dst
7857 (binary-arith32-imm-dst-Prefixed QI QI .b 0 dsub X #x9 #x1 #xE dsub-sem)
7858 (binary-arith32-imm-dst-Prefixed HI HI .w 1 dsub X #x9 #x1 #xE dsub-sem)
7860 (binary-arith32-src-dst-Prefixed QI QI .b 0 dsub X #x1 #x2 dsub-sem)
7861 (binary-arith32-src-dst-Prefixed HI HI .w 1 dsub X #x1 #x2 dsub-sem)
7863 ;-------------------------------------------------------------
7864 ; sub - binary subtraction
7865 ;-------------------------------------------------------------
7867 (define-pmacro (sub-sem mode src1 dst)
7868 (sequence ((mode result))
7869 (set result (sub mode dst src1))
7870 (set obit (sub-oflag mode dst src1 0))
7871 (set cbit (sub-cflag mode dst src1 0))
7873 (set-z-and-s result)))
7875 ; sub.size:G #imm,dst (m16 #1 m32 #1)
7876 (binary-arith-imm-dst sub G (f-0-4 7) (f-4-3 3) (f-8-4 5) #x8 #x3 #xE sub-sem)
7877 ; sub.b:S #imm8,dst3 (m16 #2)
7878 (binary-arith16-b-S-imm8-dst3 sub ".b" (f-0-4 8) (f-4-1 1) sub-sem)
7879 ; sub.BW:G src,dst (m16 #3 m32 #4)
7880 (binary-arith-src-dst sub G (f-0-4 #xA) (f-4-3 4) #x1 #xA sub-sem)
7881 ; sub.B.S src2,r0l/r0h (m16 #4)
7882 (binary-arith16-b-S-src2 sub (f-0-4 2) (f-4-1 1) sub-sem)
7883 ; sub.L:G #imm32,dst (m32 #2)
7884 (binary-arith32-imm-dst-defn SI SI .l 0 sub G #x9 #x3 #x1 sub-sem)
7885 ; sub.BW:S #imm,dst2 (m32 #3)
7886 (binary-arith32-s-imm-dst QI .b 0 sub #x0 #x7 sub-sem)
7887 (binary-arith32-s-imm-dst HI .w 1 sub #x0 #x7 sub-sem)
7888 ; sub.L:G src,dst (m32 #5)
7889 (binary-arith32-src-dst-defn SI SI .l 1 sub G #x1 #x0 sub-sem)
7891 ;-------------------------------------------------------------
7892 ; enter - enter function
7893 ; exitd - exit and deallocate stack frame
7894 ;-------------------------------------------------------------
7896 (define-pmacro (enter16-sem mach amt)
7898 (set (reg h-sp) (sub (reg h-sp) 2))
7899 (set (mem16 HI (reg h-sp)) (reg h-fb))
7900 (set (reg h-fb) (reg h-sp))
7901 (set (reg h-sp) (sub (reg h-sp) amt))))
7903 (define-pmacro (exit16-sem mach)
7904 (sequence ((SI newpc))
7905 (set (reg h-sp) (reg h-fb))
7906 (set (reg h-fb) (mem16 HI (reg h-sp)))
7907 (set (reg h-sp) (add (reg h-sp) 2))
7908 (set newpc (mem16 HI (reg h-sp)))
7909 (set (reg h-sp) (add (reg h-sp) 2))
7910 (set newpc (or newpc (sll (mem16 QI (reg h-sp)) (const 16))))
7911 (set (reg h-sp) (add (reg h-sp) 1))
7914 (define-pmacro (enter32-sem mach amt)
7916 (set (reg h-sp) (sub (reg h-sp) 4))
7917 (set (mem32 SI (reg h-sp)) (reg h-fb))
7918 (set (reg h-fb) (reg h-sp))
7919 (set (reg h-sp) (sub (reg h-sp) amt))))
7921 (define-pmacro (exit32-sem mach)
7922 (sequence ((SI newpc))
7923 (set (reg h-sp) (reg h-fb))
7924 (set (reg h-fb) (mem32 SI (reg h-sp)))
7925 (set (reg h-sp) (add (reg h-sp) 4))
7926 (set newpc (mem32 SI (reg h-sp)))
7927 (set (reg h-sp) (add (reg h-sp) 4))
7930 (dni enter16 "enter #Imm-16-QI" ((machine 16))
7931 ("enter #${Dsp-16-u8}")
7932 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 #xF) (f-12-4 2) Dsp-16-u8)
7933 (enter16-sem 16 Dsp-16-u8)
7936 (dni exitd16 "exitd" ((machine 16))
7938 (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 #xF) (f-12-4 2))
7942 (dni enter32 "enter #Imm-8-QI" ((machine 32))
7943 ("enter #${Dsp-8-u8}")
7944 (+ (f-0-4 #xE) (f-4-4 #xC) Dsp-8-u8)
7945 (enter32-sem 32 Dsp-8-u8)
7948 (dni exitd32 "exitd" ((machine 32))
7950 (+ (f-0-4 #xF) (f-4-4 #xC))
7954 ;-------------------------------------------------------------
7955 ; fclr - flag register clear
7956 ; fset - flag register set
7957 ;-------------------------------------------------------------
7959 (define-pmacro (set-flags-sem flag)
7960 (sequence ((SI tmp))
7962 ((#x0) (set cbit 1))
7963 ((#x1) (set dbit 1))
7964 ((#x2) (set zbit 1))
7965 ((#x3) (set sbit 1))
7966 ((#x4) (set bbit 1))
7967 ((#x5) (set obit 1))
7968 ((#x6) (set ibit 1))
7969 ((#x7) (set ubit 1)))
7973 (define-pmacro (clear-flags-sem flag)
7974 (sequence ((SI tmp))
7976 ((#x0) (set cbit 0))
7977 ((#x1) (set dbit 0))
7978 ((#x2) (set zbit 0))
7979 ((#x3) (set sbit 0))
7980 ((#x4) (set bbit 0))
7981 ((#x5) (set obit 0))
7982 ((#x6) (set ibit 0))
7983 ((#x7) (set ubit 0)))
7987 (dni fclr16 "fclr flag" ((machine 16))
7989 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-1 0) flags16 (f-12-4 5))
7990 (clear-flags-sem flags16)
7993 (dni fset16 "fset flag" ((machine 16))
7995 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-1 0) flags16 (f-12-4 4))
7996 (set-flags-sem flags16)
7999 (dni fclr "fclr" ((machine 32))
8001 (+ (f-0-4 #xD) (f-4-4 3) (f-8-4 #xE) (f-12-1 1) flags32)
8002 (clear-flags-sem flags32)
8005 (dni fset "fset" ((machine 32))
8007 (+ (f-0-4 #xD) (f-4-4 1) (f-8-4 #xE) (f-12-1 1) flags32)
8008 (set-flags-sem flags32)
8011 ;-------------------------------------------------------------
8013 ;-------------------------------------------------------------
8015 (define-pmacro (inc-sem mode dest)
8016 (sequence ((mode result))
8017 (set result (add mode dest 1))
8018 (set-z-and-s result)
8025 "inc.b ${Dst16-3-S-8}"
8026 (+ (f-0-4 #xA) (f-4-1 #x0) Dst16-3-S-8)
8027 (inc-sem QI Dst16-3-S-8)
8033 "inc.w ${Dst16An-S}"
8034 (+ (f-0-4 #xB) (f-5-3 #x2) Dst16An-S)
8035 (inc-sem HI Dst16An-S)
8038 (unary32-defn QI .b 0 inc #xA #x0 #xE inc-sem)
8039 (unary32-defn HI .w 1 inc #xA #x0 #xE inc-sem)
8041 ;-------------------------------------------------------------
8042 ; freit - fast return from interrupt (m32)
8044 ; into - interrupt on overflow
8045 ;-------------------------------------------------------------
8048 (dni freit32 "FREIT" ((machine 32))
8050 (+ (f-0-4 9) (f-4-4 #xF))
8054 (dni int16 "int Dsp-10-u6" ((machine 16))
8055 ("int #${Dsp-10-u6}")
8056 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-2 3) Dsp-10-u6)
8057 (c-call VOID "do_int" pc Dsp-10-u6)
8060 (dni into16 "into" ((machine 16))
8062 (+ (f-0-4 #xF) (f-4-4 6))
8066 (dni int32 "int Dsp-8-u6" ((machine 32))
8067 ("int #${Dsp-8-u6}")
8068 (+ (f-0-4 #xB) (f-4-4 #xE) Dsp-8-u6 (f-14-2 0))
8069 (c-call VOID "do_int" pc Dsp-8-u6)
8072 (dni into32 "into" ((machine 32))
8074 (+ (f-0-4 #xB) (f-4-4 #xF))
8078 ;-------------------------------------------------------------
8080 ;-------------------------------------------------------------
8082 ; TODO add support to insns allowing index
8083 (define-pmacro (indexb-sem mode d) (set SrcIndex d) (set DstIndex d))
8084 (define-pmacro (indexbd-sem mode d) (set SrcIndex (const 0)) (set DstIndex d))
8085 (define-pmacro (indexbs-sem mode d) (set SrcIndex d) (set DstIndex (const 0)))
8086 (define-pmacro (indexw-sem mode d)
8087 (set SrcIndex (sll d (const 2))) (set DstIndex (sll d (const 2))))
8088 (define-pmacro (indexwd-sem mode d)
8089 (set SrcIndex (const 0)) (set DstIndex (sll d (const 2))))
8090 (define-pmacro (indexws-sem mode d)
8091 (set SrcIndex (sll d (const 2))) (set DstIndex (const 0)))
8092 (define-pmacro (indexl-sem mode d)
8093 (set SrcIndex d) (set DstIndex (sll d (const 2))))
8094 (define-pmacro (indexld-sem mode d)
8095 (set SrcIndex (const 0)) (set DstIndex (sll d (const 2))))
8096 (define-pmacro (indexls-sem mode d)
8097 (set SrcIndex (sll d (const 2))) (set DstIndex (const 0)))
8099 ; Note that "wbit" not where the size bit goes here, hence, it's
8100 ; always 0 in these calls but op2 differs instead.
8102 ; indexb src (index byte)
8103 (unary32-defn QI .b 0 indexb #x8 0 #x3 indexb-sem)
8104 (unary32-defn HI .w 0 indexb #x8 1 #x3 indexb-sem)
8105 ; indexbd src (index byte dest)
8106 (unary32-defn QI .b 0 indexbd #xA 0 3 indexbd-sem)
8107 (unary32-defn HI .w 0 indexbd #xA 1 3 indexbd-sem)
8108 ; indexbs src (index byte src)
8109 (unary32-defn QI .b 0 indexbs #xC 0 3 indexbs-sem)
8110 (unary32-defn HI .w 0 indexbs #xC 1 3 indexbs-sem)
8111 ; indexl src (index long)
8112 (unary32-defn QI .b 0 indexl 9 2 3 indexl-sem)
8113 (unary32-defn HI .w 0 indexl 9 3 3 indexl-sem)
8114 ; indexld src (index long dest)
8115 (unary32-defn QI .b 0 indexld #xB 2 3 indexld-sem)
8116 (unary32-defn HI .w 0 indexld #xB 3 3 indexld-sem)
8117 ; indexls src (index long src)
8118 (unary32-defn QI .b 0 indexls 9 0 3 indexls-sem)
8119 (unary32-defn HI .w 0 indexls 9 1 3 indexls-sem)
8120 ; indexw src (index word)
8121 (unary32-defn QI .b 0 indexw 8 2 3 indexw-sem)
8122 (unary32-defn HI .w 0 indexw 8 3 3 indexw-sem)
8123 ; indexwd src (index word dest)
8124 (unary32-defn QI .b 0 indexwd #xA 2 3 indexwd-sem)
8125 (unary32-defn HI .w 0 indexwd #xA 3 3 indexwd-sem)
8126 ; indexws (index word src)
8127 (unary32-defn QI .b 0 indexws #xC 2 3 indexws-sem)
8128 (unary32-defn HI .w 0 indexws #xC 3 3 indexws-sem)
8130 ;-------------------------------------------------------------
8131 ; jcc - jump on condition
8132 ;-------------------------------------------------------------
8134 (define-pmacro (jcnd32-sem cnd label)
8137 ((#x00) (if (not cbit) (set pc label))) ;ltu nc
8138 ((#x01) (if (not (and cbit (not zbit))) (set pc label))) ;leu
8139 ((#x02) (if (not zbit) (set pc label))) ;ne nz
8140 ((#x03) (if (not sbit) (set pc label))) ;pz
8141 ((#x04) (if (not obit) (set pc label))) ;no
8142 ((#x05) (if (not (or zbit (xor sbit obit))) (set pc label))) ;gt
8143 ((#x06) (if (not (xor sbit obit)) (set pc label))) ;ge
8144 ((#x08) (if (trunc BI cbit) (set pc label))) ;geu c
8145 ((#x09) (if (and cbit (not zbit)) (set pc label))) ;gtu
8146 ((#x0a) (if (trunc BI zbit) (set pc label))) ;eq z
8147 ((#x0b) (if (trunc BI sbit) (set pc label))) ;n
8148 ((#x0c) (if (trunc BI obit) (set pc label))) ;o
8149 ((#x0d) (if (or zbit (xor sbit obit)) (set pc label))) ;le
8150 ((#x0e) (if (xor sbit obit) (set pc label))) ;lt
8155 (define-pmacro (jcnd16-sem cnd label)
8158 ((#x00) (if (trunc BI cbit) (set pc label))) ;geu c
8159 ((#x01) (if (and cbit (not zbit)) (set pc label))) ;gtu
8160 ((#x02) (if (trunc BI zbit) (set pc label))) ;eq z
8161 ((#x03) (if (trunc BI sbit) (set pc label))) ;n
8162 ((#x04) (if (not cbit) (set pc label))) ;ltu nc
8163 ((#x05) (if (not (and cbit (not zbit))) (set pc label))) ;leu
8164 ((#x06) (if (not zbit) (set pc label))) ;ne nz
8165 ((#x07) (if (not sbit) (set pc label))) ;pz
8166 ((#x08) (if (or zbit (xor sbit obit)) (set pc label))) ;le
8167 ((#x09) (if (trunc BI obit) (set pc label))) ;o
8168 ((#x0a) (if (not (xor sbit obit)) (set pc label))) ;ge
8169 ((#x0c) (if (not (or zbit (xor sbit obit))) (set pc label))) ;gt
8170 ((#x0d) (if (not obit) (set pc label))) ;no
8171 ((#x0e) (if (xor sbit obit) (set pc label))) ;lt
8178 (RL_JUMP RELAXABLE (machine 16))
8179 "j$cond16j5 ${Lab-8-8}"
8180 (+ (f-0-4 #x6) (f-4-1 1) cond16j5 Lab-8-8)
8181 (jcnd16-sem cond16j5 Lab-8-8)
8187 (RL_JUMP RELAXABLE (machine 16))
8188 "j$cond16j ${Lab-16-8}"
8189 (+ (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #xC) cond16j Lab-16-8)
8190 (jcnd16-sem cond16j Lab-16-8)
8196 (RL_JUMP RELAXABLE (machine 32))
8197 "j$cond32j ${Lab-8-8}"
8198 (+ (f-0-1 1) (f-4-3 5) cond32j Lab-8-8)
8199 (jcnd32-sem cond32j Lab-8-8)
8203 ;-------------------------------------------------------------
8205 ;-------------------------------------------------------------
8207 ; jmp.s label3 (m16 #1)
8208 (dni jmp16.s "jmp.s Lab-5-3" (RL_JUMP RELAXABLE (machine 16))
8209 ("jmp.s ${Lab-5-3}")
8210 (+ (f-0-4 6) (f-4-1 0) Lab-5-3)
8211 (sequence () (set pc Lab-5-3))
8213 ; jmp.b label8 (m16 #2)
8214 (dni jmp16.b "jmp.b Lab-8-8" (RL_JUMP RELAXABLE (machine 16))
8215 ("jmp.b ${Lab-8-8}")
8216 (+ (f-0-4 #xF) (f-4-4 #xE) Lab-8-8)
8217 (sequence () (set pc Lab-8-8))
8219 ; jmp.w label16 (m16 #3)
8220 (dni jmp16.w "jmp.w Lab-8-16" (RL_JUMP RELAXABLE (machine 16))
8221 ("jmp.w ${Lab-8-16}")
8222 (+ (f-0-4 #xF) (f-4-4 4) Lab-8-16)
8223 (sequence () (set pc Lab-8-16))
8225 ; jmp.a label24 (m16 #4)
8226 (dni jmp16.a "jmp.a Lab-8-24" (RL_JUMP RELAXABLE (machine 16))
8227 ("jmp.a ${Lab-8-24}")
8228 (+ (f-0-4 #xF) (f-4-4 #xC) Lab-8-24)
8229 (sequence () (set pc Lab-8-24))
8232 (define-pmacro (jmp16-sem mode dst)
8233 (set pc (and dst #xfffff))
8235 (define-pmacro (jmp32-sem mode dst)
8238 ; jmpi.w dst (m16 #1 m32 #2)
8239 (unary-insn-defn 16 16 HI .w jmpi (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 2) dst16-16-HI) jmp16-sem)
8240 (unary-insn-defn 32 16-Unprefixed HI .w jmpi (+ (f-0-4 #xC) (f-7-1 1) dst32-16-Unprefixed-HI (f-10-2 #x0) (f-12-4 #xF)) jmp32-sem)
8241 ; jmpi.a dst (m16 #2 m32 #2)
8242 (unary-insn-defn 16 16 SI .a jmpi (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 0) dst16-16-SI) jmp16-sem)
8243 (unary-insn-defn 32 16-Unprefixed SI .a jmpi (+ (f-0-4 #x8) (f-7-1 0) dst32-16-Unprefixed-SI (f-10-2 #x0) (f-12-4 1)) jmp32-sem)
8244 ; jmps imm8 (m16 #1)
8245 (dni jmps16 "jmps Imm-8-QI" ((machine 16))
8246 ("jmps #${Imm-8-QI}")
8247 (+ (f-0-4 #xE) (f-4-4 #xE) Imm-8-QI)
8248 (sequence () (set pc Imm-8-QI))
8250 ; jmp.s label3 (m32 #1)
8253 (RL_JUMP RELAXABLE (machine 32))
8254 "jmp.s ${Lab32-jmp-s}"
8255 (+ (f-0-2 1) (f-4-3 5) Lab32-jmp-s)
8256 (set pc Lab32-jmp-s)
8259 ; jmp.b label8 (m32 #2)
8260 (dni jmp32.b "jmp.b Lab-8-8" (RL_JUMP RELAXABLE (machine 32))
8261 ("jmp.b ${Lab-8-8}")
8262 (+ (f-0-4 #xB) (f-4-4 #xB) Lab-8-8)
8265 ; jmp.w label16 (m32 #3)
8266 (dni jmp32.w "jmp.w Lab-8-16" (RL_JUMP RELAXABLE (machine 32))
8267 ("jmp.w ${Lab-8-16}")
8268 (+ (f-0-4 #xC) (f-4-4 #xE) Lab-8-16)
8271 ; jmp.a label24 (m32 #4)
8272 (dni jmp32.a "jmp.a Lab-8-24" (RL_JUMP RELAXABLE (machine 32))
8273 ("jmp.a ${Lab-8-24}")
8274 (+ (f-0-4 #xC) (f-4-4 #xC) Lab-8-24)
8277 ; jmp.s imm8 (m32 #1)
8278 (dni jmps32 "jmps Imm-8-QI" (RL_JUMP (machine 32))
8279 ("jmps #${Imm-8-QI}")
8280 (+ (f-0-4 #xD) (f-4-4 #xC) Imm-8-QI)
8284 ;-------------------------------------------------------------
8285 ; jsr jump subroutine
8286 ;-------------------------------------------------------------
8288 (define-pmacro (jsr16-sem length dst)
8289 (sequence ((SI tpc))
8290 (set tpc (add pc length))
8291 (set (reg h-sp) (sub (reg h-sp) 2))
8292 (set (mem16 HI (reg h-sp)) (srl (and tpc #xffff00) 8))
8293 (set (reg h-sp) (sub (reg h-sp) 1))
8294 (set (mem16 QI (reg h-sp)) (and tpc #xff))
8298 (define-pmacro (jsr32-sem length dst)
8299 (sequence ((SI tpc))
8300 (set tpc (add pc length))
8301 (set (reg h-sp) (sub (reg h-sp) 2))
8302 (set (mem32 HI (reg h-sp)) (srl (and tpc #xffff0000) 16))
8303 (set (reg h-sp) (sub (reg h-sp) 2))
8304 (set (mem32 HI (reg h-sp)) (and tpc #xffff))
8309 ; jsr.w label16 (m16 #1)
8310 (dni jsr16.w "jsr.w Lab-8-16" (RL_JUMP RELAXABLE (machine 16))
8311 ("jsr.w ${Lab-8-16}")
8312 (+ (f-0-4 #xF) (f-4-4 5) Lab-8-16)
8313 (jsr16-sem 3 Lab-8-16)
8315 ; jsr.a label24 (m16 #2)
8316 (dni jsr16.a "jsr.a Lab-8-24" (RL_JUMP RELAXABLE (machine 16))
8317 ("jsr.a ${Lab-8-24}")
8318 (+ (f-0-4 #xF) (f-4-4 #xD) Lab-8-24)
8319 (jsr16-sem 4 Lab-8-24)
8321 (define-pmacro (jsri-defn mode op16 op16-1 op16-2 op16-3 op16-sem
8322 op32 op32-1 op32-2 op32-3 op32-4 op32-sem len)
8324 (dni (.sym jsri16 mode - op16)
8325 (.str "jsri." mode " " op16)
8326 (RL_1ADDR (machine 16))
8327 (.str "jsri." mode " ${" op16 "}")
8328 (+ op16-1 op16-2 op16-3 op16)
8331 (dni (.sym jsri32 mode - op32)
8332 (.str "jsri." mode " " op32)
8333 (RL_1ADDR (machine 32))
8334 (.str "jsri." mode " ${" op32 "}")
8335 (+ op32-1 op32-2 op32-3 op32-4 op32)
8340 ; jsri.w dst (m16 #1 m32 #1))
8341 (jsri-defn w dst16-16-20ar-HI (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #x3) jsr16-sem
8342 dst32-16-24-Unprefixed-HI (f-0-4 #xC) (f-7-1 1) (f-10-2 #x1) (f-12-4 #xF) jsr32-sem 4)
8343 (jsri-defn w dst16-16-16sa-HI (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #x3) jsr16-sem
8344 dst32-16-16sa-Unprefixed-HI (f-0-4 #xC) (f-7-1 1) (f-10-2 #x1) (f-12-4 #xF) jsr32-sem 4)
8345 (jsri-defn w dst16-16-8-HI (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #x3) jsr16-sem
8346 dst32-16-8-Unprefixed-HI (f-0-4 #xC) (f-7-1 1) (f-10-2 #x1) (f-12-4 #xF) jsr32-sem 3)
8347 (jsri-defn w dst16-basic-HI (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #x3) jsr16-sem
8348 dst32-basic-Unprefixed-HI (f-0-4 #xC) (f-7-1 1) (f-10-2 #x1) (f-12-4 #xF) jsr32-sem 2)
8350 ; jsri.a (m16 #2 m32 #2)
8351 (jsri-defn a dst16-16-20ar-SI (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #x1) jsr16-sem
8352 dst32-16-24-Unprefixed-SI (f-0-4 #x9) (f-7-1 0) (f-10-2 #x0) (f-12-4 #x1) jsr32-sem 4)
8353 (jsri-defn a dst16-16-8-SI (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #x1) jsr16-sem
8354 dst32-16-8-Unprefixed-SI (f-0-4 #x9) (f-7-1 0) (f-10-2 #x0) (f-12-4 #x1) jsr32-sem 3)
8355 (jsri-defn a dst16-16-16sa-SI (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #x1) jsr16-sem
8356 dst32-16-16sa-Unprefixed-SI (f-0-4 #x9) (f-7-1 0) (f-10-2 #x0) (f-12-4 #x1) jsr32-sem 4)
8357 (jsri-defn a dst16-basic-SI (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #x1) jsr16-sem
8358 dst32-basic-Unprefixed-SI (f-0-4 #x9) (f-7-1 0) (f-10-2 #x0) (f-12-4 #x1) jsr32-sem 2)
8360 (dni jsri32.a "jsr.w dst32-16-24-Unprefixed-HI" (RL_1ADDR (machine 32))
8361 ("jsri.a ${dst32-16-24-Unprefixed-SI}")
8362 (+ (f-0-4 #x9) (f-7-1 0) dst32-16-24-Unprefixed-SI (f-10-2 #x0) (f-12-4 #x1))
8363 (jsr32-sem 6 dst32-16-24-Unprefixed-SI)
8365 ; jsr.w label16 (m32 #1)
8366 (dni jsr32.w "jsr.w label" (RL_JUMP RELAXABLE (machine 32))
8367 ("jsr.w ${Lab-8-16}")
8368 (+ (f-0-4 #xC) (f-4-4 #xF) Lab-8-16)
8369 (jsr32-sem 3 Lab-8-16)
8371 ; jsr.a label16 (m32 #2)
8372 (dni jsr32.a "jsr.a label" (RL_JUMP (machine 32))
8373 ("jsr.a ${Lab-8-24}")
8374 (+ (f-0-4 #xC) (f-4-4 #xD) Lab-8-24)
8375 (jsr32-sem 4 Lab-8-24)
8377 ; jsrs imm8 (m16 #1)
8378 (dni jsrs16 "jsrs Imm-8-QI" ((machine 16))
8379 ("jsrs #${Imm-8-QI}")
8380 (+ (f-0-4 #xE) (f-4-4 #xF) Imm-8-QI)
8381 (jsr16-sem 2 Imm-8-QI)
8383 ; jsrs imm8 (m32 #1)
8384 (dni jsrs "jsrs #Imm-8-QI" ((machine 32))
8385 ("jsrs #${Imm-8-QI}")
8386 (+ (f-0-4 #xD) (f-4-4 #xD) Imm-8-QI)
8387 (jsr32-sem 2 Imm-8-QI)
8390 ;-------------------------------------------------------------
8391 ; ldc - load control register
8392 ; stc - store control register
8393 ;-------------------------------------------------------------
8395 (define-pmacro (ldc32-cr1-sem src dst)
8398 ((#x0) (set (reg h-dct0) src))
8399 ((#x1) (set (reg h-dct1) src))
8400 ((#x2) (sequence ((HI tflag))
8402 (if (and tflag #x1) (set cbit 1))
8403 (if (and tflag #x2) (set dbit 1))
8404 (if (and tflag #x4) (set zbit 1))
8405 (if (and tflag #x8) (set sbit 1))
8406 (if (and tflag #x10) (set bbit 1))
8407 (if (and tflag #x20) (set obit 1))
8408 (if (and tflag #x40) (set ibit 1))
8409 (if (and tflag #x80) (set ubit 1))))
8410 ((#x3) (set (reg h-svf) src))
8411 ((#x4) (set (reg h-drc0) src))
8412 ((#x5) (set (reg h-drc1) src))
8413 ((#x6) (set (reg h-dmd0) src))
8414 ((#x7) (set (reg h-dmd1) src))
8418 (define-pmacro (ldc32-cr2-sem src dst)
8421 ((#x0) (set (reg h-intb) src))
8422 ((#x1) (set (reg h-sp) src))
8423 ((#x2) (set (reg h-sb) src))
8424 ((#x3) (set (reg h-fb) src))
8425 ((#x4) (set (reg h-svp) src))
8426 ((#x5) (set (reg h-vct) src))
8427 ((#x7) (set (reg h-isp) src))
8431 (define-pmacro (ldc32-cr3-sem src dst)
8434 ((#x2) (set (reg h-dma0) src))
8435 ((#x3) (set (reg h-dma1) src))
8436 ((#x4) (set (reg h-dra0) src))
8437 ((#x5) (set (reg h-dra1) src))
8438 ((#x6) (set (reg h-dsa0) src))
8439 ((#x7) (set (reg h-dsa1) src))
8443 (define-pmacro (ldc16-sem src dst)
8446 ((#x1) (set (reg h-intb) src))
8447 ((#x2) (set (reg h-intb) (or (reg h-intb) (sll src (const 16)))))
8448 ((#x3) (sequence ((HI tflag))
8450 (if (and tflag #x1) (set cbit 1))
8451 (if (and tflag #x2) (set dbit 1))
8452 (if (and tflag #x4) (set zbit 1))
8453 (if (and tflag #x8) (set sbit 1))
8454 (if (and tflag #x10) (set bbit 1))
8455 (if (and tflag #x20) (set obit 1))
8456 (if (and tflag #x40) (set ibit 1))
8457 (if (and tflag #x80) (set ubit 1))))
8458 ((#x4) (set (reg h-isp) src))
8459 ((#x5) (set (reg h-sp) src))
8460 ((#x6) (set (reg h-sb) src))
8461 ((#x7) (set (reg h-fb) src))
8466 (define-pmacro (stc32-cr1-sem src dst)
8469 ((#x0) (set dst (reg h-dct0)))
8470 ((#x1) (set dst (reg h-dct1)))
8471 ((#x2) (sequence ((HI tflag))
8473 (if (eq cbit 1) (set tflag (or tflag #x1)))
8474 (if (eq dbit 1) (set tflag (or tflag #x2)))
8475 (if (eq zbit 1) (set tflag (or tflag #x4)))
8476 (if (eq sbit 1) (set tflag (or tflag #x8)))
8477 (if (eq bbit 1) (set tflag (or tflag #x10)))
8478 (if (eq obit 1) (set tflag (or tflag #x20)))
8479 (if (eq ibit 1) (set tflag (or tflag #x40)))
8480 (if (eq ubit 1) (set tflag (or tflag #x80)))
8482 ((#x3) (set dst (reg h-svf)))
8483 ((#x4) (set dst (reg h-drc0)))
8484 ((#x5) (set dst (reg h-drc1)))
8485 ((#x6) (set dst (reg h-dmd0)))
8486 ((#x7) (set dst (reg h-dmd1)))
8490 (define-pmacro (stc32-cr2-sem src dst)
8493 ((#x0) (set dst (reg h-intb)))
8494 ((#x1) (set dst (reg h-sp)))
8495 ((#x2) (set dst (reg h-sb)))
8496 ((#x3) (set dst (reg h-fb)))
8497 ((#x4) (set dst (reg h-svp)))
8498 ((#x5) (set dst (reg h-vct)))
8499 ((#x7) (set dst (reg h-isp)))
8503 (define-pmacro (stc32-cr3-sem src dst)
8506 ((#x2) (set dst (reg h-dma0)))
8507 ((#x3) (set dst (reg h-dma1)))
8508 ((#x4) (set dst (reg h-dra0)))
8509 ((#x5) (set dst (reg h-dra1)))
8510 ((#x6) (set dst (reg h-dsa0)))
8511 ((#x7) (set dst (reg h-dsa1)))
8515 (define-pmacro (stc16-sem src dst)
8518 ((#x1) (set dst (and (reg h-intb) (const #xffff))))
8519 ((#x2) (set dst (srl (reg h-intb) (const 16))))
8520 ((#x3) (sequence ((HI tflag))
8522 (if (eq cbit 1) (set tflag (or tflag #x1)))
8523 (if (eq dbit 1) (set tflag (or tflag #x2)))
8524 (if (eq zbit 1) (set tflag (or tflag #x4)))
8525 (if (eq sbit 1) (set tflag (or tflag #x8)))
8526 (if (eq bbit 1) (set tflag (or tflag #x10)))
8527 (if (eq obit 1) (set tflag (or tflag #x20)))
8528 (if (eq ibit 1) (set tflag (or tflag #x40)))
8529 (if (eq ubit 1) (set tflag (or tflag #x80)))
8531 ((#x4) (set dst (reg h-isp)))
8532 ((#x5) (set dst (reg h-sp)))
8533 ((#x6) (set dst (reg h-sb)))
8534 ((#x7) (set dst (reg h-fb)))
8539 (dni ldc16.imm16 "ldc #imm,dst" ((machine 16))
8540 ("ldc #${Imm-16-HI},${cr16}")
8541 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-1 0) (f-12-4 0) cr16 Imm-16-HI)
8542 (ldc16-sem Imm-16-HI cr16)
8545 (dni ldc16.dst "ldc src,dest" ((machine 16))
8546 ("ldc ${dst16-16-HI},${cr16}")
8547 (+ (f-0-4 7) (f-4-4 #xA) (f-8-1 1) cr16 dst16-16-HI)
8548 (ldc16-sem dst16-16-HI cr16)
8550 ; ldc src,dest (m32c #4)
8551 (dni ldc32.src-cr1 "ldc src,dst" ((machine 32))
8552 ("ldc ${dst32-24-Prefixed-HI},${cr1-Prefixed-32}")
8553 (+ (f-0-4 0) (f-4-4 1) (f-8-4 #xD) dst32-24-Prefixed-HI (f-15-1 1) (f-18-2 0) (f-20-1 1) cr1-Prefixed-32)
8554 (ldc32-cr1-sem dst32-24-Prefixed-HI cr1-Prefixed-32)
8556 ; ldc src,dest (m32c #5)
8557 (dni ldc32.src-cr2 "ldc src,dest" ((machine 32))
8558 ("ldc ${dst32-16-Unprefixed-SI},${cr2-32}")
8559 (+ (f-0-4 #xD) dst32-16-Unprefixed-SI (f-7-1 1) (f-10-2 0) (f-12-1 0) cr2-32)
8560 (ldc32-cr2-sem dst32-16-Unprefixed-SI cr2-32)
8562 ; ldc src,dest (m32c #6)
8563 (dni ldc32.src-cr3 "ldc src,dst" ((machine 32))
8564 ("ldc ${dst32-24-Prefixed-SI},${cr3-Prefixed-32}")
8565 (+ (f-0-4 0) (f-4-4 1) (f-8-4 #xD) dst32-24-Prefixed-SI (f-15-1 1) (f-18-2 0) (f-20-1 0) cr3-Prefixed-32)
8566 (ldc32-cr3-sem dst32-24-Prefixed-SI cr3-Prefixed-32)
8568 ; ldc src,dest (m32c #1)
8569 (dni ldc32.imm16-cr1 "ldc #imm,dst" ((machine 32))
8570 ("ldc #${Imm-16-HI},${cr1-Unprefixed-32}")
8571 (+ (f-0-4 #xD) (f-4-4 5) (f-8-4 #xA) (f-12-1 1) cr1-Unprefixed-32 Imm-16-HI)
8572 (ldc32-cr1-sem Imm-16-HI cr1-Unprefixed-32)
8574 ; ldc src,dest (m32c #2)
8575 (dni ldc32.imm16-cr2 "ldc #imm,dst" ((machine 32))
8576 ("ldc #${Dsp-16-u24},${cr2-32}")
8577 (+ (f-0-4 #xD) (f-4-4 5) (f-8-4 2) (f-12-1 1) cr2-32 Dsp-16-u24)
8578 (ldc32-cr2-sem Dsp-16-u24 cr2-32)
8580 ; ldc src,dest (m32c #3)
8581 (dni ldc32.imm16-cr3 "ldc #imm,dst" ((machine 32))
8582 ("ldc #${Dsp-16-u24},${cr3-Unprefixed-32}")
8583 (+ (f-0-4 #xD) (f-4-4 5) (f-8-4 6) (f-12-1 1) cr3-Unprefixed-32 Dsp-16-u24)
8584 (ldc32-cr3-sem Dsp-16-u24 cr3-Unprefixed-32)
8587 (dni stc16.src "stc src,dest" ((machine 16))
8588 ("stc ${cr16},${dst16-16-HI}")
8589 (+ (f-0-4 7) (f-4-4 #xB) (f-8-1 1) cr16 dst16-16-HI)
8590 (stc16-sem cr16 dst16-16-HI )
8593 (dni stc16.pc "stc pc,dest" ((machine 16))
8594 ("stc pc,${dst16-16-HI}")
8595 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 #xC) dst16-16-HI)
8596 (sequence () (set dst16-16-HI (reg h-pc)))
8599 (dni stc32.src-cr1 "stc src,dst" ((machine 32))
8600 ("stc ${cr1-Prefixed-32},${dst32-24-Prefixed-HI}")
8601 (+ (f-0-4 0) (f-4-4 1) (f-8-4 #xD) dst32-24-Prefixed-HI (f-15-1 1) (f-18-2 1) (f-20-1 1) cr1-Prefixed-32)
8602 (stc32-cr1-sem cr1-Prefixed-32 dst32-24-Prefixed-HI )
8605 (dni stc32.src-cr2 "stc src,dest" ((machine 32))
8606 ("stc ${cr2-32},${dst32-16-Unprefixed-SI}")
8607 (+ (f-0-4 #xD) dst32-16-Unprefixed-SI (f-7-1 1) (f-10-2 0) (f-12-1 2) cr2-32)
8608 (stc32-cr2-sem cr2-32 dst32-16-Unprefixed-SI )
8611 (dni stc32.src-cr3 "stc src,dst" ((machine 32))
8612 ("stc ${cr3-Prefixed-32},${dst32-24-Prefixed-SI}")
8613 (+ (f-0-4 0) (f-4-4 1) (f-8-4 #xD) dst32-24-Prefixed-SI (f-15-1 1) (f-18-2 1) (f-20-1 0) cr3-Prefixed-32)
8614 (stc32-cr3-sem cr3-Prefixed-32 dst32-24-Prefixed-SI )
8617 ;-------------------------------------------------------------
8618 ; ldctx - load context
8619 ; stctx - store context
8620 ;-------------------------------------------------------------
8623 (dni ldctx16 "ldctx abs16,abs24" ((machine 16))
8624 ("ldctx ${Dsp-16-u16},${Dsp-32-u24}")
8625 (+ (f-0-4 #x7) (f-4-4 #xC) (f-8-4 #xF) (f-12-4 #x0) Dsp-16-u16 Dsp-32-u24)
8628 (dni ldctx32 "ldctx abs16,abs24" ((machine 32))
8629 ("ldctx ${Dsp-16-u16},${Dsp-32-u24}")
8630 (+ (f-0-4 #xB) (f-4-4 #x6) (f-8-4 #xC) (f-12-4 #x3) Dsp-16-u16 Dsp-32-u24)
8633 (dni stctx16 "stctx abs16,abs24" ((machine 16))
8634 ("stctx ${Dsp-16-u16},${Dsp-32-u24}")
8635 (+ (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #xF) (f-12-4 #x0) Dsp-16-u16 Dsp-32-u24)
8638 (dni stctx32 "stctx abs16,abs24" ((machine 32))
8639 ("stctx ${Dsp-16-u16},${Dsp-32-u24}")
8640 (+ (f-0-4 #xB) (f-4-4 #x6) (f-8-4 #xD) (f-12-4 #x3) Dsp-16-u16 Dsp-32-u24)
8644 ;-------------------------------------------------------------
8645 ; lde - load from extra far data area (m16)
8646 ; ste - store to extra far data area (m16)
8647 ;-------------------------------------------------------------
8655 ;-------------------------------------------------------------
8656 ; ldipl - load interrupt permission level
8657 ;-------------------------------------------------------------
8660 ; ldintb <==> ldc #imm,intbh ; ldc #imm,intbl
8662 (dni ldipl16.imm "ldipl #imm" ((machine 16))
8663 ("ldipl #${Imm-13-u3}")
8664 (+ (f-0-4 #x7) (f-4-4 #xD) (f-8-4 #xA) (f-12-1 0) Imm-13-u3)
8667 (dni ldipl32.imm "ldipl #imm" ((machine 32))
8668 ("ldipl #${Imm-13-u3}")
8669 (+ (f-0-4 #xD) (f-4-4 5) (f-8-4 #xE) (f-12-1 1) Imm-13-u3)
8674 ;-------------------------------------------------------------
8675 ; max - maximum value
8676 ;-------------------------------------------------------------
8678 ; TODO check semantics for min -1,0
8679 (define-pmacro (max-sem mode src dst)
8681 (if (gt mode src dst)
8682 (set mode dst src)))
8685 ; max.size:G #imm,dst
8686 (binary-arith32-imm-dst-Prefixed QI QI .b 0 max X #x8 #x3 #xF max-sem)
8687 (binary-arith32-imm-dst-Prefixed HI HI .w 1 max X #x8 #x3 #xF max-sem)
8690 (binary-arith32-src-dst-Prefixed QI QI .b 0 max X #x1 #xD max-sem)
8691 (binary-arith32-src-dst-Prefixed HI HI .w 1 max X #x1 #xD max-sem)
8693 ;-------------------------------------------------------------
8694 ; min - minimum value
8695 ;-------------------------------------------------------------
8697 (define-pmacro (min-sem mode src dst)
8699 (if (lt mode src dst)
8700 (set mode dst src)))
8703 ; min.size:G #imm,dst
8704 (binary-arith32-imm-dst-Prefixed QI QI .b 0 min X #x8 #x2 #xF min-sem)
8705 (binary-arith32-imm-dst-Prefixed HI HI .w 1 min X #x8 #x2 #xF min-sem)
8708 (binary-arith32-src-dst-Prefixed QI QI .b 0 min X #x1 #xC min-sem)
8709 (binary-arith32-src-dst-Prefixed HI HI .w 1 min X #x1 #xC min-sem)
8711 ;-------------------------------------------------------------
8713 ;-------------------------------------------------------------
8715 (define-pmacro (mov-sem mode src1 dst)
8716 (sequence ((mode result))
8718 (set-z-and-s result)
8719 (set mode dst src1))
8722 (define-pmacro (mov-dspsp-dst-sem mach mode src1 dst)
8723 (set dst (mem-mach mach mode (add sp src1)))
8726 (define-pmacro (mov-src-dspsp-sem mach mode src dst1)
8727 (set (mem-mach mach mode (add sp dst1)) src)
8730 (define-pmacro (mov16-imm-an-defn size mode imm regn op1 op2)
8731 (dni (.sym mov16. size .S-imm- regn)
8732 (.str "mov." size ":S " imm "," regn)
8734 (.str "mov." size "$S #${" imm "}," regn)
8736 (mov-sem mode imm (reg (.sym h- regn)))
8739 ; mov.size:G #imm,dst (m16 #1 m32 #1)
8740 (binary-arith-imm-dst mov G (f-0-4 7) (f-4-3 2) (f-8-4 #xC) #x9 #x2 #xF mov-sem)
8741 ; mov.L:G #imm32,dst (m32 #2)
8742 (binary-arith32-imm-dst-defn SI SI .l 0 mov G #xB #x3 #x1 mov-sem)
8743 ; mov.BW:S #imm,dst2 (m32 #4)
8744 (binary-arith32-s-imm-dst QI .b 0 mov #x0 #x2 mov-sem)
8745 (binary-arith32-s-imm-dst HI .w 1 mov #x0 #x2 mov-sem)
8746 ; mov.b:S #imm8,dst3 (m16 #3)
8747 (binary-arith16-b-S-imm8-dst3 mov ".b" (f-0-4 #xC) (f-4-1 0) mov-sem)
8748 ; mov.b:S #imm8,aN (m16 #4)
8749 (mov16-imm-an-defn b QI Imm-8-QI a0 (f-0-4 #xE) (f-4-4 2))
8750 (mov16-imm-an-defn b QI Imm-8-QI a1 (f-0-4 #xE) (f-4-4 #xA))
8751 (mov16-imm-an-defn w HI Imm-8-HI a0 (f-0-4 #xA) (f-4-4 2))
8752 (mov16-imm-an-defn w HI Imm-8-HI a1 (f-0-4 #xA) (f-4-4 #xA))
8753 ; mov.WL:S #imm,A0/A1 (m32 #5)
8754 (define-pmacro (mov32-wl-s-defn mode sz op1 imm regn op2)
8755 (dni (.sym mov32- sz - regn)
8756 (.str "mov." sz ":s" imm "," regn)
8758 (.str "mov." sz "$S #${" imm "}," regn)
8759 (+ (f-0-4 op1) (f-4-4 op2) imm)
8760 (mov-sem mode imm (reg (.sym h- regn)))
8763 (mov32-wl-s-defn HI w #x9 Imm-8-HI a0 #xC)
8764 (mov32-wl-s-defn HI w #x9 Imm-8-HI a1 #xD)
8765 (mov32-wl-s-defn SI l #xB Dsp-8-s24 a0 #xC)
8766 (mov32-wl-s-defn SI l #xB Dsp-8-s24 a1 #xD)
8768 ; mov.size:Q #imm4,dst (m16 #2 m32 #3)
8769 (binary-arith16-imm4-dst-defn QI .b 0 0 mov (f-0-4 #xD) (f-4-3 4) mov-sem)
8770 (binary-arith16-imm4-dst-defn HI .w 0 1 mov (f-0-4 #xD) (f-4-3 4) mov-sem)
8771 (binary-arith32-imm4-dst-defn QI .b 1 0 mov #x7 #x2 mov-sem)
8772 (binary-arith32-imm4-dst-defn HI .w 1 1 mov #x7 #x2 mov-sem)
8774 ; mov.BW:Z #0,dst (m16 #5 m32 #6)
8775 (dni mov16.b-Z-imm8-dst3
8776 "mov.b:Z #0,Dst16-3-S-8"
8778 "mov.b$Z #0,${Dst16-3-S-8}"
8779 (+ (f-0-4 #xB) (f-4-1 #x0) Dst16-3-S-8)
8780 (mov-sem QI (const 0) Dst16-3-S-8)
8782 ; (binary-arith16-b-Z-imm8-dst3 mov ".b" (f-0-4 #xB) (f-4-1 0) mov-sem)
8783 (binary-arith32-z-imm-dst QI .b 0 mov #x0 #x1 mov-sem)
8784 (binary-arith32-z-imm-dst HI .w 1 mov #x0 #x1 mov-sem)
8785 ; mov.BW:G src,dst (m16 #6 m32 #7)
8786 (binary-arith-src-dst mov G (f-0-4 #x7) (f-4-3 1) #x1 #xB mov-sem)
8787 ; mov.B:S src2,a0/a1 (m16 #7)
8788 (dni (.sym mov 16 .b.S-An)
8789 (.str mov ".b:S src2,a[01]")
8791 (.str mov ".b$S ${src16-2-S},${Dst16AnQI-S}")
8792 (+ (f-0-4 #x3) (f-4-1 0) Dst16AnQI-S src16-2-S)
8793 (mov-sem QI src16-2-S Dst16AnQI-S)
8795 (define-pmacro (mov16-b-s-an-defn op1 op2 op2c)
8796 (dni (.sym mov16.b.S- op1 - op2)
8797 (.str mov ".b:S " op1 "," op2)
8799 (.str mov ".b$S " op1 "," op2)
8800 (+ (f-0-4 #x3) op2c)
8801 (mov-sem QI (reg (.sym h- op1)) (reg (.sym h- op2)))
8804 (mov16-b-s-an-defn r0l a1 (f-4-4 #x4))
8805 (mov16-b-s-an-defn r0h a0 (f-4-4 #x0))
8807 ; mov.L:G src,dst (m32 #8)
8808 (binary-arith32-src-dst-defn SI SI .l 1 mov G #x1 #x3 mov-sem)
8809 ; mov.B:S r0l/r0h,dst2 (m16 #8)
8810 (dni (.sym mov 16 .b.S-Rn-An)
8811 (.str mov ".b:S r0[lh],src2")
8813 (.str mov ".b$S ${Dst16RnQI-S},${src16-2-S}")
8814 (+ (f-0-4 #x0) (f-4-1 0) Dst16RnQI-S src16-2-S)
8815 (mov-sem QI src16-2-S Dst16RnQI-S)
8818 ; mov.B.S src2,r0l/r0h (m16 #9)
8819 (binary-arith16-b-S-src2 mov (f-0-4 0) (f-4-1 1) mov-sem)
8821 ; mov.BW:S src2,r0l/r0 (m32 #9)
8822 ; mov.BW:S src2,r1l/r1 (m32 #10)
8823 (define-pmacro (mov32-src-r sz szcode mode src dst opc1 opc2)
8825 (dni (.sym mov32. sz - src - dst)
8826 (.str "mov." sz "src," dst)
8828 (.str "mov." sz "$S ${" (.sym src - mode) "}," dst)
8829 (+ (f-0-2 opc1) (.sym src - mode) (f-4-3 opc2) (f-7-1 szcode))
8830 (mov-sem mode (.sym src - mode) (reg (.sym h- dst)))
8834 (mov32-src-r b 0 QI dst32-2-S-16 r0l 0 4)
8835 (mov32-src-r w 1 HI dst32-2-S-16 r0 0 4)
8836 (mov32-src-r b 0 QI dst32-2-S-8 r0l 0 4)
8837 (mov32-src-r w 1 HI dst32-2-S-8 r0 0 4)
8838 (mov32-src-r b 0 QI dst32-2-S-basic r1l 1 7)
8839 (mov32-src-r w 1 HI dst32-2-S-basic r1 1 7)
8840 (mov32-src-r b 0 QI dst32-2-S-16 r1l 1 7)
8841 (mov32-src-r w 1 HI dst32-2-S-16 r1 1 7)
8842 (mov32-src-r b 0 QI dst32-2-S-8 r1l 1 7)
8843 (mov32-src-r w 1 HI dst32-2-S-8 r1 1 7)
8845 ; mov.BW:S r0l/r0,dst2 (m32 #11)
8846 (define-pmacro (mov32-r-dest sz szcode mode src dst opc1 opc2)
8848 (dni (.sym mov32. sz - src - dst)
8849 (.str "mov." sz "src," dst)
8851 (.str "mov." sz "$S " src ",${" (.sym dst - mode) "}")
8852 (+ (f-0-2 opc1) (.sym dst - mode) (f-4-3 opc2) (f-7-1 szcode))
8853 (mov-sem mode (reg (.sym h- src)) (.sym dst - mode))
8857 (mov32-r-dest b 0 QI r0l dst32-2-S-16 0 0)
8858 (mov32-r-dest w 1 HI r0 dst32-2-S-16 0 0)
8859 (mov32-r-dest b 0 QI r0l dst32-2-S-8 0 0)
8860 (mov32-r-dest w 1 HI r0 dst32-2-S-8 0 0)
8862 ; mov.L:S src,A0/A1 (m32 #12)
8863 (define-pmacro (mov32-src-a src dst dstcode opc1 opc2)
8865 (dni (.sym mov32. sz - src - dst)
8866 (.str "mov." sz "src," dst)
8868 (.str "mov.l" "$S ${" (.sym src - SI) "}," dst)
8869 (+ (f-0-2 opc1) (.sym src - SI) (f-4-3 opc2) (f-7-1 dstcode))
8870 (mov-sem SI (.sym src - SI) (reg (.sym h- dst)))
8874 (mov32-src-a dst32-2-S-16 a0 0 1 4)
8875 (mov32-src-a dst32-2-S-16 a1 1 1 4)
8876 (mov32-src-a dst32-2-S-8 a0 0 1 4)
8877 (mov32-src-a dst32-2-S-8 a1 1 1 4)
8879 ; mov.BW:G dsp8[sp],dst (m16 #10 m32 #13)
8880 ; mov.BW:G src,dsp8[sp] (m16 #11 m32 #14)
8881 (mov-dspsp-dst mov (f-0-4 #x7) (f-4-3 2) (f-8-4 #xB) #xB #x0 #xF mov-dspsp-dst-sem)
8882 (mov-src-dspsp mov (f-0-4 #x7) (f-4-3 2) (f-8-4 #x3) #xA #x0 #xF mov-src-dspsp-sem)
8884 ;-------------------------------------------------------------
8885 ; mova - move effective address
8886 ;-------------------------------------------------------------
8888 (define-pmacro (mov16a-defn dst dstop dstcode)
8889 (dni (.sym mova16. src - dst)
8890 (.str "mova src," dst)
8892 (.str "mova ${dst16-16-Mova-HI}," dst)
8893 (+ (f-0-4 #xE) (f-4-4 #xB) dst16-16-Mova-HI (f-8-4 dstcode))
8894 (sequence () (set HI (reg dstop) dst16-16-Mova-HI))
8897 (mov16a-defn r0 h-r0 0)
8898 (mov16a-defn r1 h-r1 1)
8899 (mov16a-defn r2 h-r2 2)
8900 (mov16a-defn r3 h-r3 3)
8901 (mov16a-defn a0 h-a0 4)
8902 (mov16a-defn a1 h-a1 5)
8904 (define-pmacro (mov32a-defn dst dstop dstcode)
8905 (dni (.sym mova32. src - dst)
8906 (.str "mova src," dst)
8908 (.str "mova ${dst32-16-Unprefixed-Mova-SI}," dst)
8909 (+ (f-0-4 #xD) dst32-16-Unprefixed-Mova-SI (f-7-1 1) (f-10-2 1) (f-12-1 1) (f-13-3 dstcode))
8910 (sequence () (set SI (reg dstop) dst32-16-Unprefixed-Mova-SI))
8913 (mov32a-defn r2r0 h-r2r0 0)
8914 (mov32a-defn r3r1 h-r3r1 1)
8915 (mov32a-defn a0 h-a0 2)
8916 (mov32a-defn a1 h-a1 3)
8918 ;-------------------------------------------------------------
8919 ; movDir - move nibble
8920 ;-------------------------------------------------------------
8922 (define-pmacro (movdir-sem nib src dst)
8923 (sequence ((SI tmp))
8925 ((0) (set dst (or (and dst #xf0) (and src #xf))))
8926 ((1) (set dst (or (and dst #x0f) (sll (and src #xf) 4))))
8927 ((2) (set dst (or (and dst #xf0) (srl (and src #xf0) 4))))
8928 ((3) (set dst (or (and dst #x0f) (and src #xf0))))
8933 (define-pmacro (mov16dir-1-defn nib dircode dir)
8934 (dni (.sym mov nib 16 ".r0l-dst")
8935 (.str "mov" nib " r0l,dst")
8937 (.str "mov" nib " r0l,${dst16-16-QI}")
8938 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 dir) dst16-16-QI)
8939 (movdir-sem dircode (reg h-r0l) dst16-16-QI)
8942 (mov16dir-1-defn ll 0 8)
8943 (mov16dir-1-defn lh 1 #xA)
8944 (mov16dir-1-defn hl 2 9)
8945 (mov16dir-1-defn hh 3 #xB)
8946 (define-pmacro (mov16dir-2-defn nib dircode dir)
8947 (dni (.sym mov nib 16 ".src-r0l")
8948 (.str "mov" nib " src,r0l")
8950 (.str "mov" nib " ${dst16-16-QI},r0l")
8951 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 dir) dst16-16-QI)
8952 (movdir-sem dircode dst16-16-QI (reg h-r0l))
8955 (mov16dir-2-defn ll 0 0)
8956 (mov16dir-2-defn lh 1 2)
8957 (mov16dir-2-defn hl 2 1)
8958 (mov16dir-2-defn hh 3 3)
8960 (define-pmacro (mov32dir-1-defn nib o1o0)
8961 (dni (.sym mov nib 32 ".r0l-dst")
8962 (.str "mov" nib " r0l,dst")
8964 (.str "mov" nib " r0l,${dst32-24-Prefixed-QI}")
8965 (+ (f-0-4 #x0) (f-4-4 #x1) (f-8-4 #xB) dst32-24-Prefixed-QI (f-15-1 0) (f-18-2 o1o0) (f-20-4 #xE))
8966 (movdir-sem o1o0 (reg h-r0l) dst32-24-Prefixed-QI)
8969 (mov32dir-1-defn ll 0)
8970 (mov32dir-1-defn lh 1)
8971 (mov32dir-1-defn hl 2)
8972 (mov32dir-1-defn hh 3)
8973 (define-pmacro (mov32dir-2-defn nib o1o0)
8974 (dni (.sym mov nib 32 ".src-r0l")
8975 (.str "mov" nib " src,r0l")
8977 (.str "mov" nib " ${dst32-24-Prefixed-QI},r0l")
8978 (+ (f-0-4 #x0) (f-4-4 #x1) (f-8-4 #xA) dst32-24-Prefixed-QI (f-15-1 0) (f-18-2 o1o0) (f-20-4 #xE))
8979 (movdir-sem o1o0 dst32-24-Prefixed-QI (reg h-r0l))
8982 (mov32dir-2-defn ll 0)
8983 (mov32dir-2-defn lh 1)
8984 (mov32dir-2-defn hl 2)
8985 (mov32dir-2-defn hh 3)
8987 ;-------------------------------------------------------------
8988 ; movx - move extend sign (m32)
8989 ;-------------------------------------------------------------
8991 (define-pmacro (movx-sem mode src dst)
8992 (sequence ((SI source) (SI result))
8994 (set-z-and-s result)
8999 (binary-arith32-imm-dst-defn QI SI "" 0 movx X #xB #x1 #x1 movx-sem)
9001 ;-------------------------------------------------------------
9003 ;-------------------------------------------------------------
9005 (define-pmacro (mul-sem mode src1 dst)
9006 (sequence ((mode result))
9007 (set obit (add-oflag mode src1 dst 0))
9008 (set result (mul mode src1 dst))
9013 (binary-arith-imm-dst mul G (f-0-4 7) (f-4-3 6) (f-8-4 5) #x8 #x1 #xF mul-sem)
9015 (binary-arith-src-dst mul G (f-0-4 #x7) (f-4-3 4) #x1 #xC mul-sem)
9017 (dni mul_l "mul.l src,r2r0" ((machine 32))
9018 ("mul.l ${dst32-24-Prefixed-SI},r2r0")
9019 (+ (f-0-4 #x0) (f-4-4 #x1) (f-8-4 #x8) (f-15-1 #x1) (f-18-2 #x1) (f-20-4 #xf)
9020 dst32-24-Prefixed-SI)
9023 (dni mulu_l "mulu.l src,r2r0" ((machine 32))
9024 ("mulu.l ${dst32-24-Prefixed-SI},r2r0")
9025 (+ (f-0-4 #x0) (f-4-4 #x1) (f-8-4 #x8) (f-15-1 #x1) (f-18-2 #x0) (f-20-4 #xf)
9026 dst32-24-Prefixed-SI)
9028 ;-------------------------------------------------------------
9029 ; mulex - multiple extend sign (m32)
9030 ;-------------------------------------------------------------
9033 ; (dni mulex-absolute-indirect "mulex [src]" ((machine 32))
9034 ; ("mulex ${dst32-24-absolute-indirect-HI}")
9035 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 #xC) dst32-24-absolute-indirect-HI (f-15-1 1) (f-18-2 3) (f-20-4 #xE))
9036 ; (set R1R2R0 (mul DI (ext DI R2R0) (ext DI dst32-24-absolute-indirect-HI)))
9038 (dni mulex "mulex src" ((machine 32))
9039 ("mulex ${dst32-16-Unprefixed-Mulex-HI}")
9040 (+ (f-0-4 #xC) dst32-16-Unprefixed-Mulex-HI (f-7-1 1) (f-10-2 3) (f-12-4 #xE))
9041 (set R1R2R0 (mul DI (ext DI R2R0) (ext DI dst32-16-Unprefixed-Mulex-HI)))
9043 ; (dni mulex-indirect "mulex [src]" ((machine 32))
9044 ; ("mulex ${dst32-24-indirect-HI}")
9045 ; (+ (f-0-4 0) (f-4-4 9) (f-8-4 #xC) dst32-24-indirect-HI (f-15-1 1) (f-18-2 3) (f-20-4 #xE))
9046 ; (set R1R2R0 (mul DI (ext DI R2R0) (ext DI dst32-24-indirect-HI)))
9049 ;-------------------------------------------------------------
9050 ; mulu - multiply unsigned
9051 ;-------------------------------------------------------------
9053 (define-pmacro (mulu-sem mode src1 dst)
9054 (sequence ((mode result))
9055 (set obit (add-oflag mode src1 dst 0))
9056 (set result (mul mode src1 dst))
9061 (binary-arith-imm-dst mulu G (f-0-4 7) (f-4-3 6) (f-8-4 4) #x8 #x0 #xF mulu-sem)
9063 (binary-arith-src-dst mulu G (f-0-4 #x7) (f-4-3 0) #x1 #x4 mulu-sem)
9065 ;-------------------------------------------------------------
9066 ; neg - twos complement
9067 ;-------------------------------------------------------------
9069 (define-pmacro (neg-sem mode dst)
9070 (sequence ((mode result))
9071 (set result (neg mode dst))
9072 (set-z-and-s result)
9077 (unary-insn neg (f-0-4 7) (f-4-3 2) (f-8-4 #x5) #xA #x2 #xF neg-sem)
9079 ;-------------------------------------------------------------
9080 ; not - twos complement
9081 ;-------------------------------------------------------------
9083 (define-pmacro (not-sem mode dst)
9084 (sequence ((mode result))
9085 (set result (not mode dst))
9086 (set-z-and-s result)
9091 (unary-insn-g not (f-0-4 7) (f-4-3 2) (f-8-4 #x7) #xA #x1 #xE not-sem)
9094 "not.b:s Dst16-3-S-8"
9096 "not.b:s ${Dst16-3-S-8}"
9097 (+ (f-0-4 #xb) (f-4-1 #x1) Dst16-3-S-8)
9098 (not-sem QI Dst16-3-S-8)
9101 ;-------------------------------------------------------------
9103 ;-------------------------------------------------------------
9109 (+ (f-0-4 #x0) (f-4-4 #x4))
9117 (+ (f-0-4 #xD) (f-4-4 #xE))
9121 ;-------------------------------------------------------------
9123 ;-------------------------------------------------------------
9125 (define-pmacro (or-sem mode src1 dst)
9126 (sequence ((mode result))
9127 (set result (or mode src1 dst))
9128 (set-z-and-s result)
9132 ; or.BW #imm,dst (m16 #1 m32 #1)
9133 (binary-arith-imm-dst or G (f-0-4 7) (f-4-3 3) (f-8-4 3) #x8 #x2 #xF or-sem)
9134 ; or.b:S #imm8,dst3 (m16 #2 m32 #2)
9135 (binary-arith16-b-S-imm8-dst3 or ".b" (f-0-4 9) (f-4-1 1) or-sem)
9136 (binary-arith32-s-imm-dst QI .b 0 or #x1 #x2 or-sem)
9137 (binary-arith32-s-imm-dst HI .w 1 or #x1 #x2 or-sem)
9138 ; or.BW src,dst (m16 #3 m32 #3)
9139 (binary-arith-src-dst or G (f-0-4 #x9) (f-4-3 4) #x1 #x5 or-sem)
9140 ; or.b:S src,r0[lh] (m16)
9141 (binary-arith16-b-S-src2 or (f-0-4 1) (f-4-1 1) or-sem)
9143 ;-------------------------------------------------------------
9144 ; pop - restore register/memory
9145 ;-------------------------------------------------------------
9147 ; TODO future: split this into .b and .w semantics
9148 (define-pmacro (pop-sem-mach mach mode dst)
9149 (sequence ((mode b_or_w) (SI length))
9151 (set b_or_w (srl b_or_w #x8))
9154 (set length 2)) ; .w
9157 ((1) (set dst (mem-mach mach QI (reg h-sp))))
9158 ((2) (set dst (mem-mach mach HI (reg h-sp)))))
9159 (set (reg h-sp) (add (reg h-sp) length))
9163 (define-pmacro (pop-sem16 mode dest) (pop-sem-mach 16 mode dest))
9164 (define-pmacro (pop-sem32 mode dest) (pop-sem-mach 32 mode dest))
9167 (unary-insn-mach-g 16 pop (f-0-4 7) (f-4-3 2) (f-8-4 #xD) pop-sem16 $G)
9169 (unary-insn-mach 32 pop #xB #x2 #xF pop-sem32)
9172 (dni pop16.b-s-rn "pop.b:S r0[lh]" ((machine 16))
9173 "pop.b$S ${Rn16-push-S-anyof}"
9174 (+ (f-0-4 #x9) Rn16-push-S-anyof (f-5-3 #x2))
9175 (pop-sem16 QI Rn16-push-S-anyof)
9178 (dni pop16.b-s-an "pop.w:S a[01]" ((machine 16))
9179 "pop.w$S ${An16-push-S-anyof}"
9180 (+ (f-0-4 #xD) An16-push-S-anyof (f-5-3 #x2))
9181 (pop-sem16 HI An16-push-S-anyof)
9184 ;-------------------------------------------------------------
9185 ; popc - pop control register
9186 ; pushc - push control register
9187 ;-------------------------------------------------------------
9189 (define-pmacro (popc32-cr1-sem mode dst)
9192 ((#x0) (set (reg h-dct0) (mem32 mode (reg h-sp))))
9193 ((#x1) (set (reg h-dct1) (mem32 mode (reg h-sp))))
9194 ((#x2) (sequence ((HI tflag))
9195 (set tflag (mem32 mode (reg h-sp)))
9196 (if (and tflag #x1) (set cbit 1))
9197 (if (and tflag #x2) (set dbit 1))
9198 (if (and tflag #x4) (set zbit 1))
9199 (if (and tflag #x8) (set sbit 1))
9200 (if (and tflag #x10) (set bbit 1))
9201 (if (and tflag #x20) (set obit 1))
9202 (if (and tflag #x40) (set ibit 1))
9203 (if (and tflag #x80) (set ubit 1))))
9204 ((#x3) (set (reg h-svf) (mem32 mode (reg h-sp))))
9205 ((#x4) (set (reg h-drc0) (mem32 mode (reg h-sp))))
9206 ((#x5) (set (reg h-drc1) (mem32 mode (reg h-sp))))
9207 ((#x6) (set (reg h-dmd0) (mem32 mode (reg h-sp))))
9208 ((#x7) (set (reg h-dmd1) (mem32 mode (reg h-sp))))
9210 (set (reg h-sp) (add (reg h-sp) 2))
9213 (define-pmacro (popc32-cr2-sem mode dst)
9216 ((#x0) (set (reg h-intb) (mem32 mode (reg h-sp))))
9217 ((#x1) (set (reg h-sp) (mem32 mode (reg h-sp))))
9218 ((#x2) (set (reg h-sb) (mem32 mode (reg h-sp))))
9219 ((#x3) (set (reg h-fb) (mem32 mode (reg h-sp))))
9220 ((#x7) (set (reg h-isp) (mem32 mode (reg h-sp))))
9222 (set (reg h-sp) (add (reg h-sp) 4))
9225 (define-pmacro (popc16-sem mode dst)
9228 ((#x1) (set (reg h-intb) (or (and (reg h-intb) #x0000)
9229 (mem16 mode (reg h-sp)))))
9230 ((#x2) (set (reg h-intb) (or (and (reg h-intb) #xffff0000)
9231 (mem16 mode (reg h-sp)))))
9232 ((#x3) (sequence ((HI tflag))
9233 (set tflag (mem16 mode (reg h-sp)))
9234 (if (and tflag #x1) (set cbit 1))
9235 (if (and tflag #x2) (set dbit 1))
9236 (if (and tflag #x4) (set zbit 1))
9237 (if (and tflag #x8) (set sbit 1))
9238 (if (and tflag #x10) (set bbit 1))
9239 (if (and tflag #x20) (set obit 1))
9240 (if (and tflag #x40) (set ibit 1))
9241 (if (and tflag #x80) (set ubit 1))))
9242 ((#x4) (set (reg h-isp) (mem16 mode (reg h-sp))))
9243 ((#x5) (set (reg h-sp) (mem16 mode (reg h-sp))))
9244 ((#x6) (set (reg h-sb) (mem16 mode (reg h-sp))))
9245 ((#x7) (set (reg h-fb) (mem16 mode (reg h-sp))))
9247 (set (reg h-sp) (add (reg h-sp) 2))
9250 ; popc dest (m16c #1)
9251 (dni popc16.imm16 "popc dst" ((machine 16))
9253 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-1 0) (f-12-4 3) cr16)
9254 (popc16-sem HI cr16)
9256 ; popc dest (m32c #1)
9257 (dni popc32.imm16-cr1 "popc dst" ((machine 32))
9258 ("popc ${cr1-Unprefixed-32}")
9259 (+ (f-0-4 #xD) (f-4-4 3) (f-8-4 #xA) (f-12-1 1) cr1-Unprefixed-32)
9260 (popc32-cr1-sem HI cr1-Unprefixed-32)
9262 ; popc dest (m32c #2)
9263 (dni popc32.imm16-cr2 "popc dst" ((machine 32))
9265 (+ (f-0-4 #xD) (f-4-4 3) (f-8-4 2) (f-12-1 1) cr2-32)
9266 (popc32-cr2-sem SI cr2-32)
9269 (define-pmacro (pushc32-cr1-sem mode dst)
9271 (set (reg h-sp) (sub (reg h-sp) 2))
9273 ((#x0) (set (mem32 mode (reg h-sp)) (reg h-dct0)))
9274 ((#x1) (set (mem32 mode (reg h-sp)) (reg h-dct1)))
9275 ((#x2) (sequence ((HI tflag))
9277 (if (eq cbit 1) (set tflag (or tflag #x1)))
9278 (if (eq dbit 1) (set tflag (or tflag #x2)))
9279 (if (eq zbit 1) (set tflag (or tflag #x4)))
9280 (if (eq sbit 1) (set tflag (or tflag #x8)))
9281 (if (eq bbit 1) (set tflag (or tflag #x10)))
9282 (if (eq obit 1) (set tflag (or tflag #x20)))
9283 (if (eq ibit 1) (set tflag (or tflag #x40)))
9284 (if (eq ubit 1) (set tflag (or tflag #x80)))
9285 (set (mem32 mode (reg h-sp)) tflag)))
9286 ((#x3) (set (mem32 mode (reg h-sp)) (reg h-svf)))
9287 ((#x4) (set (mem32 mode (reg h-sp)) (reg h-drc0)))
9288 ((#x5) (set (mem32 mode (reg h-sp)) (reg h-drc1)))
9289 ((#x6) (set (mem32 mode (reg h-sp)) (reg h-dmd0)))
9290 ((#x7) (set (mem32 mode (reg h-sp)) (reg h-dmd1)))
9294 (define-pmacro (pushc32-cr2-sem mode dst)
9296 (set (reg h-sp) (sub (reg h-sp) 4))
9298 ((#x0) (set (mem32 mode (reg h-sp)) (reg h-intb)))
9299 ((#x1) (set (mem32 mode (reg h-sp)) (reg h-sp)))
9300 ((#x2) (set (mem32 mode (reg h-sp)) (reg h-sb)))
9301 ((#x3) (set (mem32 mode (reg h-sp)) (reg h-fb)))
9302 ((#x7) (set (mem32 mode (reg h-sp)) (reg h-isp)))
9306 (define-pmacro (pushc16-sem mode dst)
9308 (set (reg h-sp) (sub (reg h-sp) 2))
9310 ((#x1) (set (mem16 mode (reg h-sp)) (and (reg h-intb) #xffff)))
9311 ((#x2) (set (mem16 mode (reg h-sp)) (and (reg h-intb) #xffff0000)))
9312 ((#x3) (sequence ((HI tflag))
9313 (if (eq cbit 1) (set tflag (or tflag #x1)))
9314 (if (eq dbit 1) (set tflag (or tflag #x2)))
9315 (if (eq zbit 1) (set tflag (or tflag #x4)))
9316 (if (eq sbit 1) (set tflag (or tflag #x8)))
9317 (if (eq bbit 1) (set tflag (or tflag #x10)))
9318 (if (eq obit 1) (set tflag (or tflag #x20)))
9319 (if (eq ibit 1) (set tflag (or tflag #x40)))
9320 (if (eq ubit 1) (set tflag (or tflag #x80)))
9321 (set (mem16 mode (reg h-sp)) tflag)))
9323 ((#x4) (set (mem16 mode (reg h-sp)) (reg h-isp)))
9324 ((#x5) (set (mem16 mode (reg h-sp)) (reg h-sp)))
9325 ((#x6) (set (mem16 mode (reg h-sp)) (reg h-sb)))
9326 ((#x7) (set (mem16 mode (reg h-sp)) (reg h-fb)))
9331 (dni pushc16.imm16 "pushc dst" ((machine 16))
9333 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-1 0) (f-12-4 2) cr16)
9334 (pushc16-sem HI cr16)
9336 ; pushc src (m32c #1)
9337 (dni pushc32.imm16-cr1 "pushc dst" ((machine 32))
9338 ("pushc ${cr1-Unprefixed-32}")
9339 (+ (f-0-4 #xD) (f-4-4 1) (f-8-4 #xA) (f-12-1 1) cr1-Unprefixed-32)
9340 (pushc32-cr1-sem HI cr1-Unprefixed-32)
9342 ; pushc src (m32c #2)
9343 (dni pushc32.imm16-cr2 "pushc dst" ((machine 32))
9345 (+ (f-0-4 #xD) (f-4-4 1) (f-8-4 2) (f-12-1 1) cr2-32)
9346 (pushc32-cr2-sem SI cr2-32)
9349 ;-------------------------------------------------------------
9350 ; popm - pop multiple
9351 ; pushm - push multiple
9352 ;-------------------------------------------------------------
9354 (define-pmacro (popm-sem machine dst)
9355 (sequence ((SI addrlen))
9360 (sequence () (set R0 (mem-mach machine HI (reg h-sp)))
9361 (set (reg h-sp) (add (reg h-sp) 2))))
9363 (sequence () (set R1 (mem-mach machine HI (reg h-sp)))
9364 (set (reg h-sp) (add (reg h-sp) 2))))
9366 (sequence () (set R2 (mem-mach machine HI (reg h-sp)))
9367 (set (reg h-sp) (add (reg h-sp) 2))))
9369 (sequence () (set R3 (mem-mach machine HI (reg h-sp)))
9370 (set (reg h-sp) (add (reg h-sp) 2))))
9372 (sequence () (set A0 (mem-mach machine HI (reg h-sp)))
9373 (set (reg h-sp) (add (reg h-sp) addrlen))))
9375 (sequence () (set A1 (mem-mach machine HI (reg h-sp)))
9376 (set (reg h-sp) (add (reg h-sp) addrlen))))
9378 (sequence () (set (reg h-sb) (mem-mach machine HI (reg h-sp)))
9379 (set (reg h-sp) (add (reg h-sp) addrlen))))
9381 (sequence () (set (reg h-fb) (mem-mach machine HI (reg h-sp)))
9382 (set (reg h-sp) (add (reg h-sp) addrlen))))
9386 (define-pmacro (pushm-sem machine dst)
9387 (sequence ((SI count) (SI addrlen))
9392 (sequence () (set (reg h-sp) (sub (reg h-sp) addrlen))
9393 (set (mem-mach machine HI (reg h-sp)) (reg h-fb))))
9395 (sequence () (set (reg h-sp) (sub (reg h-sp) addrlen))
9396 (set (mem-mach machine HI (reg h-sp)) (reg h-sb))))
9398 (sequence () (set (reg h-sp) (sub (reg h-sp) addrlen))
9399 (set (mem-mach machine HI (reg h-sp)) A1)))
9401 (sequence () (set (reg h-sp) (sub (reg h-sp) addrlen))
9402 (set (mem-mach machine HI (reg h-sp)) A0)))
9404 (sequence () (set (reg h-sp) (sub (reg h-sp) 2))
9405 (set (mem-mach machine HI (reg h-sp)) R3)))
9407 (sequence () (set (reg h-sp) (sub (reg h-sp) 2))
9408 (set (mem-mach machine HI (reg h-sp)) R2)))
9410 (sequence () (set (reg h-sp) (sub (reg h-sp) 2))
9411 (set (mem-mach machine HI (reg h-sp)) R1)))
9413 (sequence () (set (reg h-sp) (sub (reg h-sp) 2))
9414 (set (mem-mach machine HI (reg h-sp)) R0)))
9418 (dni popm16 "popm regs" ((machine 16))
9419 ("popm ${Regsetpop}")
9420 (+ (f-0-4 #xE) (f-4-4 #xD) Regsetpop)
9421 (popm-sem 16 Regsetpop)
9423 (dni pushm16 "pushm regs" ((machine 16))
9424 ("pushm ${Regsetpush}")
9425 (+ (f-0-4 #xE) (f-4-4 #xC) Regsetpush)
9426 (pushm-sem 16 Regsetpush)
9428 (dni popm "popm regs" ((machine 32))
9429 ("popm ${Regsetpop}")
9430 (+ (f-0-4 #x8) (f-4-4 #xE) Regsetpop)
9431 (popm-sem 32 Regsetpop)
9433 (dni pushm "pushm regs" ((machine 32))
9434 ("pushm ${Regsetpush}")
9435 (+ (f-0-4 #x8) (f-4-4 #xF) Regsetpush)
9436 (pushm-sem 32 Regsetpush)
9439 ;-------------------------------------------------------------
9440 ; push - Save register/memory/immediate data
9441 ;-------------------------------------------------------------
9443 ; TODO future: split this into .b and .w semantics
9444 (define-pmacro (push-sem-mach mach mode dst)
9445 (sequence ((mode b_or_w) (SI length))
9447 (set b_or_w (srl b_or_w #x8))
9450 (if (eq b_or_w #xff)
9452 (set length 4))) ; .l
9453 (set (reg h-sp) (sub (reg h-sp) length))
9455 ((1) (set (mem-mach mach QI (reg h-sp)) dst))
9456 ((2) (set (mem-mach mach HI (reg h-sp)) dst))
9457 ((4) (set (mem-mach mach SI (reg h-sp)) dst)))
9461 (define-pmacro (push-sem16 mode dst) (push-sem-mach 16 mode dst))
9462 (define-pmacro (push-sem32 mode dst) (push-sem-mach 32 mode dst))
9464 ; push.BW:G imm (m16 #1 m32 #1)
9465 (dni push16.b.G-imm "push.b:G #Imm-16-QI" ((machine 16))
9466 ("push.b$G #${Imm-16-QI}")
9467 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 #xE) (f-12-4 2) Imm-16-QI)
9468 (push-sem16 QI Imm-16-QI)
9471 (dni push16.w.G-imm "push.w:G #Imm-16-HI" ((machine 16))
9472 ("push.w$G #${Imm-16-HI}")
9473 (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 #xE) (f-12-4 2) Imm-16-HI)
9474 (push-sem16 HI Imm-16-HI)
9477 (dni push32.b.imm "push.b #Imm-8-QI" ((machine 32))
9478 ("push.b #${Imm-8-QI}")
9479 (+ (f-0-4 #xA) (f-4-4 #xE) Imm-8-QI)
9480 (push-sem32 QI Imm-8-QI)
9483 (dni push32.w.imm "push.w #Imm-8-HI" ((machine 32))
9484 ("push.w #${Imm-8-HI}")
9485 (+ (f-0-4 #xA) (f-4-4 #xF) Imm-8-HI)
9486 (push-sem32 HI Imm-8-HI)
9489 ; push.BW:G src (m16 #2)
9490 (unary-insn-mach-g 16 push (f-0-4 7) (f-4-3 2) (f-8-4 #x4) push-sem16 $G)
9491 ; push.BW:G src (m32 #2)
9492 (unary-insn-mach 32 push #xC #x0 #xE push-sem32)
9495 ; push.b:S r0l/r0h (m16 #3)
9496 (dni push16.b-s-rn "push.b:S r0[lh]" ((machine 16))
9497 "push.b$S ${Rn16-push-S-anyof}"
9498 (+ (f-0-4 #x8) Rn16-push-S-anyof (f-5-3 #x2))
9499 (push-sem16 QI Rn16-push-S-anyof)
9501 ; push.w:S a0/a1 (m16 #4)
9502 (dni push16.b-s-an "push.w:S a[01]" ((machine 16))
9503 "push.w$S ${An16-push-S-anyof}"
9504 (+ (f-0-4 #xC) An16-push-S-anyof (f-5-3 #x2))
9505 (push-sem16 HI An16-push-S-anyof)
9508 ; push.l imm32 (m32 #3)
9509 (dni push32.l.imm "push.l #Imm-16-SI" ((machine 32))
9510 ("push.l #${Imm-16-SI}")
9511 (+ (f-0-4 #xB) (f-4-4 6) (f-8-4 5) (f-12-4 3) Imm-16-SI)
9512 (push-sem32 SI Imm-16-SI)
9514 ; push.l src (m32 #4)
9515 (unary-insn-defn 32 16-Unprefixed SI .l push (+ (f-0-4 #xA) (f-7-1 0) dst32-16-Unprefixed-SI (f-10-2 0) (f-12-4 1)) push-sem32)
9517 ;-------------------------------------------------------------
9518 ; pusha - push effective address
9519 ;------------------------------------------------------------
9521 (define-pmacro (push16a-sem mode dst)
9523 (set (reg h-sp) (sub (reg h-sp) 2))
9524 (set (mem16 HI (reg h-sp)) dst))
9526 (define-pmacro (push32a-sem mode dst)
9528 (set (reg h-sp) (sub (reg h-sp) 4))
9529 (set (mem32 SI (reg h-sp)) dst))
9531 (unary-insn-defn 16 16-Mova HI "" pusha (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 9) dst16-16-Mova-HI) push16a-sem)
9532 (unary-insn-defn 32 16-Unprefixed-Mova SI "" pusha (+ (f-0-4 #xB) (f-7-1 0) dst32-16-Unprefixed-Mova-SI (f-10-2 0) (f-12-4 1)) push32a-sem)
9534 ;-------------------------------------------------------------
9535 ; reit - return from interrupt
9536 ;-------------------------------------------------------------
9539 (dni reit16 "REIT" ((machine 16))
9541 (+ (f-0-4 #xF) (f-4-4 #xB))
9544 (dni reit32 "REIT" ((machine 32))
9546 (+ (f-0-4 9) (f-4-4 #xE))
9550 ;-------------------------------------------------------------
9551 ; rmpa - repeat multiple and addition
9552 ;-------------------------------------------------------------
9555 (dni rmpa16.b "rmpa.size" ((machine 16))
9557 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 #xF) (f-12-4 1))
9560 (dni rmpa16.w "rmpa.size" ((machine 16))
9562 (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 #xF) (f-12-4 1))
9565 (dni rmpa32.b "rmpa.size" ((machine 32))
9567 (+ (f-0-4 #xB) (f-4-4 8) (f-8-4 4) (f-12-4 3))
9571 (dni rmpa32.w "rmpa.size" ((machine 32))
9573 (+ (f-0-4 #xB) (f-4-4 8) (f-8-4 5) (f-12-4 3))
9577 ;-------------------------------------------------------------
9578 ; rolc - rotate left with carry
9579 ;-------------------------------------------------------------
9581 ; TODO check semantics
9582 ; TODO future: split this into .b and .w semantics
9583 (define-pmacro (rolc-sem mode dst)
9584 (sequence ((mode result) (SI ocbit) (mode b_or_w) (USI mask))
9586 (set b_or_w (srl b_or_w #x8))
9588 (set mask #x8000) ; .b
9589 (set mask #x80000000)) ; .w
9591 (set cbit (and dst mask))
9592 (set result (sll mode dst 1))
9593 (set result (or result ocbit))
9594 (set-z-and-s result)
9598 (unary-insn rolc (f-0-4 7) (f-4-3 3) (f-8-4 #xA) #xB #x2 #xE rolc-sem)
9600 ;-------------------------------------------------------------
9601 ; rorc - rotate right with carry
9602 ;-------------------------------------------------------------
9604 ; TODO check semantics
9605 ; TODO future: split this into .b and .w semantics
9606 (define-pmacro (rorc-sem mode dst)
9607 (sequence ((mode result) (SI ocbit) (mode b_or_w) (USI mask) (SI shamt))
9609 (set b_or_w (srl b_or_w #x8))
9611 (sequence () (set mask #x7fff) (set shamt 15)) ; .b
9612 (sequence () (set mask #x7fffffff) (set shamt 31))) ; .w
9614 (set cbit (and dst #x1))
9615 (set result (srl mode dst (const 1)))
9616 (set result (or (and result mask) (sll ocbit shamt)))
9617 (set-z-and-s result)
9621 (unary-insn rorc (f-0-4 7) (f-4-3 3) (f-8-4 #xB) #xA #x2 #xE rorc-sem)
9623 ;-------------------------------------------------------------
9625 ;-------------------------------------------------------------
9627 ; TODO future: split this into .b and .w semantics
9628 (define-pmacro (rot-1-sem mode src1 dst)
9629 (sequence ((mode tmp) (mode b_or_w) (USI mask) (SI shift))
9631 ((#x0) (set shift 1))
9632 ((#x1) (set shift 2))
9633 ((#x2) (set shift 3))
9634 ((#x3) (set shift 4))
9635 ((#x4) (set shift 5))
9636 ((#x5) (set shift 6))
9637 ((#x6) (set shift 7))
9638 ((#x7) (set shift 8))
9639 ((-8) (set shift -1))
9640 ((-7) (set shift -2))
9641 ((-6) (set shift -3))
9642 ((-5) (set shift -4))
9643 ((-4) (set shift -5))
9644 ((-3) (set shift -6))
9645 ((-2) (set shift -7))
9646 ((-1) (set shift -8))
9647 (else (set shift 0))
9650 (set b_or_w (srl b_or_w #x8))
9652 (set mask #x7fff) ; .b
9653 (set mask #x7fffffff)) ; .w
9655 (if (gt mode shift 0)
9657 (set tmp (rol mode tmp shift))
9658 (set cbit (and tmp #x1)))
9660 (set tmp (ror mode tmp (mul shift -1)))
9661 (set cbit (and tmp mask))))
9665 (define-pmacro (rot-2-sem mode dst)
9666 (sequence ((mode tmp) (mode b_or_w) (USI mask))
9668 (set b_or_w (srl b_or_w #x8))
9670 (set mask #x7fff) ; .b
9671 (set mask #x7fffffff)) ; .w
9673 (if (gt mode (reg h-r1h) 0)
9675 (set tmp (rol mode tmp (reg h-r1h)))
9676 (set cbit (and tmp #x1)))
9678 (set tmp (ror mode tmp (reg h-r1h)))
9679 (set cbit (and tmp mask))))
9685 (binary-arith16-shimm4-dst-defn QI .b 0 0 rot (f-0-4 #xE) (f-4-3 0) rot-1-sem)
9686 (binary-arith16-shimm4-dst-defn HI .w 0 1 rot (f-0-4 #xE) (f-4-3 0) rot-1-sem)
9687 (binary-arith32-shimm4-dst-defn QI .b 0 0 rot #x7 #x2 rot-1-sem)
9688 (binary-arith32-shimm4-dst-defn HI .w 0 1 rot #x7 #x2 rot-1-sem)
9691 (dni rot16.b-dst "rot r1h,dest" ((machine 16))
9692 ("rot.b r1h,${dst16-16-QI}")
9693 (+ (f-0-4 7) (f-4-4 #x4) (f-8-4 #x6) dst16-16-QI)
9694 (rot-2-sem QI dst16-16-QI)
9696 (dni rot16.w-dst "rot r1h,dest" ((machine 16))
9697 ("rot.w r1h,${dst16-16-HI}")
9698 (+ (f-0-4 7) (f-4-4 #x5) (f-8-4 #x6) dst16-16-HI)
9699 (rot-2-sem HI dst16-16-HI)
9702 (dni rot32.b-dst "rot r1h,dest" ((machine 32))
9703 ("rot.b r1h,${dst32-16-Unprefixed-QI}")
9704 (+ (f-0-4 #xA) dst32-16-Unprefixed-QI (f-7-1 0) (f-10-2 3) (f-12-4 #xF))
9705 (rot-2-sem QI dst32-16-Unprefixed-QI)
9707 (dni rot32.w-dst "rot r1h,dest" ((machine 32))
9708 ("rot.w r1h,${dst32-16-Unprefixed-HI}")
9709 (+ (f-0-4 #xA) dst32-16-Unprefixed-HI (f-7-1 1) (f-10-2 3) (f-12-4 #xF))
9710 (rot-2-sem HI dst32-16-Unprefixed-HI)
9713 ;-------------------------------------------------------------
9714 ; rts - return from subroutine
9715 ;-------------------------------------------------------------
9717 (define-pmacro (rts16-sem)
9718 (sequence ((SI tpc))
9719 (set tpc (mem16 HI (reg h-sp)))
9720 (set (reg h-sp) (add (reg h-sp) 2))
9721 (set tpc (or tpc (sll (mem16 QI (reg h-sp)) 16)))
9722 (set (reg h-sp) (add (reg h-sp) 1))
9726 (define-pmacro (rts32-sem)
9727 (sequence ((SI tpc))
9728 (set tpc (mem32 HI (reg h-sp)))
9729 (set (reg h-sp) (add (reg h-sp) 2))
9730 (set tpc (or tpc (sll (mem32 HI (reg h-sp)) 16)))
9731 (set (reg h-sp) (add (reg h-sp) 2))
9736 (dni rts16 "rts" ((machine 16))
9738 (+ (f-0-4 #xF) (f-4-4 3))
9742 (dni rts32 "rts" ((machine 32))
9744 (+ (f-0-4 #xD) (f-4-4 #xF))
9748 ;-------------------------------------------------------------
9749 ; sbb - subtract with borrow
9750 ;-------------------------------------------------------------
9752 (define-pmacro (sbb-sem mode src dst)
9753 (sequence ((mode result))
9754 (set result (subc mode dst src cbit))
9755 (set obit (add-oflag mode dst src cbit))
9756 (set cbit (add-oflag mode dst src cbit))
9757 (set-z-and-s result)
9761 ; sbb.size:G #imm,dst
9762 (binary-arith16-imm-dst-defn QI QI .b 0 sbb X (f-0-4 7) (f-4-3 3) (f-8-4 7) sbb-sem)
9763 (binary-arith16-imm-dst-defn HI HI .w 1 sbb X (f-0-4 7) (f-4-3 3) (f-8-4 7) sbb-sem)
9764 (binary-arith32-imm-dst-Prefixed QI QI .b 0 sbb X #x9 #x2 #xE sbb-sem)
9765 (binary-arith32-imm-dst-Prefixed HI HI .w 1 sbb X #x9 #x2 #xE sbb-sem)
9768 (binary-arith16-src-dst-defn QI QI .b 0 sbb X (f-0-4 #xB) (f-4-3 4) sbb-sem)
9769 (binary-arith16-src-dst-defn HI HI .w 1 sbb X (f-0-4 #xB) (f-4-3 4) sbb-sem)
9770 (binary-arith32-src-dst-Prefixed QI QI .b 0 sbb X #x1 #x6 sbb-sem)
9771 (binary-arith32-src-dst-Prefixed HI HI .w 1 sbb X #x1 #x6 sbb-sem)
9773 ;-------------------------------------------------------------
9774 ; sbjnz - subtract then jump on not zero
9775 ;-------------------------------------------------------------
9777 (define-pmacro (sub-jnz-sem mode src dst label)
9778 (sequence ((mode result))
9779 (set result (sub mode dst src))
9785 ; sbjnz.size #imm4,dst,label
9786 (arith-jnz-imm4-dst sbjnz s4n (f-0-4 #xF) (f-4-3 4) #xf #x1 sub-jnz-sem)
9788 ;-------------------------------------------------------------
9789 ; sccnd - store condition on condition (m32)
9790 ;-------------------------------------------------------------
9792 (define-pmacro (sccnd-sem cnd dst)
9796 ((#x00) (if (not cbit) (set dst 1))) ;ltu nc
9797 ((#x01) (if (or cbit zbit) (set dst 1))) ;leu
9798 ((#x02) (if (not zbit) (set dst 1))) ;ne nz
9799 ((#x03) (if (not sbit) (set dst 1))) ;pz
9800 ((#x04) (if (not obit) (set dst 1))) ;no
9801 ((#x05) (if (not (or zbit (xor sbit obit))) (set dst 1))) ;gt
9802 ((#x06) (if (xor sbit obit) (set dst 1))) ;ge
9803 ((#x08) (if (trunc BI cbit) (set dst 1))) ;geu c
9804 ((#x09) (if (not (or cbit zbit)) (set dst 1))) ;gtu
9805 ((#x0a) (if (trunc BI zbit) (set dst 1))) ;eq z
9806 ((#x0b) (if (trunc BI sbit) (set dst 1))) ;n
9807 ((#x0c) (if (trunc BI obit) (set dst 1))) ;o
9808 ((#x0d) (if (or zbit (xor sbit obit)) (set dst 1))) ;le
9809 ((#x0e) (if (xor sbit obit) (set dst 1))) ;lt
9818 "sc$sccond32 ${dst32-16-Unprefixed-HI}"
9819 (+ (f-0-4 #xD) dst32-16-Unprefixed-HI (f-7-1 1) (f-10-2 3) sccond32)
9820 (sccnd-sem sccond32 dst32-16-Unprefixed-HI)
9823 ;-------------------------------------------------------------
9824 ; scmpu - string compare unequal (m32)
9825 ;-------------------------------------------------------------
9828 (dni scmpu.b "scmpu.b" ((machine 32))
9830 (+ (f-0-4 #xB) (f-4-4 8) (f-8-4 #xC) (f-12-4 3))
9831 (c-call VOID "scmpu_QI_semantics")
9834 (dni scmpu.w "scmpu.w" ((machine 32))
9836 (+ (f-0-4 #xB) (f-4-4 8) (f-8-4 #xD) (f-12-4 3))
9837 (c-call VOID "scmpu_HI_semantics")
9840 ;-------------------------------------------------------------
9841 ; sha - shift arithmetic
9842 ;-------------------------------------------------------------
9844 ; TODO future: split this into .b and .w semantics
9845 (define-pmacro (sha-sem mode src1 dst)
9846 (sequence ((mode result)(mode shift)(mode shmode))
9848 ((#x0) (set shift 1))
9849 ((#x1) (set shift 2))
9850 ((#x2) (set shift 3))
9851 ((#x3) (set shift 4))
9852 ((#x4) (set shift 5))
9853 ((#x5) (set shift 6))
9854 ((#x6) (set shift 7))
9855 ((#x7) (set shift 8))
9856 ((-8) (set shift -1))
9857 ((-7) (set shift -2))
9858 ((-6) (set shift -3))
9859 ((-5) (set shift -4))
9860 ((-4) (set shift -5))
9861 ((-3) (set shift -6))
9862 ((-2) (set shift -7))
9863 ((-1) (set shift -8))
9864 (else (set shift 0))
9867 (set shmode (srl shmode #x8))
9868 (if (lt mode shift #x0) (set result (sra mode dst (mul shift -1))))
9869 (if (gt mode shift 0) (set result (sll mode dst shift)))
9870 (if (eq shmode #x0) ; QI
9873 (if (lt mode shift #x0)
9874 (set cbitamt (sub #x8 shift)) ; sra
9875 (set cbitamt (sub shift 1))) ; sll
9876 (set cbit (srl (and (sll dst cbitamt) #x80) #x7))
9877 (set obit (ne (and dst #x80) (and result #x80)))
9879 (if (eq shmode #xff) ; HI
9882 (if (lt mode shift #x0)
9883 (set cbitamt (sub 16 shift)) ; sra
9884 (set cbitamt (sub shift 1))) ; sll
9885 (set cbit (srl (and (sll dst cbitamt) #x8000) #xf))
9886 (set obit (ne (and dst #x8000) (and result #x8000)))
9888 (set-z-and-s result)
9891 (define-pmacro (shar1h-sem mode dst)
9892 (sequence ((mode result)(mode shmode))
9894 (set shmode (srl shmode #x8))
9895 (if (lt mode (reg h-r1h) 0) (set result (sra mode dst (reg h-r1h))))
9896 (if (gt mode (reg h-r1h) 0) (set result (sll mode dst (reg h-r1h))))
9897 (if (eq shmode #x0) ; QI
9900 (if (lt mode (reg h-r1h) #x0)
9901 (set cbitamt (sub #x8 (reg h-r1h))) ; sra
9902 (set cbitamt (sub (reg h-r1h) 1))) ; sll
9903 (set cbit (srl (and (sll dst cbitamt) #x80) #x7))
9904 (set obit (ne (and dst #x80) (and result #x80)))
9906 (if (eq shmode #xff) ; HI
9909 (if (lt mode (reg h-r1h) #x0)
9910 (set cbitamt (sub 16 (reg h-r1h))) ; sra
9911 (set cbitamt (sub (reg h-r1h) 1))) ; sll
9912 (set cbit (srl (and (sll dst cbitamt) #x8000) #xf))
9913 (set obit (ne (and dst #x8000) (and result #x8000)))
9915 (set-z-and-s result)
9918 ; sha.BW #imm4,dst (m16 #1 m32 #1)
9919 (binary-arith16-shimm4-dst-defn QI .b 0 0 sha (f-0-4 #xF) (f-4-3 0) sha-sem)
9920 (binary-arith16-shimm4-dst-defn HI .w 0 1 sha (f-0-4 #xF) (f-4-3 0) sha-sem)
9921 (binary-arith32-shimm4-dst-defn QI .b 1 0 sha #x7 #x0 sha-sem)
9922 (binary-arith32-shimm4-dst-defn HI .w 1 1 sha #x7 #x0 sha-sem)
9923 ; sha.BW r1h,dst (m16 #2 m32 #3)
9924 (dni sha16.b-dst "sha.b r1h,dest" ((machine 16))
9925 ("sha.b r1h,${dst16-16-QI}")
9926 (+ (f-0-4 7) (f-4-4 4) (f-8-4 #xF) dst16-16-QI)
9927 (shar1h-sem HI dst16-16-QI)
9929 (dni sha16.w-dst "sha.w r1h,dest" ((machine 16))
9930 ("sha.w r1h,${dst16-16-HI}")
9931 (+ (f-0-4 7) (f-4-4 5) (f-8-4 #xF) dst16-16-HI)
9932 (shar1h-sem HI dst16-16-HI)
9934 (dni sha32.b-dst "sha.b r1h,dest" ((machine 32))
9935 ("sha.b r1h,${dst32-16-Unprefixed-QI}")
9936 (+ (f-0-4 #xB) dst32-16-Unprefixed-QI (f-7-1 0) (f-10-2 3) (f-12-4 #xE))
9937 (shar1h-sem QI dst32-16-Unprefixed-QI)
9939 (dni sha32.w-dst "sha.w r1h,dest" ((machine 32))
9940 ("sha.w r1h,${dst32-16-Unprefixed-HI}")
9941 (+ (f-0-4 #xB) dst32-16-Unprefixed-HI (f-7-1 1) (f-10-2 3) (f-12-4 #xE))
9942 (shar1h-sem HI dst32-16-Unprefixed-HI)
9944 ; sha.L #imm,dst (m16 #3)
9945 (dni sha16-L-imm-r2r0 "sha.L #Imm-sh-12-s4,r2r0" ((machine 16))
9946 "sha.l #${Imm-sh-12-s4},r2r0"
9947 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-4 #xA) Imm-sh-12-s4)
9948 (sha-sem SI Imm-sh-12-s4 (reg h-r2r0))
9950 (dni sha16-L-imm-r3r1 "sha.L #Imm-sh-12-s4,r3r1" ((machine 16))
9951 "sha.l #${Imm-sh-12-s4},r3r1"
9952 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-4 #xB) Imm-sh-12-s4)
9953 (sha-sem SI Imm-sh-12-s4 (reg h-r3r1))
9955 ; sha.L r1h,dst (m16 #4)
9956 (dni sha16-L-r1h-r2r0 "sha.L r1h,r2r0" ((machine 16))
9958 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-4 2) (f-12-4 1))
9959 (sha-sem SI (reg h-r1h) (reg h-r2r0))
9961 (dni sha16-L-r1h-r3r1 "sha.L r1h,r3r1" ((machine 16))
9963 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-4 3) (f-12-4 1))
9964 (sha-sem SI (reg h-r1h) (reg h-r3r1))
9966 ; sha.L #imm8,dst (m32 #2)
9967 (binary-arith32-imm-dst-defn QI SI .l 0 sha X #xA #x2 #x1 sha-sem)
9968 ; sha.L r1h,dst (m32 #4)
9969 (dni sha32.l-dst "sha.l r1h,dest" ((machine 32))
9970 ("sha.l r1h,${dst32-16-Unprefixed-SI}")
9971 (+ (f-0-4 #xC) dst32-16-Unprefixed-SI (f-7-1 0) (f-10-2 1) (f-12-4 1))
9972 (shar1h-sem QI dst32-16-Unprefixed-SI)
9975 ;-------------------------------------------------------------
9976 ; shanc - shift arithmetic non carry (m32)
9977 ;-------------------------------------------------------------
9979 ; TODO check semantics
9981 (binary-arith32-imm-dst-defn QI SI .l 0 shanc X #xC #x2 #x1 sha-sem)
9983 ;-------------------------------------------------------------
9984 ; shl - shift logical
9985 ;-------------------------------------------------------------
9987 ; TODO future: split this into .b and .w semantics
9988 (define-pmacro (shl-sem mode src1 dst)
9989 (sequence ((mode result)(mode shift)(mode shmode))
9991 ((#x0) (set shift 1))
9992 ((#x1) (set shift 2))
9993 ((#x2) (set shift 3))
9994 ((#x3) (set shift 4))
9995 ((#x4) (set shift 5))
9996 ((#x5) (set shift 6))
9997 ((#x6) (set shift 7))
9998 ((#x7) (set shift 8))
9999 ((-8) (set shift -1))
10000 ((-7) (set shift -2))
10001 ((-6) (set shift -3))
10002 ((-5) (set shift -4))
10003 ((-4) (set shift -5))
10004 ((-3) (set shift -6))
10005 ((-2) (set shift -7))
10006 ((-1) (set shift -8))
10007 (else (set shift 0))
10010 (set shmode (srl shmode #x8))
10011 (if (lt mode shift #x0) (set result (srl mode dst (mul shift -1))))
10012 (if (gt mode shift 0) (set result (sll mode dst shift)))
10013 (if (eq shmode #x0) ; QI
10016 (if (lt mode shift #x0)
10017 (set cbitamt (sub #x8 shift)); srl
10018 (set cbitamt (sub shift 1))) ; sll
10019 (set cbit (srl (and (sll dst cbitamt) #x80) #x7))
10020 (set obit (ne (and dst #x80) (and result #x80)))
10022 (if (eq shmode #xff) ; HI
10025 (if (lt mode shift #x0)
10026 (set cbitamt (sub 16 shift)) ; srl
10027 (set cbitamt (sub shift 1))) ; sll
10028 (set cbit (srl (and (sll dst cbitamt) #x8000) #xf))
10029 (set obit (ne (and dst #x8000) (and result #x8000)))
10031 (set-z-and-s result)
10034 (define-pmacro (shlr1h-sem mode dst)
10035 (sequence ((mode result)(mode shmode))
10037 (set shmode (srl shmode #x8))
10038 (if (lt mode (reg h-r1h) 0) (set result (srl mode dst (reg h-r1h))))
10039 (if (gt mode (reg h-r1h) 0) (set result (sll mode dst (reg h-r1h))))
10040 (if (eq shmode #x0) ; QI
10043 (if (lt mode (reg h-r1h) #x0)
10044 (set cbitamt (sub #x8 (reg h-r1h))) ; srl
10045 (set cbitamt (sub (reg h-r1h) 1))) ; sll
10046 (set cbit (srl (and (sll dst cbitamt) #x80) #x7))
10047 (set obit (ne (and dst #x80) (and result #x80)))
10049 (if (eq shmode #xff) ; HI
10052 (if (lt mode (reg h-r1h) #x0)
10053 (set cbitamt (sub 16 (reg h-r1h))) ; srl
10054 (set cbitamt (sub (reg h-r1h) 1))) ; sll
10055 (set cbit (srl (and (sll dst cbitamt) #x8000) #xf))
10056 (set obit (ne (and dst #x8000) (and result #x8000)))
10058 (set-z-and-s result)
10061 ; shl.BW #imm4,dst (m16 #1 m32 #1)
10062 (binary-arith16-shimm4-dst-defn QI .b 0 0 shl (f-0-4 #xE) (f-4-3 4) shl-sem)
10063 (binary-arith16-shimm4-dst-defn HI .w 0 1 shl (f-0-4 #xE) (f-4-3 4) shl-sem)
10064 (binary-arith32-shimm4-dst-defn QI .b 0 0 shl #x7 #x0 shl-sem)
10065 (binary-arith32-shimm4-dst-defn HI .w 0 1 shl #x7 #x0 shl-sem)
10066 ; shl.BW r1h,dst (m16 #2 m32 #3)
10067 (dni shl16.b-dst "shl.b r1h,dest" ((machine 16))
10068 ("shl.b r1h,${dst16-16-QI}")
10069 (+ (f-0-4 7) (f-4-4 4) (f-8-4 #xE) dst16-16-QI)
10070 (shlr1h-sem HI dst16-16-QI)
10072 (dni shl16.w-dst "shl.w r1h,dest" ((machine 16))
10073 ("shl.w r1h,${dst16-16-HI}")
10074 (+ (f-0-4 7) (f-4-4 5) (f-8-4 #xE) dst16-16-HI)
10075 (shlr1h-sem HI dst16-16-HI)
10077 (dni shl32.b-dst "shl.b r1h,dest" ((machine 32))
10078 ("shl.b r1h,${dst32-16-Unprefixed-QI}")
10079 (+ (f-0-4 #xA) dst32-16-Unprefixed-QI (f-7-1 0) (f-10-2 3) (f-12-4 #xE))
10080 (shlr1h-sem QI dst32-16-Unprefixed-QI)
10082 (dni shl32.w-dst "shl.w r1h,dest" ((machine 32))
10083 ("shl.w r1h,${dst32-16-Unprefixed-HI}")
10084 (+ (f-0-4 #xA) dst32-16-Unprefixed-HI (f-7-1 1) (f-10-2 3) (f-12-4 #xE))
10085 (shlr1h-sem HI dst32-16-Unprefixed-HI)
10087 ; shl.L #imm,dst (m16 #3)
10088 (dni shl16-L-imm-r2r0 "shl.L #Imm-sh-12-s4,r2r0" ((machine 16))
10089 "shl.l #${Imm-sh-12-s4},r2r0"
10090 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-4 #x8) Imm-sh-12-s4)
10091 (shl-sem SI Imm-sh-12-s4 (reg h-r2r0))
10093 (dni shl16-L-imm-r3r1 "shl.L #Imm-sh-12-s4,r3r1" ((machine 16))
10094 "shl.l #${Imm-sh-12-s4},r3r1"
10095 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-4 #x9) Imm-sh-12-s4)
10096 (shl-sem SI Imm-sh-12-s4 (reg h-r3r1))
10098 ; shl.L r1h,dst (m16 #4)
10099 (dni shl16-L-r1h-r2r0 "shl.L r1h,r2r0" ((machine 16))
10101 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-4 0) (f-12-4 1))
10102 (shl-sem SI (reg h-r1h) (reg h-r2r0))
10104 (dni shl16-L-r1h-r3r1 "shl.L r1h,r3r1" ((machine 16))
10106 (+ (f-0-4 #xE) (f-4-4 #xB) (f-8-4 1) (f-12-4 1))
10107 (shl-sem SI (reg h-r1h) (reg h-r3r1))
10109 ; shl.L #imm8,dst (m32 #2)
10110 (binary-arith32-imm-dst-defn QI SI .l 0 shl X #x9 #x2 #x1 shl-sem)
10111 ; shl.L r1h,dst (m32 #4)
10112 (dni shl32.l-dst "shl.l r1h,dest" ((machine 32))
10113 ("shl.l r1h,${dst32-16-Unprefixed-SI}")
10114 (+ (f-0-4 #xC) dst32-16-Unprefixed-SI (f-7-1 0) (f-10-2 0) (f-12-4 1))
10115 (shlr1h-sem QI dst32-16-Unprefixed-SI)
10118 ;-------------------------------------------------------------
10119 ; shlnc - shift logical non carry
10120 ;-------------------------------------------------------------
10122 ; TODO check semantics
10123 ; shlnc.L #imm8,dst
10124 (binary-arith32-imm-dst-defn QI SI .l 0 shlnc X #x8 #x2 #x1 shl-sem)
10126 ;-------------------------------------------------------------
10127 ; sin - string input (m32)
10128 ;-------------------------------------------------------------
10131 (dni sin32.b "sin" ((machine 32))
10133 (+ (f-0-4 #xB) (f-4-4 2) (f-8-4 8) (f-12-4 3))
10134 (c-call VOID "sin_QI_semantics")
10137 (dni sin32.w "sin" ((machine 32))
10139 (+ (f-0-4 #xB) (f-4-4 2) (f-8-4 9) (f-12-4 3))
10140 (c-call VOID "sin_HI_semantics")
10143 ;-------------------------------------------------------------
10144 ; smovb - string move backward
10145 ;-------------------------------------------------------------
10148 (dni smovb16.b "smovb.b" ((machine 16))
10150 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 #xE) (f-12-4 9))
10151 (c-call VOID "smovb_QI_semantics")
10154 (dni smovb16.w "smovb.w" ((machine 16))
10156 (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 #xE) (f-12-4 9))
10157 (c-call VOID "smovb_HI_semantics")
10160 (dni smovb32.b "smovb.b" ((machine 32))
10162 (+ (f-0-4 #xB) (f-4-4 6) (f-8-4 8) (f-12-4 3))
10163 (c-call VOID "smovb_QI_semantics")
10166 (dni smovb32.w "smovb.w" ((machine 32))
10168 (+ (f-0-4 #xB) (f-4-4 6) (f-8-4 9) (f-12-4 3))
10169 (c-call VOID "smovb_HI_semantics")
10172 ;-------------------------------------------------------------
10173 ; smovf - string move forward (m32)
10174 ;-------------------------------------------------------------
10177 (dni smovf16.b "smovf.b" ((machine 16))
10179 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 #xE) (f-12-4 8))
10180 (c-call VOID "smovf_QI_semantics")
10183 (dni smovf16.w "smovf.w" ((machine 16))
10185 (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 #xE) (f-12-4 8))
10186 (c-call VOID "smovf_HI_semantics")
10189 (dni smovf32.b "smovf.b" ((machine 32))
10191 (+ (f-0-4 #xB) (f-4-4 0) (f-8-4 8) (f-12-4 3))
10192 (c-call VOID "smovf_QI_semantics")
10195 (dni smovf32.w "smovf.w" ((machine 32))
10197 (+ (f-0-4 #xB) (f-4-4 0) (f-8-4 9) (f-12-4 3))
10198 (c-call VOID "smovf_HI_semantics")
10201 ;-------------------------------------------------------------
10202 ; smovu - string move unequal (m32)
10203 ;-------------------------------------------------------------
10206 (dni smovu.b "smovu.b" ((machine 32))
10208 (+ (f-0-4 #xB) (f-4-4 8) (f-8-4 8) (f-12-4 3))
10209 (c-call VOID "smovu_QI_semantics")
10212 (dni smovu.w "smovu.w" ((machine 32))
10214 (+ (f-0-4 #xB) (f-4-4 8) (f-8-4 9) (f-12-4 3))
10215 (c-call VOID "smovu_HI_semantics")
10218 ;-------------------------------------------------------------
10219 ; sout - string output (m32)
10220 ;-------------------------------------------------------------
10223 (dni sout.b "sout.b" ((machine 32))
10225 (+ (f-0-4 #xB) (f-4-4 4) (f-8-4 8) (f-12-4 3))
10226 (c-call VOID "sout_QI_semantics")
10229 (dni sout.w "sout" ((machine 32))
10231 (+ (f-0-4 #xB) (f-4-4 4) (f-8-4 9) (f-12-4 3))
10232 (c-call VOID "sout_HI_semantics")
10235 ;-------------------------------------------------------------
10236 ; sstr - string store
10237 ;-------------------------------------------------------------
10240 (dni sstr16.b "sstr.b" ((machine 16))
10242 (+ (f-0-4 7) (f-4-4 #xC) (f-8-4 #xE) (f-12-4 #xA))
10243 (c-call VOID "sstr_QI_semantics")
10246 (dni sstr16.w "sstr.w" ((machine 16))
10248 (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 #xE) (f-12-4 #xA))
10249 (c-call VOID "sstr_HI_semantics")
10252 (dni sstr.b "sstr" ((machine 32))
10254 (+ (f-0-4 #xB) (f-4-4 8) (f-8-4 0) (f-12-4 3))
10255 (c-call VOID "sstr_QI_semantics")
10258 (dni sstr.w "sstr" ((machine 32))
10260 (+ (f-0-4 #xB) (f-4-4 8) (f-8-4 1) (f-12-4 3))
10261 (c-call VOID "sstr_HI_semantics")
10264 ;-------------------------------------------------------------
10265 ; stnz - store on not zero
10266 ;-------------------------------------------------------------
10268 (define-pmacro (stnz-sem mode src dst)
10270 (if (ne zbit (const 1))
10273 ; stnz #imm8,dst3 (m16)
10274 (binary-arith16-b-S-imm8-dst3 stnz "" (f-0-4 #xD) (f-4-1 0) stnz-sem)
10275 ; stnz.BW #imm,dst (m32)
10276 (binary-arith32-imm-dst-defn QI QI .b 0 stnz X #x9 #x1 #xF stnz-sem)
10277 (binary-arith32-imm-dst-defn HI HI .w 1 stnz X #x9 #x1 #xF stnz-sem)
10279 ;-------------------------------------------------------------
10280 ; stz - store on zero
10281 ;-------------------------------------------------------------
10283 (define-pmacro (stz-sem mode src dst)
10285 (if (eq zbit (const 1))
10288 ; stz #imm8,dst3 (m16)
10289 (binary-arith16-b-S-imm8-dst3 stz "" (f-0-4 #xC) (f-4-1 1) stz-sem)
10290 ; stz.BW #imm,dst (m32)
10291 (binary-arith32-imm-dst-defn QI QI .b 0 stz X #x9 #x0 #xF stz-sem)
10292 (binary-arith32-imm-dst-defn HI HI .w 1 stz X #x9 #x0 #xF stz-sem)
10294 ;-------------------------------------------------------------
10295 ; stzx - store on zero extention
10296 ;-------------------------------------------------------------
10298 (define-pmacro (stzx-sem mode src1 src2 dst)
10300 (if (eq zbit (const 1))
10304 ; stzx #imm8,dst3 (m16)
10305 (dni stzx16-imm8-imm8-r0h "stzx #Imm8,#Imm8,r0h" ((machine 16))
10306 ("stzx #${Imm-8-QI},#${Imm-16-QI},r0h")
10307 (+ (f-0-4 #xD) (f-4-4 #xB) Imm-8-QI Imm-16-QI)
10308 (stzx-sem QI Imm-8-QI Imm-16-QI (reg h-r0h))
10310 (dni stzx16-imm8-imm8-r0l "stzx #Imm8,#Imm8,r0l" ((machine 16))
10311 ("stzx #${Imm-8-QI},#${Imm-16-QI},r0l")
10312 (+ (f-0-4 #xD) (f-4-4 #xC) Imm-8-QI Imm-16-QI)
10313 (stzx-sem QI Imm-8-QI Imm-16-QI (reg h-r0l))
10315 (dni stzx16-imm8-imm8-dsp8sb "stzx #Imm8,#Imm8,dsp8[sb]" ((machine 16))
10316 ("stzx #${Imm-8-QI},#${Imm-24-QI},${Dsp-16-u8}[sb]")
10317 (+ (f-0-4 #xD) (f-4-4 #xD) Imm-8-QI Dsp-16-u8 Imm-24-QI)
10318 (stzx-sem QI Imm-8-QI Imm-16-QI (mem16 QI (add (reg h-sb) Dsp-24-u8)))
10320 (dni stzx16-imm8-imm8-dsp8fb "stzx #Imm8,#Imm8,dsp8[fb]" ((machine 16))
10321 ("stzx #${Imm-8-QI},#${Imm-24-QI},${Dsp-16-s8}[fb]")
10322 (+ (f-0-4 #xD) (f-4-4 #xE) Imm-8-QI Dsp-16-s8 Imm-24-QI)
10323 (stzx-sem QI Imm-8-QI Imm-24-QI (mem16 QI (add (reg h-fb) Dsp-16-s8)))
10325 (dni stzx16-imm8-imm8-abs16 "stzx #Imm8,#Imm8,abs16" ((machine 16))
10326 ("stzx #${Imm-8-QI},#${Imm-32-QI},${Dsp-16-u16}")
10327 (+ (f-0-4 #xD) (f-4-4 #xF) Imm-8-QI Dsp-16-u16 Imm-32-QI)
10328 (stzx-sem QI Imm-8-QI Imm-32-QI (mem16 QI Dsp-16-u16))
10330 ; stzx.BW #imm,dst (m32)
10331 (insn-imm1-imm2-dst-Unprefixed stzx #x9 #x3 #xF stzx-sem)
10333 ;-------------------------------------------------------------
10334 ; subx - subtract extend (m32)
10335 ;-------------------------------------------------------------
10337 (define-pmacro (subx-sem mode src1 dst)
10338 (sequence ((mode result))
10339 (set result (sub mode dst (ext mode src1)))
10340 (set obit (sub-oflag mode dst (ext mode src1) 0))
10341 (set cbit (sub-cflag mode dst (ext mode src1) 0))
10343 (set-z-and-s result)))
10345 (binary-arith32-imm-dst-defn QI SI "" 0 subx G #x9 #x1 #x1 subx-sem)
10347 (binary-arith32-src-dst-defn QI SI "" 0 subx G #x1 #x0 subx-sem)
10349 ;-------------------------------------------------------------
10351 ;-------------------------------------------------------------
10353 (define-pmacro (tst-sem mode src1 dst)
10354 (sequence ((mode result))
10355 (set result (and mode dst src1))
10356 (set-z-and-s result))
10359 ; tst.BW #imm,dst (m16 #1 m32 #1)
10360 (binary-arith-imm-dst tst G (f-0-4 7) (f-4-3 3) (f-8-4 0) #x9 #x3 #xE tst-sem)
10361 ; tst.BW src,dst (m16 #2 m32 #3)
10362 (binary-arith16-src-dst-defn QI QI .b 0 tst X (f-0-4 #x8) (f-4-3 0) tst-sem)
10363 (binary-arith16-src-dst-defn HI HI .w 1 tst X (f-0-4 #x8) (f-4-3 0) tst-sem)
10364 (binary-arith32-src-dst-Prefixed QI QI .b 0 tst G #x1 #x9 tst-sem)
10365 (binary-arith32-src-dst-Prefixed HI HI .w 1 tst G #x1 #x9 tst-sem)
10366 ; tst.BW:S #imm,dst2 (m32 #2)
10367 (binary-arith32-s-imm-dst QI .b 0 tst #x0 #x6 tst-sem)
10368 (binary-arith32-s-imm-dst HI .w 1 tst #x0 #x6 tst-sem)
10370 ;-------------------------------------------------------------
10372 ;-------------------------------------------------------------
10374 (dni und16 "und" ((machine 16))
10376 (+ (f-0-4 #xF) (f-4-4 #xF))
10380 (dni und32 "und" ((machine 32))
10382 (+ (f-0-4 #xF) (f-4-4 #xF))
10386 ;-------------------------------------------------------------
10388 ;-------------------------------------------------------------
10391 (dni wait16 "wait" ((machine 16))
10393 (+ (f-0-4 7) (f-4-4 #xD) (f-8-4 #xF) (f-12-4 3))
10397 (dni wait "wait" ((machine 32))
10399 (+ (f-0-4 #xB) (f-4-4 2) (f-8-4 0) (f-12-4 3))
10403 ;-------------------------------------------------------------
10405 ;-------------------------------------------------------------
10407 (define-pmacro (xchg-sem mode src dst)
10408 (sequence ((mode result))
10413 (define-pmacro (xchg16-defn mode sz szc src srcreg)
10414 (dni (.sym xchg16 sz - srcreg)
10415 (.str "xchg" sz "-" srcreg ",dst16-16-" mode)
10417 (.str "xchg." sz " " srcreg ",${dst16-16-" mode "}")
10418 (+ (f-0-4 #x7) (f-4-3 #x5) (f-7-1 szc) (f-8-2 0) (f-10-2 src) (.sym dst16-16- mode))
10419 (xchg-sem mode (reg (.sym h- srcreg)) (.sym dst16-16- mode))
10422 (xchg16-defn QI b 0 0 r0l)
10423 (xchg16-defn QI b 0 1 r0h)
10424 (xchg16-defn QI b 0 2 r1l)
10425 (xchg16-defn QI b 0 3 r1h)
10426 (xchg16-defn HI w 1 0 r0)
10427 (xchg16-defn HI w 1 1 r1)
10428 (xchg16-defn HI w 1 2 r2)
10429 (xchg16-defn HI w 1 3 r3)
10430 (define-pmacro (xchg32-defn mode sz szc src srcreg)
10431 (dni (.sym xchg32 sz - srcreg)
10432 (.str "xchg" sz "-" srcreg ",dst32-16-Unprefixed-" mode)
10434 (.str "xchg." sz " " srcreg ",${dst32-16-Unprefixed-" mode "}")
10435 (+ (f-0-4 #xD) (.sym dst32-16-Unprefixed- mode) (f-7-1 szc) (f-10-2 0) (f-12-1 1) (f-13-3 src))
10436 (xchg-sem mode (reg (.sym h- srcreg)) (.sym dst32-16-Unprefixed- mode))
10439 (xchg32-defn QI b 0 0 r0l)
10440 (xchg32-defn QI b 0 1 r1l)
10441 (xchg32-defn QI b 0 2 a0)
10442 (xchg32-defn QI b 0 3 a1)
10443 (xchg32-defn QI b 0 4 r0h)
10444 (xchg32-defn QI b 0 5 r1h)
10445 (xchg32-defn HI w 1 0 r0)
10446 (xchg32-defn HI w 1 1 r1)
10447 (xchg32-defn HI w 1 2 a0)
10448 (xchg32-defn HI w 1 3 a1)
10449 (xchg32-defn HI w 1 4 r2)
10450 (xchg32-defn HI w 1 5 r3)
10452 ;-------------------------------------------------------------
10453 ; xor - exclusive or
10454 ;-------------------------------------------------------------
10456 (define-pmacro (xor-sem mode src1 dst)
10457 (sequence ((mode result))
10458 (set result (xor mode src1 dst))
10459 (set-z-and-s result)
10463 ; xor.BW #imm,dst (m16 #1 m32 #1)
10464 (binary-arith-imm-dst xor G (f-0-4 7) (f-4-3 3) (f-8-4 1) #x9 #x0 #xE xor-sem)
10465 ; xor.BW src,dst (m16 #3 m32 #3)
10466 (binary-arith-src-dst xor G (f-0-4 #x8) (f-4-3 4) #x1 #x9 xor-sem)
10468 ;-------------------------------------------------------------
10470 ;-------------------------------------------------------------
10472 (define-pmacro (exts-sem smode dmode src dst)
10473 (set dst (ext dmode (trunc smode src)))
10475 (define-pmacro (extz-sem smode dmode src dst)
10476 (set dst (zext dmode (trunc smode src)))
10479 ; exts.b dst for m16c
10480 (ext16-defn QI HI .b 0 exts (f-0-4 7) (f-4-3 6) (f-8-4 6) exts-sem)
10482 ; exts.w r0 for m16c
10487 (+ (f-0-4 #x7) (f-4-4 #xC) (f-8-4 #xF) (f-12-4 3))
10488 (exts-sem HI SI R0 R2R0)
10491 ; exts.size dst for m32c
10492 (ext32-defn QI HI .b 0 exts (f-0-4 #xC) (f-10-2 1) (f-12-4 #xE) exts-sem)
10493 (ext32-defn HI SI .w 1 exts (f-0-4 #xC) (f-10-2 1) (f-12-4 #xE) exts-sem)
10494 ; exts.b src,dst for m32c
10495 (ext32-binary-defn exts .b #x1 #x7 exts-sem)
10497 ; extz.b src,dst for m32c
10498 (ext32-binary-defn extz "" #x1 #xB extz-sem)
10500 ;-------------------------------------------------------------
10502 ;-------------------------------------------------------------
10505 (dni srcind "SRC-INDIRECT" ((machine 32))
10507 (+ (f-0-4 4) (f-4-4 1))
10508 (set (reg h-src-indirect) 1)
10511 (dni destind "DEST-INDIRECT" ((machine 32))
10513 (+ (f-0-4 0) (f-4-4 9))
10514 (set (reg h-dst-indirect) 1)
10517 (dni srcdestind "SRC-DEST-INDIRECT" ((machine 32))
10518 ("src-dest-indirect")
10519 (+ (f-0-4 4) (f-4-4 9))
10520 (sequence () (set (reg h-src-indirect) 1) (set (reg h-dst-indirect) 1))