1 ; Infineon XC16X CPU description. -*- Scheme -*-
3 ; Copyright 2006, 2007, 2009 Free Software Foundation, Inc.
5 ; Contributed by KPIT Cummins Infosystems Ltd.; developed under contract
6 ; from Infineon Systems, GMBH , Germany.
8 ; This file is part of the GNU Binutils.
10 ; This program is free software; you can redistribute it and/or modify
11 ; it under the terms of the GNU General Public License as published by
12 ; the Free Software Foundation; either version 3 of the License, or
13 ; (at your option) any later version.
15 ; This program is distributed in the hope that it will be useful,
16 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ; GNU General Public License for more details.
20 ; You should have received a copy of the GNU General Public License
21 ; along with this program; if not, write to the Free Software
22 ; Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
25 (define-rtl-version 0 8)
27 (include "simplify.inc")
29 ; define-arch appears first
32 (name xc16x) ; name of cpu family
33 (comment "Infineon XC16X")
34 (default-alignment aligned)
41 ; An attribute to describe which pipeline an insn runs in generally OS.
46 (comment "parallel execution pipeline selection")
50 ; Instruction set parameters.
54 (default-insn-bitsize 32)
55 (base-insn-bitsize 32)
56 (default-insn-word-bitsize 16)
57 (decode-assist (15 14 13 12))
58 ; The XC16X fetches 1 insn at a time.
63 ; Cpu family definitions.
66 ; cpu names must be distinct from the architecture name and machine names.
67 ; The "b" suffix stands for "base" and is the convention.
68 ; The "f" suffix stands for "family" and is the convention.
70 (comment "Infineon XC16X base family")
72 (insn-chunk-bitsize 32)
79 (comment "Infineon XC16X cpu")
86 (name xc16x) (comment "XC16X") (attrs)
89 (pipeline p-mem "" () ((prefetch) (fetch) (decode) (address) (memory) (execute) (writeback)))
91 ; `state' is a list of variables for recording model state
93 ; bit mask of h-gr registers, =1 means value being loaded from memory
97 (unit u-exec "Execution Unit" ()
100 ((dr INT -1) (sr INT -1)) ; inputs
101 ((dr INT -1)) ; outputs
102 () ; profile action (default)
104 (unit u-cmp "Compare Unit" ()
107 ((src1 INT -1) (src2 INT -1)) ; inputs
109 () ; profile action (default)
111 (unit u-cti "Jump & Call Unit" ()
114 ((condbit) (sr INT -1)) ; inputs
116 () ; profile action (default)
118 (unit u-mov "Data Movement Unit" ()
121 ((dr INT -1) (sr INT -1)) ; inputs
122 ((dr INT -1)) ; output
123 () ; profile action (default)
127 ; Instruction fields.
130 ; PCREL-ADDR: pc relative value (for reloc and disassembly purposes)
131 ; ABS-ADDR: absolute address (for reloc and disassembly purposes)
132 ; RELOC: there is a relocation associated with this field (experiment)
138 (comment "there is a reloc associated with this field (experiment)")
141 (dnf f-op1 "op1" () 7 4)
142 (dnf f-op2 "op2" () 3 4)
143 (dnf f-condcode "condcode" () 7 4) ;condition code required in other jmps and calls
144 (dnf f-icondcode "indrct condcode" () 15 4) ;condition code required in other jmpi and calli
145 (dnf f-rcond "relative-cond" () 7 4) ;condition code required in JMPR
146 (dnf f-qcond "qbit" () 7 4) ;used in enum of bset/bclear macro
147 (dnf f-extccode "extended condcode" () 15 5) ;condition code required in other jmpa and calla
148 (dnf f-r0 "r0" () 9 2) ;required where 2 bit register used(only R0-R3)
149 (dnf f-r1 "r1" () 15 4)
150 (dnf f-r2 "r2" () 11 4)
151 (dnf f-r3 "r3" () 12 4)
152 (dnf f-r4 "r4" () 11 4)
153 (dnf f-uimm2 "uimm2" () 13 2) ;used for immediate data,eg in ADD,MOV insns
154 (dnf f-uimm3 "uimm3" () 10 3) ;used for immediate data,eg in ADD,SUB insns
155 (dnf f-uimm4 "uimm4" () 15 4) ;used for immediate data,eg in MOV insns
156 (dnf f-uimm7 "uimm7" (PCREL-ADDR RELOC) 15 7) ;used in TRAP
157 (dnf f-uimm8 "uimm8" () 23 8) ;used in immediate byte data,eg in ADDB,MOVB insns
158 (dnf f-uimm16 "uimm16" () 31 16) ;used for immediate word data
159 (dnf f-memory "memory" () 31 16) ; used for memory operands
160 (dnf f-memgr8 "memory" () 31 16) ; memory location of gr
161 (dnf f-rel8 "rel8" (PCREL-ADDR RELOC) 15 8) ;used in JMPR,CALLR
162 (dnf f-relhi8 "relhi8" (PCREL-ADDR RELOC) 23 8) ;used in JB,JBC,JNB,JNBS
163 (dnf f-reg8 "reg8" () 15 8) ;required where 8bit gp register used
164 (dnf f-regmem8 "regmem8" () 15 8) ;required where 8bit register used
165 (dnf f-regoff8 "regoff8" () 15 8) ;required for offset calc
166 (dnf f-reghi8 "reghi8" () 23 8) ;required where 8bit register number used
167 (dnf f-regb8 "regb8" () 15 8) ;required for byte registers RL0,RH0, till RL8,RH8
168 (dnf f-seg8 "seg8" () 15 8) ;used as segment number in JMPS,CALLS
169 (dnf f-segnum8 "segnum8" () 23 8) ;used in EXTS,EXTSR
170 (dnf f-mask8 "mask8" () 23 8) ;used as mask in BFLDH,BFLDL insns
171 (dnf f-pagenum "page num" () 25 10);used in EXTP,EXTPR
172 (dnf f-datahi8 "datahi8" () 31 8) ;used for filling with const data
173 (dnf f-data8 "data8" () 23 8) ;used for filling with const data
174 (dnf f-offset16 "address offset16" (ABS-ADDR RELOC) 31 16) ;used in JMPS,JMPA,CALLA,CALLS
175 (dnf f-op-bit1 "gap of 1 bit" () 11 1) ;used for filling with const data
176 (dnf f-op-bit2 "gap of 2 bits" () 11 2) ;used for filling with const data
177 (dnf f-op-bit4 "gap of 4 bits" () 11 4) ;used for filling with const data
178 (dnf f-op-bit3 "gap of 3 bits" () 10 3) ;used in CALLA, JMPA
179 (dnf f-op-2bit "gap of 2 bits" () 10 2) ;used in CALLA
180 (dnf f-op-bitone "gap of 1 bit " () 10 1) ;used in JMPA
181 (dnf f-op-onebit "gap of 1 bit " () 9 1) ;used in JMPA
182 (dnf f-op-1bit "gap of 1 bit " () 8 1) ;used in JMPA, CALLA
183 (dnf f-op-lbit4 "gap of 4 bits" () 15 4) ;used for filling with const data
184 (dnf f-op-lbit2 "gap of 2 bits" () 15 2) ;used for filling with const data
185 (dnf f-op-bit8 "gap of 8 bits" () 31 8) ;used for filling with const data
186 (dnf f-op-bit16 "gap of 16 bits" () 31 16) ;used for filling with const data
187 (dnf f-qbit "qbit" () 7 4) ;used in bit field of bset/bclear
188 (dnf f-qlobit "qlobit" () 31 4) ;used for filling with const data
189 (dnf f-qhibit "qhibit" () 27 4) ;used for filling with const data
190 (dnf f-qlobit2 "qlobit2" () 27 2) ;used for filling with const data
191 (dnf f-pof "upof16" () 31 16) ; used for memory operands
195 (define-normal-insn-enum insn-op1 "insn format enums" () OP1_ f-op1
196 ("0" "1" "2" "3" "4" "5" "6" "7"
197 "8" "9" "10" "11" "12" "13" "14" "15")
201 (define-normal-insn-enum insn-op2 "op2 enums" () OP2_ f-op2
202 ("0" "1" "2" "3" "4" "5" "6" "7"
203 "8" "9" "10" "11" "12" "13" "14" "15")
207 ; insn-rcond: bits 0-3
208 (define-normal-insn-enum insn-qcond "bit set/clear enums" () QBIT_ f-qcond
209 (("0" 0) ("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) ("6" 6) ("7" 7) ("8" 8) ("9" 9) ("10" 10)
210 ("11" 11) ("12" 12) ("13" 13) ("14" 14) ("15" 15))
213 ; insn-rcond: bits 0-3
214 (define-normal-insn-enum insn-rcond "relative jump condition code op2 enums" () COND_ f-rcond
215 (("UC" 0) ("NET" 1) ("Z" 2) ("NE_NZ" 3) ("V" 4) ("NV" 5) ("N" 6) ("NN" 7)
216 ("C" 8) ("NC" 9) ("SGT" 10) ("SLE" 11) ("SLT" 12) ("SGE" 13) ("UGT" 14) ("ULE" 15)
217 ("EQ" 2) ("NE" 3) ("ULT" 8) ("UGE" 9))
223 ; These entries list the elements of the raw hardware.
224 ; They're also used to provide tables and other elements of the assembly
227 (dnh h-pc "program counter" (PC) (pc) () () ())
232 (values (r0 0) (r1 1) (r2 2) (r3 3) (r4 4) (r5 5) (r6 6) (r7 7)
233 (r8 8) (r9 9) (r10 10) (r11 11) (r12 12) (r13 13) (r14 14) (r15 15))
238 (comment "general registers")
239 (attrs PROFILE CACHE-ADDR)
240 (type register HI (16))
241 (indices extern-keyword gr-names)
244 ;; HACK: Various semantics refer to h-cr.
245 ;; This is here to keep things working.
248 (comment "cr registers")
249 (attrs PROFILE CACHE-ADDR)
250 (type register HI (16))
251 (indices extern-keyword gr-names)
257 (values (0x1 0) (0x2 1) (0x3 2) (0x4 3)
258 ("1" 0) ("2" 1) ("3" 2) ("4" 3))
264 (comment "ext values")
265 (attrs PROFILE CACHE-ADDR)
266 (type register HI (8))
267 (indices extern-keyword ext-names)
273 (values ("IEN" 136) ("r0.11" 240) ("r1.11" 241) ("r2.11" 242) ("r3.11" 243) ("r4.11" 244)
274 ("r5.11" 245) ("r6.11" 246) ("r7.11" 247) ("r8.11" 248)
275 ("r9.11" 249) ("r10.11" 250) ("r11.11" 251) ("r12.11" 252)
276 ("r13.11" 253) ("r14.11" 254) ("r15.11" 255))
281 (comment "ext values")
282 (attrs PROFILE CACHE-ADDR)
283 (type register HI (1))
284 (indices extern-keyword psw-names)
290 (values (rl0 0) (rh0 1) (rl1 2) (rh1 3) (rl2 4) (rh2 5) (rl3 6) (rh3 7)
291 (rl4 8) (rh4 9) (rl5 10) (rh5 11) (rl6 12) (rh6 13) (rl7 14) (rh7 15))
296 (comment "general registers")
297 (attrs PROFILE CACHE-ADDR)
298 (type register QI (16))
299 (indices extern-keyword grb-names)
303 (name conditioncode-names)
305 (values (cc_UC 0) (cc_NET 1) (cc_Z 2) (cc_EQ 2) (cc_NZ 3) (cc_NE 3) (cc_V 4) (cc_NV 5) (cc_N 6) (cc_NN 7) (cc_ULT 8) (cc_UGE 9)
306 (cc_C 8) (cc_NC 9) (cc_SGT 10) (cc_SLE 11) (cc_SLT 12) (cc_SGE 13) (cc_UGT 14)
311 (comment "condition codes")
312 (attrs PROFILE CACHE-ADDR)
313 (type register QI (16))
314 (indices extern-keyword conditioncode-names)
318 (name extconditioncode-names)
320 (values(cc_UC 0) (cc_NET 2) (cc_Z 4) (cc_EQ 4) (cc_NZ 6) (cc_NE 6) (cc_V 8) (cc_NV 10) (cc_N 12) (cc_NN 14) (cc_ULT 16) (cc_UGE 18) (cc_C 16) (cc_NC 18) (cc_SGT 20)
321 (cc_SLE 22) (cc_SLT 24) (cc_SGE 26) (cc_UGT 28) (cc_ULE 30) (cc_nusr0 1)
322 (cc_nusr1 3) (cc_usr0 5) (cc_usr1 7))
326 (comment "extended condition codes")
327 (attrs PROFILE CACHE-ADDR)
328 (type register QI (4))
329 (indices extern-keyword extconditioncode-names)
334 (enum-prefix H-GRB8-)
335 (values (dpp0 0) (dpp1 1) (dpp2 2) (dpp3 3)
336 (psw 136) (cp 8) (mdl 7) (mdh 6)
337 (mdc 135) (sp 9) (csp 4) (vecseg 137)
338 (stkov 10) (stkun 11) (cpucon1 12) (cpucon2 13)
339 (zeros 142) (ones 143) (spseg 134) (tfr 214)
340 (rl0 240) (rh0 241) (rl1 242) (rh1 243) (rl2 244) (rh2 245) (rl3 246) (rh3 247)
341 (rl4 248) (rh4 249) (rl5 250) (rh5 251) (rl6 252) (rh6 253) (rl7 254) (rh7 255))
346 (comment "general byte registers")
347 (attrs PROFILE CACHE-ADDR)
348 (type register QI (36))
349 (indices extern-keyword grb8-names)
355 (values (dpp0 0) (dpp1 1) (dpp2 2) (dpp3 3)
356 (psw 136) (cp 8) (mdl 7) (mdh 6)
357 (mdc 135) (sp 9) (csp 4) (vecseg 137)
358 (stkov 10) (stkun 11) (cpucon1 12) (cpucon2 13)
359 (zeros 142) (ones 143) (spseg 134) (tfr 214)
360 (r0 240) (r1 241) (r2 242) (r3 243) (r4 244) (r5 245) (r6 246) (r7 247)
361 (r8 248) (r9 249) (r10 250) (r11 251) (r12 252) (r13 253) (r14 254) (r15 255))
366 (comment "registers")
367 (attrs PROFILE CACHE-ADDR)
368 (type register HI (36))
369 (indices extern-keyword r8-names)
374 (enum-prefix H-REGMEM8-)
375 (values (dpp0 0) (dpp1 1) (dpp2 2) (dpp3 3)
376 (psw 136) (cp 8) (mdl 7) (mdh 6)
377 (mdc 135) (sp 9) (csp 4) (vecseg 137)
378 (stkov 10) (stkun 11) (cpucon1 12) (cpucon2 13)
379 (zeros 142) (ones 143) (spseg 134) (tfr 214)
380 (r0 240) (r1 241) (r2 242) (r3 243) (r4 244) (r5 245) (r6 246) (r7 247)
381 (r8 248) (r9 249) (r10 250) (r11 251) (r12 252) (r13 253) (r14 254) (r15 255))
386 (comment "registers")
388 (type register HI (16))
389 (indices extern-keyword regmem8-names)
394 (enum-prefix H-REGDIV8-)
395 (values (r0 0) (r1 17) (r2 34) (r3 51) (r4 68) (r5 85) (r6 102) (r7 119)
396 (r8 136) (r9 153) (r10 170) (r11 187) (r12 204) (r13 221) (r14 238) (r15 255))
401 (comment "division insn registers")
402 (attrs PROFILE CACHE-ADDR)
403 (type register HI (16))
404 (indices extern-keyword regdiv8-names)
409 (enum-prefix H-REG0-)
410 (values (0x1 1) (0x2 2) (0x3 3) (0x4 4) (0x5 5) (0x6 6) (0x7 7) (0x8 8) (0x9 9) (0xa 10) (0xb 11)
411 (0xc 12) (0xd 13) (0xe 14) (0xf 15)
412 ("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) ("6" 6) ("7" 7) ("8" 8) ("9" 9) ("10" 10) ("11" 11)
413 ("12" 12) ("13" 13) ("14" 14) ("15" 15))
418 (comment "for 4-bit data excuding 0")
419 (attrs PROFILE CACHE-ADDR)
420 (type register HI (30))
421 (indices extern-keyword reg0-name)
426 (enum-prefix H-REG01-)
427 (values (0x1 1) (0x2 2) (0x3 3) (0x4 4) (0x5 5) (0x6 6) (0x7 7)
428 ("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) ("6" 6) ("7" 7))
433 (comment "for 4-bit data excuding 0")
434 (attrs PROFILE CACHE-ADDR)
435 (type register HI (14))
436 (indices extern-keyword reg0-name1)
440 (name regbmem8-names)
441 (enum-prefix H-REGBMEM8-)
442 (values (dpp0 0) (dpp1 1) (dpp2 2) (dpp3 3)
443 (psw 136) (cp 8) (mdl 7) (mdh 6)
444 (mdc 135) (sp 9) (csp 4) (vecseg 137)
445 (stkov 10) (stkun 11) (cpucon1 12) (cpucon2 13)
446 (zeros 142) (ones 143) (spseg 134) (tfr 214)
447 (rl0 240) (rh0 241) (rl1 242) (rh1 243) (rl2 244) (rh2 245) (rl3 246) (rh3 247)
448 (rl4 248) (rh4 249) (rl5 250) (rh5 251) (rl6 252) (rh6 253) (rl7 254) (rh7 255))
453 (comment "registers")
454 (attrs PROFILE CACHE-ADDR)
455 (type register HI (36))
456 (indices extern-keyword regbmem8-names)
461 (enum-prefix H-MEMGR8-)
462 (values (dpp0 65024) (dpp1 65026) (dpp2 65028) (dpp3 65030)
463 (psw 65296) (cp 65040) (mdl 65038) (mdh 65036)
464 (mdc 65294) (sp 65042) (csp 65032) (vecseg 65298)
465 (stkov 65044) (stkun 65046) (cpucon1 65048) (cpucon2 65050)
466 (zeros 65308) (ones 65310) (spseg 65292) (tfr 65452) )
471 (comment "memory location of registers")
473 (type register HI (20))
474 (indices extern-keyword memgr8-names)
477 (dsh h-cond "condition bit" () (register BI)) ;any bit from PSW while comparison
478 ; This bit is part of the PSW register
479 (dsh h-cbit "carry bit" () (register BI))
481 (dsh h-sgtdis "segmentation enable bit" () (register BI)) ;0 means segmentation enabled
483 ;Instruction operands
484 ; -- layer between the assembler and the raw hardware description
485 ; -- the main means of manipulating instruction fields in the semantic code
487 ; XC16X specific operand attributes:
493 (comment "immediates have an optional '#' prefix")
500 (comment "bit addr have an optional '.' prefix")
507 (comment "page offset ")
521 (comment "segment offset selection")
531 ;; Define an operand that takes a set of handlers.
532 ;; dowh: define-operand-with-handlers
533 (define-pmacro (dowh x-name x-comment x-attrs x-type x-index x-handlers)
534 (define-operand (name x-name) (comment x-comment)
535 (.splice attrs (.unsplice x-attrs))
536 (type x-type) (index x-index)
537 (.splice handlers (.unsplice x-handlers)))
540 (dnop sr "source register" () h-gr f-r2)
541 (dnop dr "destination register" () h-gr f-r1)
542 (dnop dri "destination register" () h-gr f-r4)
543 (dnop srb "source register" () h-grb f-r2)
544 (dnop drb "destination register" () h-grb f-r1)
545 (dnop sr2 "2 bit source register" () h-gr f-r0)
546 (dnop src1 "source register 1" () h-gr f-r1)
547 (dnop src2 "source register 2" () h-gr f-r2)
548 (dnop srdiv "source register 2" () h-regdiv8 f-reg8)
549 (dnop RegNam "PSW bits" () h-psw f-reg8)
550 (dnop uimm2 "2 bit unsigned number" (HASH-PREFIX) h-ext f-uimm2)
551 (dnop uimm3 "3 bit unsigned number" (HASH-PREFIX) h-r01 f-uimm3)
552 (dnop uimm4 "4 bit unsigned number" (HASH-PREFIX) h-uint f-uimm4)
553 (dnop uimm7 "7 bit trap number" (HASH-PREFIX) h-uint f-uimm7)
554 (dnop uimm8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm8)
555 (dnop uimm16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm16)
556 (dowh upof16 "16 bit unsigned immediate" (POF-PREFIX) h-addr f-memory ((print "with_pof_prefix")))
557 (dnop reg8 "8 bit word register number" () h-r8 f-reg8)
558 (dnop regmem8 "8 bit word register number" () h-regmem8 f-regmem8)
559 (dnop regbmem8 "8 bit byte register number" () h-regbmem8 f-regmem8)
560 (dnop regoff8 "8 bit word register number" () h-r8 f-regoff8)
561 (dnop reghi8 "8 bit word register number" () h-r8 f-reghi8)
562 (dnop regb8 "8 bit byte register number" () h-grb8 f-regb8)
563 (dnop genreg "8 bit word register number" () h-r8 f-regb8)
564 (dnop seg "8 bit segment number" () h-uint f-seg8)
565 (dnop seghi8 "8 bit hi segment number" () h-uint f-segnum8)
566 (dnop caddr "16 bit address offset" () h-addr f-offset16)
567 (dnop rel "8 bit signed relative offset" () h-sint f-rel8)
568 (dnop relhi "hi 8 bit signed relative offset" () h-sint f-relhi8)
569 (dnop condbit "condition bit" (SEM-ONLY) h-cond f-nil)
570 (dnop bit1 "gap of 1 bit" () h-uint f-op-bit1)
571 (dnop bit2 "gap of 2 bits" () h-uint f-op-bit2)
572 (dnop bit4 "gap of 4 bits" () h-uint f-op-bit4)
573 (dnop lbit4 "gap of 4 bits" () h-uint f-op-lbit4)
574 (dnop lbit2 "gap of 2 bits" () h-uint f-op-lbit2)
575 (dnop bit8 "gap of 8 bits" () h-uint f-op-bit8)
576 (dnop u4 "gap of 4 bits" () h-r0 f-uimm4)
577 (dnop bitone "field of 1 bit" () h-uint f-op-onebit)
578 (dnop bit01 "field of 1 bit" () h-uint f-op-1bit)
579 (dnop cond "condition code" () h-cc f-condcode)
580 (dnop icond "indirect condition code" () h-cc f-icondcode)
581 (dnop extcond "extended condition code" () h-ecc f-extccode)
582 (dnop memory "16 bit memory" () h-addr f-memory)
583 (dnop memgr8 "16 bit memory" () h-memgr8 f-memgr8)
584 (dnop cbit "carry bit" (SEM-ONLY) h-cbit f-nil)
585 (dowh qbit "bit addr" (DOT-PREFIX) h-uint f-qbit ((print "with_dot_prefix")))
586 (dowh qlobit "bit addr" (DOT-PREFIX) h-uint f-qlobit ((print "with_dot_prefix")))
587 (dowh qhibit "bit addr" (DOT-PREFIX) h-uint f-qhibit ((print "with_dot_prefix")))
588 (dnop mask8 "8 bit mask" (HASH-PREFIX) h-uint f-mask8)
589 (dnop masklo8 "8 bit mask" (HASH-PREFIX) h-uint f-datahi8)
590 (dnop pagenum "10 bit page number" (HASH-PREFIX) h-uint f-pagenum)
591 (dnop data8 "8 bit data" (HASH-PREFIX) h-uint f-data8)
592 (dnop datahi8 "8 bit data" (HASH-PREFIX) h-uint f-datahi8)
593 (dnop sgtdisbit "segmentation enable bit" (SEM-ONLY) h-sgtdis f-nil)
594 (dowh upag16 "16 bit unsigned immediate" (PAG-PREFIX) h-uint f-uimm16 ((print "with_pag_prefix")))
595 (dnop useg8 "8 bit segment " (SEG-PREFIX) h-uint f-seg8)
596 (dnop useg16 "16 bit address offset" (SEG-PREFIX) h-uint f-offset16)
597 (dnop usof16 "16 bit address offset" (SOF-PREFIX) h-uint f-offset16)
599 ; define hash operator
600 (define-operand (name hash) (comment "# prefix") (attrs)
603 (handlers (parse "hash") (print "hash"))
606 ; define dot operator
607 (define-operand (name dot) (comment ". prefix") (attrs)
610 (handlers (parse "dot") (print "dot"))
613 ; define pof operator
614 (define-operand (name pof) (comment "pof: prefix") (attrs)
617 (handlers (parse "pof") (print "pof"))
620 ; define pag operator
621 (define-operand (name pag) (comment "pag: prefix") (attrs)
624 (handlers (parse "pag") (print "pag"))
627 ; define sof operator
628 (define-operand (name sof) (comment "sof: prefix") (attrs)
631 (handlers (parse "sof") (print "sof"))
634 ; define seg operator
635 (define-operand (name segm) (comment "seg: prefix") (attrs)
638 (handlers (parse "seg") (print "seg"))
641 ; IDOC attribute for instruction documentation.
646 (comment "insn kind for documentation")
649 (MOVE - () "Data Movement")
650 (ALU - () "Arithmatic & logical")
652 (JMP - () "Jump & Call")
653 (MISC - () "Miscellaneous")
654 (SYSC - () "System control")
658 ; Include the instruction set descriptions from their respective
662 ;******************************************************************
664 ;add/sub register and immediate
665 (define-pmacro (arithmetic16 name insn insn1 opc1 opc2 op1 op2 mode dir)
667 (.str name "arithmetic" )
668 ((PIPE OS) (IDOC ALU))
669 (.str insn " $"op1 ",$"dir"$"op2)
670 (+ opc1 opc2 op1 op2)
671 (set mode op1 (insn1 mode op1 (mem HI op2)))
675 (arithmetic16 addrpof add add OP1_0 OP2_2 reg8 upof16 HI "pof")
676 (arithmetic16 subrpof sub sub OP1_2 OP2_2 reg8 upof16 HI "pof")
677 (arithmetic16 addbrpof addb add OP1_0 OP2_3 regb8 upof16 QI "pof")
678 (arithmetic16 subbrpof subb sub OP1_2 OP2_3 regb8 upof16 QI "pof")
679 (arithmetic16 addrpag add add OP1_0 OP2_2 reg8 upag16 HI "pag")
680 (arithmetic16 subrpag sub sub OP1_2 OP2_2 reg8 upag16 HI "pag")
681 (arithmetic16 addbrpag addb add OP1_0 OP2_3 regb8 upag16 QI "pag")
682 (arithmetic16 subbrpag subb sub OP1_2 OP2_3 regb8 upag16 QI "pag")
684 ;add/sub register and immediate
685 (define-pmacro (arithmetic17 name insn insn1 opc1 opc2 op1 op2 mode dir)
687 (.str name "arithmetic" )
688 ((PIPE OS) (IDOC ALU))
689 (.str insn " $"op1 ",$"dir"$"op2)
690 (+ opc1 opc2 op1 op2)
691 (set mode op1 (insn1 mode op1 (mem HI op2) cbit))
695 (arithmetic17 addcrpof addc addc OP1_1 OP2_2 reg8 upof16 HI "pof")
696 (arithmetic17 subcrpof subc subc OP1_3 OP2_2 reg8 upof16 HI "pof")
697 (arithmetic17 addcbrpof addcb addc OP1_1 OP2_3 regb8 upof16 QI "pof")
698 (arithmetic17 subcbrpof subcb subc OP1_3 OP2_3 regb8 upof16 QI "pof")
699 (arithmetic17 addcrpag addc addc OP1_1 OP2_2 reg8 upag16 HI "pag")
700 (arithmetic17 subcrpag subc subc OP1_3 OP2_2 reg8 upag16 HI "pag")
701 (arithmetic17 addcbrpag addcb addc OP1_1 OP2_3 regb8 upag16 QI "pag")
702 (arithmetic17 subcbrpag subcb subc OP1_3 OP2_3 regb8 upag16 QI "pag")
704 ;add/sub register and immediate
705 (define-pmacro (arithmetic18 name insn insn1 opc1 opc2 op1 op2 mode dir)
707 (.str name "arithmetic" )
708 ((PIPE OS) (IDOC ALU))
709 (.str insn " $"dir"$"op1 ",$"op2)
710 (+ opc1 opc2 op2 op1)
711 (set (mem HI op1) (insn1 (mem HI op1) op2 ))
715 (arithmetic18 addrpofr add add OP1_0 OP2_4 upof16 reg8 HI "pof")
716 (arithmetic18 subrpofr sub sub OP1_2 OP2_4 upof16 reg8 HI "pof")
717 (arithmetic18 addbrpofr addb add OP1_0 OP2_5 upof16 regb8 QI "pof")
718 (arithmetic18 subbrpofr subb sub OP1_2 OP2_5 upof16 regb8 QI "pof")
720 ;add/sub register and immediate
721 (define-pmacro (arithmetic19 name insn insn1 opc1 opc2 op1 op2 mode dir)
723 (.str name "arithmetic" )
724 ((PIPE OS) (IDOC ALU))
725 (.str insn " $"dir"$"op1 ",$"op2)
726 (+ opc1 opc2 op2 op1)
727 (set (mem HI op1) (insn1 mode (mem HI op1) op2 cbit))
731 (arithmetic19 addcrpofr addc addc OP1_1 OP2_4 upof16 reg8 HI "pof")
732 (arithmetic19 subcrpofr subc subc OP1_3 OP2_4 upof16 reg8 HI "pof")
733 (arithmetic19 addcbrpofr addcb addc OP1_1 OP2_5 upof16 regb8 QI "pof")
734 (arithmetic19 subcbrpofr subcb subc OP1_3 OP2_5 upof16 regb8 QI "pof")
736 ;add/sub register and immediate
737 (define-pmacro (arithmetic20 name insn insn1 opc1 opc2 op1 op2 mode dir)
739 (.str name "arithmetic" )
740 ((PIPE OS) (IDOC ALU))
741 (.str insn " $"op1 ",$hash$"dir"$"op2)
742 (+ opc1 opc2 op1 op2)
743 (set mode op1 (insn1 mode op1 op2))
747 (arithmetic20 addrhpof add add OP1_0 OP2_6 reg8 uimm16 HI "pof")
748 (arithmetic20 subrhpof sub sub OP1_2 OP2_6 reg8 uimm16 HI "pof")
749 (arithmetic20 addbrhpof add add OP1_0 OP2_6 reg8 uimm16 HI "pag")
750 (arithmetic20 subbrhpof sub sub OP1_2 OP2_6 reg8 uimm16 HI "pag")
752 ;add/sub register and immediate
753 (define-pmacro (arithmetic21 name insn insn1 opc1 opc2 op1 op2 mode dir)
755 (.str name "arithmetic" )
756 ((PIPE OS) (IDOC ALU))
757 (.str insn " $"op1 ",$hash$"dir"$"op2)
758 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
759 (set mode op1 (insn1 mode op1 op2))
763 (arithmetic21 addrhpof3 add add OP1_0 OP2_8 dr uimm3 HI "pof")
764 (arithmetic21 subrhpof3 sub sub OP1_2 OP2_8 dr uimm3 HI "pof")
765 (arithmetic21 addbrhpag3 addb add OP1_0 OP2_9 drb uimm3 QI "pag")
766 (arithmetic21 subbrhpag3 subb sub OP1_2 OP2_9 drb uimm3 QI "pag")
767 (arithmetic21 addrhpag3 add add OP1_0 OP2_8 dr uimm3 HI "pag")
768 (arithmetic21 subrhpag3 sub sub OP1_2 OP2_8 dr uimm3 HI "pag")
769 (arithmetic21 addbrhpof3 addb add OP1_0 OP2_9 drb uimm3 QI "pof")
770 (arithmetic21 subbrhpof3 subb sub OP1_2 OP2_9 drb uimm3 QI "pof")
772 ;add/sub register and immediate
773 (define-pmacro (arithmetic22 name insn insn1 opc1 opc2 op1 op2 mode dir)
775 (.str name "arithmetic" )
776 ((PIPE OS) (IDOC ALU))
777 (.str insn " $"op1 ",$hash$"dir"$"op2)
778 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
779 (set mode op1 (insn1 mode op1 op2))
783 (arithmetic22 addrbhpof addb add OP1_0 OP2_7 regb8 uimm8 QI "pof")
784 (arithmetic22 subrbhpof subb sub OP1_2 OP2_7 regb8 uimm8 QI "pof")
785 (arithmetic22 addbrhpag addb add OP1_0 OP2_7 regb8 uimm8 QI "pag")
786 (arithmetic22 subbrhpag subb sub OP1_2 OP2_7 regb8 uimm8 QI "pag")
788 ;add/sub register and immediate
789 (define-pmacro (arithmetic23 name insn insn1 opc1 opc2 op1 op2 mode dir)
791 (.str name "arithmetic" )
792 ((PIPE OS) (IDOC ALU))
793 (.str insn " $"op1 ",$hash$"dir"$"op2)
794 (+ opc1 opc2 op1 op2)
795 (set mode op1 (insn1 mode op1 op2 cbit))
799 (arithmetic23 addcrhpof addc addc OP1_1 OP2_6 reg8 uimm16 HI "pof")
800 (arithmetic23 subcrhpof subc subc OP1_3 OP2_6 reg8 uimm16 HI "pof")
801 (arithmetic23 addcbrhpof addc addc OP1_1 OP2_6 reg8 uimm16 HI "pag")
802 (arithmetic23 subcbrhpof subc subc OP1_3 OP2_6 reg8 uimm16 HI "pag")
804 ;add/sub register and immediate
805 (define-pmacro (arithmetic24 name insn insn1 opc1 opc2 op1 op2 mode dir)
807 (.str name "arithmetic" )
808 ((PIPE OS) (IDOC ALU))
809 (.str insn " $"op1 ",$hash$"dir"$"op2)
810 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
811 (set mode op1 (insn1 mode op1 op2 cbit))
815 (arithmetic24 addcrhpof3 addc addc OP1_1 OP2_8 dr uimm3 HI "pof")
816 (arithmetic24 subcrhpof3 subc subc OP1_3 OP2_8 dr uimm3 HI "pof")
817 (arithmetic24 addcbrhpag3 addcb addc OP1_1 OP2_9 drb uimm3 QI "pag")
818 (arithmetic24 subcbrhpag3 subcb subc OP1_3 OP2_9 drb uimm3 QI "pag")
819 (arithmetic24 addcrhpag3 addc addc OP1_1 OP2_8 dr uimm3 HI "pag")
820 (arithmetic24 subcrhpag3 subc subc OP1_3 OP2_8 dr uimm3 HI "pag")
821 (arithmetic24 addcbrhpof3 addcb addc OP1_1 OP2_9 drb uimm3 QI "pof")
822 (arithmetic24 subcbrhpof3 subcb subc OP1_3 OP2_9 drb uimm3 QI "pof")
824 ;add/sub register and immediate
825 (define-pmacro (arithmetic25 name insn insn1 opc1 opc2 op1 op2 mode dir)
827 (.str name "arithmetic" )
828 ((PIPE OS) (IDOC ALU))
829 (.str insn " $"op1 ",$hash$"dir"$"op2)
830 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
831 (set mode op1 (insn1 mode op1 op2 cbit))
835 (arithmetic25 addcrbhpof addcb addc OP1_1 OP2_7 regb8 uimm8 QI "pof")
836 (arithmetic25 subcrbhpof subcb subc OP1_3 OP2_7 regb8 uimm8 QI "pof")
837 (arithmetic25 addcbrhpag addcb addc OP1_1 OP2_7 regb8 uimm8 QI "pag")
838 (arithmetic25 subcbrhpag subcb subc OP1_3 OP2_7 regb8 uimm8 QI "pag")
840 ;add/sub register and immediate
841 (define-pmacro (arithmetic10 name insn insn1 opc1 opc2 op1 op2 mode)
843 (.str name "arithmetic" )
844 ((PIPE OS) (IDOC ALU))
845 (.str insn " $"op1 ",$hash$"op2)
846 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
847 (set mode op1 (insn1 mode op1 op2))
851 (arithmetic10 addri add add OP1_0 OP2_8 dr uimm3 HI)
852 (arithmetic10 subri sub sub OP1_2 OP2_8 dr uimm3 HI)
853 (arithmetic10 addbri addb add OP1_0 OP2_9 drb uimm3 QI)
854 (arithmetic10 subbri subb sub OP1_2 OP2_9 drb uimm3 QI)
856 ;add/sub register and immediate
857 (define-pmacro (arithmetic11 name insn insn1 opc1 opc2 op1 op2 mode)
859 (.str name "arithmetic" )
860 ((PIPE OS) (IDOC ALU))
861 (.str insn " $"op1 ",$hash$"op2)
862 (+ opc1 opc2 op1 op2)
863 (set mode op1 (insn1 mode op1 op2))
867 (arithmetic11 addrim add add OP1_0 OP2_6 reg8 uimm16 HI)
868 (arithmetic11 subrim sub sub OP1_2 OP2_6 reg8 uimm16 HI)
870 ;add/sub register and immediate
871 (define-pmacro (arithmetic12 name insn insn1 opc1 opc2 op1 op2 mode)
873 (.str name "arithmetic" )
874 ((PIPE OS) (IDOC ALU))
875 (.str insn " $"op1 ",$hash$"op2)
876 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
877 (set mode op1 (insn1 mode op1 op2))
881 (arithmetic12 addbrim addb add OP1_0 OP2_7 regb8 uimm8 QI)
882 (arithmetic12 subbrim subb sub OP1_2 OP2_7 regb8 uimm8 QI)
884 ;add/sub register and immediate with carry
885 (define-pmacro (arithmetic13 name insn insn1 opc1 opc2 op1 op2 mode)
887 (.str name "arithmetic" )
888 ((PIPE OS) (IDOC ALU))
889 (.str insn " $"op1 ",$hash$"op2)
890 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
891 (set mode op1 (insn1 mode op1 op2 cbit))
895 (arithmetic13 addcri addc addc OP1_1 OP2_8 dr uimm3 HI)
896 (arithmetic13 subcri subc subc OP1_3 OP2_8 dr uimm3 HI)
897 (arithmetic13 addcbri addcb addc OP1_1 OP2_9 drb uimm3 QI)
898 (arithmetic13 subcbri subcb subc OP1_3 OP2_9 drb uimm3 QI)
900 ;add/sub register and immediate with carry
901 (define-pmacro (arithmetic14 name insn insn1 opc1 opc2 op1 op2 mode)
903 (.str name "arithmetic" )
904 ((PIPE OS) (IDOC ALU))
905 (.str insn " $"op1 ",$hash$"op2)
906 (+ opc1 opc2 op1 op2)
907 (set mode op1 (insn1 mode op1 op2 cbit))
911 (arithmetic14 addcrim addc addc OP1_1 OP2_6 reg8 uimm16 HI)
912 (arithmetic14 subcrim subc subc OP1_3 OP2_6 reg8 uimm16 HI)
914 ;add/sub register and immediate with carry
915 (define-pmacro (arithmetic15 name insn insn1 opc1 opc2 op1 op2 mode)
917 (.str name "arithmetic" )
918 ((PIPE OS) (IDOC ALU))
919 (.str insn " $"op1 ",$hash$"op2)
920 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
921 (set mode op1 (insn1 mode op1 op2 cbit))
925 (arithmetic15 addcbrim addcb addc OP1_1 OP2_7 regb8 uimm8 QI)
926 (arithmetic15 subcbrim subcb subc OP1_3 OP2_7 regb8 uimm8 QI)
930 (define-pmacro (arithmetic name insn insn1 opc1 opc2 op1 op2 mode)
932 (.str name "arithmetic" )
933 ((PIPE OS) (IDOC ALU))
934 (.str insn " $"op1 ",$"op2)
935 (+ opc1 opc2 op1 op2)
936 (set mode op1 (insn1 mode op1 op2))
940 (arithmetic addr add add OP1_0 OP2_0 dr sr HI)
941 (arithmetic subr sub sub OP1_2 OP2_0 dr sr HI)
942 (arithmetic addbr addb add OP1_0 OP2_1 drb srb QI)
943 (arithmetic subbr subb sub OP1_2 OP2_1 drb srb QI)
945 ;add/sub register and indirect memory
946 (define-pmacro (arithmetic1 name insn insn1 opc1 opc2 op1 op2 mode)
948 (.str name "arithmetic" )
949 ((PIPE OS) (IDOC ALU))
950 (.str insn " $"op1 ",[$"op2"]")
951 (+ opc1 opc2 op1 (f-op-bit2 2) op2)
952 (set mode op1 (insn1 mode op1 (mem HI op2)))
956 (arithmetic1 add2 add add OP1_0 OP2_8 dr sr2 HI)
957 (arithmetic1 sub2 sub sub OP1_2 OP2_8 dr sr2 HI)
958 (arithmetic1 addb2 addb add OP1_0 OP2_9 drb sr2 QI)
959 (arithmetic1 subb2 subb sub OP1_2 OP2_9 drb sr2 QI)
961 ;add/sub register and indirect memory post increment
962 (define-pmacro (arithmetic2 name insn insn1 opc1 opc2 op1 op2 mode)
964 (.str name "arithmetic" )
965 ((PIPE OS) (IDOC ALU))
966 (.str insn " $"op1 ",[$"op2"+]")
967 (+ opc1 opc2 op1 (f-op-bit2 3) op2)
969 (set mode op1 (insn1 mode op1 (mem HI op2)))
970 (set HI op2 (add HI op2 (const 2)))
975 (arithmetic2 add2i add add OP1_0 OP2_8 dr sr2 HI)
976 (arithmetic2 sub2i sub sub OP1_2 OP2_8 dr sr2 HI)
977 (arithmetic2 addb2i addb add OP1_0 OP2_9 drb sr2 QI)
978 (arithmetic2 subb2i subb sub OP1_2 OP2_9 drb sr2 QI)
980 ;add/sub registers with carry
981 (define-pmacro (arithmetic3 name insn insn1 opc1 opc2 op1 op2 mode)
983 (.str name "arithmetic" )
984 ((PIPE OS) (IDOC ALU))
985 (.str insn " $"op1 ",$"op2)
986 (+ opc1 opc2 op1 op2)
987 (set mode op1 (insn1 mode op1 op2 cbit))
991 (arithmetic3 addcr addc addc OP1_1 OP2_0 dr sr HI)
992 (arithmetic3 subcr subc subc OP1_3 OP2_0 dr sr HI)
993 (arithmetic3 addbcr addcb addc OP1_1 OP2_1 drb srb QI)
994 (arithmetic3 subbcr subcb subc OP1_3 OP2_1 drb srb QI)
997 ;add/sub register and indirect memory
998 (define-pmacro (arithmetic4 name insn insn1 opc1 opc2 op1 op2 mode)
1000 (.str name "arithmetic" )
1001 ((PIPE OS) (IDOC ALU))
1002 (.str insn " $"op1 ",[$"op2"]")
1003 (+ opc1 opc2 op1 (f-op-bit2 2) op2)
1004 (set mode op1 (insn1 mode op1 (mem HI op2) cbit))
1008 (arithmetic4 addcr2 addc addc OP1_1 OP2_8 dr sr2 HI)
1009 (arithmetic4 subcr2 subc subc OP1_3 OP2_8 dr sr2 HI)
1010 (arithmetic4 addbcr2 addcb addc OP1_1 OP2_9 drb sr2 QI)
1011 (arithmetic4 subbcr2 subcb subc OP1_3 OP2_9 drb sr2 QI)
1013 ;add/sub register and indirect memory post increment
1014 (define-pmacro (arithmetic5 name insn insn1 opc1 opc2 op1 op2 mode)
1016 (.str name "arithmetic" )
1017 ((PIPE OS) (IDOC ALU))
1018 (.str insn " $"op1 ",[$"op2"+]")
1019 (+ opc1 opc2 op1 (f-op-bit2 3) op2)
1021 (set mode op1 (insn1 mode op1 (mem HI op2) cbit))
1022 (set HI op2 (add HI op2 (const 2)))
1027 (arithmetic5 addcr2i addc addc OP1_1 OP2_8 dr sr2 HI)
1028 (arithmetic5 subcr2i subc subc OP1_3 OP2_8 dr sr2 HI)
1029 (arithmetic5 addbcr2i addcb addc OP1_1 OP2_9 drb sr2 QI)
1030 (arithmetic5 subbcr2i subcb subc OP1_3 OP2_9 drb sr2 QI)
1032 ;add/sub register and direct memory
1033 (define-pmacro (arithmetic6 name insn insn1 opc1 opc2 op1 op2 mode)
1035 (.str name "arithmetic" )
1036 ((PIPE OS) (IDOC ALU))
1037 (.str insn " $"op1 ",$"op2)
1038 (+ opc1 opc2 op1 op2)
1039 (set mode op1 (insn1 mode op1 op2))
1044 ;add/sub register and direct memory
1045 (define-pmacro (arithmetic7 name insn insn1 opc1 opc2 op1 op2 mode)
1047 (.str name "arithmetic" )
1048 ((PIPE OS) (IDOC ALU))
1049 (.str insn " $"op1 ",$"op2)
1050 (+ opc1 opc2 op2 op1)
1051 (set (mem HI op1) (insn1 (mem HI op1) op2))
1055 (arithmetic6 addrm2 add add OP1_0 OP2_2 regmem8 memgr8 HI)
1056 (arithmetic7 addrm3 add add OP1_0 OP2_4 memgr8 regmem8 HI)
1057 (arithmetic6 addrm add add OP1_0 OP2_2 reg8 memory HI)
1058 (arithmetic7 addrm1 add add OP1_0 OP2_4 memory reg8 HI)
1059 (arithmetic6 subrm3 sub sub OP1_2 OP2_2 regmem8 memgr8 HI)
1060 (arithmetic7 subrm2 sub sub OP1_2 OP2_4 memgr8 regmem8 HI)
1061 (arithmetic6 subrm1 sub sub OP1_2 OP2_2 reg8 memory HI)
1062 (arithmetic7 subrm sub sub OP1_2 OP2_4 memory reg8 HI)
1063 (arithmetic6 addbrm2 addb add OP1_0 OP2_3 regbmem8 memgr8 QI)
1064 (arithmetic7 addbrm3 addb add OP1_0 OP2_5 memgr8 regbmem8 QI)
1065 (arithmetic6 addbrm addb add OP1_0 OP2_3 regb8 memory QI)
1066 (arithmetic7 addbrm1 addb add OP1_0 OP2_5 memory regb8 QI)
1067 (arithmetic6 subbrm3 subb sub OP1_2 OP2_3 regbmem8 memgr8 QI)
1068 (arithmetic7 subbrm2 subb sub OP1_2 OP2_5 memgr8 regbmem8 QI)
1069 (arithmetic6 subbrm1 subb sub OP1_2 OP2_3 regb8 memory QI)
1070 (arithmetic7 subbrm subb sub OP1_2 OP2_5 memory regb8 QI)
1072 ;add/sub registers with carry
1073 (define-pmacro (arithmetic8 name insn insn1 opc1 opc2 op1 op2 mode)
1075 (.str name "arithmetic" )
1076 ((PIPE OS) (IDOC ALU))
1077 (.str insn " $"op1 ",$"op2)
1078 (+ opc1 opc2 op1 op2)
1079 (set mode op1 (insn1 mode op1 op2 cbit))
1084 ;add/sub registers with carry
1085 (define-pmacro (arithmetic9 name insn insn1 opc1 opc2 op1 op2 mode)
1087 (.str name "arithmetic" )
1088 ((PIPE OS) (IDOC ALU))
1089 (.str insn " $"op1 ",$"op2)
1090 (+ opc1 opc2 op2 op1)
1091 (set (mem HI op1) (insn1 (mem HI op1) op2 cbit))
1095 (arithmetic8 addcrm2 addc addc OP1_1 OP2_2 regmem8 memgr8 HI)
1096 (arithmetic9 addcrm3 addc addc OP1_1 OP2_4 memgr8 regmem8 HI)
1097 (arithmetic8 addcrm addc addc OP1_1 OP2_2 reg8 memory HI)
1098 (arithmetic9 addcrm1 addc addc OP1_1 OP2_4 memory reg8 HI)
1099 (arithmetic8 subcrm3 subc subc OP1_3 OP2_2 regmem8 memgr8 HI)
1100 (arithmetic9 subcrm2 subc subc OP1_3 OP2_4 memgr8 regmem8 HI)
1101 (arithmetic8 subcrm1 subc subc OP1_3 OP2_2 reg8 memory HI)
1102 (arithmetic9 subcrm subc subc OP1_3 OP2_4 memory reg8 HI)
1103 (arithmetic8 addcbrm2 addcb addc OP1_1 OP2_3 regbmem8 memgr8 QI)
1104 (arithmetic9 addcbrm3 addcb addc OP1_1 OP2_5 memgr8 regbmem8 QI)
1105 (arithmetic8 addcbrm addcb addc OP1_1 OP2_3 regb8 memory QI)
1106 (arithmetic9 addcbrm1 addcb addc OP1_1 OP2_5 memory regb8 QI)
1107 (arithmetic8 subcbrm3 subcb subc OP1_3 OP2_3 regbmem8 memgr8 QI)
1108 (arithmetic9 subcbrm2 subcb subc OP1_3 OP2_5 memgr8 regbmem8 QI)
1109 (arithmetic8 subcbrm1 subcb subc OP1_3 OP2_3 regb8 memory QI)
1110 (arithmetic9 subcbrm subcb subc OP1_3 OP2_5 memory regb8 QI)
1113 (dni muls "signed multiplication"
1114 ((PIPE OS) (IDOC ALU))
1116 (+ OP1_0 OP2_11 src1 src2)
1117 (nop) ;; FIXME: (reg SI h-md 0)
1121 (dni mulu "unsigned multiplication"
1122 ((PIPE OS) (IDOC ALU))
1124 (+ OP1_1 OP2_11 src1 src2)
1125 (nop) ;; FIXME: (reg SI h-md 0)
1129 (dni div "16-by-16 signed division"
1130 ((PIPE OS) (IDOC ALU))
1132 (+ OP1_4 OP2_11 srdiv )
1134 (set HI (reg HI h-cr 6) (div HI (reg HI h-cr 6) srdiv))
1135 (set HI (reg HI h-cr 7) (mod HI (reg HI h-cr 6) srdiv))
1140 (dni divl "32-by16 signed division"
1141 ((PIPE OS) (IDOC ALU))
1143 (+ OP1_6 OP2_11 srdiv )
1145 (set HI (reg HI h-cr 6) 0) ;; FIXME: (div SI (reg SI h-md 0) srdiv))
1146 (set HI (reg HI h-cr 7) 0) ;; FIXME: (mod SI (reg SI h-md 0) srdiv))
1151 (dni divlu "32-by16 unsigned division"
1152 ((PIPE OS) (IDOC ALU))
1154 (+ OP1_7 OP2_11 srdiv )
1156 (set HI (reg HI h-cr 6) 0) ;; FIXME: (udiv SI (reg SI h-md 0) srdiv))
1157 (set HI (reg HI h-cr 7) 0) ;; FIXME: (umod SI (reg SI h-md 0) srdiv))
1162 (dni divu "16-by-16 unsigned division"
1163 ((PIPE OS) (IDOC ALU))
1165 (+ OP1_5 OP2_11 srdiv )
1167 (set HI (reg HI h-cr 6) (udiv HI (reg HI h-cr 6) srdiv))
1168 (set HI (reg HI h-cr 7) (umod HI (reg HI h-cr 6) srdiv))
1173 ;Integer one's complement
1175 (dni cpl "Integer Ones complement"
1176 ((PIPE OS) (IDOC MISC))
1178 (+ OP1_9 OP2_1 dr (f-op-bit4 0))
1179 (set dr (inv HI dr))
1183 ;Bytes one's complement
1185 (dni cplb "Byte Ones complement"
1186 ((PIPE OS) (IDOC MISC))
1188 (+ OP1_11 OP2_1 drb (f-op-bit4 0))
1189 (set drb (inv QI drb))
1192 ;Integer two's complement
1194 (dni neg "Integer two's complement"
1195 ((PIPE OS) (IDOC MISC))
1197 (+ OP1_8 OP2_1 dr (f-op-bit4 0))
1198 (set dr (neg HI dr))
1201 ;Bytes two's complement
1203 (dni negb "byte twos complement"
1204 ((PIPE OS) (IDOC MISC))
1206 (+ OP1_10 OP2_1 drb (f-op-bit4 0))
1207 (set drb (neg QI drb))
1211 ;****************************************************************
1213 ;****************************************************************
1214 ;and/or/xor registers
1215 (define-pmacro (logical name insn insn1 opc1 opc2 op1 op2 mode)
1217 (.str name "logical" )
1218 ((PIPE OS) (IDOC ALU))
1219 (.str insn " $"op1 ",$"op2)
1220 (+ opc1 opc2 op1 op2)
1221 (set mode op1 (insn1 mode op1 op2))
1226 (logical andr and and OP1_6 OP2_0 dr sr HI)
1227 (logical orr or or OP1_7 OP2_0 dr sr HI)
1228 (logical xorr xor xor OP1_5 OP2_0 dr sr HI)
1229 (logical andbr andb and OP1_6 OP2_1 drb srb QI)
1230 (logical orbr orb or OP1_7 OP2_1 drb srb QI)
1231 (logical xorbr xorb xor OP1_5 OP2_1 drb srb QI)
1233 ;and/or/xor register and immediate
1234 (define-pmacro (logical1 name insn insn1 opc1 opc2 op1 op2 mode)
1236 (.str name "logical" )
1237 ((PIPE OS) (IDOC ALU))
1238 (.str insn " $"op1 ",$hash$"op2)
1239 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
1240 (set mode op1 (insn1 mode op1 op2))
1244 (logical1 andri and and OP1_6 OP2_8 dr uimm3 HI)
1245 (logical1 orri or or OP1_7 OP2_8 dr uimm3 HI)
1246 (logical1 xorri xor xor OP1_5 OP2_8 dr uimm3 HI)
1247 (logical1 andbri andb and OP1_6 OP2_9 drb uimm3 QI)
1248 (logical1 orbri orb or OP1_7 OP2_9 drb uimm3 QI)
1249 (logical1 xorbri xorb xor OP1_5 OP2_9 drb uimm3 QI)
1251 ;and/or/xor register and immediate
1252 (define-pmacro (logical2 name insn insn1 opc1 opc2 op1 op2 mode)
1254 (.str name "logical" )
1255 ((PIPE OS) (IDOC ALU))
1256 (.str insn " $"op1 ",$hash$"op2)
1257 (+ opc1 opc2 op1 op2)
1258 (set mode op1 (insn1 mode op1 op2))
1262 (logical2 andrim and and OP1_6 OP2_6 reg8 uimm16 HI)
1263 (logical2 orrim or or OP1_7 OP2_6 reg8 uimm16 HI)
1264 (logical2 xorrim xor xor OP1_5 OP2_6 reg8 uimm16 HI)
1266 ;and/or/xor register and immediate
1267 (define-pmacro (logical3 name insn insn1 opc1 opc2 op1 op2 mode)
1269 (.str name "logical" )
1270 ((PIPE OS) (IDOC ALU))
1271 (.str insn " $"op1 ",$hash$"op2)
1272 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
1273 (set mode op1 (insn1 mode op1 op2))
1277 (logical3 andbrim andb and OP1_6 OP2_7 regb8 uimm8 QI)
1278 (logical3 orbrim orb or OP1_7 OP2_7 regb8 uimm8 QI)
1279 (logical3 xorbrim xorb xor OP1_5 OP2_7 regb8 uimm8 QI)
1281 ;and/or/xor register and indirect memory
1282 (define-pmacro (logical4 name insn insn1 opc1 opc2 op1 op2 mode)
1284 (.str name "logical" )
1285 ((PIPE OS) (IDOC ALU))
1286 (.str insn " $"op1 ",[$"op2"]")
1287 (+ opc1 opc2 op1 (f-op-bit2 2) op2)
1288 (set mode op1 (insn1 mode op1 (mem HI op2)))
1292 (logical4 and2 and and OP1_6 OP2_8 dr sr2 HI)
1293 (logical4 or2 or or OP1_7 OP2_8 dr sr2 HI)
1294 (logical4 xor2 xor xor OP1_5 OP2_8 dr sr2 HI)
1295 (logical4 andb2 andb and OP1_6 OP2_9 drb sr2 QI)
1296 (logical4 orb2 orb or OP1_7 OP2_9 drb sr2 QI)
1297 (logical4 xorb2 xorb xor OP1_5 OP2_9 drb sr2 QI)
1299 ;and/or/xor register and indirect memory post increment
1300 (define-pmacro (logical5 name insn insn1 opc1 opc2 op1 op2 mode)
1302 (.str name "logical" )
1303 ((PIPE OS) (IDOC ALU))
1304 (.str insn " $"op1 ",[$"op2"+]")
1305 (+ opc1 opc2 op1 (f-op-bit2 3) op2)
1307 (set mode op1 (insn1 mode op1 (mem HI op2)))
1308 (set HI op2 (add HI op2 (const 2)))
1313 (logical5 and2i and and OP1_6 OP2_8 dr sr2 HI)
1314 (logical5 or2i or or OP1_7 OP2_8 dr sr2 HI)
1315 (logical5 xor2i xor xor OP1_5 OP2_8 dr sr2 HI)
1316 (logical5 andb2i andb and OP1_6 OP2_9 drb sr2 QI)
1317 (logical5 orb2i orb or OP1_7 OP2_9 drb sr2 QI)
1318 (logical5 xorb2i xorb xor OP1_5 OP2_9 drb sr2 QI)
1320 ;add/sub register and immediate
1321 (define-pmacro (logical7 name insn insn1 opc1 opc2 op1 op2 mode dir)
1323 (.str name "arithmetic" )
1324 ((PIPE OS) (IDOC ALU))
1325 (.str insn " $"dir"$"op1 ",$"op2)
1326 (+ opc1 opc2 op1 op2)
1327 (set (mem HI op1) (insn1 (mem HI op1) op2 ))
1331 (logical7 andpofr and and OP1_6 OP2_2 reg8 upof16 HI "pof")
1332 (logical7 orpofr or or OP1_7 OP2_2 reg8 upof16 HI "pof")
1333 (logical7 xorpofr xor xor OP1_5 OP2_2 reg8 upof16 HI "pof")
1334 (logical7 andbpofr andb and OP1_6 OP2_3 regb8 upof16 QI "pof")
1335 (logical7 orbpofr orb or OP1_7 OP2_3 regb8 upof16 QI "pof")
1336 (logical7 xorbpofr xorb xor OP1_5 OP2_3 regb8 upof16 QI "pof")
1338 ;add/sub register and immediate
1339 (define-pmacro (logical8 name insn insn1 opc1 opc2 op1 op2 mode dir)
1341 (.str name "arithmetic" )
1342 ((PIPE OS) (IDOC ALU))
1343 (.str insn " $"dir"$"op1 ",$"op2)
1344 (+ opc1 opc2 op1 op2)
1345 (set (mem HI op1) (insn1 (mem HI op1) op2 ))
1349 (logical8 andrpofr and and OP1_6 OP2_4 upof16 reg8 HI "pof")
1350 (logical8 orrpofr or or OP1_7 OP2_4 upof16 reg8 HI "pof")
1351 (logical8 xorrpofr xor xor OP1_5 OP2_4 upof16 reg8 HI "pof")
1352 (logical8 andbrpofr andb and OP1_6 OP2_5 upof16 regb8 QI "pof")
1353 (logical8 orbrpofr orb or OP1_7 OP2_5 upof16 regb8 QI "pof")
1354 (logical8 xorbrpofr xorb xor OP1_5 OP2_5 upof16 regb8 QI "pof")
1356 ;and/or/xor register and direct memory
1357 (define-pmacro (logical6 name insn insn1 opc1 opc2 op1 op2 mode)
1359 (.str name "arithmetic" )
1360 ((PIPE OS) (IDOC ALU))
1361 (.str insn " $"op1 ",$"op2)
1362 (+ opc1 opc2 op1 op2)
1363 (set mode op1 (insn1 mode op1 op2))
1368 ;and/or/xor register and direct memory
1369 (define-pmacro (logical7 name insn insn1 opc1 opc2 op1 op2 mode)
1371 (.str name "arithmetic" )
1372 ((PIPE OS) (IDOC ALU))
1373 (.str insn " $"op1 ",$"op2)
1374 (+ opc1 opc2 op2 op1)
1375 (set (mem HI op1) (insn1 (mem HI op1) op2))
1379 (logical6 andrm2 and and OP1_6 OP2_2 regmem8 memgr8 HI)
1380 (logical7 andrm3 and and OP1_6 OP2_4 memgr8 regmem8 HI)
1381 (logical6 andrm and and OP1_6 OP2_2 reg8 memory HI)
1382 (logical7 andrm1 and and OP1_6 OP2_4 memory reg8 HI)
1383 (logical6 orrm3 or or OP1_7 OP2_2 regmem8 memgr8 HI)
1384 (logical7 orrm2 or or OP1_7 OP2_4 memgr8 regmem8 HI)
1385 (logical6 orrm1 or or OP1_7 OP2_2 reg8 memory HI)
1386 (logical7 orrm or or OP1_7 OP2_4 memory reg8 HI)
1387 (logical6 xorrm3 xor xor OP1_5 OP2_2 regmem8 memgr8 HI)
1388 (logical7 xorrm2 xor xor OP1_5 OP2_4 memgr8 regmem8 HI)
1389 (logical6 xorrm1 xor xor OP1_5 OP2_2 reg8 memory HI)
1390 (logical7 xorrm xor xor OP1_5 OP2_4 memory reg8 HI)
1391 (logical6 andbrm2 andb and OP1_6 OP2_3 regbmem8 memgr8 QI)
1392 (logical7 andbrm3 andb and OP1_6 OP2_5 memgr8 regbmem8 QI)
1393 (logical6 andbrm andb and OP1_6 OP2_3 regb8 memory QI)
1394 (logical7 andbrm1 andb and OP1_6 OP2_5 memory regb8 QI)
1395 (logical6 orbrm3 orb or OP1_7 OP2_3 regbmem8 memgr8 QI)
1396 (logical7 orbrm2 orb or OP1_7 OP2_5 memgr8 regbmem8 QI)
1397 (logical6 orbrm1 orb or OP1_7 OP2_3 regb8 memory QI)
1398 (logical7 orbrm orb or OP1_7 OP2_5 memory regb8 QI)
1399 (logical6 xorbrm3 xorb xor OP1_5 OP2_3 regbmem8 memgr8 QI)
1400 (logical7 xorbrm2 xorb xor OP1_5 OP2_5 memgr8 regbmem8 QI)
1401 (logical6 xorbrm1 xorb xor OP1_5 OP2_3 regb8 memory QI)
1402 (logical7 xorbrm xorb xor OP1_5 OP2_5 memory regb8 QI)
1404 ;****************************************************************
1406 ;****************************************************************
1408 (define-pmacro (move name insn opc1 opc2 op1 op2 mode)
1410 (.str name "mov registers" )
1411 ((PIPE OS) (IDOC MOVE))
1412 (.str insn " $"op1 ",$"op2)
1413 (+ opc1 opc2 op1 op2)
1418 (move movr mov OP1_15 OP2_0 dr sr HI)
1419 (move movrb movb OP1_15 OP2_1 drb srb HI)
1421 ;mov register and immediate
1422 (define-pmacro (move1 name insn opc1 opc2 op1 op2 mode)
1425 ((PIPE OS) (IDOC MOVE))
1426 (.str insn " $"op1 ",$hash$"op2)
1427 (+ opc1 opc2 op2 op1)
1432 (move1 movri mov OP1_14 OP2_0 dri u4 HI)
1433 (move1 movbri movb OP1_14 OP2_1 srb u4 QI)
1436 (dni movi "move immediate to register"
1437 ((PIPE OS) (IDOC MOVE))
1438 "mov $reg8,$hash$uimm16"
1439 (+ OP1_14 OP2_6 reg8 uimm16)
1440 (set HI reg8 uimm16)
1445 (dni movbi "move immediate to register"
1446 ((PIPE OS) (IDOC MOVE))
1447 "movb $regb8,$hash$uimm8"
1448 (+ OP1_14 OP2_7 regb8 uimm8 (f-op-bit8 0))
1449 (set QI regb8 uimm8)
1453 ;move and indirect memory
1454 (define-pmacro (mov2 name insn opc1 opc2 op1 op2 mode)
1457 ((PIPE OS) (IDOC MOVE))
1458 (.str insn " $"op1 ",[$"op2"]")
1459 (+ opc1 opc2 op1 op2)
1460 (set mode op1 (mem HI op2))
1464 (mov2 movr2 mov OP1_10 OP2_8 dr sr HI)
1465 (mov2 movbr2 movb OP1_10 OP2_9 drb sr QI)
1467 ;move and indirect memory
1468 (define-pmacro (mov3 name insn opc1 opc2 op1 op2 mode)
1471 ((PIPE OS) (IDOC MOVE))
1472 (.str insn " [$"op2 "],$"op1)
1473 (+ opc1 opc2 op1 op2)
1474 (set mode op1 (mem HI op2))
1478 (mov3 movri2 mov OP1_11 OP2_8 dr sr HI)
1479 (mov3 movbri2 movb OP1_11 OP2_9 drb sr QI)
1481 ;move and indirect memory
1482 (define-pmacro (mov4 name insn opc1 opc2 op1 op2 mode)
1485 ((PIPE OS) (IDOC MOVE))
1486 (.str insn " [-$"op2 "],$"op1)
1487 (+ opc1 opc2 op1 op2)
1489 (set op1 (sub op2 (const HI 2)))
1490 (set HI (mem HI op2) op1)
1495 (mov4 movri3 mov OP1_8 OP2_8 dr sr HI)
1496 (mov4 movbri3 movb OP1_8 OP2_9 drb sr QI)
1498 ;mov register and indirect memory post increment
1499 (define-pmacro (mov5 name insn opc1 opc2 op1 op2 mode)
1502 ((PIPE OS) (IDOC MOVE))
1503 (.str insn " $"op1 ",[$"op2"+]")
1504 (+ opc1 opc2 op1 op2)
1506 (set mode op1 (mem HI op2))
1507 (set HI op2 (add HI op2 (const 2)))
1512 (mov5 mov2i mov OP1_9 OP2_8 dr sr HI)
1513 (mov5 movb2i movb OP1_9 OP2_9 drb sr HI)
1515 ;mov indirect memory
1516 (define-pmacro (mov6 name insn opc1 opc2 op1 op2 mode)
1519 ((PIPE OS) (IDOC MOVE))
1520 (.str insn " [$"op1 "],[$"op2"]")
1521 (+ opc1 opc2 op1 op2)
1522 (set HI (mem HI op1) (mem HI op2))
1526 (mov6 mov6i mov OP1_12 OP2_8 dr sr HI)
1527 (mov6 movb6i movb OP1_12 OP2_9 dr sr HI)
1529 ;mov indirect memory
1530 (define-pmacro (mov7 name insn opc1 opc2 op1 op2 mode)
1533 ((PIPE OS) (IDOC MOVE))
1534 (.str insn " [$"op1 "+],[$"op2"]")
1535 (+ opc1 opc2 op1 op2)
1537 (set mode (mem mode op1) (mem mode op2))
1538 (set mode op1 (add mode op1 (const mode 2)))
1543 (mov7 mov7i mov OP1_13 OP2_8 dr sr HI)
1544 (mov7 movb7i movb OP1_13 OP2_9 dr sr HI)
1546 ;mov indirect memory
1547 (define-pmacro (mov8 name insn opc1 opc2 op1 op2 mode)
1550 ((PIPE OS) (IDOC MOVE))
1551 (.str insn " [$"op1 "],[$"op2"+]")
1552 (+ opc1 opc2 op1 op2)
1554 (set mode (mem mode op1) (mem mode op2))
1555 (set mode op2 (add mode op2 (const mode 2)))
1560 (mov8 mov8i mov OP1_14 OP2_8 dr sr HI)
1561 (mov8 movb8i movb OP1_14 OP2_9 dr sr HI)
1563 ;mov indirect memory
1564 (define-pmacro (mov9 name insn opc1 opc2 op1 op2 mode)
1567 ((PIPE OS) (IDOC MOVE))
1568 (.str insn " $"op1 ",[$"op2"+$hash$"uimm16"]")
1569 (+ opc1 opc2 op1 op2 uimm16)
1570 (sequence ((mode tmp1))
1571 (set mode tmp1 (add HI op2 uimm16))
1572 (set mode op1 (mem HI tmp1))
1577 (mov9 mov9i mov OP1_13 OP2_4 dr sr HI)
1578 (mov9 movb9i movb OP1_15 OP2_4 drb sr QI)
1580 ;mov indirect memory
1581 (define-pmacro (mov10 name insn opc1 opc2 op1 op2 mode)
1584 ((PIPE OS) (IDOC MOVE))
1585 (.str insn " [$"op2"+$hash$"uimm16 "],$"op1)
1586 (+ opc1 opc2 op1 op2 uimm16)
1587 (sequence ((mode tmp1))
1588 (set mode tmp1 (add HI op1 uimm16))
1589 (set mode (mem HI tmp1) op1)
1594 (mov10 mov10i mov OP1_12 OP2_4 dr sr HI)
1595 (mov10 movb10i movb OP1_14 OP2_4 drb sr QI)
1597 ;move and indirect memory
1598 (define-pmacro (mov11 name insn opc1 opc2 op1 op2 mode)
1601 ((PIPE OS) (IDOC MOVE))
1602 (.str insn " [$"op1 "],$"op2)
1603 (+ opc1 opc2 (f-op-lbit4 0) op1 op2)
1604 (set (mem mode op1) (mem HI op2))
1608 (mov11 movri11 mov OP1_8 OP2_4 src2 memory HI)
1609 (mov11 movbri11 movb OP1_10 OP2_4 src2 memory HI)
1611 ;move and indirect memory
1612 (define-pmacro (mov12 name insn opc1 opc2 op1 op2 mode)
1615 ((PIPE OS) (IDOC MOVE))
1616 (.str insn " $"op2 ",[$"op1"]")
1617 (+ opc1 opc2 (f-op-lbit4 0) op1 op2)
1618 (set (mem HI op2) (mem mode op1))
1622 (mov12 movri12 mov OP1_9 OP2_4 src2 memory HI)
1623 (mov12 movbri12 movb OP1_11 OP2_4 src2 memory HI)
1625 (define-pmacro (movemem3 name insn opc1 opc2 op1 op2 dir)
1628 ((PIPE OS) (IDOC MOVE))
1629 (.str insn " $"op1 ",$hash$"dir"$"op2)
1630 (+ opc1 opc2 op1 op2)
1635 (movemem3 movehm5 mov OP1_14 OP2_6 regoff8 upof16 "pof")
1636 (movemem3 movehm6 mov OP1_14 OP2_6 regoff8 upag16 "pag")
1637 (movemem3 movehm7 mov OP1_14 OP2_6 regoff8 useg16 "segm")
1638 (movemem3 movehm8 mov OP1_14 OP2_6 regoff8 usof16 "sof")
1640 (define-pmacro (movemem4 name insn opc1 opc2 op1 op2 dir)
1643 ((PIPE OS) (IDOC MOVE))
1644 (.str insn " $"op1 ",$hash$"dir"$"op2)
1645 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
1650 (movemem4 movehm9 movb OP1_14 OP2_7 regb8 uimm8 "pof")
1651 (movemem4 movehm10 movb OP1_14 OP2_7 regoff8 uimm8 "pag")
1653 (define-pmacro (movemem name insn opc1 opc2 op1 op2 mode dir)
1656 ((PIPE OS) (IDOC MOVE))
1657 (.str insn " $"op1 ",$"dir"$"op2)
1658 (+ opc1 opc2 op1 op2)
1659 (set mode op1 (mem HI op2))
1663 (movemem movrmp mov OP1_15 OP2_2 regoff8 upof16 HI "pof")
1664 (movemem movrmp1 movb OP1_15 OP2_3 regb8 upof16 QI "pof")
1665 (movemem movrmp2 mov OP1_15 OP2_2 regoff8 upag16 HI "pag")
1666 (movemem movrmp3 movb OP1_15 OP2_3 regb8 upag16 QI "pag")
1668 (define-pmacro (movemem1 name insn opc1 opc2 op1 op2 dir)
1671 ((PIPE OS) (IDOC MOVE))
1672 (.str insn " $"dir"$"op1 ",$"op2)
1673 (+ opc1 opc2 op2 op1)
1674 (set (mem HI op1) op2 )
1678 (movemem1 movrmp4 mov OP1_15 OP2_6 upof16 regoff8 "pof")
1679 (movemem1 movrmp5 movb OP1_15 OP2_7 upof16 regb8 "pof")
1681 (define-pmacro (movemem2 name insn opc1 opc2 op1 op2 mode dir)
1684 ((PIPE OS) (IDOC MOVE))
1685 (.str insn " $"op1 ",$hash$"dir"$"op2)
1686 (+ opc1 opc2 op2 op1)
1691 (movemem2 movehm1 mov OP1_14 OP2_0 dri u4 HI "pof")
1692 (movemem2 movehm2 movb OP1_14 OP2_1 srb u4 QI "pof")
1693 (movemem2 movehm3 mov OP1_14 OP2_0 dri u4 HI "pag")
1694 (movemem2 movehm4 movb OP1_14 OP2_1 srb u4 QI "pag")
1696 ;move register and direct memory
1697 (define-pmacro (move12 name insn opc1 opc2 op1 op2 mode)
1700 ((PIPE OS) (IDOC MOVE))
1701 (.str insn " $"op1 ",$"op2)
1702 (+ opc1 opc2 op1 op2)
1703 (set mode op1 (mem HI op2))
1708 ;move register and direct memory
1709 (define-pmacro (move13 name insn opc1 opc2 op1 op2 mode)
1712 ((PIPE OS) (IDOC MOVE))
1713 (.str insn " $"op1 ",$"op2)
1714 (+ opc1 opc2 op2 op1)
1715 (set (mem HI op1) op2)
1719 (move12 mve12 mov OP1_15 OP2_2 regmem8 memgr8 HI)
1720 (move13 mve13 mov OP1_15 OP2_6 memgr8 regmem8 HI)
1721 (move12 mover12 mov OP1_15 OP2_2 reg8 memory HI)
1722 (move13 mvr13 mov OP1_15 OP2_6 memory reg8 HI)
1723 (move12 mver12 movb OP1_15 OP2_3 regbmem8 memgr8 QI)
1724 (move13 mver13 movb OP1_15 OP2_7 memgr8 regbmem8 QI)
1725 (move12 movr12 movb OP1_15 OP2_3 regb8 memory QI)
1726 (move13 movr13 movb OP1_15 OP2_7 memory regb8 QI)
1729 (dni movbsrr "mov byte register with sign extension to word register"
1730 ((PIPE OS) (IDOC MOVE))
1732 (+ OP1_13 OP2_0 drb sr)
1734 (if (and QI drb (const 128))
1735 (set HI sr (or HI (const HI 65280) drb)))
1736 (set HI sr (and HI (const HI 255) drb))
1742 (dni movbzrr "mov byte register with zero extension to word register"
1743 ((PIPE OS) (IDOC MOVE))
1745 (+ OP1_12 OP2_0 drb sr)
1746 (set HI sr (and HI (const HI 255) drb))
1751 (dni movbsrpofm "mov memory to byte register"
1752 ((PIPE OS) (IDOC MOVE))
1753 "movbs $regmem8,$pof$upof16"
1754 (+ OP1_13 OP2_2 regmem8 upof16)
1755 (set QI regmem8 (mem HI upof16))
1760 (dni movbspofmr "mov memory to byte register"
1761 ((PIPE OS) (IDOC MOVE))
1762 "movbs $pof$upof16,$regbmem8"
1763 (+ OP1_13 OP2_5 upof16 regbmem8 )
1764 (set QI (mem HI upof16) regbmem8)
1769 (dni movbzrpofm "mov memory to byte register"
1770 ((PIPE OS) (IDOC MOVE))
1771 "movbz $reg8,$pof$upof16"
1772 (+ OP1_12 OP2_2 reg8 upof16)
1773 (set QI reg8 (mem HI upof16))
1778 (dni movbzpofmr "mov memory to byte register"
1779 ((PIPE OS) (IDOC MOVE))
1780 "movbz $pof$upof16,$regb8"
1781 (+ OP1_12 OP2_5 upof16 regb8 )
1782 (set QI (mem HI upof16) regb8)
1786 ;move register and direct memory
1787 (define-pmacro (move14 name insn opc1 opc2 op1 op2 )
1790 ((PIPE OS) (IDOC MOVE))
1791 (.str insn " $"op1 ",$"op2)
1792 (+ opc1 opc2 op1 op2)
1793 (set HI op1 (and HI (const HI 255) (mem QI op2)))
1798 ;move register and direct memory
1799 (define-pmacro (move15 name insn opc1 opc2 op1 op2 )
1802 ((PIPE OS) (IDOC MOVE))
1803 (.str insn " $"op1 ",$"op2)
1804 (+ opc1 opc2 op2 op1)
1805 (set HI (mem HI op1) (and HI (const HI 255) op2))
1809 (move14 movebs14 movbs OP1_13 OP2_2 regmem8 memgr8 )
1810 (move15 movebs15 movbs OP1_13 OP2_5 memgr8 regbmem8 )
1811 (move14 moverbs14 movbs OP1_13 OP2_2 reg8 memory )
1812 (move15 movrbs15 movbs OP1_13 OP2_5 memory regb8 )
1813 (move14 movebz14 movbz OP1_12 OP2_2 regmem8 memgr8 )
1814 (move15 movebz15 movbz OP1_12 OP2_5 memgr8 regbmem8 )
1815 (move14 moverbz14 movbz OP1_12 OP2_2 reg8 memory )
1816 (move15 movrbz15 movbz OP1_12 OP2_5 memory regb8 )
1820 (define-pmacro (moveb1 name insn opc1 opc2 op1 op2)
1823 ((PIPE OS) (IDOC MOVE))
1824 (.str insn " $"op2 ",$"op1)
1825 (+ opc1 opc2 op1 op2)
1827 (if (and QI op1 (const 128))
1828 (set HI op2 (or HI (const HI 65280) op1)))
1829 (set HI op2 (and HI (const HI 255) op1))
1834 (moveb1 movrbs movbs OP1_13 OP2_0 drb sr )
1835 (moveb1 movrbz movbz OP1_12 OP2_0 drb sr )
1839 ;jump and call insns
1840 ;******************************************************************
1841 ;Absolute conditional jump
1842 (define-pmacro (jmpabs name insn)
1844 (.str name "Absolute conditional jump" )
1845 ((PIPE OS) (IDOC JMP))
1846 (.str insn " $extcond,$caddr")
1847 (+ OP1_14 OP2_10 extcond (f-op-bitone 0) bitone bit01 caddr)
1848 (sequence ((HI tmp1) (HI tmp2))
1849 (set tmp1 (mem HI caddr))
1850 (set tmp2 (sub HI pc (mem HI caddr)))
1851 (if (gt tmp2 (const 0)) ;; FIXME: (lt tmp2 (const 32)) (eq tmp2 (const 32))
1852 (set bitone (const 1)))
1853 (if (lt tmp2 (const 0)) ;; FIXME: (eq tmp2 (const 0)) (gt tmp2 (const 32))
1854 (set bitone (const 0)))
1855 (if (eq extcond (const 1)) ;; FIXME: (ne extcond cc_Z))
1856 (set bit01 (const 0))
1857 (set HI pc (mem HI caddr)))
1858 (if (ne extcond (const 1)) ;; FIXME: (eq extcond cc_Z))
1859 (set bit01 (const 1))
1860 (set HI pc (add HI pc (const 2))))
1866 (jmpabs jmpa0 jmpa+)
1870 (dni jmpa- "Absolute conditional jump"
1871 (COND-CTI (PIPE OS) (IDOC JMP))
1872 "jmpa- $extcond,$caddr"
1873 (+ OP1_14 OP2_10 extcond (f-op-bitone 0) bitone (f-op-1bit 1) caddr)
1874 (sequence ((HI tmp1) (HI tmp2))
1875 (set tmp1 (mem HI caddr))
1876 (set tmp2 (sub HI pc (mem HI caddr)))
1877 (if (gt tmp2 (const 0)) ;; FIXME: (lt tmp2 (const 32)) (eq tmp2 (const 32))
1878 (set bitone (const 1)))
1879 (if (lt tmp2 (const 0)) ;; FIXME: (eq tmp2 (const 0)) (gt tmp2 (const 32))
1880 (set bitone (const 0)))
1881 (set HI pc (add HI pc (const 2)))
1887 (dni jmpi "Indirect conditional jump"
1888 (COND-CTI (PIPE OS) (IDOC JMP))
1890 (+ OP1_9 OP2_12 icond sr)
1892 (if (eq icond (const 1))
1893 (set HI pc (mem HI sr)))
1894 (set HI pc (add HI pc (const 2)))
1899 (define-pmacro (jmprel name insn opc1)
1901 (.str name "conditional" )
1902 (COND-CTI (PIPE OS) (IDOC JMP))
1903 (.str insn " $cond,$rel")
1906 (if (eq cond (const 1))
1908 (if (lt QI rel (const 0))
1910 ;; FIXME: (neg QI rel)
1911 ;; FIXME: (add QI rel (const 1))
1912 ;; FIXME: (mul QI rel (const 2))
1913 (set HI pc (sub HI pc rel))
1915 (set HI pc (add HI pc (mul QI rel (const 2))))
1924 (jmprel jmpr_nenz jmpr COND_NE_NZ )
1925 (jmprel jmpr_sgt jmpr COND_SGT )
1926 (jmprel jmpr_z jmpr COND_Z )
1927 (jmprel jmpr_v jmpr COND_V )
1928 (jmprel jmpr_nv jmpr COND_NV )
1929 (jmprel jmpr_n jmpr COND_N )
1930 (jmprel jmpr_nn jmpr COND_NN )
1931 (jmprel jmpr_c jmpr COND_C )
1932 (jmprel jmpr_nc jmpr COND_NC )
1933 (jmprel jmpr_eq jmpr COND_EQ )
1934 (jmprel jmpr_ne jmpr COND_NE )
1935 (jmprel jmpr_ult jmpr COND_ULT )
1936 (jmprel jmpr_ule jmpr COND_ULE )
1937 (jmprel jmpr_uge jmpr COND_UGE )
1938 (jmprel jmpr_ugt jmpr COND_UGT )
1939 (jmprel jmpr_sle jmpr COND_SLE )
1940 (jmprel jmpr_sge jmpr COND_SGE )
1941 (jmprel jmpr_net jmpr COND_NET )
1942 (jmprel jmpr_uc jmpr COND_UC )
1943 (jmprel jmpr_slt jmpr COND_SLT )
1949 (dni jmpseg "absolute inter-segment jump"
1950 (UNCOND-CTI(PIPE OS) (IDOC JMP))
1951 "jmps $hash$segm$useg8,$hash$sof$usof16"
1952 (+ OP1_15 OP2_10 seg usof16)
1954 (if (eq BI sgtdisbit (const BI 0))
1955 (set QI (reg h-cr 10) useg8))
1956 ;; FIXME: previous indentation suggested this nop was the `else'
1957 ;; clause of the previous `if'.
1965 (dni jmps "absolute inter-segment jump"
1966 (UNCOND-CTI(PIPE OS) (IDOC JMP))
1968 (+ OP1_15 OP2_10 seg caddr)
1970 (if (eq BI sgtdisbit (const BI 0))
1971 (set QI (reg h-cr 10) seg))
1972 ;; FIXME: previous indentation suggested this nop was the `else'
1973 ;; clause of the previous `if'.
1981 ;relative jump if bit set
1983 (dni jb "relative jump if bit set"
1984 ((PIPE OS) (IDOC JMP))
1985 "jb $genreg$dot$qlobit,$relhi"
1986 (+ OP1_8 OP2_10 genreg relhi qlobit (f-qhibit 0))
1987 (sequence ((HI tmp1) (HI tmp2))
1988 (set HI tmp1 genreg)
1989 (set HI tmp2 (const 1))
1990 ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...)
1991 (set HI tmp2 (and tmp1 tmp2))
1992 (if (eq tmp2 (const 1)) ;; FIXME: (ne tmp2 0)?
1994 (if (lt QI relhi (const 0))
1995 (set HI pc (add HI pc (mul QI relhi (const 2)))))
1997 (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right?
2002 ;relative jump if bit set and clear bit
2004 (dni jbc "relative jump if bit set and clear bit"
2005 ((PIPE OS) (IDOC JMP))
2006 "jbc $genreg$dot$qlobit,$relhi"
2007 (+ OP1_10 OP2_10 genreg relhi qlobit (f-qhibit 0))
2008 (sequence ((HI tmp1) (HI tmp2))
2009 (set HI tmp1 genreg)
2010 (set HI tmp2 (const 1))
2011 ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...)
2012 (set HI tmp2 (and tmp1 tmp2))
2013 (if (eq tmp2 (const 1)) ;; FIXME: (ne tmp2 0)?
2015 ;; FIXME: The `else' clause has several statements.
2016 (if (lt QI relhi (const 0))
2017 (set tmp2 (const 1))
2019 ;; FIXME: (sll tmp2 qlobit)
2020 ;; FIXME: (inv tmp2)
2021 (set HI tmp1 (and tmp1 tmp2))
2022 (set HI genreg tmp1)
2023 (set HI pc (add HI pc (mul QI relhi (const 2)))))
2025 (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right?
2030 ;relative jump if bit set
2032 (dni jnb "relative jump if bit not set"
2033 ((PIPE OS) (IDOC JMP))
2034 "jnb $genreg$dot$qlobit,$relhi"
2035 (+ OP1_9 OP2_10 genreg relhi qlobit (f-qhibit 0))
2036 (sequence ((HI tmp1) (HI tmp2))
2037 (set HI tmp1 genreg)
2038 (set HI tmp2 (const 1))
2039 ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...)
2040 (set HI tmp2 (and tmp1 tmp2))
2041 (if (eq tmp2 (const 0)) ;; FIXME: (ne tmp2 0)?
2043 (if (lt QI relhi (const 0))
2044 (set HI pc (add HI pc (mul QI relhi (const 2)))))
2046 (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right?
2051 ;relative jump if bit not set and set bit
2052 ;JNBS bitaddrQ.q,rel
2053 (dni jnbs "relative jump if bit not set and set bit"
2054 ((PIPE OS) (IDOC JMP))
2055 "jnbs $genreg$dot$qlobit,$relhi"
2056 (+ OP1_11 OP2_10 genreg relhi qlobit (f-qhibit 0))
2057 (sequence ((HI tmp1) (HI tmp2))
2058 (set HI tmp1 genreg)
2059 (set HI tmp2 (const 1))
2060 ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...)
2061 (set HI tmp2 (and tmp1 tmp2))
2062 (if (eq tmp2 (const 0))
2064 ;; FIXME: The `else' clause has several statements.
2065 (if (lt QI relhi (const 0))
2066 (set tmp2 (const 1))
2068 ;; FIXME: (sll tmp2 qbit)
2069 (set BI tmp1(or tmp1 tmp2))
2071 (set HI pc (add HI pc (mul QI relhi (const 2)))))
2073 (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right?
2079 ;Absolute conditional call
2080 (define-pmacro (callabs name insn)
2082 (.str name "Absolute conditional call" )
2083 ((PIPE OS) (IDOC JMP))
2084 (.str insn " $extcond,$caddr")
2085 (+ OP1_12 OP2_10 extcond (f-op-2bit 0) bit01 caddr)
2087 (if (eq extcond (const 1))
2088 (set bit01 (const 0))
2089 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2090 (set HI (mem HI (reg h-cr 9)) pc)
2091 (set HI pc (mem HI caddr)))
2092 (if (ne extcond (const 1))
2093 (set bit01 (const 1))
2094 (set HI pc (add HI pc (const 2))))
2100 (callabs calla0 calla+)
2101 (callabs calla1 calla)
2104 (dni calla- "Absolute conditional call"
2105 (COND-CTI (PIPE OS) (IDOC JMP))
2106 "calla- $extcond,$caddr"
2107 (+ OP1_12 OP2_10 extcond (f-op-bit3 1) caddr)
2109 (if (eq extcond (const 1))
2110 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2111 (set HI (mem HI (reg h-cr 9)) pc)
2112 (set HI pc (mem HI caddr)))
2113 (set HI pc (add HI pc (const 2)))
2119 (dni calli "indirect subroutine call"
2120 (COND-CTI (PIPE OS) (IDOC JMP))
2121 "calli $icond,[$sr]"
2122 (+ OP1_10 OP2_11 icond sr)
2124 (if (eq icond (const 1))
2126 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2127 (set HI (mem HI (reg h-cr 9)) pc)
2128 (set HI pc (mem HI sr))
2131 (set HI pc (add HI pc (const 2)))
2137 (dni callr "Call subroutine with PC relative signed 8 bit offset"
2138 ( COND-CTI (PIPE OS) (IDOC JMP))
2140 (+ OP1_11 OP2_11 rel)
2142 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2143 (set HI (mem HI (reg h-cr 9)) pc)
2145 (if (lt QI rel (const 0))
2147 ;; FIXME: (neg QI rel)
2148 ;; FIXME: (add QI rel (const 1))
2149 ;; FIXME: (mul QI rel (const 2))
2150 (set HI pc (sub HI pc rel))
2152 (set HI pc (add HI pc (mul QI rel (const 2))))
2160 (dni callseg "call inter-segment subroutine"
2161 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2162 "calls $hash$segm$useg8,$hash$sof$usof16"
2163 (+ OP1_13 OP2_10 useg8 usof16)
2165 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2166 (set HI (mem HI (reg h-cr 9)) (reg h-cr 10))
2167 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2168 (set HI (mem HI (reg h-cr 9)) pc)
2169 (if (eq BI sgtdisbit (const BI 0))
2170 (set QI (reg h-cr 10) useg8))
2171 ;; FIXME: previous indentation suggested this nop was the `else'
2172 ;; clause of the previous `if'.
2180 (dni calls "call inter-segment subroutine"
2181 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2183 (+ OP1_13 OP2_10 seg caddr)
2185 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2186 (set HI (mem HI (reg h-cr 9)) (reg h-cr 10))
2187 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2188 (set HI (mem HI (reg h-cr 9)) pc)
2189 (if (eq BI sgtdisbit (const BI 0))
2190 (set QI (reg h-cr 10) seg))
2191 ;; FIXME: previous indentation suggested this nop was the `else'
2192 ;; clause of the previous `if'.
2200 (dni pcall "push word and call absolute subroutine"
2201 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2202 "pcall $reg8,$caddr"
2203 (+ OP1_14 OP2_2 reg8 caddr)
2204 (sequence ((HI tmp1))
2206 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2207 (set HI (mem HI (reg h-cr 9)) tmp1)
2208 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2209 (set HI (mem HI (reg h-cr 9)) pc)
2216 (dni trap "software trap"
2217 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2219 (+ OP1_9 OP2_11 uimm7 (f-op-1bit 0))
2221 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2222 (set HI (mem HI (reg h-cr 9)) (reg h-cr 4))
2223 (if (eq BI sgtdisbit (const BI 0))
2224 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2225 (set HI (mem HI (reg h-cr 9)) (reg h-cr 10) )
2228 (set HI (reg h-cr 10) (reg h-cr 11))
2229 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2230 (set HI (mem HI (reg h-cr 9)) pc)
2231 (set HI pc (mul QI uimm7 (const 4)))
2238 (dni ret "return from subroutine"
2239 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2241 (+ OP1_12 OP2_11 (f-op-bit8 0))
2243 (set HI pc (mem HI (reg h-cr 9)))
2244 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2250 (dni rets "return from inter-segment sunroutine"
2251 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2253 (+ OP1_13 OP2_11 (f-op-bit8 0))
2255 (set HI pc (mem HI (reg h-cr 9)))
2256 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2257 (if (eq BI sgtdisbit (const BI 0))
2258 (set HI (reg h-cr 10) (mem HI (reg h-cr 9)))
2261 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2267 (dni retp "return from subroutine and pop word register"
2268 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2270 (+ OP1_14 OP2_11 reg8)
2271 (sequence ((HI tmp1))
2272 (set HI pc (mem HI (reg h-cr 9)))
2273 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2274 (set HI tmp1 (mem HI (reg h-cr 9)))
2275 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2282 (dni reti "return from ISR"
2283 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2285 (+ OP1_15 OP2_11 (f-op-lbit4 8) (f-op-bit4 8))
2287 (set HI pc (mem HI (reg h-cr 9)))
2288 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2289 (if (eq BI sgtdisbit (const BI 0))
2291 (set HI (reg h-cr 10) (mem HI (reg h-cr 9)))
2292 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2296 (set HI (reg h-cr 4) (mem HI (reg h-cr 9)))
2297 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2302 ;stack operation insn
2303 ;******************************************************************
2305 (dni pop "restore register from system stack"
2306 ((PIPE OS) (IDOC MISC))
2308 (+ OP1_15 OP2_12 reg8)
2309 (sequence ((HI tmp1))
2310 (set HI tmp1 (mem HI (reg h-cr 9)))
2311 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2318 (dni push "save register on system stack"
2319 ((PIPE OS) (IDOC MISC))
2321 (+ OP1_14 OP2_12 reg8)
2322 (sequence ((HI tmp1))
2324 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2325 (set HI (mem HI (reg h-cr 9)) tmp1)
2330 ;context switching insns
2332 (dni scxti "Push word register on stack and update same with immediate data"
2333 ((PIPE OS) (IDOC MISC))
2334 "scxt $reg8,$hash$uimm16"
2335 (+ OP1_12 OP2_6 reg8 uimm16)
2336 (sequence ((HI tmp1) (HI tmp2))
2338 (set HI tmp2 uimm16)
2339 ;; FIXME: (sub HI (reg HI h-cr 9) (const 2))
2340 (set HI (reg HI h-cr 9) tmp1)
2347 (dni scxtrpofm "mov memory to byte register"
2348 ((PIPE OS) (IDOC MOVE))
2349 "scxt $reg8,$pof$upof16"
2350 (+ OP1_13 OP2_6 reg8 upof16)
2351 (set QI reg8 (mem HI upof16))
2355 ; SCXT regmem8,memgr8
2356 (dni scxtmg "Push word register on stack and update same with direct memory"
2357 ((PIPE OS) (IDOC MISC))
2358 "scxt $regmem8,$memgr8"
2359 (+ OP1_13 OP2_6 regmem8 memgr8)
2360 (sequence ((HI tmp1) (HI tmp2))
2361 (set HI tmp1 regmem8)
2362 (set HI tmp2 memgr8)
2363 ;; FIXME: (sub HI (reg HI h-cr 9) (const 2))
2364 (set HI (reg HI h-cr 9) tmp1)
2365 (set HI regmem8 tmp2)
2371 (dni scxtm "Push word register on stack and update same with direct memory"
2372 ((PIPE OS) (IDOC MISC))
2373 "scxt $reg8,$memory"
2374 (+ OP1_13 OP2_6 reg8 memory)
2375 (sequence ((HI tmp1) (HI tmp2))
2377 (set HI tmp2 memory)
2378 ;; FIXME: (sub HI (reg HI h-cr 9) (const 2))
2379 (set HI (reg HI h-cr 9) tmp1)
2388 ((PIPE OS) (IDOC MISC))
2390 (+ OP1_12 OP2_12 (f-op-bit8 0))
2395 ;*********system control instructions *********************/
2397 (define-pmacro (sysctrl name insn opc1 opc2 op1 op2 op3)
2399 (.str name "miscellaneous" )
2400 ((PIPE OS) (IDOC MISC))
2402 (+ opc1 opc2 (f-op-lbit4 op1) (f-op-bit4 op2) (f-data8 op3) (f-op-bit8 op3))
2407 (sysctrl srstm srst OP1_11 OP2_7 4 8 183 )
2408 (sysctrl idlem idle OP1_8 OP2_7 7 8 135)
2409 (sysctrl pwrdnm pwrdn OP1_9 OP2_7 6 8 151)
2410 (sysctrl diswdtm diswdt OP1_10 OP2_5 5 10 165)
2411 (sysctrl enwdtm enwdt OP1_8 OP2_5 7 10 133)
2412 (sysctrl einitm einit OP1_11 OP2_5 4 10 181)
2413 (sysctrl srvwdtm srvwdt OP1_10 OP2_7 5 8 167 )
2418 ((PIPE OS) (IDOC MISC))
2420 (+ OP1_8 OP2_12 (f-op-bit8 0))
2427 (dni atomic "begin atomic sequence"
2428 ((PIPE OS) (IDOC SYSC))
2429 "atomic $hash$uimm2"
2430 (+ OP1_13 OP2_1 (f-op-lbit2 0) uimm2 (f-op-bit4 0))
2431 (sequence ((HI count))
2432 (set HI count uimm2)
2434 ((ne HI count (const 0))
2436 (set HI pc (add HI pc (const 2)))
2437 (set HI count (sub HI count (const 1)))
2440 (set HI count (const 0))
2445 ;extended register sequence
2447 (dni extr "begin extended register sequence"
2448 ((PIPE OS) (IDOC SYSC))
2450 (+ OP1_13 OP2_1 (f-op-lbit2 2) uimm2 (f-op-bit4 0))
2451 (sequence ((HI count))
2452 (set HI count uimm2)
2454 ((ne HI count (const 0))
2456 (set HI pc (add HI pc (const 2)))
2457 (set HI count (sub HI count (const 1)))
2460 (set HI count (const 0))
2465 ;extended page sequence
2467 (dni extp "begin extended page sequence"
2468 ((PIPE OS) (IDOC SYSC))
2469 "extp $sr,$hash$uimm2"
2470 (+ OP1_13 OP2_12 (f-op-lbit2 1) uimm2 sr)
2471 (sequence ((HI count))
2472 (set HI count uimm2)
2474 ((ne HI count (const 0))
2476 (set HI pc (add HI pc (const 2)))
2477 (set HI count (sub HI count (const 1)))
2480 (set HI count (const 0))
2485 ;extended page sequence
2486 ; EXTP #pag10,#irang2
2487 (dni extp1 "begin extended page sequence"
2488 ((PIPE OS) (IDOC SYSC))
2489 "extp $hash$pagenum,$hash$uimm2"
2490 (+ OP1_13 OP2_7 (f-op-lbit2 1) uimm2 (f-op-bit4 0) pagenum (f-qlobit 0) (f-qlobit2 0))
2491 (sequence ((HI count))
2492 (set HI count uimm2)
2494 ((ne HI count (const 0))
2496 (set HI pc (add HI pc (const 2)))
2497 (set HI count (sub HI count (const 1)))
2500 (set HI count (const 0))
2505 ; EXTP #pag10,#irang2
2506 (dni extpg1 "begin extended page sequence"
2507 ((PIPE OS) (IDOC SYSC))
2508 "extp $hash$pag$upag16,$hash$uimm2"
2509 (+ OP1_13 OP2_7 (f-op-lbit2 1) uimm2 (f-op-bit4 0) upag16 )
2510 (sequence ((HI count))
2511 (set HI count uimm2)
2513 ((ne HI count (const 0))
2515 (set HI pc (add HI pc (const 2)))
2516 (set HI count (sub HI count (const 1)))
2519 (set HI count (const 0))
2524 ;extended page and register sequence
2526 (dni extpr "begin extended page and register sequence"
2527 ((PIPE OS) (IDOC SYSC))
2528 "extpr $sr,$hash$uimm2"
2529 (+ OP1_13 OP2_12 (f-op-lbit2 3) uimm2 sr)
2530 (sequence ((HI count))
2531 (set HI count uimm2)
2533 ((ne HI count (const 0))
2535 (set HI pc (add HI pc (const 2)))
2536 (set HI count (sub HI count (const 1)))
2539 (set HI count (const 0))
2544 ;extended page and register sequence
2545 ; EXTPR #pag10,#irang2
2546 (dni extpr1 "begin extended page sequence"
2547 ((PIPE OS) (IDOC SYSC))
2548 "extpr $hash$pagenum,$hash$uimm2"
2549 (+ OP1_13 OP2_7 (f-op-lbit2 3) uimm2 (f-op-bit4 0) pagenum (f-qlobit 0) (f-qlobit2 0))
2550 (sequence ((HI count))
2551 (set HI count uimm2)
2553 ((ne HI count (const 0))
2555 (set HI pc (add HI pc (const 2)))
2556 (set HI count (sub HI count (const 1)))
2559 (set HI count (const 0))
2564 ;extended segment sequence
2566 (dni exts "begin extended segment sequence"
2567 ((PIPE OS) (IDOC SYSC))
2568 "exts $sr,$hash$uimm2"
2569 (+ OP1_13 OP2_12 (f-op-lbit2 0) uimm2 sr)
2570 (sequence ((HI count))
2571 (set HI count uimm2)
2573 ((ne HI count (const 0))
2575 (set HI pc (add HI pc (const 2)))
2576 (set HI count (sub HI count (const 1)))
2579 (set HI count (const 0))
2584 ;extended segment sequence
2585 ; EXTS #seg8,#irang2
2586 (dni exts1 "begin extended segment sequence"
2587 ((PIPE OS) (IDOC SYSC))
2588 "exts $hash$seghi8,$hash$uimm2"
2589 (+ OP1_13 OP2_7 (f-op-lbit2 0) uimm2 (f-op-bit4 0) seghi8 (f-op-bit8 0))
2590 (sequence ((HI count))
2591 (set HI count uimm2)
2593 ((ne HI count (const 0))
2595 (set HI pc (add HI pc (const 2)))
2596 (set HI count (sub HI count (const 1)))
2599 (set HI count (const 0))
2604 ;extended segment register sequence
2606 (dni extsr "begin extended segment and register sequence"
2607 ((PIPE OS) (IDOC SYSC))
2608 "extsr $sr,$hash$uimm2"
2609 (+ OP1_13 OP2_12 (f-op-lbit2 2) uimm2 sr)
2610 (sequence ((HI count))
2611 (set HI count uimm2)
2613 ((ne HI count (const 0))
2615 (set HI pc (add HI pc (const 2)))
2616 (set HI count (sub HI count (const 1)))
2619 (set HI count (const 0))
2624 ;extended segment register sequence
2625 ; EXTSR #pag10,#irang2
2626 (dni extsr1 "begin extended segment and register sequence"
2627 ((PIPE OS) (IDOC SYSC))
2628 "extsr $hash$seghi8,$hash$uimm2"
2629 (+ OP1_13 OP2_7 (f-op-lbit2 2) uimm2 (f-op-bit4 0) seghi8 (f-op-bit8 0))
2630 (sequence ((HI count))
2631 (set HI count uimm2)
2633 ((ne HI count (const 0))
2635 (set HI pc (add HI pc (const 2)))
2636 (set HI count (sub HI count (const 1)))
2639 (set HI count (const 0))
2644 ;prioritize register
2646 (dni prior "add registers"
2647 ((PIPE OS) (IDOC ALU))
2649 (+ OP1_2 OP2_11 dr sr)
2650 (sequence ((HI count) (HI tmp1) (HI tmp2))
2651 (set HI count (const 0))
2653 (set HI tmp2 (and tmp1 (const 32768)))
2655 ((ne HI tmp2 (const 1)) ;;(ne HI sr (const 0)) - FIXME: and? or?
2656 ;;(sll HI tmp1 (const 1)) - FIXME: missing (set ...)
2657 (set HI tmp2 (and tmp1 (const 32768)))
2658 (set HI count (add HI count (const 1)))
2668 ;******************************************************************
2670 (define-pmacro (bclear name insn opc1)
2672 (.str name "bit clear" )
2673 ((PIPE OS) (IDOC ALU))
2674 (.str insn " $reg8$dot$qbit")
2675 (+ opc1 OP2_14 reg8)
2676 (sequence ((HI tmp1) (HI tmp2))
2677 (set tmp2 (const 1))
2679 ;; FIXME: (sll tmp2 qbit)
2680 ;; FIXME: (inv tmp2)
2681 (set BI tmp1(and tmp1 tmp2))
2688 (dni bclr18 "bit logical MOVN"
2689 ((PIPE OS) (IDOC ALU))
2691 (+ OP1_11 OP2_14 RegNam)
2692 (sequence ((HI tmp1) (HI tmp2))
2693 (set tmp2 (const 1))
2695 ;; FIXME: (sll tmp2 qbit)
2696 ;; FIXME: (inv tmp2)
2697 (set BI tmp1(and tmp1 tmp2))
2703 (bclear bclr0 bclr QBIT_0 )
2704 (bclear bclr1 bclr QBIT_1 )
2705 (bclear bclr2 bclr QBIT_2 )
2706 (bclear bclr3 bclr QBIT_3 )
2707 (bclear bclr4 bclr QBIT_4 )
2708 (bclear bclr5 bclr QBIT_5 )
2709 (bclear bclr6 bclr QBIT_6 )
2710 (bclear bclr7 bclr QBIT_7 )
2711 (bclear bclr8 bclr QBIT_8 )
2712 (bclear bclr9 bclr QBIT_9 )
2713 (bclear bclr10 bclr QBIT_10 )
2714 (bclear bclr11 bclr QBIT_11 )
2715 (bclear bclr12 bclr QBIT_12 )
2716 (bclear bclr13 bclr QBIT_13 )
2717 (bclear bclr14 bclr QBIT_14 )
2718 (bclear bclr15 bclr QBIT_15 )
2721 (dni bset19 "bit logical MOVN"
2722 ((PIPE OS) (IDOC ALU))
2724 (+ OP1_11 OP2_15 RegNam)
2725 (sequence ((HI tmp1) (HI tmp2))
2726 (set tmp2 (const 1))
2728 ;; FIXME: (sll tmp2 qbit)
2729 (set BI tmp1(or tmp1 tmp2))
2735 (define-pmacro (bitset name insn opc1)
2737 (.str name "bit set" )
2738 ((PIPE OS) (IDOC ALU))
2739 (.str insn " $reg8$dot$qbit")
2740 (+ opc1 OP2_15 reg8)
2741 (sequence ((HI tmp1) (HI tmp2))
2742 (set tmp2 (const 1))
2744 ;; FIXME: (sll tmp2 qbit)
2745 (set BI tmp1(or tmp1 tmp2))
2752 (bitset bset0 bset QBIT_0 )
2753 (bitset bset1 bset QBIT_1 )
2754 (bitset bset2 bset QBIT_2 )
2755 (bitset bset3 bset QBIT_3 )
2756 (bitset bset4 bset QBIT_4 )
2757 (bitset bset5 bset QBIT_5 )
2758 (bitset bset6 bset QBIT_6 )
2759 (bitset bset7 bset QBIT_7 )
2760 (bitset bset8 bset QBIT_8 )
2761 (bitset bset9 bset QBIT_9 )
2762 (bitset bset10 bset QBIT_10 )
2763 (bitset bset11 bset QBIT_11 )
2764 (bitset bset12 bset QBIT_12 )
2765 (bitset bset13 bset QBIT_13 )
2766 (bitset bset14 bset QBIT_14 )
2767 (bitset bset15 bset QBIT_15 )
2770 ;BMOV bitaddrZ.z,bitaddrQ.q
2771 (dni bmov "bit logical MOV"
2772 ((PIPE OS) (IDOC ALU))
2773 "bmov $reghi8$dot$qhibit,$reg8$dot$qlobit"
2774 (+ OP1_4 OP2_10 reg8 reghi8 qhibit qlobit)
2775 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2776 (set HI tmp1 reghi8)
2778 (set tmp3 (const 1))
2779 (set tmp4 (const 1))
2780 ;; FIXME: (sll tmp3 qlobit)
2781 ;; FIXME: (sll tmp4 qhibit)
2782 ;; FIXME: (and tmp1 tmp3)
2783 ;; FIXME: (and tmp2 tmp4)
2785 (set HI reghi8 tmp1)
2791 ;BMOVN bitaddrZ.z,bitaddrQ.q
2792 (dni bmovn "bit logical MOVN"
2793 ((PIPE OS) (IDOC ALU))
2794 "bmovn $reghi8$dot$qhibit,$reg8$dot$qlobit"
2795 (+ OP1_3 OP2_10 reg8 reghi8 qhibit qlobit)
2796 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2797 (set HI tmp1 reghi8)
2799 (set tmp3 (const 1))
2800 (set tmp4 (const 1))
2801 ;; FIXME: (sll tmp3 qlobit)
2802 ;; FIXME: (sll tmp4 qhibit)
2803 ;; FIXME: (and tmp1 tmp3)
2804 ;; FIXME: (and tmp2 tmp4)
2805 ;; FIXME: (inv HI tmp2)
2807 (set HI reghi8 tmp1)
2813 ;BAND bitaddrZ.z,bitaddrQ.q
2814 (dni band "bit logical AND"
2815 ((PIPE OS) (IDOC ALU))
2816 "band $reghi8$dot$qhibit,$reg8$dot$qlobit"
2817 (+ OP1_6 OP2_10 reg8 reghi8 qhibit qlobit)
2818 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2819 (set HI tmp1 reghi8)
2821 (set tmp3 (const 1))
2822 (set tmp4 (const 1))
2823 ;; FIXME: (sll tmp3 qlobit)
2824 ;; FIXME: (sll tmp4 qhibit)
2825 ;; FIXME: (and tmp1 tmp3)
2826 ;; FIXME: (and tmp2 tmp4)
2827 (set BI tmp1(and tmp1 tmp2))
2828 (set HI reghi8 tmp1)
2834 ;BOR bitaddrZ.z,bitaddrQ.q
2835 (dni bor "bit logical OR"
2836 ((PIPE OS) (IDOC ALU))
2837 "bor $reghi8$dot$qhibit,$reg8$dot$qlobit"
2838 (+ OP1_5 OP2_10 reg8 reghi8 qhibit qlobit)
2839 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2840 (set HI tmp1 reghi8)
2842 (set tmp3 (const 1))
2843 (set tmp4 (const 1))
2844 ;; FIXME: (sll tmp3 qlobit)
2845 ;; FIXME: (sll tmp4 qhibit)
2846 ;; FIXME: (and tmp1 tmp3)
2847 ;; FIXME: (and tmp2 tmp4)
2848 (set BI tmp1(or tmp1 tmp2))
2849 (set HI reghi8 tmp1)
2855 ;BXOR bitaddrZ.z,bitaddrQ.q
2856 (dni bxor "bit logical XOR"
2857 ((PIPE OS) (IDOC ALU))
2858 "bxor $reghi8$dot$qhibit,$reg8$dot$qlobit"
2859 (+ OP1_7 OP2_10 reg8 reghi8 qhibit qlobit)
2860 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2861 (set HI tmp1 reghi8)
2863 (set tmp3 (const 1))
2864 (set tmp4 (const 1))
2865 ;; FIXME: (sll tmp3 qlobit)
2866 ;; FIXME: (sll tmp4 qhibit)
2867 ;; FIXME: (and tmp1 tmp3)
2868 ;; FIXME: (and tmp2 tmp4)
2869 (set BI tmp1(xor tmp1 tmp2))
2870 (set HI reghi8 tmp1)
2875 ;cmp direct bit to bit
2876 ;BCMP bitaddrZ.z,bitaddrQ.q
2877 (dni bcmp "bit to bit compare"
2878 ((PIPE OS) (IDOC ALU))
2879 "bcmp $reghi8$dot$qhibit,$reg8$dot$qlobit"
2880 (+ OP1_2 OP2_10 reg8 reghi8 qhibit qlobit)
2881 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2882 (set HI tmp1 reghi8)
2884 (set tmp3 (const 1))
2885 (set tmp4 (const 1))
2886 ;; FIXME: (sll tmp3 qlobit)
2887 ;; FIXME: (sll tmp4 qhibit)
2888 ;; FIXME: (and tmp1 tmp3)
2889 ;; FIXME: (and tmp2 tmp4)
2890 (set BI tmp1(xor tmp1 tmp2))
2891 (set HI reghi8 tmp1)
2898 (dni bfldl "bit field low byte"
2899 ((PIPE OS) (IDOC MOVE))
2900 "bfldl $reg8,$hash$mask8,$hash$datahi8"
2901 (+ OP1_0 OP2_10 reg8 mask8 datahi8)
2902 (sequence ((HI tmp1) (QI tmp2) (QI tmp3))
2905 (set QI tmp3 datahi8)
2906 ;; FIXME: (inv QI tmp2)
2907 (set HI tmp1 (and tmp1 tmp2))
2908 (set HI tmp1 (or tmp1 tmp3))
2914 ;bit field high byte
2916 (dni bfldh "bit field high byte"
2917 ((PIPE OS) (IDOC MOVE))
2918 "bfldh $reg8,$hash$masklo8,$hash$data8"
2919 (+ OP1_1 OP2_10 reg8 masklo8 data8)
2920 (sequence ((HI tmp1) (HI tmp2) (HI tmp3))
2922 (set QI tmp2 masklo8)
2924 ;; FIXME: (sll tmp2 (const 8))
2925 ;; FIXME: (inv HI tmp2)
2926 ;; FIXME: (sll tmp3 (const 8))
2927 (set HI tmp1 (and tmp1 tmp2))
2928 (set HI tmp1 (or tmp1 tmp3))
2934 ;/**********compare instructions******************
2938 (dni cmpr "compare two registers"
2939 ((PIPE OS) (IDOC CMP))
2941 (+ OP1_4 OP2_0 src1 src2)
2942 (set condbit (lt HI src1 src2))
2946 ;Compare byte register
2948 (dni cmpbr "compare two byte registers"
2949 ((PIPE OS) (IDOC CMP))
2951 (+ OP1_4 OP2_1 drb srb)
2952 (set condbit (lt QI drb srb))
2956 (define-pmacro (cmp1 name insn opc1 opc2 op1 op2 mode)
2958 (.str name "compare" )
2959 ((PIPE OS) (IDOC CMP))
2960 (.str insn " $"op1 ",$hash$"op2)
2961 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
2962 (set condbit (lt mode op1 op2))
2966 (cmp1 cmpri cmp OP1_4 OP2_8 src1 uimm3 HI)
2967 (cmp1 cmpbri cmpb OP1_4 OP2_9 drb uimm3 QI)
2971 ((PIPE OS) (IDOC CMP))
2972 "cmp $reg8,$hash$uimm16"
2973 (+ OP1_4 OP2_6 reg8 uimm16)
2974 (set condbit (lt HI reg8 uimm16))
2979 (dni cmpbi "compare"
2980 ((PIPE OS) (IDOC CMP))
2981 "cmpb $regb8,$hash$uimm8"
2982 (+ OP1_4 OP2_7 regb8 uimm8 (f-op-bit8 0))
2983 (set condbit (lt QI regb8 uimm8))
2987 ;compare reg and indirect memory
2988 (define-pmacro (cmp2 name insn opc1 opc2 op1 op2 mode)
2990 (.str name "compare" )
2991 ((PIPE OS) (IDOC CMP))
2992 (.str insn " $"op1 ",[$"op2"]")
2993 (+ opc1 opc2 op1 (f-op-bit2 2) op2)
2994 (set condbit (lt mode op1 op2))
2998 (cmp2 cmpr2 cmp OP1_4 OP2_8 dr sr2 HI)
2999 (cmp2 cmpbr2 cmpb OP1_4 OP2_9 drb sr2 QI)
3001 ;compare register and indirect memory post increment
3002 (define-pmacro (cmp3 name insn opc1 opc2 op1 op2 mode)
3004 (.str name "compare" )
3005 ((PIPE OS) (IDOC CMP))
3006 (.str insn " $"op1 ",[$"op2"+]")
3007 (+ opc1 opc2 op1 (f-op-bit2 3) op2)
3009 (set condbit (lt mode op1 op2))
3010 (set HI op2 (add HI op2 (const 2)))
3015 (cmp3 cmp2i cmp OP1_4 OP2_8 dr sr2 HI)
3016 (cmp3 cmpb2i cmpb OP1_4 OP2_9 drb sr2 QI)
3018 ;compare register and direct memory
3019 (define-pmacro (cmp4 name insn opc1 opc2 op1 op2 mode)
3021 (.str name "compare" )
3022 ((PIPE OS) (IDOC CMP))
3023 (.str insn " $"op1 ",$pof$"op2)
3024 (+ opc1 opc2 op1 op2)
3025 (set condbit (lt HI op1 (mem HI op2)))
3029 (cmp4 cmp04 cmp OP1_4 OP2_2 reg8 upof16 HI)
3030 (cmp4 cmpb4 cmpb OP1_4 OP2_3 regb8 upof16 QI)
3032 ;compare register and direct memory
3033 (define-pmacro (cmp4 name insn opc1 opc2 op1 op2 mode)
3035 (.str name "compare" )
3036 ((PIPE OS) (IDOC CMP))
3037 (.str insn " $"op1 ",$"op2)
3038 (+ opc1 opc2 op1 op2)
3039 (set condbit (lt HI op1 (mem HI op2)))
3043 (cmp4 cmp004 cmp OP1_4 OP2_2 regmem8 memgr8 HI)
3044 (cmp4 cmp0004 cmp OP1_4 OP2_2 reg8 memory HI)
3045 (cmp4 cmpb04 cmpb OP1_4 OP2_3 regbmem8 memgr8 QI)
3046 (cmp4 cmpb004 cmpb OP1_4 OP2_3 regb8 memory QI)
3048 ;compare register and immediate
3049 (define-pmacro (cmp5 name insn opc1 opc2 op1 op2 mode)
3051 (.str name "compare" )
3052 ((PIPE OS) (IDOC CMP))
3053 (.str insn " $"op1 ",$hash$"op2)
3054 (+ opc1 opc2 op2 op1)
3056 (set condbit (lt HI op1 op2))
3057 (set mode op1 (sub HI op1 (const 1)))
3062 (cmp5 cmpd1ri cmpd1 OP1_10 OP2_0 sr uimm4 HI)
3063 (cmp5 cmpd2ri cmpd2 OP1_11 OP2_0 sr uimm4 HI)
3064 (cmp5 cmpi1ri cmpi1 OP1_8 OP2_0 sr uimm4 HI)
3065 (cmp5 cmpi2ri cmpi2 OP1_9 OP2_0 sr uimm4 HI)
3066 (cmp5 cmpd1rim cmpd1 OP1_10 OP2_6 reg8 uimm16 HI)
3067 (cmp5 cmpd2rim cmpd2 OP1_11 OP2_6 reg8 uimm16 HI)
3068 (cmp5 cmpi1rim cmpi1 OP1_8 OP2_6 reg8 uimm16 HI)
3069 (cmp5 cmpi2rim cmpi2 OP1_9 OP2_6 reg8 uimm16 HI)
3071 ;compare register and direct memory
3072 (define-pmacro (cmp6 name insn opc1 opc2 op1 op2 mode )
3074 (.str name "compare" )
3075 ((PIPE OS) (IDOC CMP))
3076 (.str insn " $"op1 ",$pof$"op2)
3077 (+ opc1 opc2 op1 op2)
3079 (set condbit (lt HI op1 (mem HI op2)))
3080 (set mode op1 (sub HI op1 (const 1)))
3085 (cmp6 cmpd1rp cmpd1 OP1_10 OP2_2 reg8 upof16 HI )
3086 (cmp6 cmpd2rp cmpd2 OP1_11 OP2_2 reg8 upof16 HI )
3087 (cmp6 cmpi1rp cmpi1 OP1_8 OP2_2 reg8 upof16 HI )
3088 (cmp6 cmpi2rp cmpi2 OP1_9 OP2_2 reg8 upof16 HI )
3090 ;compare register and direct memory
3091 (define-pmacro (cmp7 name insn opc1 opc2 op1 op2 mode)
3093 (.str name "compare" )
3094 ((PIPE OS) (IDOC CMP))
3095 (.str insn " $"op1 ",$"op2)
3096 (+ opc1 opc2 op1 op2)
3098 (set condbit (lt HI op1 (mem HI op2)))
3099 (set mode op1 (sub HI op1 (const 1)))
3104 (cmp7 cmpd1rm cmpd1 OP1_10 OP2_2 regmem8 memgr8 HI)
3105 (cmp7 cmpd2rm cmpd2 OP1_11 OP2_2 regmem8 memgr8 HI)
3106 (cmp7 cmpi1rm cmpi1 OP1_8 OP2_2 regmem8 memgr8 HI)
3107 (cmp7 cmpi2rm cmpi2 OP1_9 OP2_2 regmem8 memgr8 HI)
3108 (cmp7 cmpd1rmi cmpd1 OP1_10 OP2_2 reg8 memory HI)
3109 (cmp7 cmpd2rmi cmpd2 OP1_11 OP2_2 reg8 memory HI)
3110 (cmp7 cmpi1rmi cmpi1 OP1_8 OP2_2 reg8 memory HI)
3111 (cmp7 cmpi2rmi cmpi2 OP1_9 OP2_2 reg8 memory HI)
3114 ;Shift and rotate insns
3115 ;****************************************************************
3116 (define-pmacro (shift name insn insn1 opc1 opc2 op1 op2 mode)
3118 (.str name "shift" )
3119 ((PIPE OS) (IDOC ALU))
3120 (.str insn " $"op1 ",$"op2)
3121 (+ opc1 opc2 op1 op2)
3122 (set mode op1 (insn1 mode op1 op2))
3126 (shift shlr shl sll OP1_4 OP2_12 dr sr HI)
3127 (shift shrr shr srl OP1_6 OP2_12 dr sr HI)
3128 (shift rolr rol rol OP1_0 OP2_12 dr sr HI)
3129 (shift rorr ror ror OP1_2 OP2_12 dr sr HI)
3130 (shift ashrr ashr sra OP1_10 OP2_12 dr sr HI)
3132 (define-pmacro (shift1 name insn insn1 opc1 opc2 op1 op2 mode)
3134 (.str name "shift" )
3135 ((PIPE OS) (IDOC ALU))
3136 (.str insn " $"op1 ",$hash$"op2)
3137 (+ opc1 opc2 op2 op1)
3138 (set mode op1 (insn1 mode op1 op2))
3142 (shift1 shlri shl sll OP1_5 OP2_12 sr uimm4 HI)
3143 (shift1 shrri shr srl OP1_7 OP2_12 sr uimm4 HI)
3144 (shift1 rolri rol rol OP1_1 OP2_12 sr uimm4 HI)
3145 (shift1 rorri ror ror OP1_3 OP2_12 sr uimm4 HI)
3146 (shift1 ashrri ashr sra OP1_11 OP2_12 sr uimm4 HI)