1 ; IQ2000/IQ10 Common CPU description. -*- Scheme -*- 2 ; Copyright 2001, 2002, 2007, 2009 Free Software Foundation, Inc. 3 ; 4 ; Contributed by Red Hat Inc; developed under contract from Fujitsu. 5 ; 6 ; This file is part of the GNU Binutils. 7 ; 8 ; This program is free software; you can redistribute it and/or modify 9 ; it under the terms of the GNU General Public License as published by 10 ; the Free Software Foundation; either version 3 of the License, or 11 ; (at your option) any later version. 12 ; 13 ; This program is distributed in the hope that it will be useful, 14 ; but WITHOUT ANY WARRANTY; without even the implied warranty of 15 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 ; GNU General Public License for more details. 17 ; 18 ; You should have received a copy of the GNU General Public License 19 ; along with this program; if not, write to the Free Software 20 ; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 21 ; MA 02110-1301, USA. 22 23 (include "simplify.inc") 24 25 (define-arch 26 (name iq2000) 27 (comment "IQ2000 architecture") 28 (insn-lsb0? #t) 29 (machs iq2000 iq10) 30 (isas iq2000) 31 ) 32 33 (define-isa 34 (name iq2000) 35 (comment "Basic IQ2000 instruction set") 36 (default-insn-word-bitsize 32) 37 (default-insn-bitsize 32) 38 (base-insn-bitsize 32) 39 (decode-assist (31 30 29 28 27 26)) 40 ) 41 42 (define-cpu 43 (name iq2000bf) 44 (comment "IQ2000 family") 45 (endian big) 46 (word-bitsize 32) 47 (file-transform "") 48 ) 49 50 (define-cpu 51 (name iq10bf) 52 (comment "IQ10 coprocessor family") 53 (endian big) 54 (word-bitsize 32) 55 (file-transform "") 56 57 ) 58 59 (define-mach 60 (name iq2000) 61 (comment "IQ2000 packet processing engine") 62 (cpu iq2000bf) 63 (isas iq2000) 64 ) 65 66 (define-mach 67 (name iq10) 68 (comment "IQ10 coprocessor") 69 (cpu iq10bf) 70 (isas iq2000) 71 ) 72 73 (define-model 74 (name iq2000) 75 (comment "IQ2000 microprocessor") 76 (mach iq2000) 77 (unit u-exec "Execution Unit" () 78 1 1 ; issue done 79 () () () ()) 80 ) 81 82 (define-model 83 (name iq10) 84 (comment "IQ10 coprocessor") 85 (mach iq10) 86 (unit u-exec "Execution Unit" () 87 1 1 ; issue done 88 () () () ()) 89 ) 90 91 ; Macros to simplify MACH attribute specification. 92 93 (define-pmacro MACH2000 (MACH iq2000)) 94 (define-pmacro MACH10 (MACH iq10)) 95 96 98 ; Hardware elements. 99 100 (define-hardware 101 (name h-pc) 102 (comment "program counter") 103 (attrs PC PROFILE (ISA iq2000)) 104 (type pc) 105 (get () (c-call USI "get_h_pc")) 106 (set (newval) (c-call VOID "set_h_pc" newval)) 107 ) 108 ; FIXME: it would be nice if the hardwired zero in R0 could be 109 ; specified as a virtual hardware element, with one less register in 110 ; the register file proper. 111 112 (define-keyword 113 (name gr-names) 114 (print-name h-gr) 115 (values (r0 0) (%0 0) (r1 1) (%1 1) (r2 2) (%2 2) (r3 3) (%3 3) 116 (r4 4) (%4 4) (r5 5) (%5 5) (r6 6) (%6 6) (r7 7) (%7 7) 117 (r8 8) (%8 8) (r9 9) (%9 9) (r10 10) (%10 10) (r11 11) (%11 11) 118 (r12 12) (%12 12) (r13 13) (%13 13) (r14 14) (%14 14) (r15 15) (%15 15) 119 (r16 16) (%16 16) (r17 17) (%17 17) (r18 18) (%18 18) (r19 19) (%19 19) 120 (r20 20) (%20 20) (r21 21) (%21 21) (r22 22) (%22 22) (r23 23) (%23 23) 121 (r24 24) (%24 24) (r25 25) (%25 25) (r26 26) (%26 26) (r27 27) (%27 27) 122 (r28 28) (%28 28) (r29 29) (%29 29) (r30 30) (%30 30) (r31 31) (%31 31)) 123 ) 124 125 (define-hardware 126 (name h-gr) 127 (comment "General purpose registers") 128 ; (attrs (ISA iq2000) CACHE-ADDR) 129 (type register SI (32)) 130 (indices extern-keyword gr-names) 131 (get (idx) 132 (cond SI 133 ((eq idx 0) (const 0)) 134 (else (raw-reg h-gr idx)))) 135 (set (idx newval) 136 (cond VOID 137 ((eq idx 0) (nop)) 138 (else (set (raw-reg h-gr idx) newval)))) 139 ) 140 141 143 ; Instruction fields. 144 145 (dnf f-opcode "opcode field" () 31 6) 146 (dnf f-rs "register field Rs" () 25 5) 147 (dnf f-rt "register field Rt" () 20 5) 148 (dnf f-rd "register field Rd" () 15 5) 149 (dnf f-shamt "shift amount field" () 10 5) 150 (dnf f-cp-op "coprocessor op field" () 10 3) 151 (dnf f-cp-op-10 "coprocessor op field for CAM" () 10 5) 152 (dnf f-cp-grp "coprocessor group field" () 7 2) 153 (dnf f-func "function field" () 5 6) 154 (dnf f-imm "immediate field" () 15 16) 155 156 (define-multi-ifield 157 (name f-rd-rs) 158 (comment "register Rd implied from Rs") 159 (attrs) 160 (mode UINT) 161 (subfields f-rd f-rs) 162 (insert (sequence () 163 (set (ifield f-rd) (ifield f-rd-rs)) 164 (set (ifield f-rs) (ifield f-rd-rs)) 165 )) 166 (extract (sequence () 167 (set (ifield f-rd-rs) (ifield f-rs)) 168 )) 169 ) 170 171 (define-multi-ifield 172 (name f-rd-rt) 173 (comment "register Rd implied from Rt") 174 (attrs) 175 (mode UINT) 176 (subfields f-rd f-rt) 177 (insert (sequence () 178 (set (ifield f-rd) (ifield f-rd-rt)) 179 (set (ifield f-rt) (ifield f-rd-rt)) 180 )) 181 (extract (sequence () 182 (set (ifield f-rd-rt) (ifield f-rt)) 183 )) 184 ) 185 186 (define-multi-ifield 187 (name f-rt-rs) 188 (comment "register Rt implied from Rs") 189 (attrs) 190 (mode UINT) 191 (subfields f-rt f-rs) 192 (insert (sequence () 193 (set (ifield f-rt) (ifield f-rt-rs)) 194 (set (ifield f-rs) (ifield f-rt-rs)) 195 )) 196 (extract (sequence () 197 (set (ifield f-rd-rs) (ifield f-rs)) 198 )) 199 ) 200 201 (df f-jtarg "jump target field" (ABS-ADDR) 15 16 UINT 202 ((value pc) (srl USI (and USI value #x03FFFF) 2)) 203 ((value pc) (or USI (and USI pc #xF0000000) (sll USI value 2)))) 204 205 (df f-jtargq10 "iq10 jump target field" (ABS-ADDR) 20 21 UINT 206 ((value pc) (srl SI (and SI value #x7FFFFF) 2)) 207 ((value pc) (or SI (and SI pc #xF0000000) (sll SI value 2)))) 208 209 (df f-offset "pc offset field" (PCREL-ADDR) 15 16 INT 210 ; Actually, this is relative to the address of the delay slot. 211 ((value pc) (sra SI (sub SI value pc) 2)) 212 ((value pc) (add SI (sll SI value 2) (add pc 4)))) 213 214 ; Instruction fields that scarcely appear in instructions. 215 216 (dnf f-count "count field" () 15 7) 217 (dnf f-bytecount "byte count field" () 7 8) 218 (dnf f-index "index field" () 8 9) 219 (dnf f-mask "mask field" () 9 4) 220 (dnf f-maskq10 "iq10 mask field" () 10 5) 221 (dnf f-maskl "mask left field" () 4 5) 222 (dnf f-excode "execcode field" () 25 20) 223 (dnf f-rsrvd "reserved field" () 25 10) 224 (dnf f-10-11 "bits 10:0" () 10 11) 225 (dnf f-24-19 "bits 24:6" () 24 19) 226 (dnf f-5 "bit 5" () 5 1) 227 (dnf f-10 "bit 10" () 10 1) 228 (dnf f-25 "bit 25" () 25 1) 229 (dnf f-cam-z "cam global mask z" () 5 3) 230 (dnf f-cam-y "cam operation y" () 2 3) 231 (dnf f-cm-3func "CM 3 bit fn field" () 5 3) 232 (dnf f-cm-4func "CM 4 bit fn field" () 5 4) 233 (dnf f-cm-3z "CM 3Z field" () 1 2) 234 (dnf f-cm-4z "CM 4Z field" () 2 3) 235 236 238 ; Enumerations. 239 240 (define-normal-insn-enum 241 opcodes "primary opcodes" () OP_ f-opcode 242 (("SPECIAL" 0) ("REGIMM" 1) ("J" 2) ("JAL" 3) ("BEQ" 4) ("BNE" 5) ("BLEZ" 6) ("BGTZ" 7) 243 ("ADDI" 8) ("ADDIU" 9) ("SLTI" 10) ("SLTIU" 11) ("ANDI" 12) ("ORI" 13) ("XORI" 14) ("LUI" 15) 244 ("COP0" 16) ("COP1" 17) ("COP2" 18) ("COP3" 19) ("BEQL" 20) ("BNEL" 21) ("BLEZL" 22) ("BGTZL" 23) 245 ("BMB0" 24) ("BMB1" 25) ("BMB2" 26) ("BMB3" 27) ("BBI" 28) ("BBV" 29) ("BBIN" 30) ("BBVN" 31) 246 ("LB" 32) ("LH" 33) ("LW" 35) ("LBU" 36) ("LHU" 37) ("RAM" 39) 247 ("SB" 40) ("SH" 41) ("SW" 43) ("ANDOI" 44) ("BMB" 45) ("ORUI" 47) 248 ("LDW" 48) 249 ("SDW" 56) ("ANDOUI" 63)) 250 ) 251 252 (define-normal-insn-enum 253 q10_opcodes "iq10-only primary opcodes" () OP10_ f-opcode 254 (("BMB" 6) ("ORUI" 15) ("BMBL" 22) ("ANDOUI" 47) ("BBIL" 60) ("BBVL" 61) ("BBINL" 62) ("BBVNL" 63)) 255 ) 256 257 (define-normal-insn-enum 258 regimm-functions "branch sub-opcodes" () FUNC_ f-rt 259 (("BLTZ" 0) ("BGEZ" 1) ("BLTZL" 2) ("BGEZL" 3) ("BLEZ" 4) ("BGTZ" 5) ("BLEZL" 6) ("BGTZL" 7) 260 ("BRI" 8) ("BRV" 9) ("BCTX" 12) 261 ("BLTZAL" 16) ("BGEZAL" 17) ("BLTZALL" 18) ("BGEZALL" 19) ("BLEZAL" 20) ("BGTZAL" 21) ("BLEZALL" 22) ("BGTZALL" 23)) 262 ) 263 264 (define-normal-insn-enum 265 functions "function sub-opcodes" () FUNC_ f-func 266 (("SLL" 0) ("SLMV" 1) ("SRL" 2) ("SRA" 3) ("SLLV" 4) ("SRMV" 5) ("SRLV" 6) ("SRAV" 7) 267 ("JR" 8) ("JALR" 9) ("JCR" 10) ("SYSCALL" 12) ("BREAK" 13) ("SLEEP" 14) 268 ("ADD" 32) ("ADDU" 33) ("SUB" 34) ("SUBU" 35) ("AND" 36) ("OR" 37) ("XOR" 38) ("NOR" 39) 269 ("ADO16" 41) ("SLT" 42) ("SLTU" 43) ("MRGB" 45)) 270 ) 271 272 ; iq10 special function sub-opcodes 273 (define-normal-insn-enum 274 q10s_functions "iq10-only special function sub-opcodes" () FUNC10_ f-func 275 (("YIELD" 14) ("CNT1S" 46)) 276 ) 277 278 ; coprocessor opcodes in concert with f-cp-grp 279 (define-normal-insn-enum 280 cop_functions "iq10 function sub-opcodes" () FUNC10_ f-func 281 (("CFC" 0) ("LOCK" 1) ("CTC" 2) ("UNLK" 3) ("SWRD" 4) ("SWRDL" 5) ("SWWR" 6) ("SWWRU" 7) 282 ("RBA" 8) ("RBAL" 9) ("RBAR" 10) ("DWRD" 12) ("DWRDL" 13) 283 ("WBA" 16) ("WBAU" 17) ("WBAC" 18) ("CRC32" 20) ("CRC32B" 21) 284 ("MCID" 32) ("DBD" 33) ("DBA" 34) ("DPWT" 35) ("AVAIL" 36) ("FREE" 37) ("CHKHDR" 38) ("TSTOD" 39) 285 ("PKRLA" 40) ("PKRLAU" 41) ("PKRLAH" 42) ("PKRLAC" 43) ("CMPHDR" 44) 286 287 ("CM64RS" 0) ("CM64RD" 1) ("CM64RI" 4) ("CM64CLR" 5) 288 ("CM64SS" 8) ("CM64SD" 9) ("CM64SI" 12) 289 ("CM64RA" 16) ("CM64RIA2" 20) ("CM128RIA2" 21) 290 ("CM64SA" 24) ("CM64SIA2" 28) ("CM128SIA2" 29) 291 ("CM32RS" 32) ("CM32RD" 33) ("CM32XOR" 34) ("CM32ANDN" 35) ("CM32RI" 36) ("CM128VSA" 38) 292 ("CM32SS" 40) ("CM32SD" 41) ("CM32OR" 42) ("CM32AND" 43) ("CM32SI" 44) 293 ("CM32RA" 48) 294 ("CM32SA" 56) ) 295 ) 296 297 ; coprocessor opcodes in concert with f-cp-grp 298 (define-normal-insn-enum 299 cop_cm128_4functions "iq10 function sub-opcodes" () FUNC10_ f-cm-4func 300 (("CM128RIA3" 4) ("CM128SIA3" 6)) 301 ) 302 303 (define-normal-insn-enum 304 cop_cm128_3functions "iq10 function sub-opcodes" () FUNC10_ f-cm-3func 305 (("CM128RIA4" 6) ("CM128SIA4" 7)) 306 ) 307 308 (define-normal-insn-enum 309 cop2_functions "iq10 coprocessor sub-opcodes" () FUNC10_ f-cp-op 310 (("PKRLI" 0) ("PKRLIU" 1) ("PKRLIH" 2) ("PKRLIC" 3) ("RBIR" 1) ("RBI" 2) ("RBIL" 3) ("WBIC" 5) ("WBI" 6) ("WBIU" 7)) 311 ) 312 313 (define-normal-insn-enum 314 cop3_cam_functions "iq10 coprocessor cam sub-opcodes" () FUNC10_ f-cp-op-10 315 (("CAM36" 16) ("CAM72" 17) ("CAM144" 18) ("CAM288" 19)) 316 ) 317 318 320 ; Attributes. 321 322 (define-attr 323 (for insn) 324 (type boolean) 325 (name YIELD-INSN) 326 (comment "insn generates a context yield") 327 ) 328 329 (define-attr 330 (for insn) 331 (type boolean) 332 (name LOAD-DELAY) 333 (comment "insn has a load delay") 334 ) 335 336 (define-attr 337 (for insn) 338 (type boolean) 339 (name EVEN-REG-NUM) 340 (comment "insn requires an even numbered register in rt(2000) or rd(10)") 341 ) 342 343 (define-attr 344 (for insn) 345 (type boolean) 346 (name UNSUPPORTED) 347 (comment "insn is unsupported") 348 ) 349 350 (define-pmacro (define-reg-use-attr regfield) 351 (define-attr 352 (for insn) 353 (type boolean) 354 (name (.sym USES- (.upcase regfield))) 355 (comment ("insn accesses register operand " regfield)))) 356 357 (define-reg-use-attr "rd") 358 (define-reg-use-attr "rs") 359 (define-reg-use-attr "rt") 360 (define-reg-use-attr "r31") 361 362 364 ; Operands. 365 366 (dnop rs "register Rs" () h-gr f-rs) 367 (dnop rt "register Rt" () h-gr f-rt) 368 (dnop rd "register Rd" () h-gr f-rd) 369 (dnop rd-rs "register Rd from Rs" () h-gr f-rd-rs) 370 (dnop rd-rt "register Rd from Rt" () h-gr f-rd-rt) 371 (dnop rt-rs "register Rt from Rs" () h-gr f-rt-rs) 372 (dnop shamt "shift amount" () h-uint f-shamt) 373 (define-operand (name imm) (comment "immediate") (attrs) 374 (type h-uint) (index f-imm) (handlers (parse "imm"))) 375 (dnop offset "pc-relative offset" () h-iaddr f-offset) 376 (dnop baseoff "base register offset" () h-iaddr f-imm) 377 (dnop jmptarg "jump target" () h-iaddr f-jtarg) 378 (dnop mask "mask" () h-uint f-mask) 379 (dnop maskq10 "iq10 mask" () h-uint f-maskq10) 380 (dnop maskl "mask left" () h-uint f-maskl) 381 (dnop count "count" () h-uint f-count) 382 (dnop _index "index" () h-uint f-index) 383 (dnop execode "execcode" () h-uint f-excode) 384 (dnop bytecount "byte count" () h-uint f-bytecount) 385 (dnop cam-y "cam global opn y" () h-uint f-cam-y) 386 (dnop cam-z "cam global mask z" () h-uint f-cam-z) 387 (dnop cm-3func "CM 3 bit fn field" () h-uint f-cm-3func) 388 (dnop cm-4func "CM 4 bit fn field" () h-uint f-cm-4func) 389 (dnop cm-3z "CM 3 bit Z field" () h-uint f-cm-3z) 390 (dnop cm-4z "CM 4 bit Z field" () h-uint f-cm-4z) 391 392 ; Aliases for the rs and rt operands. This just makes the load/store 393 ; insns easier to compare with the instruction set documentation. 394 395 (dnop base "base register" () h-gr f-rs) 396 (dnop maskr "mask right" () h-uint f-rs) 397 (dnop bitnum "bit number" () h-uint f-rt) 398 399 ; For high(foo). 400 (define-operand 401 (name hi16) 402 (comment "high 16 bit immediate") 403 (attrs) 404 (type h-uint) 405 (index f-imm) 406 (handlers (parse "hi16")) 407 ) 408 409 ; For low(foo). 410 (define-operand 411 (name lo16) 412 (comment "16 bit signed immediate, for low") 413 (attrs) 414 (type h-uint) 415 (index f-imm) 416 (handlers (parse "lo16")) 417 ) 418 419 ; For negated imm. 420 (define-operand 421 (name mlo16) 422 (comment "negated 16 bit signed immediate") 423 (attrs) 424 (type h-uint) 425 (index f-imm) 426 (handlers (parse "mlo16")) 427 ) 428 429 ; For iq10 jmps 430 ; In the future, we'll want the j & jal to use the 21 bit target, with 431 ; the upper five bits shifted up. For now, don't use this. 432 (define-operand 433 (name jmptargq10) 434 (comment "iq10 21-bit jump offset") 435 (attrs) 436 (type h-iaddr) 437 (index f-jtargq10) 438 (handlers (parse "jtargq10")) 439 ) 440 441 443 ; Instructions. 444 445 ; A pmacro for use in semantic bodies of unimplemented insns. 446 (define-pmacro (unimp mnemonic) (nop)) 447 448 (define-pmacro (bitset? value bit-num) 449 (and value (sll 1 bit-num))) 450 451 (define-pmacro (bitclear? value bit-num) 452 (not (bitset? value bit-num))) 453 454 ; Arithmetic/logic instructions. 455 456 (dni add2 "add registers" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 457 "add ${rd-rs},$rt" 458 (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_ADD) 459 (set rd-rs (add rt rd-rs)) 460 ()) 461 462 (dni add "add registers" (USES-RD USES-RS USES-RT) 463 "add $rd,$rs,$rt" 464 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADD) 465 (set rd (add rs rt)) 466 ()) 467 468 469 (dni addi2 "add immediate" (ALIAS NO-DIS USES-RS USES-RT) 470 "addi ${rt-rs},$lo16" 471 (+ OP_ADDI rt-rs lo16) 472 (set rt-rs (add rt-rs (ext SI (trunc HI lo16)))) 473 ()) 474 475 (dni addi "add immediate" (USES-RS USES-RT) 476 "addi $rt,$rs,$lo16" 477 (+ OP_ADDI rs rt lo16) 478 (set rt (add rs (ext SI (trunc HI lo16)))) 479 ()) 480 481 (dni addiu2 "add immediate unsigned" (ALIAS NO-DIS USES-RS USES-RT) 482 "addiu ${rt-rs},$lo16" 483 (+ OP_ADDIU rt-rs lo16) 484 (set rt-rs (add rt-rs (ext SI (trunc HI lo16)))) 485 ()) 486 487 (dni addiu "add immediate unsigned" (USES-RS USES-RT) 488 "addiu $rt,$rs,$lo16" 489 (+ OP_ADDIU rs rt lo16) 490 (set rt (add rs (ext SI (trunc HI lo16)))) 491 ()) 492 493 (dni addu2 "add unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 494 "addu ${rd-rs},$rt" 495 (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_ADDU) 496 (set rd-rs (add rd-rs rt)) 497 ()) 498 499 (dni addu "add unsigned" (USES-RD USES-RS USES-RT) 500 "addu $rd,$rs,$rt" 501 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADDU) 502 (set rd (add rs rt)) 503 ()) 504 505 (dni ado162 "add 16, ones complement" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 506 "ado16 ${rd-rs},$rt" 507 (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_ADO16) 508 (sequence ((HI high) (HI low)) 509 (set low (add HI (and HI rd-rs #xFFFF) (and HI rt #xFFFF))) 510 (set high (add HI (srl rd-rs 16) (srl rt 16))) 511 (set rd-rs (or SI (sll SI high 16) low))) 512 ()) 513 514 (dni ado16 "add 16, ones complement" (USES-RD USES-RS USES-RT) 515 "ado16 $rd,$rs,$rt" 516 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_ADO16) 517 (sequence ((HI high) (HI low)) 518 (set low (add HI (and HI rs #xFFFF) (and HI rt #xFFFF))) 519 (set high (add HI (srl rs 16) (srl rt 16))) 520 (set rd (or SI (sll SI high 16) low))) 521 ()) 522 523 (dni and2 "and register" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 524 "and ${rd-rs},$rt" 525 (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_AND) 526 (set rd-rs (and rd-rs rt)) 527 ()) 528 529 (dni and "and register" (USES-RD USES-RS USES-RT) 530 "and $rd,$rs,$rt" 531 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_AND) 532 (set rd (and rs rt)) 533 ()) 534 535 (dni andi2 "and immediate" (ALIAS NO-DIS USES-RS USES-RT) 536 "andi ${rt-rs},$lo16" 537 (+ OP_ANDI rt-rs lo16) 538 (set rt-rs (and rt-rs (zext SI lo16))) 539 ()) 540 541 (dni andi "and immediate" (USES-RS USES-RT) 542 "andi $rt,$rs,$lo16" 543 (+ OP_ANDI rs rt lo16) 544 (set rt (and rs (zext SI lo16))) 545 ()) 546 547 (dni andoi2 "and ones immediate" (ALIAS NO-DIS USES-RS USES-RT) 548 "andoi ${rt-rs},$lo16" 549 (+ OP_ANDOI rt-rs lo16) 550 (set rt-rs (and rt-rs (or #xFFFF0000 (ext SI (trunc HI lo16))))) 551 ()) 552 553 (dni andoi "and ones immediate" (USES-RS USES-RT) 554 "andoi $rt,$rs,$lo16" 555 (+ OP_ANDOI rs rt lo16) 556 (set rt (and rs (or #xFFFF0000 (ext SI (trunc HI lo16))))) 557 ()) 558 559 (dni nor2 "nor" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 560 "nor ${rd-rs},$rt" 561 (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_NOR) 562 (set rd-rs (inv (or rd-rs rt))) 563 ()) 564 565 (dni nor "nor" (USES-RD USES-RS USES-RT) 566 "nor $rd,$rs,$rt" 567 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_NOR) 568 (set rd (inv (or rs rt))) 569 ()) 570 571 (dni or2 "or" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 572 "or ${rd-rs},$rt" 573 (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_OR) 574 (set rd-rs (or rd-rs rt)) 575 ()) 576 577 (dni or "or" (USES-RD USES-RS USES-RT) 578 "or $rd,$rs,$rt" 579 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_OR) 580 (set rd (or rs rt)) 581 ()) 582 583 (dni ori2 "or immediate" (ALIAS NO-DIS USES-RS USES-RT) 584 "ori ${rt-rs},$lo16" 585 (+ OP_ORI rt-rs lo16) 586 (set rt-rs (or rt-rs (zext SI lo16))) 587 ()) 588 589 (dni ori "or immediate" (USES-RS USES-RT) 590 "ori $rt,$rs,$lo16" 591 (+ OP_ORI rs rt lo16) 592 (set rt (or rs (zext SI lo16))) 593 ()) 594 595 (dni ram "rotate and mask" (USES-RD USES-RT) 596 "ram $rd,$rt,$shamt,$maskl,$maskr" 597 (+ OP_RAM maskr rt rd shamt (f-5 0) maskl) 598 (sequence () 599 (set rd (ror rt shamt)) 600 (set rd (and rd (srl #xFFFFFFFF maskl))) 601 (set rd (and rd (sll #xFFFFFFFF maskr)))) 602 ()) 603 604 (dni sll "shift left logical" (USES-RD USES-RT) 605 "sll $rd,$rt,$shamt" 606 (+ OP_SPECIAL (f-rs 0) rt rd shamt (f-func 0)) 607 (set rd (sll rt shamt)) 608 ()) 609 610 (dni sllv2 "shift left logical variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 611 "sllv ${rd-rt},$rs" 612 (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SLLV) 613 (set rd-rt (sll rd-rt (and rs #x1F))) 614 ()) 615 616 (dni sllv "shift left logical variable" (USES-RD USES-RS USES-RT) 617 "sllv $rd,$rt,$rs" 618 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLLV) 619 (set rd (sll rt (and rs #x1F))) 620 ()) 621 622 (dni slmv2 "shift left and mask variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 623 "slmv ${rd-rt},$rs,$shamt" 624 (+ OP_SPECIAL rs rd-rt shamt FUNC_SLMV) 625 (set rd-rt (and (sll rd-rt shamt) (srl #xFFFFFFFF rs))) 626 ()) 627 628 (dni slmv "shift left and mask variable" (USES-RD USES-RS USES-RT) 629 "slmv $rd,$rt,$rs,$shamt" 630 (+ OP_SPECIAL rs rt rd shamt FUNC_SLMV) 631 (set rd (and (sll rt shamt) (srl #xFFFFFFFF rs))) 632 ()) 633 634 (dni slt2 "set if less than" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 635 "slt ${rd-rs},$rt" 636 (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SLT) 637 (if (lt rd-rs rt) 638 (set rd-rs 1) 639 (set rd-rs 0)) 640 ()) 641 642 (dni slt "set if less than" (USES-RD USES-RS USES-RT) 643 "slt $rd,$rs,$rt" 644 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLT) 645 (if (lt rs rt) 646 (set rd 1) 647 (set rd 0)) 648 ()) 649 650 (dni slti2 "set if less than immediate" (ALIAS NO-DIS USES-RS USES-RT) 651 "slti ${rt-rs},$imm" 652 (+ OP_SLTI rt-rs imm) 653 (if (lt rt-rs (ext SI (trunc HI imm))) 654 (set rt-rs 1) 655 (set rt-rs 0)) 656 ()) 657 658 (dni slti "set if less than immediate" (USES-RS USES-RT) 659 "slti $rt,$rs,$imm" 660 (+ OP_SLTI rs rt imm) 661 (if (lt rs (ext SI (trunc HI imm))) 662 (set rt 1) 663 (set rt 0)) 664 ()) 665 666 (dni sltiu2 "set if less than immediate unsigned" (ALIAS NO-DIS USES-RS USES-RT) 667 "sltiu ${rt-rs},$imm" 668 (+ OP_SLTIU rt-rs imm) 669 (if (ltu rt-rs (ext SI (trunc HI imm))) 670 (set rt-rs 1) 671 (set rt-rs 0)) 672 ()) 673 674 (dni sltiu "set if less than immediate unsigned" (USES-RS USES-RT) 675 "sltiu $rt,$rs,$imm" 676 (+ OP_SLTIU rs rt imm) 677 (if (ltu rs (ext SI (trunc HI imm))) 678 (set rt 1) 679 (set rt 0)) 680 ()) 681 682 (dni sltu2 "set if less than unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 683 "sltu ${rd-rs},$rt" 684 (+ OP_SPECIAL rd-rs rt (f-shamt 0) FUNC_SLTU) 685 (if (ltu rd-rs rt) 686 (set rd-rs 1) 687 (set rd-rs 0)) 688 ()) 689 690 (dni sltu "set if less than unsigned" (USES-RD USES-RS USES-RT) 691 "sltu $rd,$rs,$rt" 692 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SLTU) 693 (if (ltu rs rt) 694 (set rd 1) 695 (set rd 0)) 696 ()) 697 698 (dni sra2 "shift right arithmetic" (ALIAS NO-DIS USES-RD USES-RT) 699 "sra ${rd-rt},$shamt" 700 (+ OP_SPECIAL (f-rs 0) rd-rt shamt FUNC_SRA) 701 (set rd-rt (sra rd-rt shamt)) 702 ()) 703 704 (dni sra "shift right arithmetic" (USES-RD USES-RT) 705 "sra $rd,$rt,$shamt" 706 (+ OP_SPECIAL (f-rs 0) rt rd shamt FUNC_SRA) 707 (set rd (sra rt shamt)) 708 ()) 709 710 (dni srav2 "shift right arithmetic variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 711 "srav ${rd-rt},$rs" 712 (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SRAV) 713 (set rd-rt (sra rd-rt (and rs #x1F))) 714 ()) 715 716 (dni srav "shift right arithmetic variable" (USES-RD USES-RS USES-RT) 717 "srav $rd,$rt,$rs" 718 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SRAV) 719 (set rd (sra rt (and rs #x1F))) 720 ()) 721 722 (dni srl "shift right logical" (USES-RD USES-RT) 723 "srl $rd,$rt,$shamt" 724 (+ OP_SPECIAL (f-rs 0) rt rd shamt FUNC_SRL) 725 (set rd (srl rt shamt)) 726 ()) 727 728 (dni srlv2 "shift right logical variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 729 "srlv ${rd-rt},$rs" 730 (+ OP_SPECIAL rs rd-rt (f-shamt 0) FUNC_SRLV) 731 (set rd-rt (srl rd-rt (and rs #x1F))) 732 ()) 733 734 (dni srlv "shift right logical variable" (USES-RD USES-RS USES-RT) 735 "srlv $rd,$rt,$rs" 736 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SRLV) 737 (set rd (srl rt (and rs #x1F))) 738 ()) 739 740 (dni srmv2 "shift right and mask variable" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 741 "srmv ${rd-rt},$rs,$shamt" 742 (+ OP_SPECIAL rs rd-rt shamt FUNC_SRMV) 743 (set rd-rt (and (srl rd-rt shamt) (sll #xFFFFFFFF rs))) 744 ()) 745 746 (dni srmv "shift right and mask variable" (USES-RD USES-RS USES-RT) 747 "srmv $rd,$rt,$rs,$shamt" 748 (+ OP_SPECIAL rs rt rd shamt FUNC_SRMV) 749 (set rd (and (srl rt shamt) (sll #xFFFFFFFF rs))) 750 ()) 751 752 (dni sub2 "subtract" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 753 "sub ${rd-rs},$rt" 754 (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SUB) 755 (set rd-rs (sub rd-rs rt)) 756 ()) 757 758 (dni sub "subtract" (USES-RD USES-RS USES-RT) 759 "sub $rd,$rs,$rt" 760 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SUB) 761 (set rd (sub rs rt)) 762 ()) 763 764 (dni subu2 "subtract unsigned" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 765 "subu ${rd-rs},$rt" 766 (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_SUBU) 767 (set rd-rs (sub rd-rs rt)) 768 ()) 769 770 (dni subu "subtract unsigned" (USES-RD USES-RS USES-RT) 771 "subu $rd,$rs,$rt" 772 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_SUBU) 773 (set rd (sub rs rt)) 774 ()) 775 776 (dni xor2 "exclusive or" (ALIAS NO-DIS USES-RD USES-RS USES-RT) 777 "xor ${rd-rs},$rt" 778 (+ OP_SPECIAL rt rd-rs (f-shamt 0) FUNC_XOR) 779 (set rd-rs (xor rd-rs rt)) 780 ()) 781 782 (dni xor "exclusive or" (USES-RD USES-RS USES-RT) 783 "xor $rd,$rs,$rt" 784 (+ OP_SPECIAL rs rt rd (f-shamt 0) FUNC_XOR) 785 (set rd (xor rs rt)) 786 ()) 787 788 (dni xori2 "exclusive or immediate" (ALIAS NO-DIS USES-RS USES-RT) 789 "xori ${rt-rs},$lo16" 790 (+ OP_XORI rt-rs lo16) 791 (set rt-rs (xor rt-rs (zext SI lo16))) 792 ()) 793 794 (dni xori "exclusive or immediate" (USES-RS USES-RT) 795 "xori $rt,$rs,$lo16" 796 (+ OP_XORI rs rt lo16) 797 (set rt (xor rs (zext SI lo16))) 798 ()) 799 800 802 ; Branch instructions. 803 804 (dni bbi "branch bit immediate" (USES-RS) 805 "bbi $rs($bitnum),$offset" 806 (+ OP_BBI rs bitnum offset) 807 (if (bitset? rs bitnum) 808 (delay 1 (set pc offset))) 809 ()) 810 811 (dni bbin "branch bit immediate negated" (USES-RS) 812 "bbin $rs($bitnum),$offset" 813 (+ OP_BBIN rs bitnum offset) 814 (if (bitclear? rs bitnum) 815 (delay 1 (set pc offset))) 816 ()) 817 818 (dni bbv "branch bit variable" (USES-RS USES-RT) 819 "bbv $rs,$rt,$offset" 820 (+ OP_BBV rs rt offset) 821 (if (bitset? rs (and rt #x1F)) 822 (delay 1 (set pc offset))) 823 ()) 824 825 (dni bbvn "branch bit variable negated" (USES-RS USES-RT) 826 "bbvn $rs,$rt,$offset" 827 (+ OP_BBVN rs rt offset) 828 (if (bitclear? rs (and rt #x1F)) 829 (delay 1 (set pc offset))) 830 ()) 831 832 (dni beq "branch if equal" (USES-RS USES-RT) 833 "beq $rs,$rt,$offset" 834 (+ OP_BEQ rs rt offset) 835 (if (eq rs rt) 836 (delay 1 (set pc offset))) 837 ()) 838 839 (dni beql "branch if equal likely" (USES-RS USES-RT) 840 "beql $rs,$rt,$offset" 841 (+ OP_BEQL rs rt offset) 842 (if (eq rs rt) 843 (delay 1 (set pc offset)) 844 (skip 1)) 845 ()) 846 847 (dni bgez "branch if greater than or equal to zero" (USES-RS) 848 "bgez $rs,$offset" 849 (+ OP_REGIMM rs FUNC_BGEZ offset) 850 (if (ge rs 0) 851 (delay 1 (set pc offset))) 852 ()) 853 854 (dni bgezal "branch if greater than or equal to zero and link" (USES-RS USES-R31) 855 "bgezal $rs,$offset" 856 (+ OP_REGIMM rs FUNC_BGEZAL offset) 857 (if (ge rs 0) 858 (sequence () 859 (set (reg h-gr 31) (add pc 8)) 860 (delay 1 (set pc offset)))) 861 ()) 862 863 (dni bgezall 864 "branch if greater than equal to zero and link likely" (USES-RS USES-R31) 865 "bgezall $rs,$offset" 866 (+ OP_REGIMM rs FUNC_BGEZALL offset) 867 (if (ge rs 0) 868 (sequence () 869 (set (reg h-gr 31) (add pc 8)) 870 (delay 1 (set pc offset))) 871 (skip 1)) 872 ()) 873 874 (dni bgezl "branch if greater or equal to zero likely" (USES-RS) 875 "bgezl $rs,$offset" 876 (+ OP_REGIMM rs FUNC_BGEZL offset) 877 (if (ge rs 0) 878 (delay 1 (set pc offset)) 879 (skip 1)) 880 ()) 881 882 (dni bltz "branch if less than zero" (USES-RS) 883 "bltz $rs,$offset" 884 (+ OP_REGIMM rs FUNC_BLTZ offset) 885 (if (lt rs 0) 886 (delay 1 (set pc offset))) 887 ()) 888 889 (dni bltzl "branch if less than zero likely" (USES-RS) 890 "bltzl $rs,$offset" 891 (+ OP_REGIMM rs FUNC_BLTZL offset) 892 (if (lt rs 0) 893 (delay 1 (set pc offset)) 894 (skip 1)) 895 ()) 896 897 (dni bltzal "branch if less than zero and link" (USES-RS USES-R31) 898 "bltzal $rs,$offset" 899 (+ OP_REGIMM rs FUNC_BLTZAL offset) 900 (if (lt rs 0) 901 (sequence () 902 (set (reg h-gr 31) (add pc 8)) 903 (delay 1 (set pc offset)))) 904 ()) 905 906 (dni bltzall "branch if less than zero and link likely" (USES-RS USES-R31) 907 "bltzall $rs,$offset" 908 (+ OP_REGIMM rs FUNC_BLTZALL offset) 909 (if (lt rs 0) 910 (sequence () 911 (set (reg h-gr 31) (add pc 8)) 912 (delay 1 (set pc offset))) 913 (skip 1)) 914 ()) 915 916 (dni bmb0 "branch if matching byte-lane 0" (USES-RS USES-RT) 917 "bmb0 $rs,$rt,$offset" 918 (+ OP_BMB0 rs rt offset) 919 (if (eq (and rs #xFF) (and rt #xFF)) 920 (delay 1 (set pc offset))) 921 ()) 922 923 (dni bmb1 "branch if matching byte-lane 1" (USES-RS USES-RT) 924 "bmb1 $rs,$rt,$offset" 925 (+ OP_BMB1 rs rt offset) 926 (if (eq (and rs #xFF00) (and rt #xFF00)) 927 (delay 1 (set pc offset))) 928 ()) 929 930 (dni bmb2 "branch if matching byte-lane 2" (USES-RS USES-RT) 931 "bmb2 $rs,$rt,$offset" 932 (+ OP_BMB2 rs rt offset) 933 (if (eq (and rs #xFF0000) (and rt #xFF0000)) 934 (delay 1 (set pc offset))) 935 ()) 936 937 (dni bmb3 "branch if matching byte-lane 3" (USES-RS USES-RT) 938 "bmb3 $rs,$rt,$offset" 939 (+ OP_BMB3 rs rt offset) 940 (if (eq (and rs #xFF000000) (and rt #xFF000000)) 941 (delay 1 (set pc offset))) 942 ()) 943 944 (dni bne "branch if not equal" (USES-RS USES-RT) 945 "bne $rs,$rt,$offset" 946 (+ OP_BNE rs rt offset) 947 (if (ne rs rt) 948 (delay 1 (set pc offset))) 949 ()) 950 951 (dni bnel "branch if not equal likely" (USES-RS USES-RT) 952 "bnel $rs,$rt,$offset" 953 (+ OP_BNEL rs rt offset) 954 (if (ne rs rt) 955 (delay 1 (set pc offset)) 956 (skip 1)) 957 ()) 958 959 961 962 964 ; Jump instructions. 965 ; Might as well jump! 966 967 (dni jalr "jump and link register" (USES-RD USES-RS) 968 "jalr $rd,$rs" 969 (+ OP_SPECIAL rs (f-rt 0) rd (f-shamt 0) FUNC_JALR) 970 (delay 1 971 (sequence () 972 (set rd (add pc 8)) 973 (set pc rs))) 974 ()) 975 976 (dni jr "jump register" (USES-RS) 977 "jr $rs" 978 (+ OP_SPECIAL rs (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_JR) 979 (delay 1 (set pc rs)) 980 ()) 981 982 984 ; Load instructions. 985 986 (dni lb "load byte" (LOAD-DELAY USES-RS USES-RT) 987 "lb $rt,$lo16($base)" 988 (+ OP_LB base rt lo16) 989 (set rt (ext WI (mem QI (add base (ext SI (trunc HI lo16)))))) 990 ; (sequence ((SI addr) (SI word)) 991 ; (set addr (add base lo16)) 992 ; (set word (mem SI (and addr (inv 3)))) 993 ; (set word (srl word (sll (and addr 2) 3))) 994 ; (set rt (ext SI word))) 995 ()) 996 997 (dni lbu "load byte unsigned" (LOAD-DELAY USES-RS USES-RT) 998 "lbu $rt,$lo16($base)" 999 (+ OP_LBU base rt lo16) 1000 (set rt (zext WI (mem QI (add base (ext SI (trunc HI lo16)))))) 1001 ; (sequence ((SI addr) (SI word)) 1002 ; (set addr (add base lo16)) 1003 ; (set word (mem SI (and addr (inv 3)))) 1004 ; (set rt (srl word (sll (and addr 2) 3)))) 1005 ()) 1006 1007 (dni lh "load half word" (LOAD-DELAY USES-RS USES-RT) 1008 "lh $rt,$lo16($base)" 1009 (+ OP_LH base rt lo16) 1010 (set rt (ext WI (mem HI (add base (ext SI (trunc HI lo16)))))) 1011 ; (sequence ((SI addr) (HI word)) 1012 ; (set addr (add base lo16)) 1013 ; (set word (mem SI (and addr (inv 3)))) 1014 ; (set word (srl word (sll (and addr 1) 4))) 1015 ; (set rt (ext SI word))) 1016 ()) 1017 1018 (dni lhu "load half word unsigned" (LOAD-DELAY USES-RS USES-RT) 1019 "lhu $rt,$lo16($base)" 1020 (+ OP_LHU base rt lo16) 1021 (set rt (zext WI (mem HI (add base (ext SI (trunc HI lo16)))))) 1022 ; (sequence ((SI addr) (SI word)) 1023 ; (set addr (add base lo16)) 1024 ; (set word (mem SI (and addr (inv 3)))) 1025 ; (set rt (srl word (sll (and addr 1) 4)))) 1026 ()) 1027 1028 (dni lui "load upper immediate" (USES-RT) 1029 "lui $rt,$hi16" 1030 (+ OP_LUI (f-rs 0) rt hi16) 1031 (set rt (sll hi16 16)) 1032 ()) 1033 1034 (dni lw "load word" (LOAD-DELAY USES-RS USES-RT) 1035 "lw $rt,$lo16($base)" 1036 (+ OP_LW base rt lo16) 1037 (set rt (mem SI (add base (ext SI (trunc HI lo16))))) 1038 ()) 1039 1040 1042 ; Store instructions. 1043 1044 (dni sb "store byte" (USES-RS USES-RT) 1045 "sb $rt,$lo16($base)" 1046 (+ OP_SB base rt lo16) 1047 (set (mem QI (add base (ext SI (trunc HI lo16)))) (and QI rt #xFF)) 1048 ()) 1049 1050 (dni sh "store half word" (USES-RS USES-RT) 1051 "sh $rt,$lo16($base)" 1052 (+ OP_SH base rt lo16) 1053 (set (mem HI (add base (ext SI (trunc HI lo16)))) (and HI rt #xFFFF)) 1054 ()) 1055 1056 (dni sw "store word" (USES-RS USES-RT) 1057 "sw $rt,$lo16($base)" 1058 (+ OP_SW base rt lo16) 1059 (set (mem SI (add base (ext SI (trunc HI lo16)))) rt) 1060 ()) 1061 1062 1064 ; Special instructions for simulation/debugging 1065 (dni break "breakpoint" () 1066 "break" 1067 (+ OP_SPECIAL (f-rs 0) (f-rt 0) (f-rd 0) (f-shamt 0) FUNC_BREAK) 1068 (c-call VOID "do_break" pc) 1069 ()) 1070 1071 (dni syscall "system call" (YIELD-INSN) 1072 "syscall" 1073 (+ OP_SPECIAL execode (f-func 12)) 1074 (c-call VOID "do_syscall") 1075 ()) 1076 1077 ; Macro instructions, common to iq10 & iq2000 1078 1079 (dnmi nop "nop" () 1080 "nop" 1081 (emit sll (rd 0) (rt 0) (shamt 0)) 1082 ) 1083 1084 (dnmi li "load immediate" (USES-RS NO-DIS) 1085 "li $rs,$imm" 1086 (emit ori (rt 0) rs imm) 1087 ) 1088 1089 (dnmi move "move" (USES-RD USES-RT NO-DIS) 1090 "move $rd,$rt" 1091 (emit or rd (rs 0) rt) 1092 ) 1093 1094 (dnmi lb-base-0 "load byte - implied base 0" (USES-RT NO-DIS) 1095 "lb $rt,$lo16" 1096 (emit lb rt lo16 (base 0)) 1097 ) 1098 1099 (dnmi lbu-base-0 "load byte unsigned - implied base 0" (USES-RT NO-DIS) 1100 "lbu $rt,$lo16" 1101 (emit lbu rt lo16 (base 0)) 1102 ) 1103 1104 (dnmi lh-base-0 "load half - implied base 0" (USES-RT NO-DIS) 1105 "lh $rt,$lo16" 1106 (emit lh rt lo16 (base 0)) 1107 ) 1108 1109 (dnmi lw-base-0 "load word - implied base 0" (USES-RT NO-DIS) 1110 "lw $rt,$lo16" 1111 (emit lw rt lo16 (base 0)) 1112 ) 1113 1114 (dnmi m-add "add immediate" (USES-RS USES-RT NO-DIS) 1115 "add $rt,$rs,$lo16" 1116 (emit addi rt rs lo16)) 1117 1118 (dnmi m-addu "add immediate unsigned" (USES-RS USES-RT NO-DIS) 1119 "addu $rt,$rs,$lo16" 1120 (emit addiu rt rs lo16) 1121 ) 1122 1123 (dnmi m-and "and immediate" (USES-RS USES-RT NO-DIS) 1124 "and $rt,$rs,$lo16" 1125 (emit andi rt rs lo16) 1126 ) 1127 1128 (dnmi m-j "jump register" (USES-RS NO-DIS) 1129 "j $rs" 1130 (emit jr rs) 1131 ) 1132 1133 (dnmi m-or "or immediate" (USES-RS USES-RT NO-DIS) 1134 "or $rt,$rs,$lo16" 1135 (emit ori rt rs lo16) 1136 ) 1137 1138 (dnmi m-sll "shift left logical" (USES-RD USES-RT USES-RS NO-DIS) 1139 "sll $rd,$rt,$rs" 1140 (emit sllv rd rt rs) 1141 ) 1142 1143 (dnmi m-slt "slt immediate" (USES-RS USES-RT NO-DIS) 1144 "slt $rt,$rs,$imm" 1145 (emit slti rt rs imm) 1146 ) 1147 1148 (dnmi m-sltu "sltu immediate" (USES-RS USES-RT NO-DIS) 1149 "sltu $rt,$rs,$imm" 1150 (emit sltiu rt rs imm) 1151 ) 1152 1153 (dnmi m-sra "shift right arithmetic" (USES-RD USES-RT USES-RS NO-DIS) 1154 "sra $rd,$rt,$rs" 1155 (emit srav rd rt rs) 1156 ) 1157 1158 (dnmi m-srl "shift right logical" (USES-RD USES-RT USES-RS NO-DIS) 1159 "srl $rd,$rt,$rs" 1160 (emit srlv rd rt rs) 1161 ) 1162 1163 (dnmi not "not" (USES-RD USES-RT NO-DIS) 1164 "not $rd,$rt" 1165 (emit nor rd (rs 0) rt) 1166 ) 1167 1168 (dnmi subi "sub immediate" (USES-RS USES-RT NO-DIS) 1169 "subi $rt,$rs,$mlo16" 1170 (emit addiu rt rs mlo16) 1171 ) 1172 1173 (dnmi m-sub "subtract immediate" (USES-RS USES-RT NO-DIS) 1174 "sub $rt,$rs,$mlo16" 1175 (emit addiu rt rs mlo16) 1176 ) 1177 1178 (dnmi m-subu "subtract unsigned" (USES-RS USES-RT NO-DIS) 1179 "subu $rt,$rs,$mlo16" 1180 (emit addiu rt rs mlo16) 1181 ) 1182 1183 (dnmi sb-base-0 "store byte - implied base 0" (USES-RT NO-DIS) 1184 "sb $rt,$lo16" 1185 (emit sb rt lo16 (base 0)) 1186 ) 1187 1188 (dnmi sh-base-0 "store half - implied base 0" (USES-RT NO-DIS) 1189 "sh $rt,$lo16" 1190 (emit sh rt lo16 (base 0)) 1191 ) 1192 1193 (dnmi sw-base-0 "store word - implied base 0" (USES-RT NO-DIS) 1194 "sw $rt,$lo16" 1195 (emit sw rt lo16 (base 0)) 1196 ) 1197 1198 (dnmi m-xor "xor immediate" (USES-RS USES-RT NO-DIS) 1199 "xor $rt,$rs,$lo16" 1200 (emit xori rt rs lo16) 1201 ) 1202 1203 1204 (if (keep-mach? (iq2000)) 1205 (include "iq2000m.cpu")) 1206 1207 (if (keep-mach? (iq10)) 1208 (include "iq10.cpu")) 1209