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 (dnop sr "source register" () h-gr f-r2)
532 (dnop dr "destination register" () h-gr f-r1)
533 (dnop dri "destination register" () h-gr f-r4)
534 (dnop srb "source register" () h-grb f-r2)
535 (dnop drb "destination register" () h-grb f-r1)
536 (dnop sr2 "2 bit source register" () h-gr f-r0)
537 (dnop src1 "source register 1" () h-gr f-r1)
538 (dnop src2 "source register 2" () h-gr f-r2)
539 (dnop srdiv "source register 2" () h-regdiv8 f-reg8)
540 (dnop RegNam "PSW bits" () h-psw f-reg8)
541 (dnop uimm2 "2 bit unsigned number" (HASH-PREFIX) h-ext f-uimm2)
542 (dnop uimm3 "3 bit unsigned number" (HASH-PREFIX) h-r01 f-uimm3)
543 (dnop uimm4 "4 bit unsigned number" (HASH-PREFIX) h-uint f-uimm4)
544 (dnop uimm7 "7 bit trap number" (HASH-PREFIX) h-uint f-uimm7)
545 (dnop uimm8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm8)
546 (dnop uimm16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm16)
547 (dnop upof16 "16 bit unsigned immediate" (POF-PREFIX) h-addr f-memory)
548 (dnop reg8 "8 bit word register number" () h-r8 f-reg8)
549 (dnop regmem8 "8 bit word register number" () h-regmem8 f-regmem8)
550 (dnop regbmem8 "8 bit byte register number" () h-regbmem8 f-regmem8)
551 (dnop regoff8 "8 bit word register number" () h-r8 f-regoff8)
552 (dnop reghi8 "8 bit word register number" () h-r8 f-reghi8)
553 (dnop regb8 "8 bit byte register number" () h-grb8 f-regb8)
554 (dnop genreg "8 bit word register number" () h-r8 f-regb8)
555 (dnop seg "8 bit segment number" () h-uint f-seg8)
556 (dnop seghi8 "8 bit hi segment number" () h-uint f-segnum8)
557 (dnop caddr "16 bit address offset" () h-addr f-offset16)
558 (dnop rel "8 bit signed relative offset" () h-sint f-rel8)
559 (dnop relhi "hi 8 bit signed relative offset" () h-sint f-relhi8)
560 (dnop condbit "condition bit" (SEM-ONLY) h-cond f-nil)
561 (dnop bit1 "gap of 1 bit" () h-uint f-op-bit1)
562 (dnop bit2 "gap of 2 bits" () h-uint f-op-bit2)
563 (dnop bit4 "gap of 4 bits" () h-uint f-op-bit4)
564 (dnop lbit4 "gap of 4 bits" () h-uint f-op-lbit4)
565 (dnop lbit2 "gap of 2 bits" () h-uint f-op-lbit2)
566 (dnop bit8 "gap of 8 bits" () h-uint f-op-bit8)
567 (dnop u4 "gap of 4 bits" () h-r0 f-uimm4)
568 (dnop bitone "field of 1 bit" () h-uint f-op-onebit)
569 (dnop bit01 "field of 1 bit" () h-uint f-op-1bit)
570 (dnop cond "condition code" () h-cc f-condcode)
571 (dnop icond "indirect condition code" () h-cc f-icondcode)
572 (dnop extcond "extended condition code" () h-ecc f-extccode)
573 (dnop memory "16 bit memory" () h-addr f-memory)
574 (dnop memgr8 "16 bit memory" () h-memgr8 f-memgr8)
575 (dnop cbit "carry bit" (SEM-ONLY) h-cbit f-nil)
576 (dnop qbit "bit addr" (DOT-PREFIX) h-uint f-qbit)
577 (dnop qlobit "bit addr" (DOT-PREFIX) h-uint f-qlobit)
578 (dnop qhibit "bit addr" (DOT-PREFIX) h-uint f-qhibit)
579 (dnop mask8 "8 bit mask" (HASH-PREFIX) h-uint f-mask8)
580 (dnop masklo8 "8 bit mask" (HASH-PREFIX) h-uint f-datahi8)
581 (dnop pagenum "10 bit page number" (HASH-PREFIX) h-uint f-pagenum)
582 (dnop data8 "8 bit data" (HASH-PREFIX) h-uint f-data8)
583 (dnop datahi8 "8 bit data" (HASH-PREFIX) h-uint f-datahi8)
584 (dnop sgtdisbit "segmentation enable bit" (SEM-ONLY) h-sgtdis f-nil)
585 (dnop upag16 "16 bit unsigned immediate" (PAG-PREFIX) h-uint f-uimm16)
586 (dnop useg8 "8 bit segment " (SEG-PREFIX) h-uint f-seg8)
587 (dnop useg16 "16 bit address offset" (SEG-PREFIX) h-uint f-offset16)
588 (dnop usof16 "16 bit address offset" (SOF-PREFIX) h-uint f-offset16)
590 ; define hash operator
591 (define-operand (name hash) (comment "# prefix") (attrs)
594 (handlers (parse "hash") (print "hash"))
597 ; define dot operator
598 (define-operand (name dot) (comment ". prefix") (attrs)
601 (handlers (parse "dot") (print "dot"))
604 ; define pof operator
605 (define-operand (name pof) (comment "pof: prefix") (attrs)
608 (handlers (parse "pof") (print "pof"))
611 ; define pag operator
612 (define-operand (name pag) (comment "pag: prefix") (attrs)
615 (handlers (parse "pag") (print "pag"))
618 ; define sof operator
619 (define-operand (name sof) (comment "sof: prefix") (attrs)
622 (handlers (parse "sof") (print "sof"))
625 ; define seg operator
626 (define-operand (name segm) (comment "seg: prefix") (attrs)
629 (handlers (parse "seg") (print "seg"))
632 ; IDOC attribute for instruction documentation.
637 (comment "insn kind for documentation")
640 (MOVE - () "Data Movement")
641 (ALU - () "Arithmatic & logical")
643 (JMP - () "Jump & Call")
644 (MISC - () "Miscellaneous")
645 (SYSC - () "System control")
649 ; Include the instruction set descriptions from their respective
653 ;******************************************************************
655 ;add/sub register and immediate
656 (define-pmacro (arithmetic16 name insn insn1 opc1 opc2 op1 op2 mode dir)
658 (.str name "arithmetic" )
659 ((PIPE OS) (IDOC ALU))
660 (.str insn " $"op1 ",$"dir"$"op2)
661 (+ opc1 opc2 op1 op2)
662 (set mode op1 (insn1 mode op1 (mem HI op2)))
666 (arithmetic16 addrpof add add OP1_0 OP2_2 reg8 upof16 HI "pof")
667 (arithmetic16 subrpof sub sub OP1_2 OP2_2 reg8 upof16 HI "pof")
668 (arithmetic16 addbrpof addb add OP1_0 OP2_3 regb8 upof16 QI "pof")
669 (arithmetic16 subbrpof subb sub OP1_2 OP2_3 regb8 upof16 QI "pof")
670 (arithmetic16 addrpag add add OP1_0 OP2_2 reg8 upag16 HI "pag")
671 (arithmetic16 subrpag sub sub OP1_2 OP2_2 reg8 upag16 HI "pag")
672 (arithmetic16 addbrpag addb add OP1_0 OP2_3 regb8 upag16 QI "pag")
673 (arithmetic16 subbrpag subb sub OP1_2 OP2_3 regb8 upag16 QI "pag")
675 ;add/sub register and immediate
676 (define-pmacro (arithmetic17 name insn insn1 opc1 opc2 op1 op2 mode dir)
678 (.str name "arithmetic" )
679 ((PIPE OS) (IDOC ALU))
680 (.str insn " $"op1 ",$"dir"$"op2)
681 (+ opc1 opc2 op1 op2)
682 (set mode op1 (insn1 mode op1 (mem HI op2) cbit))
686 (arithmetic17 addcrpof addc addc OP1_1 OP2_2 reg8 upof16 HI "pof")
687 (arithmetic17 subcrpof subc subc OP1_3 OP2_2 reg8 upof16 HI "pof")
688 (arithmetic17 addcbrpof addcb addc OP1_1 OP2_3 regb8 upof16 QI "pof")
689 (arithmetic17 subcbrpof subcb subc OP1_3 OP2_3 regb8 upof16 QI "pof")
690 (arithmetic17 addcrpag addc addc OP1_1 OP2_2 reg8 upag16 HI "pag")
691 (arithmetic17 subcrpag subc subc OP1_3 OP2_2 reg8 upag16 HI "pag")
692 (arithmetic17 addcbrpag addcb addc OP1_1 OP2_3 regb8 upag16 QI "pag")
693 (arithmetic17 subcbrpag subcb subc OP1_3 OP2_3 regb8 upag16 QI "pag")
695 ;add/sub register and immediate
696 (define-pmacro (arithmetic18 name insn insn1 opc1 opc2 op1 op2 mode dir)
698 (.str name "arithmetic" )
699 ((PIPE OS) (IDOC ALU))
700 (.str insn " $"dir"$"op1 ",$"op2)
701 (+ opc1 opc2 op2 op1)
702 (set (mem HI op1) (insn1 (mem HI op1) op2 ))
706 (arithmetic18 addrpofr add add OP1_0 OP2_4 upof16 reg8 HI "pof")
707 (arithmetic18 subrpofr sub sub OP1_2 OP2_4 upof16 reg8 HI "pof")
708 (arithmetic18 addbrpofr addb add OP1_0 OP2_5 upof16 regb8 QI "pof")
709 (arithmetic18 subbrpofr subb sub OP1_2 OP2_5 upof16 regb8 QI "pof")
711 ;add/sub register and immediate
712 (define-pmacro (arithmetic19 name insn insn1 opc1 opc2 op1 op2 mode dir)
714 (.str name "arithmetic" )
715 ((PIPE OS) (IDOC ALU))
716 (.str insn " $"dir"$"op1 ",$"op2)
717 (+ opc1 opc2 op2 op1)
718 (set (mem HI op1) (insn1 mode (mem HI op1) op2 cbit))
722 (arithmetic19 addcrpofr addc addc OP1_1 OP2_4 upof16 reg8 HI "pof")
723 (arithmetic19 subcrpofr subc subc OP1_3 OP2_4 upof16 reg8 HI "pof")
724 (arithmetic19 addcbrpofr addcb addc OP1_1 OP2_5 upof16 regb8 QI "pof")
725 (arithmetic19 subcbrpofr subcb subc OP1_3 OP2_5 upof16 regb8 QI "pof")
727 ;add/sub register and immediate
728 (define-pmacro (arithmetic20 name insn insn1 opc1 opc2 op1 op2 mode dir)
730 (.str name "arithmetic" )
731 ((PIPE OS) (IDOC ALU))
732 (.str insn " $"op1 ",$hash$"dir"$"op2)
733 (+ opc1 opc2 op1 op2)
734 (set mode op1 (insn1 mode op1 op2))
738 (arithmetic20 addrhpof add add OP1_0 OP2_6 reg8 uimm16 HI "pof")
739 (arithmetic20 subrhpof sub sub OP1_2 OP2_6 reg8 uimm16 HI "pof")
740 (arithmetic20 addbrhpof add add OP1_0 OP2_6 reg8 uimm16 HI "pag")
741 (arithmetic20 subbrhpof sub sub OP1_2 OP2_6 reg8 uimm16 HI "pag")
743 ;add/sub register and immediate
744 (define-pmacro (arithmetic21 name insn insn1 opc1 opc2 op1 op2 mode dir)
746 (.str name "arithmetic" )
747 ((PIPE OS) (IDOC ALU))
748 (.str insn " $"op1 ",$hash$"dir"$"op2)
749 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
750 (set mode op1 (insn1 mode op1 op2))
754 (arithmetic21 addrhpof3 add add OP1_0 OP2_8 dr uimm3 HI "pof")
755 (arithmetic21 subrhpof3 sub sub OP1_2 OP2_8 dr uimm3 HI "pof")
756 (arithmetic21 addbrhpag3 addb add OP1_0 OP2_9 drb uimm3 QI "pag")
757 (arithmetic21 subbrhpag3 subb sub OP1_2 OP2_9 drb uimm3 QI "pag")
758 (arithmetic21 addrhpag3 add add OP1_0 OP2_8 dr uimm3 HI "pag")
759 (arithmetic21 subrhpag3 sub sub OP1_2 OP2_8 dr uimm3 HI "pag")
760 (arithmetic21 addbrhpof3 addb add OP1_0 OP2_9 drb uimm3 QI "pof")
761 (arithmetic21 subbrhpof3 subb sub OP1_2 OP2_9 drb uimm3 QI "pof")
763 ;add/sub register and immediate
764 (define-pmacro (arithmetic22 name insn insn1 opc1 opc2 op1 op2 mode dir)
766 (.str name "arithmetic" )
767 ((PIPE OS) (IDOC ALU))
768 (.str insn " $"op1 ",$hash$"dir"$"op2)
769 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
770 (set mode op1 (insn1 mode op1 op2))
774 (arithmetic22 addrbhpof addb add OP1_0 OP2_7 regb8 uimm8 QI "pof")
775 (arithmetic22 subrbhpof subb sub OP1_2 OP2_7 regb8 uimm8 QI "pof")
776 (arithmetic22 addbrhpag addb add OP1_0 OP2_7 regb8 uimm8 QI "pag")
777 (arithmetic22 subbrhpag subb sub OP1_2 OP2_7 regb8 uimm8 QI "pag")
779 ;add/sub register and immediate
780 (define-pmacro (arithmetic23 name insn insn1 opc1 opc2 op1 op2 mode dir)
782 (.str name "arithmetic" )
783 ((PIPE OS) (IDOC ALU))
784 (.str insn " $"op1 ",$hash$"dir"$"op2)
785 (+ opc1 opc2 op1 op2)
786 (set mode op1 (insn1 mode op1 op2 cbit))
790 (arithmetic23 addcrhpof addc addc OP1_1 OP2_6 reg8 uimm16 HI "pof")
791 (arithmetic23 subcrhpof subc subc OP1_3 OP2_6 reg8 uimm16 HI "pof")
792 (arithmetic23 addcbrhpof addc addc OP1_1 OP2_6 reg8 uimm16 HI "pag")
793 (arithmetic23 subcbrhpof subc subc OP1_3 OP2_6 reg8 uimm16 HI "pag")
795 ;add/sub register and immediate
796 (define-pmacro (arithmetic24 name insn insn1 opc1 opc2 op1 op2 mode dir)
798 (.str name "arithmetic" )
799 ((PIPE OS) (IDOC ALU))
800 (.str insn " $"op1 ",$hash$"dir"$"op2)
801 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
802 (set mode op1 (insn1 mode op1 op2 cbit))
806 (arithmetic24 addcrhpof3 addc addc OP1_1 OP2_8 dr uimm3 HI "pof")
807 (arithmetic24 subcrhpof3 subc subc OP1_3 OP2_8 dr uimm3 HI "pof")
808 (arithmetic24 addcbrhpag3 addcb addc OP1_1 OP2_9 drb uimm3 QI "pag")
809 (arithmetic24 subcbrhpag3 subcb subc OP1_3 OP2_9 drb uimm3 QI "pag")
810 (arithmetic24 addcrhpag3 addc addc OP1_1 OP2_8 dr uimm3 HI "pag")
811 (arithmetic24 subcrhpag3 subc subc OP1_3 OP2_8 dr uimm3 HI "pag")
812 (arithmetic24 addcbrhpof3 addcb addc OP1_1 OP2_9 drb uimm3 QI "pof")
813 (arithmetic24 subcbrhpof3 subcb subc OP1_3 OP2_9 drb uimm3 QI "pof")
815 ;add/sub register and immediate
816 (define-pmacro (arithmetic25 name insn insn1 opc1 opc2 op1 op2 mode dir)
818 (.str name "arithmetic" )
819 ((PIPE OS) (IDOC ALU))
820 (.str insn " $"op1 ",$hash$"dir"$"op2)
821 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
822 (set mode op1 (insn1 mode op1 op2 cbit))
826 (arithmetic25 addcrbhpof addcb addc OP1_1 OP2_7 regb8 uimm8 QI "pof")
827 (arithmetic25 subcrbhpof subcb subc OP1_3 OP2_7 regb8 uimm8 QI "pof")
828 (arithmetic25 addcbrhpag addcb addc OP1_1 OP2_7 regb8 uimm8 QI "pag")
829 (arithmetic25 subcbrhpag subcb subc OP1_3 OP2_7 regb8 uimm8 QI "pag")
831 ;add/sub register and immediate
832 (define-pmacro (arithmetic10 name insn insn1 opc1 opc2 op1 op2 mode)
834 (.str name "arithmetic" )
835 ((PIPE OS) (IDOC ALU))
836 (.str insn " $"op1 ",$hash$"op2)
837 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
838 (set mode op1 (insn1 mode op1 op2))
842 (arithmetic10 addri add add OP1_0 OP2_8 dr uimm3 HI)
843 (arithmetic10 subri sub sub OP1_2 OP2_8 dr uimm3 HI)
844 (arithmetic10 addbri addb add OP1_0 OP2_9 drb uimm3 QI)
845 (arithmetic10 subbri subb sub OP1_2 OP2_9 drb uimm3 QI)
847 ;add/sub register and immediate
848 (define-pmacro (arithmetic11 name insn insn1 opc1 opc2 op1 op2 mode)
850 (.str name "arithmetic" )
851 ((PIPE OS) (IDOC ALU))
852 (.str insn " $"op1 ",$hash$"op2)
853 (+ opc1 opc2 op1 op2)
854 (set mode op1 (insn1 mode op1 op2))
858 (arithmetic11 addrim add add OP1_0 OP2_6 reg8 uimm16 HI)
859 (arithmetic11 subrim sub sub OP1_2 OP2_6 reg8 uimm16 HI)
861 ;add/sub register and immediate
862 (define-pmacro (arithmetic12 name insn insn1 opc1 opc2 op1 op2 mode)
864 (.str name "arithmetic" )
865 ((PIPE OS) (IDOC ALU))
866 (.str insn " $"op1 ",$hash$"op2)
867 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
868 (set mode op1 (insn1 mode op1 op2))
872 (arithmetic12 addbrim addb add OP1_0 OP2_7 regb8 uimm8 QI)
873 (arithmetic12 subbrim subb sub OP1_2 OP2_7 regb8 uimm8 QI)
875 ;add/sub register and immediate with carry
876 (define-pmacro (arithmetic13 name insn insn1 opc1 opc2 op1 op2 mode)
878 (.str name "arithmetic" )
879 ((PIPE OS) (IDOC ALU))
880 (.str insn " $"op1 ",$hash$"op2)
881 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
882 (set mode op1 (insn1 mode op1 op2 cbit))
886 (arithmetic13 addcri addc addc OP1_1 OP2_8 dr uimm3 HI)
887 (arithmetic13 subcri subc subc OP1_3 OP2_8 dr uimm3 HI)
888 (arithmetic13 addcbri addcb addc OP1_1 OP2_9 drb uimm3 QI)
889 (arithmetic13 subcbri subcb subc OP1_3 OP2_9 drb uimm3 QI)
891 ;add/sub register and immediate with carry
892 (define-pmacro (arithmetic14 name insn insn1 opc1 opc2 op1 op2 mode)
894 (.str name "arithmetic" )
895 ((PIPE OS) (IDOC ALU))
896 (.str insn " $"op1 ",$hash$"op2)
897 (+ opc1 opc2 op1 op2)
898 (set mode op1 (insn1 mode op1 op2 cbit))
902 (arithmetic14 addcrim addc addc OP1_1 OP2_6 reg8 uimm16 HI)
903 (arithmetic14 subcrim subc subc OP1_3 OP2_6 reg8 uimm16 HI)
905 ;add/sub register and immediate with carry
906 (define-pmacro (arithmetic15 name insn insn1 opc1 opc2 op1 op2 mode)
908 (.str name "arithmetic" )
909 ((PIPE OS) (IDOC ALU))
910 (.str insn " $"op1 ",$hash$"op2)
911 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
912 (set mode op1 (insn1 mode op1 op2 cbit))
916 (arithmetic15 addcbrim addcb addc OP1_1 OP2_7 regb8 uimm8 QI)
917 (arithmetic15 subcbrim subcb subc OP1_3 OP2_7 regb8 uimm8 QI)
921 (define-pmacro (arithmetic name insn insn1 opc1 opc2 op1 op2 mode)
923 (.str name "arithmetic" )
924 ((PIPE OS) (IDOC ALU))
925 (.str insn " $"op1 ",$"op2)
926 (+ opc1 opc2 op1 op2)
927 (set mode op1 (insn1 mode op1 op2))
931 (arithmetic addr add add OP1_0 OP2_0 dr sr HI)
932 (arithmetic subr sub sub OP1_2 OP2_0 dr sr HI)
933 (arithmetic addbr addb add OP1_0 OP2_1 drb srb QI)
934 (arithmetic subbr subb sub OP1_2 OP2_1 drb srb QI)
936 ;add/sub register and indirect memory
937 (define-pmacro (arithmetic1 name insn insn1 opc1 opc2 op1 op2 mode)
939 (.str name "arithmetic" )
940 ((PIPE OS) (IDOC ALU))
941 (.str insn " $"op1 ",[$"op2"]")
942 (+ opc1 opc2 op1 (f-op-bit2 2) op2)
943 (set mode op1 (insn1 mode op1 (mem HI op2)))
947 (arithmetic1 add2 add add OP1_0 OP2_8 dr sr2 HI)
948 (arithmetic1 sub2 sub sub OP1_2 OP2_8 dr sr2 HI)
949 (arithmetic1 addb2 addb add OP1_0 OP2_9 drb sr2 QI)
950 (arithmetic1 subb2 subb sub OP1_2 OP2_9 drb sr2 QI)
952 ;add/sub register and indirect memory post increment
953 (define-pmacro (arithmetic2 name insn insn1 opc1 opc2 op1 op2 mode)
955 (.str name "arithmetic" )
956 ((PIPE OS) (IDOC ALU))
957 (.str insn " $"op1 ",[$"op2"+]")
958 (+ opc1 opc2 op1 (f-op-bit2 3) op2)
960 (set mode op1 (insn1 mode op1 (mem HI op2)))
961 (set HI op2 (add HI op2 (const 2)))
966 (arithmetic2 add2i add add OP1_0 OP2_8 dr sr2 HI)
967 (arithmetic2 sub2i sub sub OP1_2 OP2_8 dr sr2 HI)
968 (arithmetic2 addb2i addb add OP1_0 OP2_9 drb sr2 QI)
969 (arithmetic2 subb2i subb sub OP1_2 OP2_9 drb sr2 QI)
971 ;add/sub registers with carry
972 (define-pmacro (arithmetic3 name insn insn1 opc1 opc2 op1 op2 mode)
974 (.str name "arithmetic" )
975 ((PIPE OS) (IDOC ALU))
976 (.str insn " $"op1 ",$"op2)
977 (+ opc1 opc2 op1 op2)
978 (set mode op1 (insn1 mode op1 op2 cbit))
982 (arithmetic3 addcr addc addc OP1_1 OP2_0 dr sr HI)
983 (arithmetic3 subcr subc subc OP1_3 OP2_0 dr sr HI)
984 (arithmetic3 addbcr addcb addc OP1_1 OP2_1 drb srb QI)
985 (arithmetic3 subbcr subcb subc OP1_3 OP2_1 drb srb QI)
988 ;add/sub register and indirect memory
989 (define-pmacro (arithmetic4 name insn insn1 opc1 opc2 op1 op2 mode)
991 (.str name "arithmetic" )
992 ((PIPE OS) (IDOC ALU))
993 (.str insn " $"op1 ",[$"op2"]")
994 (+ opc1 opc2 op1 (f-op-bit2 2) op2)
995 (set mode op1 (insn1 mode op1 (mem HI op2) cbit))
999 (arithmetic4 addcr2 addc addc OP1_1 OP2_8 dr sr2 HI)
1000 (arithmetic4 subcr2 subc subc OP1_3 OP2_8 dr sr2 HI)
1001 (arithmetic4 addbcr2 addcb addc OP1_1 OP2_9 drb sr2 QI)
1002 (arithmetic4 subbcr2 subcb subc OP1_3 OP2_9 drb sr2 QI)
1004 ;add/sub register and indirect memory post increment
1005 (define-pmacro (arithmetic5 name insn insn1 opc1 opc2 op1 op2 mode)
1007 (.str name "arithmetic" )
1008 ((PIPE OS) (IDOC ALU))
1009 (.str insn " $"op1 ",[$"op2"+]")
1010 (+ opc1 opc2 op1 (f-op-bit2 3) op2)
1012 (set mode op1 (insn1 mode op1 (mem HI op2) cbit))
1013 (set HI op2 (add HI op2 (const 2)))
1018 (arithmetic5 addcr2i addc addc OP1_1 OP2_8 dr sr2 HI)
1019 (arithmetic5 subcr2i subc subc OP1_3 OP2_8 dr sr2 HI)
1020 (arithmetic5 addbcr2i addcb addc OP1_1 OP2_9 drb sr2 QI)
1021 (arithmetic5 subbcr2i subcb subc OP1_3 OP2_9 drb sr2 QI)
1023 ;add/sub register and direct memory
1024 (define-pmacro (arithmetic6 name insn insn1 opc1 opc2 op1 op2 mode)
1026 (.str name "arithmetic" )
1027 ((PIPE OS) (IDOC ALU))
1028 (.str insn " $"op1 ",$"op2)
1029 (+ opc1 opc2 op1 op2)
1030 (set mode op1 (insn1 mode op1 op2))
1035 ;add/sub register and direct memory
1036 (define-pmacro (arithmetic7 name insn insn1 opc1 opc2 op1 op2 mode)
1038 (.str name "arithmetic" )
1039 ((PIPE OS) (IDOC ALU))
1040 (.str insn " $"op1 ",$"op2)
1041 (+ opc1 opc2 op2 op1)
1042 (set (mem HI op1) (insn1 (mem HI op1) op2))
1046 (arithmetic6 addrm2 add add OP1_0 OP2_2 regmem8 memgr8 HI)
1047 (arithmetic7 addrm3 add add OP1_0 OP2_4 memgr8 regmem8 HI)
1048 (arithmetic6 addrm add add OP1_0 OP2_2 reg8 memory HI)
1049 (arithmetic7 addrm1 add add OP1_0 OP2_4 memory reg8 HI)
1050 (arithmetic6 subrm3 sub sub OP1_2 OP2_2 regmem8 memgr8 HI)
1051 (arithmetic7 subrm2 sub sub OP1_2 OP2_4 memgr8 regmem8 HI)
1052 (arithmetic6 subrm1 sub sub OP1_2 OP2_2 reg8 memory HI)
1053 (arithmetic7 subrm sub sub OP1_2 OP2_4 memory reg8 HI)
1054 (arithmetic6 addbrm2 addb add OP1_0 OP2_3 regbmem8 memgr8 QI)
1055 (arithmetic7 addbrm3 addb add OP1_0 OP2_5 memgr8 regbmem8 QI)
1056 (arithmetic6 addbrm addb add OP1_0 OP2_3 regb8 memory QI)
1057 (arithmetic7 addbrm1 addb add OP1_0 OP2_5 memory regb8 QI)
1058 (arithmetic6 subbrm3 subb sub OP1_2 OP2_3 regbmem8 memgr8 QI)
1059 (arithmetic7 subbrm2 subb sub OP1_2 OP2_5 memgr8 regbmem8 QI)
1060 (arithmetic6 subbrm1 subb sub OP1_2 OP2_3 regb8 memory QI)
1061 (arithmetic7 subbrm subb sub OP1_2 OP2_5 memory regb8 QI)
1063 ;add/sub registers with carry
1064 (define-pmacro (arithmetic8 name insn insn1 opc1 opc2 op1 op2 mode)
1066 (.str name "arithmetic" )
1067 ((PIPE OS) (IDOC ALU))
1068 (.str insn " $"op1 ",$"op2)
1069 (+ opc1 opc2 op1 op2)
1070 (set mode op1 (insn1 mode op1 op2 cbit))
1075 ;add/sub registers with carry
1076 (define-pmacro (arithmetic9 name insn insn1 opc1 opc2 op1 op2 mode)
1078 (.str name "arithmetic" )
1079 ((PIPE OS) (IDOC ALU))
1080 (.str insn " $"op1 ",$"op2)
1081 (+ opc1 opc2 op2 op1)
1082 (set (mem HI op1) (insn1 (mem HI op1) op2 cbit))
1086 (arithmetic8 addcrm2 addc addc OP1_1 OP2_2 regmem8 memgr8 HI)
1087 (arithmetic9 addcrm3 addc addc OP1_1 OP2_4 memgr8 regmem8 HI)
1088 (arithmetic8 addcrm addc addc OP1_1 OP2_2 reg8 memory HI)
1089 (arithmetic9 addcrm1 addc addc OP1_1 OP2_4 memory reg8 HI)
1090 (arithmetic8 subcrm3 subc subc OP1_3 OP2_2 regmem8 memgr8 HI)
1091 (arithmetic9 subcrm2 subc subc OP1_3 OP2_4 memgr8 regmem8 HI)
1092 (arithmetic8 subcrm1 subc subc OP1_3 OP2_2 reg8 memory HI)
1093 (arithmetic9 subcrm subc subc OP1_3 OP2_4 memory reg8 HI)
1094 (arithmetic8 addcbrm2 addcb addc OP1_1 OP2_3 regbmem8 memgr8 QI)
1095 (arithmetic9 addcbrm3 addcb addc OP1_1 OP2_5 memgr8 regbmem8 QI)
1096 (arithmetic8 addcbrm addcb addc OP1_1 OP2_3 regb8 memory QI)
1097 (arithmetic9 addcbrm1 addcb addc OP1_1 OP2_5 memory regb8 QI)
1098 (arithmetic8 subcbrm3 subcb subc OP1_3 OP2_3 regbmem8 memgr8 QI)
1099 (arithmetic9 subcbrm2 subcb subc OP1_3 OP2_5 memgr8 regbmem8 QI)
1100 (arithmetic8 subcbrm1 subcb subc OP1_3 OP2_3 regb8 memory QI)
1101 (arithmetic9 subcbrm subcb subc OP1_3 OP2_5 memory regb8 QI)
1104 (dni muls "signed multiplication"
1105 ((PIPE OS) (IDOC ALU))
1107 (+ OP1_0 OP2_11 src1 src2)
1108 (nop) ;; FIXME: (reg SI h-md 0)
1112 (dni mulu "unsigned multiplication"
1113 ((PIPE OS) (IDOC ALU))
1115 (+ OP1_1 OP2_11 src1 src2)
1116 (nop) ;; FIXME: (reg SI h-md 0)
1120 (dni div "16-by-16 signed division"
1121 ((PIPE OS) (IDOC ALU))
1123 (+ OP1_4 OP2_11 srdiv )
1125 (set HI (reg HI h-cr 6) (div HI (reg HI h-cr 6) srdiv))
1126 (set HI (reg HI h-cr 7) (mod HI (reg HI h-cr 6) srdiv))
1131 (dni divl "32-by16 signed division"
1132 ((PIPE OS) (IDOC ALU))
1134 (+ OP1_6 OP2_11 srdiv )
1136 (set HI (reg HI h-cr 6) 0) ;; FIXME: (div SI (reg SI h-md 0) srdiv))
1137 (set HI (reg HI h-cr 7) 0) ;; FIXME: (mod SI (reg SI h-md 0) srdiv))
1142 (dni divlu "32-by16 unsigned division"
1143 ((PIPE OS) (IDOC ALU))
1145 (+ OP1_7 OP2_11 srdiv )
1147 (set HI (reg HI h-cr 6) 0) ;; FIXME: (udiv SI (reg SI h-md 0) srdiv))
1148 (set HI (reg HI h-cr 7) 0) ;; FIXME: (umod SI (reg SI h-md 0) srdiv))
1153 (dni divu "16-by-16 unsigned division"
1154 ((PIPE OS) (IDOC ALU))
1156 (+ OP1_5 OP2_11 srdiv )
1158 (set HI (reg HI h-cr 6) (udiv HI (reg HI h-cr 6) srdiv))
1159 (set HI (reg HI h-cr 7) (umod HI (reg HI h-cr 6) srdiv))
1164 ;Integer one's complement
1166 (dni cpl "Integer Ones complement"
1167 ((PIPE OS) (IDOC MISC))
1169 (+ OP1_9 OP2_1 dr (f-op-bit4 0))
1170 (set dr (inv HI dr))
1174 ;Bytes one's complement
1176 (dni cplb "Byte Ones complement"
1177 ((PIPE OS) (IDOC MISC))
1179 (+ OP1_11 OP2_1 drb (f-op-bit4 0))
1180 (set drb (inv QI drb))
1183 ;Integer two's complement
1185 (dni neg "Integer two's complement"
1186 ((PIPE OS) (IDOC MISC))
1188 (+ OP1_8 OP2_1 dr (f-op-bit4 0))
1189 (set dr (neg HI dr))
1192 ;Bytes two's complement
1194 (dni negb "byte twos complement"
1195 ((PIPE OS) (IDOC MISC))
1197 (+ OP1_10 OP2_1 drb (f-op-bit4 0))
1198 (set drb (neg QI drb))
1202 ;****************************************************************
1204 ;****************************************************************
1205 ;and/or/xor registers
1206 (define-pmacro (logical name insn insn1 opc1 opc2 op1 op2 mode)
1208 (.str name "logical" )
1209 ((PIPE OS) (IDOC ALU))
1210 (.str insn " $"op1 ",$"op2)
1211 (+ opc1 opc2 op1 op2)
1212 (set mode op1 (insn1 mode op1 op2))
1217 (logical andr and and OP1_6 OP2_0 dr sr HI)
1218 (logical orr or or OP1_7 OP2_0 dr sr HI)
1219 (logical xorr xor xor OP1_5 OP2_0 dr sr HI)
1220 (logical andbr andb and OP1_6 OP2_1 drb srb QI)
1221 (logical orbr orb or OP1_7 OP2_1 drb srb QI)
1222 (logical xorbr xorb xor OP1_5 OP2_1 drb srb QI)
1224 ;and/or/xor register and immediate
1225 (define-pmacro (logical1 name insn insn1 opc1 opc2 op1 op2 mode)
1227 (.str name "logical" )
1228 ((PIPE OS) (IDOC ALU))
1229 (.str insn " $"op1 ",$hash$"op2)
1230 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
1231 (set mode op1 (insn1 mode op1 op2))
1235 (logical1 andri and and OP1_6 OP2_8 dr uimm3 HI)
1236 (logical1 orri or or OP1_7 OP2_8 dr uimm3 HI)
1237 (logical1 xorri xor xor OP1_5 OP2_8 dr uimm3 HI)
1238 (logical1 andbri andb and OP1_6 OP2_9 drb uimm3 QI)
1239 (logical1 orbri orb or OP1_7 OP2_9 drb uimm3 QI)
1240 (logical1 xorbri xorb xor OP1_5 OP2_9 drb uimm3 QI)
1242 ;and/or/xor register and immediate
1243 (define-pmacro (logical2 name insn insn1 opc1 opc2 op1 op2 mode)
1245 (.str name "logical" )
1246 ((PIPE OS) (IDOC ALU))
1247 (.str insn " $"op1 ",$hash$"op2)
1248 (+ opc1 opc2 op1 op2)
1249 (set mode op1 (insn1 mode op1 op2))
1253 (logical2 andrim and and OP1_6 OP2_6 reg8 uimm16 HI)
1254 (logical2 orrim or or OP1_7 OP2_6 reg8 uimm16 HI)
1255 (logical2 xorrim xor xor OP1_5 OP2_6 reg8 uimm16 HI)
1257 ;and/or/xor register and immediate
1258 (define-pmacro (logical3 name insn insn1 opc1 opc2 op1 op2 mode)
1260 (.str name "logical" )
1261 ((PIPE OS) (IDOC ALU))
1262 (.str insn " $"op1 ",$hash$"op2)
1263 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
1264 (set mode op1 (insn1 mode op1 op2))
1268 (logical3 andbrim andb and OP1_6 OP2_7 regb8 uimm8 QI)
1269 (logical3 orbrim orb or OP1_7 OP2_7 regb8 uimm8 QI)
1270 (logical3 xorbrim xorb xor OP1_5 OP2_7 regb8 uimm8 QI)
1272 ;and/or/xor register and indirect memory
1273 (define-pmacro (logical4 name insn insn1 opc1 opc2 op1 op2 mode)
1275 (.str name "logical" )
1276 ((PIPE OS) (IDOC ALU))
1277 (.str insn " $"op1 ",[$"op2"]")
1278 (+ opc1 opc2 op1 (f-op-bit2 2) op2)
1279 (set mode op1 (insn1 mode op1 (mem HI op2)))
1283 (logical4 and2 and and OP1_6 OP2_8 dr sr2 HI)
1284 (logical4 or2 or or OP1_7 OP2_8 dr sr2 HI)
1285 (logical4 xor2 xor xor OP1_5 OP2_8 dr sr2 HI)
1286 (logical4 andb2 andb and OP1_6 OP2_9 drb sr2 QI)
1287 (logical4 orb2 orb or OP1_7 OP2_9 drb sr2 QI)
1288 (logical4 xorb2 xorb xor OP1_5 OP2_9 drb sr2 QI)
1290 ;and/or/xor register and indirect memory post increment
1291 (define-pmacro (logical5 name insn insn1 opc1 opc2 op1 op2 mode)
1293 (.str name "logical" )
1294 ((PIPE OS) (IDOC ALU))
1295 (.str insn " $"op1 ",[$"op2"+]")
1296 (+ opc1 opc2 op1 (f-op-bit2 3) op2)
1298 (set mode op1 (insn1 mode op1 (mem HI op2)))
1299 (set HI op2 (add HI op2 (const 2)))
1304 (logical5 and2i and and OP1_6 OP2_8 dr sr2 HI)
1305 (logical5 or2i or or OP1_7 OP2_8 dr sr2 HI)
1306 (logical5 xor2i xor xor OP1_5 OP2_8 dr sr2 HI)
1307 (logical5 andb2i andb and OP1_6 OP2_9 drb sr2 QI)
1308 (logical5 orb2i orb or OP1_7 OP2_9 drb sr2 QI)
1309 (logical5 xorb2i xorb xor OP1_5 OP2_9 drb sr2 QI)
1311 ;add/sub register and immediate
1312 (define-pmacro (logical7 name insn insn1 opc1 opc2 op1 op2 mode dir)
1314 (.str name "arithmetic" )
1315 ((PIPE OS) (IDOC ALU))
1316 (.str insn " $"dir"$"op1 ",$"op2)
1317 (+ opc1 opc2 op1 op2)
1318 (set (mem HI op1) (insn1 (mem HI op1) op2 ))
1322 (logical7 andpofr and and OP1_6 OP2_2 reg8 upof16 HI "pof")
1323 (logical7 orpofr or or OP1_7 OP2_2 reg8 upof16 HI "pof")
1324 (logical7 xorpofr xor xor OP1_5 OP2_2 reg8 upof16 HI "pof")
1325 (logical7 andbpofr andb and OP1_6 OP2_3 regb8 upof16 QI "pof")
1326 (logical7 orbpofr orb or OP1_7 OP2_3 regb8 upof16 QI "pof")
1327 (logical7 xorbpofr xorb xor OP1_5 OP2_3 regb8 upof16 QI "pof")
1329 ;add/sub register and immediate
1330 (define-pmacro (logical8 name insn insn1 opc1 opc2 op1 op2 mode dir)
1332 (.str name "arithmetic" )
1333 ((PIPE OS) (IDOC ALU))
1334 (.str insn " $"dir"$"op1 ",$"op2)
1335 (+ opc1 opc2 op1 op2)
1336 (set (mem HI op1) (insn1 (mem HI op1) op2 ))
1340 (logical8 andrpofr and and OP1_6 OP2_4 upof16 reg8 HI "pof")
1341 (logical8 orrpofr or or OP1_7 OP2_4 upof16 reg8 HI "pof")
1342 (logical8 xorrpofr xor xor OP1_5 OP2_4 upof16 reg8 HI "pof")
1343 (logical8 andbrpofr andb and OP1_6 OP2_5 upof16 regb8 QI "pof")
1344 (logical8 orbrpofr orb or OP1_7 OP2_5 upof16 regb8 QI "pof")
1345 (logical8 xorbrpofr xorb xor OP1_5 OP2_5 upof16 regb8 QI "pof")
1347 ;and/or/xor register and direct memory
1348 (define-pmacro (logical6 name insn insn1 opc1 opc2 op1 op2 mode)
1350 (.str name "arithmetic" )
1351 ((PIPE OS) (IDOC ALU))
1352 (.str insn " $"op1 ",$"op2)
1353 (+ opc1 opc2 op1 op2)
1354 (set mode op1 (insn1 mode op1 op2))
1359 ;and/or/xor register and direct memory
1360 (define-pmacro (logical7 name insn insn1 opc1 opc2 op1 op2 mode)
1362 (.str name "arithmetic" )
1363 ((PIPE OS) (IDOC ALU))
1364 (.str insn " $"op1 ",$"op2)
1365 (+ opc1 opc2 op2 op1)
1366 (set (mem HI op1) (insn1 (mem HI op1) op2))
1370 (logical6 andrm2 and and OP1_6 OP2_2 regmem8 memgr8 HI)
1371 (logical7 andrm3 and and OP1_6 OP2_4 memgr8 regmem8 HI)
1372 (logical6 andrm and and OP1_6 OP2_2 reg8 memory HI)
1373 (logical7 andrm1 and and OP1_6 OP2_4 memory reg8 HI)
1374 (logical6 orrm3 or or OP1_7 OP2_2 regmem8 memgr8 HI)
1375 (logical7 orrm2 or or OP1_7 OP2_4 memgr8 regmem8 HI)
1376 (logical6 orrm1 or or OP1_7 OP2_2 reg8 memory HI)
1377 (logical7 orrm or or OP1_7 OP2_4 memory reg8 HI)
1378 (logical6 xorrm3 xor xor OP1_5 OP2_2 regmem8 memgr8 HI)
1379 (logical7 xorrm2 xor xor OP1_5 OP2_4 memgr8 regmem8 HI)
1380 (logical6 xorrm1 xor xor OP1_5 OP2_2 reg8 memory HI)
1381 (logical7 xorrm xor xor OP1_5 OP2_4 memory reg8 HI)
1382 (logical6 andbrm2 andb and OP1_6 OP2_3 regbmem8 memgr8 QI)
1383 (logical7 andbrm3 andb and OP1_6 OP2_5 memgr8 regbmem8 QI)
1384 (logical6 andbrm andb and OP1_6 OP2_3 regb8 memory QI)
1385 (logical7 andbrm1 andb and OP1_6 OP2_5 memory regb8 QI)
1386 (logical6 orbrm3 orb or OP1_7 OP2_3 regbmem8 memgr8 QI)
1387 (logical7 orbrm2 orb or OP1_7 OP2_5 memgr8 regbmem8 QI)
1388 (logical6 orbrm1 orb or OP1_7 OP2_3 regb8 memory QI)
1389 (logical7 orbrm orb or OP1_7 OP2_5 memory regb8 QI)
1390 (logical6 xorbrm3 xorb xor OP1_5 OP2_3 regbmem8 memgr8 QI)
1391 (logical7 xorbrm2 xorb xor OP1_5 OP2_5 memgr8 regbmem8 QI)
1392 (logical6 xorbrm1 xorb xor OP1_5 OP2_3 regb8 memory QI)
1393 (logical7 xorbrm xorb xor OP1_5 OP2_5 memory regb8 QI)
1395 ;****************************************************************
1397 ;****************************************************************
1399 (define-pmacro (move name insn opc1 opc2 op1 op2 mode)
1401 (.str name "mov registers" )
1402 ((PIPE OS) (IDOC MOVE))
1403 (.str insn " $"op1 ",$"op2)
1404 (+ opc1 opc2 op1 op2)
1409 (move movr mov OP1_15 OP2_0 dr sr HI)
1410 (move movrb movb OP1_15 OP2_1 drb srb HI)
1412 ;mov register and immediate
1413 (define-pmacro (move1 name insn opc1 opc2 op1 op2 mode)
1416 ((PIPE OS) (IDOC MOVE))
1417 (.str insn " $"op1 ",$hash$"op2)
1418 (+ opc1 opc2 op2 op1)
1423 (move1 movri mov OP1_14 OP2_0 dri u4 HI)
1424 (move1 movbri movb OP1_14 OP2_1 srb u4 QI)
1427 (dni movi "move immediate to register"
1428 ((PIPE OS) (IDOC MOVE))
1429 "mov $reg8,$hash$uimm16"
1430 (+ OP1_14 OP2_6 reg8 uimm16)
1431 (set HI reg8 uimm16)
1436 (dni movbi "move immediate to register"
1437 ((PIPE OS) (IDOC MOVE))
1438 "movb $regb8,$hash$uimm8"
1439 (+ OP1_14 OP2_7 regb8 uimm8 (f-op-bit8 0))
1440 (set QI regb8 uimm8)
1444 ;move and indirect memory
1445 (define-pmacro (mov2 name insn opc1 opc2 op1 op2 mode)
1448 ((PIPE OS) (IDOC MOVE))
1449 (.str insn " $"op1 ",[$"op2"]")
1450 (+ opc1 opc2 op1 op2)
1451 (set mode op1 (mem HI op2))
1455 (mov2 movr2 mov OP1_10 OP2_8 dr sr HI)
1456 (mov2 movbr2 movb OP1_10 OP2_9 drb sr QI)
1458 ;move and indirect memory
1459 (define-pmacro (mov3 name insn opc1 opc2 op1 op2 mode)
1462 ((PIPE OS) (IDOC MOVE))
1463 (.str insn " [$"op2 "],$"op1)
1464 (+ opc1 opc2 op1 op2)
1465 (set mode op1 (mem HI op2))
1469 (mov3 movri2 mov OP1_11 OP2_8 dr sr HI)
1470 (mov3 movbri2 movb OP1_11 OP2_9 drb sr QI)
1472 ;move and indirect memory
1473 (define-pmacro (mov4 name insn opc1 opc2 op1 op2 mode)
1476 ((PIPE OS) (IDOC MOVE))
1477 (.str insn " [-$"op2 "],$"op1)
1478 (+ opc1 opc2 op1 op2)
1480 (set op1 (sub op2 (const HI 2)))
1481 (set HI (mem HI op2) op1)
1486 (mov4 movri3 mov OP1_8 OP2_8 dr sr HI)
1487 (mov4 movbri3 movb OP1_8 OP2_9 drb sr QI)
1489 ;mov register and indirect memory post increment
1490 (define-pmacro (mov5 name insn opc1 opc2 op1 op2 mode)
1493 ((PIPE OS) (IDOC MOVE))
1494 (.str insn " $"op1 ",[$"op2"+]")
1495 (+ opc1 opc2 op1 op2)
1497 (set mode op1 (mem HI op2))
1498 (set HI op2 (add HI op2 (const 2)))
1503 (mov5 mov2i mov OP1_9 OP2_8 dr sr HI)
1504 (mov5 movb2i movb OP1_9 OP2_9 drb sr HI)
1506 ;mov indirect memory
1507 (define-pmacro (mov6 name insn opc1 opc2 op1 op2 mode)
1510 ((PIPE OS) (IDOC MOVE))
1511 (.str insn " [$"op1 "],[$"op2"]")
1512 (+ opc1 opc2 op1 op2)
1513 (set HI (mem HI op1) (mem HI op2))
1517 (mov6 mov6i mov OP1_12 OP2_8 dr sr HI)
1518 (mov6 movb6i movb OP1_12 OP2_9 dr sr HI)
1520 ;mov indirect memory
1521 (define-pmacro (mov7 name insn opc1 opc2 op1 op2 mode)
1524 ((PIPE OS) (IDOC MOVE))
1525 (.str insn " [$"op1 "+],[$"op2"]")
1526 (+ opc1 opc2 op1 op2)
1528 (set mode (mem mode op1) (mem mode op2))
1529 (set mode op1 (add mode op1 (const mode 2)))
1534 (mov7 mov7i mov OP1_13 OP2_8 dr sr HI)
1535 (mov7 movb7i movb OP1_13 OP2_9 dr sr HI)
1537 ;mov indirect memory
1538 (define-pmacro (mov8 name insn opc1 opc2 op1 op2 mode)
1541 ((PIPE OS) (IDOC MOVE))
1542 (.str insn " [$"op1 "],[$"op2"+]")
1543 (+ opc1 opc2 op1 op2)
1545 (set mode (mem mode op1) (mem mode op2))
1546 (set mode op2 (add mode op2 (const mode 2)))
1551 (mov8 mov8i mov OP1_14 OP2_8 dr sr HI)
1552 (mov8 movb8i movb OP1_14 OP2_9 dr sr HI)
1554 ;mov indirect memory
1555 (define-pmacro (mov9 name insn opc1 opc2 op1 op2 mode)
1558 ((PIPE OS) (IDOC MOVE))
1559 (.str insn " $"op1 ",[$"op2"+$hash$"uimm16"]")
1560 (+ opc1 opc2 op1 op2 uimm16)
1561 (sequence ((mode tmp1))
1562 (set mode tmp1 (add HI op2 uimm16))
1563 (set mode op1 (mem HI tmp1))
1568 (mov9 mov9i mov OP1_13 OP2_4 dr sr HI)
1569 (mov9 movb9i movb OP1_15 OP2_4 drb sr QI)
1571 ;mov indirect memory
1572 (define-pmacro (mov10 name insn opc1 opc2 op1 op2 mode)
1575 ((PIPE OS) (IDOC MOVE))
1576 (.str insn " [$"op2"+$hash$"uimm16 "],$"op1)
1577 (+ opc1 opc2 op1 op2 uimm16)
1578 (sequence ((mode tmp1))
1579 (set mode tmp1 (add HI op1 uimm16))
1580 (set mode (mem HI tmp1) op1)
1585 (mov10 mov10i mov OP1_12 OP2_4 dr sr HI)
1586 (mov10 movb10i movb OP1_14 OP2_4 drb sr QI)
1588 ;move and indirect memory
1589 (define-pmacro (mov11 name insn opc1 opc2 op1 op2 mode)
1592 ((PIPE OS) (IDOC MOVE))
1593 (.str insn " [$"op1 "],$"op2)
1594 (+ opc1 opc2 (f-op-lbit4 0) op1 op2)
1595 (set (mem mode op1) (mem HI op2))
1599 (mov11 movri11 mov OP1_8 OP2_4 src2 memory HI)
1600 (mov11 movbri11 movb OP1_10 OP2_4 src2 memory HI)
1602 ;move and indirect memory
1603 (define-pmacro (mov12 name insn opc1 opc2 op1 op2 mode)
1606 ((PIPE OS) (IDOC MOVE))
1607 (.str insn " $"op2 ",[$"op1"]")
1608 (+ opc1 opc2 (f-op-lbit4 0) op1 op2)
1609 (set (mem HI op2) (mem mode op1))
1613 (mov12 movri12 mov OP1_9 OP2_4 src2 memory HI)
1614 (mov12 movbri12 movb OP1_11 OP2_4 src2 memory HI)
1616 (define-pmacro (movemem3 name insn opc1 opc2 op1 op2 dir)
1619 ((PIPE OS) (IDOC MOVE))
1620 (.str insn " $"op1 ",$hash$"dir"$"op2)
1621 (+ opc1 opc2 op1 op2)
1626 (movemem3 movehm5 mov OP1_14 OP2_6 regoff8 upof16 "pof")
1627 (movemem3 movehm6 mov OP1_14 OP2_6 regoff8 upag16 "pag")
1628 (movemem3 movehm7 mov OP1_14 OP2_6 regoff8 useg16 "segm")
1629 (movemem3 movehm8 mov OP1_14 OP2_6 regoff8 usof16 "sof")
1631 (define-pmacro (movemem4 name insn opc1 opc2 op1 op2 dir)
1634 ((PIPE OS) (IDOC MOVE))
1635 (.str insn " $"op1 ",$hash$"dir"$"op2)
1636 (+ opc1 opc2 op1 op2 (f-op-bit8 0))
1641 (movemem4 movehm9 movb OP1_14 OP2_7 regb8 uimm8 "pof")
1642 (movemem4 movehm10 movb OP1_14 OP2_7 regoff8 uimm8 "pag")
1644 (define-pmacro (movemem name insn opc1 opc2 op1 op2 mode dir)
1647 ((PIPE OS) (IDOC MOVE))
1648 (.str insn " $"op1 ",$"dir"$"op2)
1649 (+ opc1 opc2 op1 op2)
1650 (set mode op1 (mem HI op2))
1654 (movemem movrmp mov OP1_15 OP2_2 regoff8 upof16 HI "pof")
1655 (movemem movrmp1 movb OP1_15 OP2_3 regb8 upof16 QI "pof")
1656 (movemem movrmp2 mov OP1_15 OP2_2 regoff8 upag16 HI "pag")
1657 (movemem movrmp3 movb OP1_15 OP2_3 regb8 upag16 QI "pag")
1659 (define-pmacro (movemem1 name insn opc1 opc2 op1 op2 dir)
1662 ((PIPE OS) (IDOC MOVE))
1663 (.str insn " $"dir"$"op1 ",$"op2)
1664 (+ opc1 opc2 op2 op1)
1665 (set (mem HI op1) op2 )
1669 (movemem1 movrmp4 mov OP1_15 OP2_6 upof16 regoff8 "pof")
1670 (movemem1 movrmp5 movb OP1_15 OP2_7 upof16 regb8 "pof")
1672 (define-pmacro (movemem2 name insn opc1 opc2 op1 op2 mode dir)
1675 ((PIPE OS) (IDOC MOVE))
1676 (.str insn " $"op1 ",$hash$"dir"$"op2)
1677 (+ opc1 opc2 op2 op1)
1682 (movemem2 movehm1 mov OP1_14 OP2_0 dri u4 HI "pof")
1683 (movemem2 movehm2 movb OP1_14 OP2_1 srb u4 QI "pof")
1684 (movemem2 movehm3 mov OP1_14 OP2_0 dri u4 HI "pag")
1685 (movemem2 movehm4 movb OP1_14 OP2_1 srb u4 QI "pag")
1687 ;move register and direct memory
1688 (define-pmacro (move12 name insn opc1 opc2 op1 op2 mode)
1691 ((PIPE OS) (IDOC MOVE))
1692 (.str insn " $"op1 ",$"op2)
1693 (+ opc1 opc2 op1 op2)
1694 (set mode op1 (mem HI op2))
1699 ;move register and direct memory
1700 (define-pmacro (move13 name insn opc1 opc2 op1 op2 mode)
1703 ((PIPE OS) (IDOC MOVE))
1704 (.str insn " $"op1 ",$"op2)
1705 (+ opc1 opc2 op2 op1)
1706 (set (mem HI op1) op2)
1710 (move12 mve12 mov OP1_15 OP2_2 regmem8 memgr8 HI)
1711 (move13 mve13 mov OP1_15 OP2_6 memgr8 regmem8 HI)
1712 (move12 mover12 mov OP1_15 OP2_2 reg8 memory HI)
1713 (move13 mvr13 mov OP1_15 OP2_6 memory reg8 HI)
1714 (move12 mver12 movb OP1_15 OP2_3 regbmem8 memgr8 QI)
1715 (move13 mver13 movb OP1_15 OP2_7 memgr8 regbmem8 QI)
1716 (move12 movr12 movb OP1_15 OP2_3 regb8 memory QI)
1717 (move13 movr13 movb OP1_15 OP2_7 memory regb8 QI)
1720 (dni movbsrr "mov byte register with sign extension to word register"
1721 ((PIPE OS) (IDOC MOVE))
1723 (+ OP1_13 OP2_0 drb sr)
1725 (if (and QI drb (const 128))
1726 (set HI sr (or HI (const HI 65280) drb)))
1727 (set HI sr (and HI (const HI 255) drb))
1733 (dni movbzrr "mov byte register with zero extension to word register"
1734 ((PIPE OS) (IDOC MOVE))
1736 (+ OP1_12 OP2_0 drb sr)
1737 (set HI sr (and HI (const HI 255) drb))
1742 (dni movbsrpofm "mov memory to byte register"
1743 ((PIPE OS) (IDOC MOVE))
1744 "movbs $regmem8,$pof$upof16"
1745 (+ OP1_13 OP2_2 regmem8 upof16)
1746 (set QI regmem8 (mem HI upof16))
1751 (dni movbspofmr "mov memory to byte register"
1752 ((PIPE OS) (IDOC MOVE))
1753 "movbs $pof$upof16,$regbmem8"
1754 (+ OP1_13 OP2_5 upof16 regbmem8 )
1755 (set QI (mem HI upof16) regbmem8)
1760 (dni movbzrpofm "mov memory to byte register"
1761 ((PIPE OS) (IDOC MOVE))
1762 "movbz $reg8,$pof$upof16"
1763 (+ OP1_12 OP2_2 reg8 upof16)
1764 (set QI reg8 (mem HI upof16))
1769 (dni movbzpofmr "mov memory to byte register"
1770 ((PIPE OS) (IDOC MOVE))
1771 "movbz $pof$upof16,$regb8"
1772 (+ OP1_12 OP2_5 upof16 regb8 )
1773 (set QI (mem HI upof16) regb8)
1777 ;move register and direct memory
1778 (define-pmacro (move14 name insn opc1 opc2 op1 op2 )
1781 ((PIPE OS) (IDOC MOVE))
1782 (.str insn " $"op1 ",$"op2)
1783 (+ opc1 opc2 op1 op2)
1784 (set HI op1 (and HI (const HI 255) (mem QI op2)))
1789 ;move register and direct memory
1790 (define-pmacro (move15 name insn opc1 opc2 op1 op2 )
1793 ((PIPE OS) (IDOC MOVE))
1794 (.str insn " $"op1 ",$"op2)
1795 (+ opc1 opc2 op2 op1)
1796 (set HI (mem HI op1) (and HI (const HI 255) op2))
1800 (move14 movebs14 movbs OP1_13 OP2_2 regmem8 memgr8 )
1801 (move15 movebs15 movbs OP1_13 OP2_5 memgr8 regbmem8 )
1802 (move14 moverbs14 movbs OP1_13 OP2_2 reg8 memory )
1803 (move15 movrbs15 movbs OP1_13 OP2_5 memory regb8 )
1804 (move14 movebz14 movbz OP1_12 OP2_2 regmem8 memgr8 )
1805 (move15 movebz15 movbz OP1_12 OP2_5 memgr8 regbmem8 )
1806 (move14 moverbz14 movbz OP1_12 OP2_2 reg8 memory )
1807 (move15 movrbz15 movbz OP1_12 OP2_5 memory regb8 )
1811 (define-pmacro (moveb1 name insn opc1 opc2 op1 op2)
1814 ((PIPE OS) (IDOC MOVE))
1815 (.str insn " $"op2 ",$"op1)
1816 (+ opc1 opc2 op1 op2)
1818 (if (and QI op1 (const 128))
1819 (set HI op2 (or HI (const HI 65280) op1)))
1820 (set HI op2 (and HI (const HI 255) op1))
1825 (moveb1 movrbs movbs OP1_13 OP2_0 drb sr )
1826 (moveb1 movrbz movbz OP1_12 OP2_0 drb sr )
1830 ;jump and call insns
1831 ;******************************************************************
1832 ;Absolute conditional jump
1833 (define-pmacro (jmpabs name insn)
1835 (.str name "Absolute conditional jump" )
1836 ((PIPE OS) (IDOC JMP))
1837 (.str insn " $extcond,$caddr")
1838 (+ OP1_14 OP2_10 extcond (f-op-bitone 0) bitone bit01 caddr)
1839 (sequence ((HI tmp1) (HI tmp2))
1840 (set tmp1 (mem HI caddr))
1841 (set tmp2 (sub HI pc (mem HI caddr)))
1842 (if (gt tmp2 (const 0)) ;; FIXME: (lt tmp2 (const 32)) (eq tmp2 (const 32))
1843 (set bitone (const 1)))
1844 (if (lt tmp2 (const 0)) ;; FIXME: (eq tmp2 (const 0)) (gt tmp2 (const 32))
1845 (set bitone (const 0)))
1846 (if (eq extcond (const 1)) ;; FIXME: (ne extcond cc_Z))
1847 (set bit01 (const 0))
1848 (set HI pc (mem HI caddr)))
1849 (if (ne extcond (const 1)) ;; FIXME: (eq extcond cc_Z))
1850 (set bit01 (const 1))
1851 (set HI pc (add HI pc (const 2))))
1857 (jmpabs jmpa0 jmpa+)
1861 (dni jmpa- "Absolute conditional jump"
1862 (COND-CTI (PIPE OS) (IDOC JMP))
1863 "jmpa- $extcond,$caddr"
1864 (+ OP1_14 OP2_10 extcond (f-op-bitone 0) bitone (f-op-1bit 1) caddr)
1865 (sequence ((HI tmp1) (HI tmp2))
1866 (set tmp1 (mem HI caddr))
1867 (set tmp2 (sub HI pc (mem HI caddr)))
1868 (if (gt tmp2 (const 0)) ;; FIXME: (lt tmp2 (const 32)) (eq tmp2 (const 32))
1869 (set bitone (const 1)))
1870 (if (lt tmp2 (const 0)) ;; FIXME: (eq tmp2 (const 0)) (gt tmp2 (const 32))
1871 (set bitone (const 0)))
1872 (set HI pc (add HI pc (const 2)))
1878 (dni jmpi "Indirect conditional jump"
1879 (COND-CTI (PIPE OS) (IDOC JMP))
1881 (+ OP1_9 OP2_12 icond sr)
1883 (if (eq icond (const 1))
1884 (set HI pc (mem HI sr)))
1885 (set HI pc (add HI pc (const 2)))
1890 (define-pmacro (jmprel name insn opc1)
1892 (.str name "conditional" )
1893 (COND-CTI (PIPE OS) (IDOC JMP))
1894 (.str insn " $cond,$rel")
1897 (if (eq cond (const 1))
1899 (if (lt QI rel (const 0))
1901 ;; FIXME: (neg QI rel)
1902 ;; FIXME: (add QI rel (const 1))
1903 ;; FIXME: (mul QI rel (const 2))
1904 (set HI pc (sub HI pc rel))
1906 (set HI pc (add HI pc (mul QI rel (const 2))))
1915 (jmprel jmpr_nenz jmpr COND_NE_NZ )
1916 (jmprel jmpr_sgt jmpr COND_SGT )
1917 (jmprel jmpr_z jmpr COND_Z )
1918 (jmprel jmpr_v jmpr COND_V )
1919 (jmprel jmpr_nv jmpr COND_NV )
1920 (jmprel jmpr_n jmpr COND_N )
1921 (jmprel jmpr_nn jmpr COND_NN )
1922 (jmprel jmpr_c jmpr COND_C )
1923 (jmprel jmpr_nc jmpr COND_NC )
1924 (jmprel jmpr_eq jmpr COND_EQ )
1925 (jmprel jmpr_ne jmpr COND_NE )
1926 (jmprel jmpr_ult jmpr COND_ULT )
1927 (jmprel jmpr_ule jmpr COND_ULE )
1928 (jmprel jmpr_uge jmpr COND_UGE )
1929 (jmprel jmpr_ugt jmpr COND_UGT )
1930 (jmprel jmpr_sle jmpr COND_SLE )
1931 (jmprel jmpr_sge jmpr COND_SGE )
1932 (jmprel jmpr_net jmpr COND_NET )
1933 (jmprel jmpr_uc jmpr COND_UC )
1934 (jmprel jmpr_slt jmpr COND_SLT )
1940 (dni jmpseg "absolute inter-segment jump"
1941 (UNCOND-CTI(PIPE OS) (IDOC JMP))
1942 "jmps $hash$segm$useg8,$hash$sof$usof16"
1943 (+ OP1_15 OP2_10 seg usof16)
1945 (if (eq BI sgtdisbit (const BI 0))
1946 (set QI (reg h-cr 10) useg8))
1947 ;; FIXME: previous indentation suggested this nop was the `else'
1948 ;; clause of the previous `if'.
1956 (dni jmps "absolute inter-segment jump"
1957 (UNCOND-CTI(PIPE OS) (IDOC JMP))
1959 (+ OP1_15 OP2_10 seg caddr)
1961 (if (eq BI sgtdisbit (const BI 0))
1962 (set QI (reg h-cr 10) seg))
1963 ;; FIXME: previous indentation suggested this nop was the `else'
1964 ;; clause of the previous `if'.
1972 ;relative jump if bit set
1974 (dni jb "relative jump if bit set"
1975 ((PIPE OS) (IDOC JMP))
1976 "jb $genreg$dot$qlobit,$relhi"
1977 (+ OP1_8 OP2_10 genreg relhi qlobit (f-qhibit 0))
1978 (sequence ((HI tmp1) (HI tmp2))
1979 (set HI tmp1 genreg)
1980 (set HI tmp2 (const 1))
1981 ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...)
1982 (set HI tmp2 (and tmp1 tmp2))
1983 (if (eq tmp2 (const 1)) ;; FIXME: (ne tmp2 0)?
1985 (if (lt QI relhi (const 0))
1986 (set HI pc (add HI pc (mul QI relhi (const 2)))))
1988 (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right?
1993 ;relative jump if bit set and clear bit
1995 (dni jbc "relative jump if bit set and clear bit"
1996 ((PIPE OS) (IDOC JMP))
1997 "jbc $genreg$dot$qlobit,$relhi"
1998 (+ OP1_10 OP2_10 genreg relhi qlobit (f-qhibit 0))
1999 (sequence ((HI tmp1) (HI tmp2))
2000 (set HI tmp1 genreg)
2001 (set HI tmp2 (const 1))
2002 ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...)
2003 (set HI tmp2 (and tmp1 tmp2))
2004 (if (eq tmp2 (const 1)) ;; FIXME: (ne tmp2 0)?
2006 ;; FIXME: The `else' clause has several statements.
2007 (if (lt QI relhi (const 0))
2008 (set tmp2 (const 1))
2010 ;; FIXME: (sll tmp2 qlobit)
2011 ;; FIXME: (inv tmp2)
2012 (set HI tmp1 (and tmp1 tmp2))
2013 (set HI genreg tmp1)
2014 (set HI pc (add HI pc (mul QI relhi (const 2)))))
2016 (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right?
2021 ;relative jump if bit set
2023 (dni jnb "relative jump if bit not set"
2024 ((PIPE OS) (IDOC JMP))
2025 "jnb $genreg$dot$qlobit,$relhi"
2026 (+ OP1_9 OP2_10 genreg relhi qlobit (f-qhibit 0))
2027 (sequence ((HI tmp1) (HI tmp2))
2028 (set HI tmp1 genreg)
2029 (set HI tmp2 (const 1))
2030 ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...)
2031 (set HI tmp2 (and tmp1 tmp2))
2032 (if (eq tmp2 (const 0)) ;; FIXME: (ne tmp2 0)?
2034 (if (lt QI relhi (const 0))
2035 (set HI pc (add HI pc (mul QI relhi (const 2)))))
2037 (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right?
2042 ;relative jump if bit not set and set bit
2043 ;JNBS bitaddrQ.q,rel
2044 (dni jnbs "relative jump if bit not set and set bit"
2045 ((PIPE OS) (IDOC JMP))
2046 "jnbs $genreg$dot$qlobit,$relhi"
2047 (+ OP1_11 OP2_10 genreg relhi qlobit (f-qhibit 0))
2048 (sequence ((HI tmp1) (HI tmp2))
2049 (set HI tmp1 genreg)
2050 (set HI tmp2 (const 1))
2051 ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...)
2052 (set HI tmp2 (and tmp1 tmp2))
2053 (if (eq tmp2 (const 0))
2055 ;; FIXME: The `else' clause has several statements.
2056 (if (lt QI relhi (const 0))
2057 (set tmp2 (const 1))
2059 ;; FIXME: (sll tmp2 qbit)
2060 (set BI tmp1(or tmp1 tmp2))
2062 (set HI pc (add HI pc (mul QI relhi (const 2)))))
2064 (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right?
2070 ;Absolute conditional call
2071 (define-pmacro (callabs name insn)
2073 (.str name "Absolute conditional call" )
2074 ((PIPE OS) (IDOC JMP))
2075 (.str insn " $extcond,$caddr")
2076 (+ OP1_12 OP2_10 extcond (f-op-2bit 0) bit01 caddr)
2078 (if (eq extcond (const 1))
2079 (set bit01 (const 0))
2080 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2081 (set HI (mem HI (reg h-cr 9)) pc)
2082 (set HI pc (mem HI caddr)))
2083 (if (ne extcond (const 1))
2084 (set bit01 (const 1))
2085 (set HI pc (add HI pc (const 2))))
2091 (callabs calla0 calla+)
2092 (callabs calla1 calla)
2095 (dni calla- "Absolute conditional call"
2096 (COND-CTI (PIPE OS) (IDOC JMP))
2097 "calla- $extcond,$caddr"
2098 (+ OP1_12 OP2_10 extcond (f-op-bit3 1) caddr)
2100 (if (eq extcond (const 1))
2101 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2102 (set HI (mem HI (reg h-cr 9)) pc)
2103 (set HI pc (mem HI caddr)))
2104 (set HI pc (add HI pc (const 2)))
2110 (dni calli "indirect subroutine call"
2111 (COND-CTI (PIPE OS) (IDOC JMP))
2112 "calli $icond,[$sr]"
2113 (+ OP1_10 OP2_11 icond sr)
2115 (if (eq icond (const 1))
2117 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2118 (set HI (mem HI (reg h-cr 9)) pc)
2119 (set HI pc (mem HI sr))
2122 (set HI pc (add HI pc (const 2)))
2128 (dni callr "Call subroutine with PC relative signed 8 bit offset"
2129 ( COND-CTI (PIPE OS) (IDOC JMP))
2131 (+ OP1_11 OP2_11 rel)
2133 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2134 (set HI (mem HI (reg h-cr 9)) pc)
2136 (if (lt QI rel (const 0))
2138 ;; FIXME: (neg QI rel)
2139 ;; FIXME: (add QI rel (const 1))
2140 ;; FIXME: (mul QI rel (const 2))
2141 (set HI pc (sub HI pc rel))
2143 (set HI pc (add HI pc (mul QI rel (const 2))))
2151 (dni callseg "call inter-segment subroutine"
2152 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2153 "calls $hash$segm$useg8,$hash$sof$usof16"
2154 (+ OP1_13 OP2_10 useg8 usof16)
2156 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2157 (set HI (mem HI (reg h-cr 9)) (reg h-cr 10))
2158 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2159 (set HI (mem HI (reg h-cr 9)) pc)
2160 (if (eq BI sgtdisbit (const BI 0))
2161 (set QI (reg h-cr 10) useg8))
2162 ;; FIXME: previous indentation suggested this nop was the `else'
2163 ;; clause of the previous `if'.
2171 (dni calls "call inter-segment subroutine"
2172 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2174 (+ OP1_13 OP2_10 seg caddr)
2176 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2177 (set HI (mem HI (reg h-cr 9)) (reg h-cr 10))
2178 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2179 (set HI (mem HI (reg h-cr 9)) pc)
2180 (if (eq BI sgtdisbit (const BI 0))
2181 (set QI (reg h-cr 10) seg))
2182 ;; FIXME: previous indentation suggested this nop was the `else'
2183 ;; clause of the previous `if'.
2191 (dni pcall "push word and call absolute subroutine"
2192 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2193 "pcall $reg8,$caddr"
2194 (+ OP1_14 OP2_2 reg8 caddr)
2195 (sequence ((HI tmp1))
2197 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2198 (set HI (mem HI (reg h-cr 9)) tmp1)
2199 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2200 (set HI (mem HI (reg h-cr 9)) pc)
2207 (dni trap "software trap"
2208 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2210 (+ OP1_9 OP2_11 uimm7 (f-op-1bit 0))
2212 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2213 (set HI (mem HI (reg h-cr 9)) (reg h-cr 4))
2214 (if (eq BI sgtdisbit (const BI 0))
2215 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2216 (set HI (mem HI (reg h-cr 9)) (reg h-cr 10) )
2219 (set HI (reg h-cr 10) (reg h-cr 11))
2220 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2221 (set HI (mem HI (reg h-cr 9)) pc)
2222 (set HI pc (mul QI uimm7 (const 4)))
2229 (dni ret "return from subroutine"
2230 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2232 (+ OP1_12 OP2_11 (f-op-bit8 0))
2234 (set HI pc (mem HI (reg h-cr 9)))
2235 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2241 (dni rets "return from inter-segment sunroutine"
2242 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2244 (+ OP1_13 OP2_11 (f-op-bit8 0))
2246 (set HI pc (mem HI (reg h-cr 9)))
2247 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2248 (if (eq BI sgtdisbit (const BI 0))
2249 (set HI (reg h-cr 10) (mem HI (reg h-cr 9)))
2252 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2258 (dni retp "return from subroutine and pop word register"
2259 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2261 (+ OP1_14 OP2_11 reg8)
2262 (sequence ((HI tmp1))
2263 (set HI pc (mem HI (reg h-cr 9)))
2264 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2265 (set HI tmp1 (mem HI (reg h-cr 9)))
2266 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2273 (dni reti "return from ISR"
2274 (UNCOND-CTI (PIPE OS) (IDOC JMP))
2276 (+ OP1_15 OP2_11 (f-op-lbit4 8) (f-op-bit4 8))
2278 (set HI pc (mem HI (reg h-cr 9)))
2279 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2280 (if (eq BI sgtdisbit (const BI 0))
2282 (set HI (reg h-cr 10) (mem HI (reg h-cr 9)))
2283 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2287 (set HI (reg h-cr 4) (mem HI (reg h-cr 9)))
2288 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2293 ;stack operation insn
2294 ;******************************************************************
2296 (dni pop "restore register from system stack"
2297 ((PIPE OS) (IDOC MISC))
2299 (+ OP1_15 OP2_12 reg8)
2300 (sequence ((HI tmp1))
2301 (set HI tmp1 (mem HI (reg h-cr 9)))
2302 (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2)))
2309 (dni push "save register on system stack"
2310 ((PIPE OS) (IDOC MISC))
2312 (+ OP1_14 OP2_12 reg8)
2313 (sequence ((HI tmp1))
2315 (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2)))
2316 (set HI (mem HI (reg h-cr 9)) tmp1)
2321 ;context switching insns
2323 (dni scxti "Push word register on stack and update same with immediate data"
2324 ((PIPE OS) (IDOC MISC))
2325 "scxt $reg8,$hash$uimm16"
2326 (+ OP1_12 OP2_6 reg8 uimm16)
2327 (sequence ((HI tmp1) (HI tmp2))
2329 (set HI tmp2 uimm16)
2330 ;; FIXME: (sub HI (reg HI h-cr 9) (const 2))
2331 (set HI (reg HI h-cr 9) tmp1)
2338 (dni scxtrpofm "mov memory to byte register"
2339 ((PIPE OS) (IDOC MOVE))
2340 "scxt $reg8,$pof$upof16"
2341 (+ OP1_13 OP2_6 reg8 upof16)
2342 (set QI reg8 (mem HI upof16))
2346 ; SCXT regmem8,memgr8
2347 (dni scxtmg "Push word register on stack and update same with direct memory"
2348 ((PIPE OS) (IDOC MISC))
2349 "scxt $regmem8,$memgr8"
2350 (+ OP1_13 OP2_6 regmem8 memgr8)
2351 (sequence ((HI tmp1) (HI tmp2))
2352 (set HI tmp1 regmem8)
2353 (set HI tmp2 memgr8)
2354 ;; FIXME: (sub HI (reg HI h-cr 9) (const 2))
2355 (set HI (reg HI h-cr 9) tmp1)
2356 (set HI regmem8 tmp2)
2362 (dni scxtm "Push word register on stack and update same with direct memory"
2363 ((PIPE OS) (IDOC MISC))
2364 "scxt $reg8,$memory"
2365 (+ OP1_13 OP2_6 reg8 memory)
2366 (sequence ((HI tmp1) (HI tmp2))
2368 (set HI tmp2 memory)
2369 ;; FIXME: (sub HI (reg HI h-cr 9) (const 2))
2370 (set HI (reg HI h-cr 9) tmp1)
2379 ((PIPE OS) (IDOC MISC))
2381 (+ OP1_12 OP2_12 (f-op-bit8 0))
2386 ;*********system control instructions *********************/
2388 (define-pmacro (sysctrl name insn opc1 opc2 op1 op2 op3)
2390 (.str name "miscellaneous" )
2391 ((PIPE OS) (IDOC MISC))
2393 (+ opc1 opc2 (f-op-lbit4 op1) (f-op-bit4 op2) (f-data8 op3) (f-op-bit8 op3))
2398 (sysctrl srstm srst OP1_11 OP2_7 4 8 183 )
2399 (sysctrl idlem idle OP1_8 OP2_7 7 8 135)
2400 (sysctrl pwrdnm pwrdn OP1_9 OP2_7 6 8 151)
2401 (sysctrl diswdtm diswdt OP1_10 OP2_5 5 10 165)
2402 (sysctrl enwdtm enwdt OP1_8 OP2_5 7 10 133)
2403 (sysctrl einitm einit OP1_11 OP2_5 4 10 181)
2404 (sysctrl srvwdtm srvwdt OP1_10 OP2_7 5 8 167 )
2409 ((PIPE OS) (IDOC MISC))
2411 (+ OP1_8 OP2_12 (f-op-bit8 0))
2418 (dni atomic "begin atomic sequence"
2419 ((PIPE OS) (IDOC SYSC))
2420 "atomic $hash$uimm2"
2421 (+ OP1_13 OP2_1 (f-op-lbit2 0) uimm2 (f-op-bit4 0))
2422 (sequence ((HI count))
2423 (set HI count uimm2)
2425 ((ne HI count (const 0))
2427 (set HI pc (add HI pc (const 2)))
2428 (set HI count (sub HI count (const 1)))
2431 (set HI count (const 0))
2436 ;extended register sequence
2438 (dni extr "begin extended register sequence"
2439 ((PIPE OS) (IDOC SYSC))
2441 (+ OP1_13 OP2_1 (f-op-lbit2 2) uimm2 (f-op-bit4 0))
2442 (sequence ((HI count))
2443 (set HI count uimm2)
2445 ((ne HI count (const 0))
2447 (set HI pc (add HI pc (const 2)))
2448 (set HI count (sub HI count (const 1)))
2451 (set HI count (const 0))
2456 ;extended page sequence
2458 (dni extp "begin extended page sequence"
2459 ((PIPE OS) (IDOC SYSC))
2460 "extp $sr,$hash$uimm2"
2461 (+ OP1_13 OP2_12 (f-op-lbit2 1) uimm2 sr)
2462 (sequence ((HI count))
2463 (set HI count uimm2)
2465 ((ne HI count (const 0))
2467 (set HI pc (add HI pc (const 2)))
2468 (set HI count (sub HI count (const 1)))
2471 (set HI count (const 0))
2476 ;extended page sequence
2477 ; EXTP #pag10,#irang2
2478 (dni extp1 "begin extended page sequence"
2479 ((PIPE OS) (IDOC SYSC))
2480 "extp $hash$pagenum,$hash$uimm2"
2481 (+ OP1_13 OP2_7 (f-op-lbit2 1) uimm2 (f-op-bit4 0) pagenum (f-qlobit 0) (f-qlobit2 0))
2482 (sequence ((HI count))
2483 (set HI count uimm2)
2485 ((ne HI count (const 0))
2487 (set HI pc (add HI pc (const 2)))
2488 (set HI count (sub HI count (const 1)))
2491 (set HI count (const 0))
2496 ; EXTP #pag10,#irang2
2497 (dni extpg1 "begin extended page sequence"
2498 ((PIPE OS) (IDOC SYSC))
2499 "extp $hash$pag$upag16,$hash$uimm2"
2500 (+ OP1_13 OP2_7 (f-op-lbit2 1) uimm2 (f-op-bit4 0) upag16 )
2501 (sequence ((HI count))
2502 (set HI count uimm2)
2504 ((ne HI count (const 0))
2506 (set HI pc (add HI pc (const 2)))
2507 (set HI count (sub HI count (const 1)))
2510 (set HI count (const 0))
2515 ;extended page and register sequence
2517 (dni extpr "begin extended page and register sequence"
2518 ((PIPE OS) (IDOC SYSC))
2519 "extpr $sr,$hash$uimm2"
2520 (+ OP1_13 OP2_12 (f-op-lbit2 3) uimm2 sr)
2521 (sequence ((HI count))
2522 (set HI count uimm2)
2524 ((ne HI count (const 0))
2526 (set HI pc (add HI pc (const 2)))
2527 (set HI count (sub HI count (const 1)))
2530 (set HI count (const 0))
2535 ;extended page and register sequence
2536 ; EXTPR #pag10,#irang2
2537 (dni extpr1 "begin extended page sequence"
2538 ((PIPE OS) (IDOC SYSC))
2539 "extpr $hash$pagenum,$hash$uimm2"
2540 (+ OP1_13 OP2_7 (f-op-lbit2 3) uimm2 (f-op-bit4 0) pagenum (f-qlobit 0) (f-qlobit2 0))
2541 (sequence ((HI count))
2542 (set HI count uimm2)
2544 ((ne HI count (const 0))
2546 (set HI pc (add HI pc (const 2)))
2547 (set HI count (sub HI count (const 1)))
2550 (set HI count (const 0))
2555 ;extended segment sequence
2557 (dni exts "begin extended segment sequence"
2558 ((PIPE OS) (IDOC SYSC))
2559 "exts $sr,$hash$uimm2"
2560 (+ OP1_13 OP2_12 (f-op-lbit2 0) uimm2 sr)
2561 (sequence ((HI count))
2562 (set HI count uimm2)
2564 ((ne HI count (const 0))
2566 (set HI pc (add HI pc (const 2)))
2567 (set HI count (sub HI count (const 1)))
2570 (set HI count (const 0))
2575 ;extended segment sequence
2576 ; EXTS #seg8,#irang2
2577 (dni exts1 "begin extended segment sequence"
2578 ((PIPE OS) (IDOC SYSC))
2579 "exts $hash$seghi8,$hash$uimm2"
2580 (+ OP1_13 OP2_7 (f-op-lbit2 0) uimm2 (f-op-bit4 0) seghi8 (f-op-bit8 0))
2581 (sequence ((HI count))
2582 (set HI count uimm2)
2584 ((ne HI count (const 0))
2586 (set HI pc (add HI pc (const 2)))
2587 (set HI count (sub HI count (const 1)))
2590 (set HI count (const 0))
2595 ;extended segment register sequence
2597 (dni extsr "begin extended segment and register sequence"
2598 ((PIPE OS) (IDOC SYSC))
2599 "extsr $sr,$hash$uimm2"
2600 (+ OP1_13 OP2_12 (f-op-lbit2 2) uimm2 sr)
2601 (sequence ((HI count))
2602 (set HI count uimm2)
2604 ((ne HI count (const 0))
2606 (set HI pc (add HI pc (const 2)))
2607 (set HI count (sub HI count (const 1)))
2610 (set HI count (const 0))
2615 ;extended segment register sequence
2616 ; EXTSR #pag10,#irang2
2617 (dni extsr1 "begin extended segment and register sequence"
2618 ((PIPE OS) (IDOC SYSC))
2619 "extsr $hash$seghi8,$hash$uimm2"
2620 (+ OP1_13 OP2_7 (f-op-lbit2 2) uimm2 (f-op-bit4 0) seghi8 (f-op-bit8 0))
2621 (sequence ((HI count))
2622 (set HI count uimm2)
2624 ((ne HI count (const 0))
2626 (set HI pc (add HI pc (const 2)))
2627 (set HI count (sub HI count (const 1)))
2630 (set HI count (const 0))
2635 ;prioritize register
2637 (dni prior "add registers"
2638 ((PIPE OS) (IDOC ALU))
2640 (+ OP1_2 OP2_11 dr sr)
2641 (sequence ((HI count) (HI tmp1) (HI tmp2))
2642 (set HI count (const 0))
2644 (set HI tmp2 (and tmp1 (const 32768)))
2646 ((ne HI tmp2 (const 1)) ;;(ne HI sr (const 0)) - FIXME: and? or?
2647 ;;(sll HI tmp1 (const 1)) - FIXME: missing (set ...)
2648 (set HI tmp2 (and tmp1 (const 32768)))
2649 (set HI count (add HI count (const 1)))
2659 ;******************************************************************
2661 (define-pmacro (bclear name insn opc1)
2663 (.str name "bit clear" )
2664 ((PIPE OS) (IDOC ALU))
2665 (.str insn " $reg8$dot$qbit")
2666 (+ opc1 OP2_14 reg8)
2667 (sequence ((HI tmp1) (HI tmp2))
2668 (set tmp2 (const 1))
2670 ;; FIXME: (sll tmp2 qbit)
2671 ;; FIXME: (inv tmp2)
2672 (set BI tmp1(and tmp1 tmp2))
2679 (dni bclr18 "bit logical MOVN"
2680 ((PIPE OS) (IDOC ALU))
2682 (+ OP1_11 OP2_14 RegNam)
2683 (sequence ((HI tmp1) (HI tmp2))
2684 (set tmp2 (const 1))
2686 ;; FIXME: (sll tmp2 qbit)
2687 ;; FIXME: (inv tmp2)
2688 (set BI tmp1(and tmp1 tmp2))
2694 (bclear bclr0 bclr QBIT_0 )
2695 (bclear bclr1 bclr QBIT_1 )
2696 (bclear bclr2 bclr QBIT_2 )
2697 (bclear bclr3 bclr QBIT_3 )
2698 (bclear bclr4 bclr QBIT_4 )
2699 (bclear bclr5 bclr QBIT_5 )
2700 (bclear bclr6 bclr QBIT_6 )
2701 (bclear bclr7 bclr QBIT_7 )
2702 (bclear bclr8 bclr QBIT_8 )
2703 (bclear bclr9 bclr QBIT_9 )
2704 (bclear bclr10 bclr QBIT_10 )
2705 (bclear bclr11 bclr QBIT_11 )
2706 (bclear bclr12 bclr QBIT_12 )
2707 (bclear bclr13 bclr QBIT_13 )
2708 (bclear bclr14 bclr QBIT_14 )
2709 (bclear bclr15 bclr QBIT_15 )
2712 (dni bset19 "bit logical MOVN"
2713 ((PIPE OS) (IDOC ALU))
2715 (+ OP1_11 OP2_15 RegNam)
2716 (sequence ((HI tmp1) (HI tmp2))
2717 (set tmp2 (const 1))
2719 ;; FIXME: (sll tmp2 qbit)
2720 (set BI tmp1(or tmp1 tmp2))
2726 (define-pmacro (bitset name insn opc1)
2728 (.str name "bit set" )
2729 ((PIPE OS) (IDOC ALU))
2730 (.str insn " $reg8$dot$qbit")
2731 (+ opc1 OP2_15 reg8)
2732 (sequence ((HI tmp1) (HI tmp2))
2733 (set tmp2 (const 1))
2735 ;; FIXME: (sll tmp2 qbit)
2736 (set BI tmp1(or tmp1 tmp2))
2743 (bitset bset0 bset QBIT_0 )
2744 (bitset bset1 bset QBIT_1 )
2745 (bitset bset2 bset QBIT_2 )
2746 (bitset bset3 bset QBIT_3 )
2747 (bitset bset4 bset QBIT_4 )
2748 (bitset bset5 bset QBIT_5 )
2749 (bitset bset6 bset QBIT_6 )
2750 (bitset bset7 bset QBIT_7 )
2751 (bitset bset8 bset QBIT_8 )
2752 (bitset bset9 bset QBIT_9 )
2753 (bitset bset10 bset QBIT_10 )
2754 (bitset bset11 bset QBIT_11 )
2755 (bitset bset12 bset QBIT_12 )
2756 (bitset bset13 bset QBIT_13 )
2757 (bitset bset14 bset QBIT_14 )
2758 (bitset bset15 bset QBIT_15 )
2761 ;BMOV bitaddrZ.z,bitaddrQ.q
2762 (dni bmov "bit logical MOV"
2763 ((PIPE OS) (IDOC ALU))
2764 "bmov $reghi8$dot$qhibit,$reg8$dot$qlobit"
2765 (+ OP1_4 OP2_10 reg8 reghi8 qhibit qlobit)
2766 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2767 (set HI tmp1 reghi8)
2769 (set tmp3 (const 1))
2770 (set tmp4 (const 1))
2771 ;; FIXME: (sll tmp3 qlobit)
2772 ;; FIXME: (sll tmp4 qhibit)
2773 ;; FIXME: (and tmp1 tmp3)
2774 ;; FIXME: (and tmp2 tmp4)
2776 (set HI reghi8 tmp1)
2782 ;BMOVN bitaddrZ.z,bitaddrQ.q
2783 (dni bmovn "bit logical MOVN"
2784 ((PIPE OS) (IDOC ALU))
2785 "bmovn $reghi8$dot$qhibit,$reg8$dot$qlobit"
2786 (+ OP1_3 OP2_10 reg8 reghi8 qhibit qlobit)
2787 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2788 (set HI tmp1 reghi8)
2790 (set tmp3 (const 1))
2791 (set tmp4 (const 1))
2792 ;; FIXME: (sll tmp3 qlobit)
2793 ;; FIXME: (sll tmp4 qhibit)
2794 ;; FIXME: (and tmp1 tmp3)
2795 ;; FIXME: (and tmp2 tmp4)
2796 ;; FIXME: (inv HI tmp2)
2798 (set HI reghi8 tmp1)
2804 ;BAND bitaddrZ.z,bitaddrQ.q
2805 (dni band "bit logical AND"
2806 ((PIPE OS) (IDOC ALU))
2807 "band $reghi8$dot$qhibit,$reg8$dot$qlobit"
2808 (+ OP1_6 OP2_10 reg8 reghi8 qhibit qlobit)
2809 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2810 (set HI tmp1 reghi8)
2812 (set tmp3 (const 1))
2813 (set tmp4 (const 1))
2814 ;; FIXME: (sll tmp3 qlobit)
2815 ;; FIXME: (sll tmp4 qhibit)
2816 ;; FIXME: (and tmp1 tmp3)
2817 ;; FIXME: (and tmp2 tmp4)
2818 (set BI tmp1(and tmp1 tmp2))
2819 (set HI reghi8 tmp1)
2825 ;BOR bitaddrZ.z,bitaddrQ.q
2826 (dni bor "bit logical OR"
2827 ((PIPE OS) (IDOC ALU))
2828 "bor $reghi8$dot$qhibit,$reg8$dot$qlobit"
2829 (+ OP1_5 OP2_10 reg8 reghi8 qhibit qlobit)
2830 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2831 (set HI tmp1 reghi8)
2833 (set tmp3 (const 1))
2834 (set tmp4 (const 1))
2835 ;; FIXME: (sll tmp3 qlobit)
2836 ;; FIXME: (sll tmp4 qhibit)
2837 ;; FIXME: (and tmp1 tmp3)
2838 ;; FIXME: (and tmp2 tmp4)
2839 (set BI tmp1(or tmp1 tmp2))
2840 (set HI reghi8 tmp1)
2846 ;BXOR bitaddrZ.z,bitaddrQ.q
2847 (dni bxor "bit logical XOR"
2848 ((PIPE OS) (IDOC ALU))
2849 "bxor $reghi8$dot$qhibit,$reg8$dot$qlobit"
2850 (+ OP1_7 OP2_10 reg8 reghi8 qhibit qlobit)
2851 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2852 (set HI tmp1 reghi8)
2854 (set tmp3 (const 1))
2855 (set tmp4 (const 1))
2856 ;; FIXME: (sll tmp3 qlobit)
2857 ;; FIXME: (sll tmp4 qhibit)
2858 ;; FIXME: (and tmp1 tmp3)
2859 ;; FIXME: (and tmp2 tmp4)
2860 (set BI tmp1(xor tmp1 tmp2))
2861 (set HI reghi8 tmp1)
2866 ;cmp direct bit to bit
2867 ;BCMP bitaddrZ.z,bitaddrQ.q
2868 (dni bcmp "bit to bit compare"
2869 ((PIPE OS) (IDOC ALU))
2870 "bcmp $reghi8$dot$qhibit,$reg8$dot$qlobit"
2871 (+ OP1_2 OP2_10 reg8 reghi8 qhibit qlobit)
2872 (sequence ((HI tmp1) (HI tmp2) (HI tmp3) (HI tmp4))
2873 (set HI tmp1 reghi8)
2875 (set tmp3 (const 1))
2876 (set tmp4 (const 1))
2877 ;; FIXME: (sll tmp3 qlobit)
2878 ;; FIXME: (sll tmp4 qhibit)
2879 ;; FIXME: (and tmp1 tmp3)
2880 ;; FIXME: (and tmp2 tmp4)
2881 (set BI tmp1(xor tmp1 tmp2))
2882 (set HI reghi8 tmp1)
2889 (dni bfldl "bit field low byte"
2890 ((PIPE OS) (IDOC MOVE))
2891 "bfldl $reg8,$hash$mask8,$hash$datahi8"
2892 (+ OP1_0 OP2_10 reg8 mask8 datahi8)
2893 (sequence ((HI tmp1) (QI tmp2) (QI tmp3))
2896 (set QI tmp3 datahi8)
2897 ;; FIXME: (inv QI tmp2)
2898 (set HI tmp1 (and tmp1 tmp2))
2899 (set HI tmp1 (or tmp1 tmp3))
2905 ;bit field high byte
2907 (dni bfldh "bit field high byte"
2908 ((PIPE OS) (IDOC MOVE))
2909 "bfldh $reg8,$hash$masklo8,$hash$data8"
2910 (+ OP1_1 OP2_10 reg8 masklo8 data8)
2911 (sequence ((HI tmp1) (HI tmp2) (HI tmp3))
2913 (set QI tmp2 masklo8)
2915 ;; FIXME: (sll tmp2 (const 8))
2916 ;; FIXME: (inv HI tmp2)
2917 ;; FIXME: (sll tmp3 (const 8))
2918 (set HI tmp1 (and tmp1 tmp2))
2919 (set HI tmp1 (or tmp1 tmp3))
2925 ;/**********compare instructions******************
2929 (dni cmpr "compare two registers"
2930 ((PIPE OS) (IDOC CMP))
2932 (+ OP1_4 OP2_0 src1 src2)
2933 (set condbit (lt HI src1 src2))
2937 ;Compare byte register
2939 (dni cmpbr "compare two byte registers"
2940 ((PIPE OS) (IDOC CMP))
2942 (+ OP1_4 OP2_1 drb srb)
2943 (set condbit (lt QI drb srb))
2947 (define-pmacro (cmp1 name insn opc1 opc2 op1 op2 mode)
2949 (.str name "compare" )
2950 ((PIPE OS) (IDOC CMP))
2951 (.str insn " $"op1 ",$hash$"op2)
2952 (+ opc1 opc2 op1 (f-op-bit1 0) op2)
2953 (set condbit (lt mode op1 op2))
2957 (cmp1 cmpri cmp OP1_4 OP2_8 src1 uimm3 HI)
2958 (cmp1 cmpbri cmpb OP1_4 OP2_9 drb uimm3 QI)
2962 ((PIPE OS) (IDOC CMP))
2963 "cmp $reg8,$hash$uimm16"
2964 (+ OP1_4 OP2_6 reg8 uimm16)
2965 (set condbit (lt HI reg8 uimm16))
2970 (dni cmpbi "compare"
2971 ((PIPE OS) (IDOC CMP))
2972 "cmpb $regb8,$hash$uimm8"
2973 (+ OP1_4 OP2_7 regb8 uimm8 (f-op-bit8 0))
2974 (set condbit (lt QI regb8 uimm8))
2978 ;compare reg and indirect memory
2979 (define-pmacro (cmp2 name insn opc1 opc2 op1 op2 mode)
2981 (.str name "compare" )
2982 ((PIPE OS) (IDOC CMP))
2983 (.str insn " $"op1 ",[$"op2"]")
2984 (+ opc1 opc2 op1 (f-op-bit2 2) op2)
2985 (set condbit (lt mode op1 op2))
2989 (cmp2 cmpr2 cmp OP1_4 OP2_8 dr sr2 HI)
2990 (cmp2 cmpbr2 cmpb OP1_4 OP2_9 drb sr2 QI)
2992 ;compare register and indirect memory post increment
2993 (define-pmacro (cmp3 name insn opc1 opc2 op1 op2 mode)
2995 (.str name "compare" )
2996 ((PIPE OS) (IDOC CMP))
2997 (.str insn " $"op1 ",[$"op2"+]")
2998 (+ opc1 opc2 op1 (f-op-bit2 3) op2)
3000 (set condbit (lt mode op1 op2))
3001 (set HI op2 (add HI op2 (const 2)))
3006 (cmp3 cmp2i cmp OP1_4 OP2_8 dr sr2 HI)
3007 (cmp3 cmpb2i cmpb OP1_4 OP2_9 drb sr2 QI)
3009 ;compare register and direct memory
3010 (define-pmacro (cmp4 name insn opc1 opc2 op1 op2 mode)
3012 (.str name "compare" )
3013 ((PIPE OS) (IDOC CMP))
3014 (.str insn " $"op1 ",$pof$"op2)
3015 (+ opc1 opc2 op1 op2)
3016 (set condbit (lt HI op1 (mem HI op2)))
3020 (cmp4 cmp04 cmp OP1_4 OP2_2 reg8 upof16 HI)
3021 (cmp4 cmpb4 cmpb OP1_4 OP2_3 regb8 upof16 QI)
3023 ;compare register and direct memory
3024 (define-pmacro (cmp4 name insn opc1 opc2 op1 op2 mode)
3026 (.str name "compare" )
3027 ((PIPE OS) (IDOC CMP))
3028 (.str insn " $"op1 ",$"op2)
3029 (+ opc1 opc2 op1 op2)
3030 (set condbit (lt HI op1 (mem HI op2)))
3034 (cmp4 cmp004 cmp OP1_4 OP2_2 regmem8 memgr8 HI)
3035 (cmp4 cmp0004 cmp OP1_4 OP2_2 reg8 memory HI)
3036 (cmp4 cmpb04 cmpb OP1_4 OP2_3 regbmem8 memgr8 QI)
3037 (cmp4 cmpb004 cmpb OP1_4 OP2_3 regb8 memory QI)
3039 ;compare register and immediate
3040 (define-pmacro (cmp5 name insn opc1 opc2 op1 op2 mode)
3042 (.str name "compare" )
3043 ((PIPE OS) (IDOC CMP))
3044 (.str insn " $"op1 ",$hash$"op2)
3045 (+ opc1 opc2 op2 op1)
3047 (set condbit (lt HI op1 op2))
3048 (set mode op1 (sub HI op1 (const 1)))
3053 (cmp5 cmpd1ri cmpd1 OP1_10 OP2_0 sr uimm4 HI)
3054 (cmp5 cmpd2ri cmpd2 OP1_11 OP2_0 sr uimm4 HI)
3055 (cmp5 cmpi1ri cmpi1 OP1_8 OP2_0 sr uimm4 HI)
3056 (cmp5 cmpi2ri cmpi2 OP1_9 OP2_0 sr uimm4 HI)
3057 (cmp5 cmpd1rim cmpd1 OP1_10 OP2_6 reg8 uimm16 HI)
3058 (cmp5 cmpd2rim cmpd2 OP1_11 OP2_6 reg8 uimm16 HI)
3059 (cmp5 cmpi1rim cmpi1 OP1_8 OP2_6 reg8 uimm16 HI)
3060 (cmp5 cmpi2rim cmpi2 OP1_9 OP2_6 reg8 uimm16 HI)
3062 ;compare register and direct memory
3063 (define-pmacro (cmp6 name insn opc1 opc2 op1 op2 mode )
3065 (.str name "compare" )
3066 ((PIPE OS) (IDOC CMP))
3067 (.str insn " $"op1 ",$pof$"op2)
3068 (+ opc1 opc2 op1 op2)
3070 (set condbit (lt HI op1 (mem HI op2)))
3071 (set mode op1 (sub HI op1 (const 1)))
3076 (cmp6 cmpd1rp cmpd1 OP1_10 OP2_2 reg8 upof16 HI )
3077 (cmp6 cmpd2rp cmpd2 OP1_11 OP2_2 reg8 upof16 HI )
3078 (cmp6 cmpi1rp cmpi1 OP1_8 OP2_2 reg8 upof16 HI )
3079 (cmp6 cmpi2rp cmpi2 OP1_9 OP2_2 reg8 upof16 HI )
3081 ;compare register and direct memory
3082 (define-pmacro (cmp7 name insn opc1 opc2 op1 op2 mode)
3084 (.str name "compare" )
3085 ((PIPE OS) (IDOC CMP))
3086 (.str insn " $"op1 ",$"op2)
3087 (+ opc1 opc2 op1 op2)
3089 (set condbit (lt HI op1 (mem HI op2)))
3090 (set mode op1 (sub HI op1 (const 1)))
3095 (cmp7 cmpd1rm cmpd1 OP1_10 OP2_2 regmem8 memgr8 HI)
3096 (cmp7 cmpd2rm cmpd2 OP1_11 OP2_2 regmem8 memgr8 HI)
3097 (cmp7 cmpi1rm cmpi1 OP1_8 OP2_2 regmem8 memgr8 HI)
3098 (cmp7 cmpi2rm cmpi2 OP1_9 OP2_2 regmem8 memgr8 HI)
3099 (cmp7 cmpd1rmi cmpd1 OP1_10 OP2_2 reg8 memory HI)
3100 (cmp7 cmpd2rmi cmpd2 OP1_11 OP2_2 reg8 memory HI)
3101 (cmp7 cmpi1rmi cmpi1 OP1_8 OP2_2 reg8 memory HI)
3102 (cmp7 cmpi2rmi cmpi2 OP1_9 OP2_2 reg8 memory HI)
3105 ;Shift and rotate insns
3106 ;****************************************************************
3107 (define-pmacro (shift name insn insn1 opc1 opc2 op1 op2 mode)
3109 (.str name "shift" )
3110 ((PIPE OS) (IDOC ALU))
3111 (.str insn " $"op1 ",$"op2)
3112 (+ opc1 opc2 op1 op2)
3113 (set mode op1 (insn1 mode op1 op2))
3117 (shift shlr shl sll OP1_4 OP2_12 dr sr HI)
3118 (shift shrr shr srl OP1_6 OP2_12 dr sr HI)
3119 (shift rolr rol rol OP1_0 OP2_12 dr sr HI)
3120 (shift rorr ror ror OP1_2 OP2_12 dr sr HI)
3121 (shift ashrr ashr sra OP1_10 OP2_12 dr sr HI)
3123 (define-pmacro (shift1 name insn insn1 opc1 opc2 op1 op2 mode)
3125 (.str name "shift" )
3126 ((PIPE OS) (IDOC ALU))
3127 (.str insn " $"op1 ",$hash$"op2)
3128 (+ opc1 opc2 op2 op1)
3129 (set mode op1 (insn1 mode op1 op2))
3133 (shift1 shlri shl sll OP1_5 OP2_12 sr uimm4 HI)
3134 (shift1 shrri shr srl OP1_7 OP2_12 sr uimm4 HI)
3135 (shift1 rolri rol rol OP1_1 OP2_12 sr uimm4 HI)
3136 (shift1 rorri ror ror OP1_3 OP2_12 sr uimm4 HI)
3137 (shift1 ashrri ashr sra OP1_11 OP2_12 sr uimm4 HI)