1883529b6Schristos; Toshiba MeP Media Engine architecture description. -*- Scheme -*- 2883529b6Schristos; Copyright 2011 Free Software Foundation, Inc. 3883529b6Schristos; 4883529b6Schristos; Contributed by Red Hat Inc; 5883529b6Schristos; 6883529b6Schristos; This file is part of the GNU Binutils. 7883529b6Schristos; 8883529b6Schristos; This program is free software; you can redistribute it and/or modify 9883529b6Schristos; it under the terms of the GNU General Public License as published by 10883529b6Schristos; the Free Software Foundation; either version 3 of the License, or 11883529b6Schristos; (at your option) any later version. 12883529b6Schristos; 13883529b6Schristos; This program is distributed in the hope that it will be useful, 14883529b6Schristos; but WITHOUT ANY WARRANTY; without even the implied warranty of 15883529b6Schristos; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16883529b6Schristos; GNU General Public License for more details. 17883529b6Schristos; 18883529b6Schristos; You should have received a copy of the GNU General Public License 19883529b6Schristos; along with this program; if not, write to the Free Software 20883529b6Schristos; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 21883529b6Schristos; MA 02110-1301, USA. 22883529b6Schristos 23883529b6Schristos(include "simplify.inc") 24883529b6Schristos 25883529b6Schristos(define-pmacro isa-enum () 26883529b6Schristos (isas mep 27883529b6Schristos; begin-isa-enum 28883529b6Schristos ext_core1 ext_cop1_16 ext_cop1_32 ext_cop1_48 ext_cop1_64 29883529b6Schristos; end-isa-enum 30883529b6Schristos ) 31883529b6Schristos) 32883529b6Schristos 33883529b6Schristos(define-arch 34883529b6Schristos (name mep) 35883529b6Schristos (comment "Toshiba MeP Media Engine") 36883529b6Schristos (insn-lsb0? #f) ;; work around cgen limitation 37883529b6Schristos (machs mep h1 c5) 38883529b6Schristos isa-enum 39883529b6Schristos) 40883529b6Schristos 41883529b6Schristos(define-isa 42883529b6Schristos (name mep) 43883529b6Schristos (comment "MeP core instruction set") 44883529b6Schristos (default-insn-word-bitsize 32) 45883529b6Schristos (default-insn-bitsize 32) 46883529b6Schristos (base-insn-bitsize 32) 47883529b6Schristos) 48883529b6Schristos 49883529b6Schristos; begin-isas 50883529b6Schristos(define-isa 51883529b6Schristos (name ext_core1) 52883529b6Schristos (comment "MeP core extension instruction set") 53883529b6Schristos (default-insn-word-bitsize 32) 54883529b6Schristos (default-insn-bitsize 32) 55883529b6Schristos (base-insn-bitsize 32) 56883529b6Schristos) 57883529b6Schristos 58883529b6Schristos(define-isa 59883529b6Schristos (name ext_cop1_16) 60883529b6Schristos (comment "MeP coprocessor instruction set") 61883529b6Schristos (default-insn-word-bitsize 32) 62883529b6Schristos (default-insn-bitsize 32) 63883529b6Schristos (base-insn-bitsize 32) 64883529b6Schristos) 65883529b6Schristos 66883529b6Schristos(define-isa 67883529b6Schristos (name ext_cop1_32) 68883529b6Schristos (comment "MeP coprocessor instruction set") 69883529b6Schristos (default-insn-word-bitsize 32) 70883529b6Schristos (default-insn-bitsize 32) 71883529b6Schristos (base-insn-bitsize 32) 72883529b6Schristos) 73883529b6Schristos 74883529b6Schristos(define-isa 75883529b6Schristos (name ext_cop1_48) 76883529b6Schristos (comment "MeP coprocessor instruction set") 77883529b6Schristos (default-insn-word-bitsize 32) 78883529b6Schristos (default-insn-bitsize 32) 79883529b6Schristos (base-insn-bitsize 32) 80883529b6Schristos) 81883529b6Schristos 82883529b6Schristos(define-isa 83883529b6Schristos (name ext_cop1_64) 84883529b6Schristos (comment "MeP coprocessor instruction set") 85883529b6Schristos (default-insn-word-bitsize 32) 86883529b6Schristos (default-insn-bitsize 32) 87883529b6Schristos (base-insn-bitsize 32) 88883529b6Schristos) 89883529b6Schristos 90883529b6Schristos(define-pmacro all-mep-isas () (ISA mep,ext_core1,ext_cop1_16,ext_cop1_32,ext_cop1_48,ext_cop1_64)) 91883529b6Schristos 92883529b6Schristos(define-pmacro all-mep-core-isas () (ISA mep,ext_core1,ext_cop1_32)) 93883529b6Schristos 94883529b6Schristos(define-pmacro all-core-isa-list () mep,ext_core1) 95883529b6Schristos; end-isas 96883529b6Schristos 97883529b6Schristos(define-cpu 98883529b6Schristos (name mepf) 99883529b6Schristos (comment "MeP family") 100883529b6Schristos (endian either) 101883529b6Schristos (insn-chunk-bitsize 16) 102883529b6Schristos (word-bitsize 32) 103883529b6Schristos) 104883529b6Schristos 105883529b6Schristos(define-mach 106883529b6Schristos (name mep) 107883529b6Schristos (comment "MeP media engine") 108883529b6Schristos (cpu mepf) 109883529b6Schristos isa-enum 110883529b6Schristos) 111883529b6Schristos 112883529b6Schristos(define-mach 113883529b6Schristos (name h1) 114883529b6Schristos (comment "H1 media engine") 115883529b6Schristos (cpu mepf) 116883529b6Schristos isa-enum 117883529b6Schristos) 118883529b6Schristos 119883529b6Schristos(define-mach 120883529b6Schristos (name c5) 121883529b6Schristos (comment "C5 media engine") 122883529b6Schristos (cpu mepf) 123883529b6Schristos isa-enum 124883529b6Schristos) 125883529b6Schristos 126883529b6Schristos(define-model 127883529b6Schristos (name mep) 128883529b6Schristos (comment "MeP media engine processor") 129883529b6Schristos (mach c5) ; mach gets changed by MeP-Integrator 130883529b6Schristos 131883529b6Schristos (unit u-exec "execution unit" () 132883529b6Schristos 1 1 ; issue done 133883529b6Schristos () () () ()) 134883529b6Schristos 135883529b6Schristos ; Branch unit 136883529b6Schristos (unit u-branch "Branch Unit" () 137883529b6Schristos 0 0 ; issue done 138883529b6Schristos () ; state 139883529b6Schristos () ; inputs 140883529b6Schristos ((pc)) ; outputs 141883529b6Schristos () ; profile action (default) 142883529b6Schristos ) 143883529b6Schristos 144883529b6Schristos ; Multiply unit 145883529b6Schristos (unit u-multiply "Multiply Unit" () 146883529b6Schristos 0 0 ; issue done 147883529b6Schristos () ; state 148883529b6Schristos () ; inputs 149883529b6Schristos () ; outputs 150883529b6Schristos () ; profile action (default) 151883529b6Schristos ) 152883529b6Schristos 153883529b6Schristos ; Divide unit 154883529b6Schristos (unit u-divide "Divide Unit" () 155883529b6Schristos 0 0 ; issue done 156883529b6Schristos () ; state 157883529b6Schristos () ; inputs 158883529b6Schristos () ; outputs 159883529b6Schristos () ; profile action (default) 160883529b6Schristos ) 161883529b6Schristos 162883529b6Schristos ; Stcb unit 163883529b6Schristos (unit u-stcb "stcb Unit" () 164883529b6Schristos 0 0 ; issue done 165883529b6Schristos () ; state 166883529b6Schristos () ; inputs 167883529b6Schristos () ; outputs 168883529b6Schristos () ; profile action (default) 169883529b6Schristos ) 170883529b6Schristos 171883529b6Schristos ; Ldcb unit 172883529b6Schristos (unit u-ldcb "ldcb Unit" () 173883529b6Schristos 0 0 ; issue done 174883529b6Schristos () ; state 175883529b6Schristos () ; inputs 176883529b6Schristos () ; outputs 177883529b6Schristos () ; profile action (default) 178883529b6Schristos ) 179883529b6Schristos 180883529b6Schristos ; Load gpr unit 181883529b6Schristos (unit u-load-gpr "Load into GPR Unit" () 182883529b6Schristos 0 0 ; issue done 183883529b6Schristos () ; state 184883529b6Schristos () ; inputs 185883529b6Schristos ((loadreg INT -1)) ; outputs 186883529b6Schristos () ; profile action (default) 187883529b6Schristos ) 188883529b6Schristos 189883529b6Schristos (unit u-ldcb-gpr "Ldcb into GPR Unit" () 190883529b6Schristos 0 0 ; issue done 191883529b6Schristos () ; state 192883529b6Schristos () ; inputs 193883529b6Schristos ((loadreg INT -1)) ; outputs 194883529b6Schristos () ; profile action (default) 195883529b6Schristos ) 196883529b6Schristos 197883529b6Schristos ; Multiply into GPR unit 198883529b6Schristos (unit u-mul-gpr "Multiply into GPR Unit" () 199883529b6Schristos 0 0 ; issue done 200883529b6Schristos () ; state 201883529b6Schristos () ; inputs 202883529b6Schristos ((resultreg INT -1)) ; outputs 203883529b6Schristos () ; profile action (default) 204883529b6Schristos ) 205883529b6Schristos 206883529b6Schristos ; Use gpr unit -- stalls if GPR not ready 207883529b6Schristos (unit u-use-gpr "Use GPR Unit" () 208883529b6Schristos 0 0 ; issue done 209883529b6Schristos () ; state 210883529b6Schristos ((usereg INT -1)) ; inputs 211883529b6Schristos () ; outputs 212883529b6Schristos () ; profile action (default) 213883529b6Schristos ) 214883529b6Schristos 215883529b6Schristos ; Use ctrl-reg unit -- stalls if CTRL-REG not ready 216883529b6Schristos (unit u-use-ctrl-reg "Use CTRL-REG Unit" () 217883529b6Schristos 0 0 ; issue done 218883529b6Schristos () ; state 219883529b6Schristos ((usereg INT -1)) ; inputs 220883529b6Schristos () ; outputs 221883529b6Schristos () ; profile action (default) 222883529b6Schristos ) 223883529b6Schristos 224883529b6Schristos ; Store ctrl-reg unit -- stalls if CTRL-REG not ready 225883529b6Schristos (unit u-store-ctrl-reg "Store CTRL-REG Unit" () 226883529b6Schristos 0 0 ; issue done 227883529b6Schristos () ; state 228883529b6Schristos () ; inputs 229883529b6Schristos ((storereg INT -1)) ; outputs 230883529b6Schristos () ; profile action (default) 231883529b6Schristos ) 232883529b6Schristos) 233883529b6Schristos 234883529b6Schristos; Hardware elements. 235883529b6Schristos 236883529b6Schristos(dnh h-pc "program counter" (PC PROFILE all-mep-isas) (pc) () () ()) 237883529b6Schristos 238883529b6Schristos(define-hardware 239883529b6Schristos (name h-gpr) 240883529b6Schristos (comment "General purpose registers") 241883529b6Schristos (attrs all-mep-isas CACHE-ADDR PROFILE) 242883529b6Schristos (type register SI (16)) 243883529b6Schristos (indices keyword "$" 244883529b6Schristos (("0" 0) ("1" 1) ("2" 2) ("3" 3) ("4" 4) ("5" 5) 245883529b6Schristos ("6" 6) ("7" 7) ("8" 8) ("9" 9) ("10" 10) ("11" 11) 246883529b6Schristos ; "$8" is the preferred name for register 8, but "$tp", "$gp" 247883529b6Schristos ; and "$sp" are preferred for their respective registers. 248883529b6Schristos (fp 8) (tp 13) (gp 14) (sp 15) 249883529b6Schristos ("12" 12) ("13" 13) ("14" 14) ("15" 15))) 250883529b6Schristos) 251883529b6Schristos 252883529b6Schristos(define-hardware 253883529b6Schristos (name h-csr) 254883529b6Schristos (comment "Control/special registers") 255883529b6Schristos (attrs all-mep-isas PROFILE) 256883529b6Schristos (type register SI (32)) 257883529b6Schristos (indices keyword "$" 258883529b6Schristos ((pc 0) (lp 1) (sar 2) (rpb 4) (rpe 5) (rpc 6) 259883529b6Schristos (hi 7) (lo 8) (mb0 12) (me0 13) (mb1 14) (me1 15) 260883529b6Schristos (psw 16) (id 17) (tmp 18) (epc 19) (exc 20) (cfg 21) 261883529b6Schristos (npc 23) (dbg 24) (depc 25) (opt 26) (rcfg 27) (ccfg 28) 262883529b6Schristos; begin-extra-csr-registers 263883529b6Schristos (vid 22) 264883529b6Schristos; end-extra-csr-registers 265883529b6Schristos )) 266883529b6Schristos (get (index) (c-call SI "cgen_get_csr_value" index)) 267883529b6Schristos (set (index newval) (c-call VOID "cgen_set_csr_value" index newval)) 268883529b6Schristos) 269883529b6Schristos 270883529b6Schristos(define-pmacro (-reg-pair n) ((.sym n) n)) 271883529b6Schristos(define-hardware 272883529b6Schristos (name h-cr64) 273883529b6Schristos (comment "64-bit coprocessor registers") 274883529b6Schristos (attrs all-mep-isas) 275883529b6Schristos ; This assumes that the data path of the co-pro is 64 bits. 276883529b6Schristos (type register DI (32)) 277883529b6Schristos (indices keyword "$c" (.map -reg-pair (.iota 32))) 278883529b6Schristos (set (index newval) (c-call VOID "h_cr64_queue_set" index newval)) 279883529b6Schristos) 280883529b6Schristos(define-hardware 281883529b6Schristos (name h-cr64-w) 282883529b6Schristos (comment "64-bit coprocessor registers, pending writes") 283883529b6Schristos (attrs all-mep-isas) 284883529b6Schristos ; This assumes that the data path of the co-pro is 64 bits. 285883529b6Schristos (type register DI (32)) 286883529b6Schristos) 287883529b6Schristos 288883529b6Schristos(define-hardware 289883529b6Schristos (name h-cr) 290883529b6Schristos (comment "32-bit coprocessor registers") 291883529b6Schristos (attrs all-mep-isas VIRTUAL) 292883529b6Schristos (type register SI (32)) 293883529b6Schristos (indices keyword "$c" (.map -reg-pair (.iota 32))) 294883529b6Schristos (set (index newval) (c-call VOID "h_cr64_set" index (ext DI newval))) 295883529b6Schristos (get (index) (trunc SI (c-call DI "h_cr64_get" index))) 296883529b6Schristos) 297883529b6Schristos 298883529b6Schristos;; Given a coprocessor control register number N, expand to a 299883529b6Schristos;; name/index pair: ($ccrN N) 300883529b6Schristos(define-pmacro (-ccr-reg-pair n) ((.sym "$ccr" n) n)) 301883529b6Schristos 302883529b6Schristos(define-hardware 303883529b6Schristos (name h-ccr) 304883529b6Schristos (comment "Coprocessor control registers") 305883529b6Schristos (attrs all-mep-isas) 306883529b6Schristos (type register SI (64)) 307883529b6Schristos (indices keyword "" (.map -ccr-reg-pair (.iota 64))) 308883529b6Schristos (set (index newval) (c-call VOID "h_ccr_queue_set" index newval)) 309883529b6Schristos) 310883529b6Schristos(define-hardware 311883529b6Schristos (name h-ccr-w) 312883529b6Schristos (comment "Coprocessor control registers, pending writes") 313883529b6Schristos (attrs all-mep-isas) 314883529b6Schristos (type register SI (64)) 315883529b6Schristos) 316883529b6Schristos 317883529b6Schristos 318883529b6Schristos; Instruction fields. Bit numbering reversed. 319883529b6Schristos 320883529b6Schristos; Conventions: 321883529b6Schristos; 322883529b6Schristos; N = number of bits in value 323883529b6Schristos; A = alignment (2 or 4, omit for 1) 324883529b6Schristos; B = leftmost (i.e. closest to zero) bit position 325883529b6Schristos; 326883529b6Schristos; -- Generic Fields (f-*) -- 327883529b6Schristos; N number of bits in *value* (1-24) 328883529b6Schristos; [us] signed vs unsigned 329883529b6Schristos; B position of left-most bit (4-16) 330883529b6Schristos; aA opt. alignment (2=drop 1 lsb, 4=drop 2 lsbs, etc) 331883529b6Schristos; n opt. for noncontiguous fields 332883529b6Schristos; f-foo-{hi,lo} msb/lsb parts of field f-foo 333883529b6Schristos; 334883529b6Schristos; -- Operands -- 335883529b6Schristos; pcrelNaA PC-relative branch target (signed) 336883529b6Schristos; pcabsNaA Absolute branch target (unsigned) 337883529b6Schristos; 338883529b6Schristos; [us]dispNaA [un]signed displacement 339883529b6Schristos; [us]immN [un]signed immediate value 340883529b6Schristos; addrNaA absolute address (unsigned) 341883529b6Schristos; 342883529b6Schristos; Additional prefixes may be used for special cases. 343883529b6Schristos 344883529b6Schristos(dnf f-major "major opcode" (all-mep-core-isas) 0 4) 345883529b6Schristos 346883529b6Schristos(dnf f-rn "register n" (all-mep-core-isas) 4 4) 347883529b6Schristos(dnf f-rn3 "register 0-7" (all-mep-core-isas) 5 3) 348883529b6Schristos(dnf f-rm "register m" (all-mep-core-isas) 8 4) 349883529b6Schristos(dnf f-rl "register l" (all-mep-core-isas) 12 4) 350883529b6Schristos(dnf f-sub2 "sub opcode (2 bits)" (all-mep-core-isas) 14 2) 351883529b6Schristos(dnf f-sub3 "sub opcode (3 bits)" (all-mep-core-isas) 13 3) 352883529b6Schristos(dnf f-sub4 "sub opcode (4 bits)" (all-mep-core-isas) 12 4) 353883529b6Schristos(dnf f-ext "extended field" (all-mep-core-isas) 16 8) 354883529b6Schristos(dnf f-ext4 "extended field 16:4" (all-mep-core-isas) 16 4) 355883529b6Schristos(dnf f-ext62 "extended field 20:2" (all-mep-core-isas) 20 2) 356883529b6Schristos(dnf f-crn "copro register n" (all-mep-core-isas) 4 4) 357883529b6Schristos 358883529b6Schristos(df f-csrn-hi "cr hi 1u15" (all-mep-core-isas) 15 1 UINT #f #f) 359883529b6Schristos(df f-csrn-lo "cr lo 4u8" (all-mep-core-isas) 8 4 UINT #f #f) 360883529b6Schristos(define-multi-ifield 361883529b6Schristos (name f-csrn) 362883529b6Schristos (comment "control reg") 363883529b6Schristos (attrs all-mep-core-isas) 364883529b6Schristos (mode UINT) 365883529b6Schristos (subfields f-csrn-hi f-csrn-lo) 366883529b6Schristos (insert (sequence () 367883529b6Schristos (set (ifield f-csrn-lo) (and (ifield f-csrn) #xf)) 368883529b6Schristos (set (ifield f-csrn-hi) (srl (ifield f-csrn) 4)))) 369883529b6Schristos (extract (set (ifield f-csrn) 370883529b6Schristos (or (sll (ifield f-csrn-hi) 4) (ifield f-csrn-lo)))) 371883529b6Schristos ) 372883529b6Schristos 373883529b6Schristos(df f-crnx-hi "crx hi 1u28" (all-mep-core-isas) 28 1 UINT #f #f) 374883529b6Schristos(df f-crnx-lo "crx lo 4u4" (all-mep-core-isas) 4 4 UINT #f #f) 375883529b6Schristos(define-multi-ifield 376883529b6Schristos (name f-crnx) 377883529b6Schristos (comment "copro register n (0-31)") 378883529b6Schristos (attrs all-mep-core-isas) 379883529b6Schristos (mode UINT) 380883529b6Schristos (subfields f-crnx-hi f-crnx-lo) 381883529b6Schristos (insert (sequence () 382883529b6Schristos (set (ifield f-crnx-lo) (and (ifield f-crnx) #xf)) 383883529b6Schristos (set (ifield f-crnx-hi) (srl (ifield f-crnx) 4)))) 384883529b6Schristos (extract (set (ifield f-crnx) 385883529b6Schristos (or (sll (ifield f-crnx-hi) 4) (ifield f-crnx-lo)))) 386883529b6Schristos ) 387883529b6Schristos 388883529b6Schristos; Miscellaneous fields. 389883529b6Schristos 390883529b6Schristos(define-pmacro (dnfb n) 391883529b6Schristos (dnf (.sym f- n) (.str "bit " n) (all-mep-isas) n 1)) 392883529b6Schristos 393883529b6Schristos; Define small fields used throughout the instruction set description. 394883529b6Schristos; Each field (eg. `f-N') is at single bit field at position N. 395883529b6Schristos 396883529b6Schristos(dnfb 0) 397883529b6Schristos(dnfb 1) 398883529b6Schristos(dnfb 2) 399883529b6Schristos(dnfb 3) 400883529b6Schristos(dnfb 4) 401883529b6Schristos(dnfb 5) 402883529b6Schristos(dnfb 6) 403883529b6Schristos(dnfb 7) 404883529b6Schristos(dnfb 8) 405883529b6Schristos(dnfb 9) 406883529b6Schristos(dnfb 10) 407883529b6Schristos(dnfb 11) 408883529b6Schristos(dnfb 12) 409883529b6Schristos(dnfb 13) 410883529b6Schristos(dnfb 14) 411883529b6Schristos(dnfb 15) 412883529b6Schristos(dnfb 16) 413883529b6Schristos(dnfb 17) 414883529b6Schristos(dnfb 18) 415883529b6Schristos(dnfb 19) 416883529b6Schristos(dnfb 20) 417883529b6Schristos(dnfb 21) 418883529b6Schristos(dnfb 22) 419883529b6Schristos(dnfb 23) 420883529b6Schristos(dnfb 24) 421883529b6Schristos(dnfb 25) 422883529b6Schristos(dnfb 26) 423883529b6Schristos(dnfb 27) 424883529b6Schristos(dnfb 28) 425883529b6Schristos(dnfb 29) 426883529b6Schristos(dnfb 30) 427883529b6Schristos(dnfb 31) 428883529b6Schristos 429883529b6Schristos; Branch/Jump target addresses 430883529b6Schristos 431883529b6Schristos(df f-8s8a2 "pc-rel addr (8 bits)" (all-mep-core-isas PCREL-ADDR) 8 7 INT 432883529b6Schristos ((value pc) (sra SI (sub SI value pc) 1)) 433*4f645668Schristos ((value pc) (add SI (mul SI value 2) pc))) 434883529b6Schristos 435883529b6Schristos(df f-12s4a2 "pc-rel addr (12 bits)" (all-mep-core-isas PCREL-ADDR) 4 11 INT 436883529b6Schristos ((value pc) (sra SI (sub SI value pc) 1)) 437*4f645668Schristos ((value pc) (add SI (mul SI value 2) pc))) 438883529b6Schristos 439883529b6Schristos(df f-17s16a2 "pc-rel addr (17 bits)" (all-mep-core-isas PCREL-ADDR) 16 16 INT 440883529b6Schristos ((value pc) (sra SI (sub SI value pc) 1)) 441*4f645668Schristos ((value pc) (add SI (mul SI value 2) pc))) 442883529b6Schristos 443883529b6Schristos(df f-24s5a2n-hi "24s5a2n hi 16s16" (all-mep-core-isas PCREL-ADDR) 16 16 INT #f #f) 444883529b6Schristos(df f-24s5a2n-lo "24s5a2n lo 7s5a2" (all-mep-core-isas PCREL-ADDR) 5 7 UINT #f #f) 445883529b6Schristos(define-multi-ifield 446883529b6Schristos (name f-24s5a2n) 447883529b6Schristos (comment "pc-rel addr (24 bits align 2)") 448883529b6Schristos (attrs all-mep-core-isas PCREL-ADDR) 449883529b6Schristos (mode INT) 450883529b6Schristos (subfields f-24s5a2n-hi f-24s5a2n-lo) 451883529b6Schristos (insert (sequence () 452883529b6Schristos (set (ifield f-24s5a2n) 453883529b6Schristos (sub (ifield f-24s5a2n) pc)) 454883529b6Schristos (set (ifield f-24s5a2n-lo) 455883529b6Schristos (srl (and (ifield f-24s5a2n) #xfe) 1)) 456883529b6Schristos (set (ifield f-24s5a2n-hi) 457883529b6Schristos (sra INT (ifield f-24s5a2n) 8)))) 458883529b6Schristos (extract (set (ifield f-24s5a2n) 459*4f645668Schristos (add SI (or (mul (ifield f-24s5a2n-hi) 256) 460883529b6Schristos (sll (ifield f-24s5a2n-lo) 1)) 461883529b6Schristos pc))) 462883529b6Schristos ) 463883529b6Schristos 464883529b6Schristos(df f-24u5a2n-hi "24u5a2n hi 16u16" (all-mep-core-isas) 16 16 UINT #f #f) 465883529b6Schristos(df f-24u5a2n-lo "24u5a2n lo 7u5a2" (all-mep-core-isas) 5 7 UINT #f #f) 466883529b6Schristos(define-multi-ifield 467883529b6Schristos (name f-24u5a2n) 468883529b6Schristos (comment "abs jump target (24 bits, alignment 2)") 469883529b6Schristos (attrs all-mep-core-isas ABS-ADDR) 470883529b6Schristos (mode UINT) 471883529b6Schristos (subfields f-24u5a2n-hi f-24u5a2n-lo) 472883529b6Schristos (insert (sequence () 473883529b6Schristos (set (ifield f-24u5a2n-lo) 474883529b6Schristos (srl (and (ifield f-24u5a2n) #xff) 1)) 475883529b6Schristos (set (ifield f-24u5a2n-hi) 476883529b6Schristos (srl (ifield f-24u5a2n) 8)) 477883529b6Schristos )) 478883529b6Schristos (extract (set (ifield f-24u5a2n) 479883529b6Schristos (or (sll (ifield f-24u5a2n-hi) 8) 480883529b6Schristos (sll (ifield f-24u5a2n-lo) 1)))) 481883529b6Schristos ) 482883529b6Schristos 483883529b6Schristos; Displacement fields. 484883529b6Schristos 485883529b6Schristos(df f-2u6 "SAR offset (2 bits)" (all-mep-core-isas) 6 2 UINT #f #f) 486883529b6Schristos(df f-7u9 "tp-rel b (7 bits)" (all-mep-core-isas) 9 7 UINT #f #f) 487883529b6Schristos(df f-7u9a2 "tp-rel h (7 bits)" (all-mep-core-isas) 9 6 UINT 488883529b6Schristos ((value pc) (srl SI value 1)) 489*4f645668Schristos ((value pc) (mul SI value 2))) 490883529b6Schristos(df f-7u9a4 "tp/sp-rel w (7 bits)" (all-mep-core-isas) 9 5 UINT 491883529b6Schristos ((value pc) (srl SI value 2)) 492883529b6Schristos ((value pc) (sll SI value 2))) 493883529b6Schristos(df f-16s16 "general 16-bit s-val" (all-mep-core-isas) 16 16 INT #f #f) 494883529b6Schristos 495883529b6Schristos; Immediate fields. 496883529b6Schristos 497883529b6Schristos(df f-2u10 "swi level (2 bits)" (all-mep-core-isas) 10 2 UINT #f #f) 498883529b6Schristos(df f-3u5 "bit offset (3 bits)" (all-mep-core-isas) 5 3 UINT #f #f) 499883529b6Schristos(df f-4u8 "bCC const (4 bits)" (all-mep-core-isas) 8 4 UINT #f #f) 500883529b6Schristos(df f-5u8 "slt & shifts (5 bits)" (all-mep-core-isas) 8 5 UINT #f #f) 501883529b6Schristos(df f-5u24 "clip immediate (5 bits)" (all-mep-core-isas) 24 5 UINT #f #f) 502883529b6Schristos(df f-6s8 "add immediate (6 bits)" (all-mep-core-isas) 8 6 INT #f #f) 503883529b6Schristos(df f-8s8 "add imm (8 bits)" (all-mep-core-isas) 8 8 INT #f #f) 504883529b6Schristos(df f-16u16 "general 16-bit u-val" (all-mep-core-isas) 16 16 UINT #f #f) 505883529b6Schristos(df f-12u16 "cmov fixed 1" (all-mep-core-isas) 16 12 UINT #f #f) 506883529b6Schristos(df f-3u29 "cmov fixed 2" (all-mep-core-isas) 29 3 UINT #f #f) 507883529b6Schristos 508883529b6Schristos 509883529b6Schristos; These are all for the coprocessor opcodes 510883529b6Schristos 511883529b6Schristos; The field is like IJKiiiiiii where I and J are toggled if K is set, 512883529b6Schristos; for compatibility with older cores. 513883529b6Schristos(define-pmacro (compute-cdisp10 val) 514883529b6Schristos (cond SI 515883529b6Schristos ((and SI (cond SI ((and SI val #x80) (xor SI val #x300)) (else val)) #x200) 516883529b6Schristos (sub (cond SI ((and SI val #x80) (xor SI val #x300)) (else val)) #x400)) 517883529b6Schristos (else 518883529b6Schristos (cond SI ((and SI val #x80) (xor SI val #x300)) (else val))) 519883529b6Schristos ) 520883529b6Schristos ) 521883529b6Schristos(define-pmacro (extend-cdisp10 val) 522883529b6Schristos (cond SI 523883529b6Schristos ((and SI (compute-cdisp10 val) #x200) 524883529b6Schristos (sub (and SI (compute-cdisp10 val) #x3ff) #x400)) 525883529b6Schristos (else 526883529b6Schristos (and SI (compute-cdisp10 val) #x3ff)) 527883529b6Schristos ) 528883529b6Schristos ) 529883529b6Schristos 530883529b6Schristos(df f-cdisp10 "cop imm10" (all-mep-core-isas) 22 10 INT 531883529b6Schristos ((value pc) (extend-cdisp10 value)) 532883529b6Schristos ((value pc) (extend-cdisp10 value)) 533883529b6Schristos ) 534883529b6Schristos 535883529b6Schristos; Non-contiguous fields. 536883529b6Schristos 537883529b6Schristos(df f-24u8a4n-hi "24u8a4n hi 16u16" (all-mep-core-isas) 16 16 UINT #f #f) 538883529b6Schristos(df f-24u8a4n-lo "24u8a4n lo 8u8a4" (all-mep-core-isas) 8 6 UINT #f #f) 539883529b6Schristos(define-multi-ifield 540883529b6Schristos (name f-24u8a4n) 541883529b6Schristos (comment "absolute 24-bit address") 542883529b6Schristos (attrs all-mep-core-isas) 543883529b6Schristos (mode UINT) 544883529b6Schristos (subfields f-24u8a4n-hi f-24u8a4n-lo) 545883529b6Schristos (insert (sequence () 546883529b6Schristos (set (ifield f-24u8a4n-hi) (srl (ifield f-24u8a4n) 8)) 547883529b6Schristos (set (ifield f-24u8a4n-lo) (srl (and (ifield f-24u8a4n) #xfc) 2)))) 548883529b6Schristos (extract (set (ifield f-24u8a4n) 549883529b6Schristos (or (sll (ifield f-24u8a4n-hi) 8) 550883529b6Schristos (sll (ifield f-24u8a4n-lo) 2)))) 551883529b6Schristos ) 552883529b6Schristos 553883529b6Schristos(df f-24u8n-hi "24u8n hi 16u16" (all-mep-core-isas) 16 16 UINT #f #f) 554883529b6Schristos(df f-24u8n-lo "24u8n lo 8u8" (all-mep-core-isas) 8 8 UINT #f #f) 555883529b6Schristos(define-multi-ifield 556883529b6Schristos (name f-24u8n) 557883529b6Schristos (comment "24-bit constant") 558883529b6Schristos (attrs all-mep-core-isas) 559883529b6Schristos (mode UINT) 560883529b6Schristos (subfields f-24u8n-hi f-24u8n-lo) 561883529b6Schristos (insert (sequence () 562883529b6Schristos (set (ifield f-24u8n-hi) (srl (ifield f-24u8n) 8)) 563883529b6Schristos (set (ifield f-24u8n-lo) (and (ifield f-24u8n) #xff)))) 564883529b6Schristos (extract (set (ifield f-24u8n) 565883529b6Schristos (or (sll (ifield f-24u8n-hi) 8) 566883529b6Schristos (ifield f-24u8n-lo)))) 567883529b6Schristos ) 568883529b6Schristos 569883529b6Schristos(df f-24u4n-hi "24u4n hi 8u4" (all-mep-core-isas) 4 8 UINT #f #f) 570883529b6Schristos(df f-24u4n-lo "24u4n lo 16u16" (all-mep-core-isas) 16 16 UINT #f #f) 571883529b6Schristos(define-multi-ifield 572883529b6Schristos (name f-24u4n) 573883529b6Schristos (comment "coprocessor code") 574883529b6Schristos (attrs all-mep-core-isas) 575883529b6Schristos (mode UINT) 576883529b6Schristos (subfields f-24u4n-hi f-24u4n-lo) 577883529b6Schristos (insert (sequence () 578883529b6Schristos (set (ifield f-24u4n-hi) (srl (ifield f-24u4n) 16)) 579883529b6Schristos (set (ifield f-24u4n-lo) (and (ifield f-24u4n) #xffff)))) 580883529b6Schristos (extract (set (ifield f-24u4n) 581883529b6Schristos (or (sll (ifield f-24u4n-hi) 16) 582883529b6Schristos (ifield f-24u4n-lo)))) 583883529b6Schristos ) 584883529b6Schristos 585883529b6Schristos(define-multi-ifield 586883529b6Schristos (name f-callnum) 587883529b6Schristos (comment "system call number field") 588883529b6Schristos (attrs all-mep-core-isas) 589883529b6Schristos (mode UINT) 590883529b6Schristos (subfields f-5 f-6 f-7 f-11) 591883529b6Schristos (insert (sequence () 592883529b6Schristos (set (ifield f-5) (and (srl (ifield f-callnum) 3) 1)) 593883529b6Schristos (set (ifield f-6) (and (srl (ifield f-callnum) 2) 1)) 594883529b6Schristos (set (ifield f-7) (and (srl (ifield f-callnum) 1) 1)) 595883529b6Schristos (set (ifield f-11) (and (ifield f-callnum) 1)))) 596883529b6Schristos (extract (set (ifield f-callnum) 597883529b6Schristos (or (sll (ifield f-5) 3) 598883529b6Schristos (or (sll (ifield f-6) 2) 599883529b6Schristos (or (sll (ifield f-7) 1) 600883529b6Schristos (ifield f-11)))))) 601883529b6Schristos ) 602883529b6Schristos 603883529b6Schristos(df f-ccrn-hi "ccrn hi 2u28" (all-mep-core-isas) 28 2 UINT #f #f) 604883529b6Schristos(df f-ccrn-lo "ccrn lo 4u4" (all-mep-core-isas) 4 4 UINT #f #f) 605883529b6Schristos(define-multi-ifield 606883529b6Schristos (name f-ccrn) 607883529b6Schristos (comment "Coprocessor register number field") 608883529b6Schristos (attrs all-mep-core-isas) 609883529b6Schristos (mode UINT) 610883529b6Schristos (subfields f-ccrn-hi f-ccrn-lo) 611883529b6Schristos (insert (sequence () 612883529b6Schristos (set (ifield f-ccrn-hi) (and (srl (ifield f-ccrn) 4) #x3)) 613883529b6Schristos (set (ifield f-ccrn-lo) (and (ifield f-ccrn) #xf)))) 614883529b6Schristos (extract (set (ifield f-ccrn) 615883529b6Schristos (or (sll (ifield f-ccrn-hi) 4) 616883529b6Schristos (ifield f-ccrn-lo)))) 617883529b6Schristos ) 618883529b6Schristos 619883529b6Schristos; Operands. 620883529b6Schristos 621883529b6Schristos;; Only LABEL, REGNUM, FMAX_FLOAT and FMAX_INT are now relevant for correct 622883529b6Schristos;; operation. The others are mostly kept for backwards compatibility, 623883529b6Schristos;; although they do affect the dummy prototypes in 624883529b6Schristos;; gcc/config/mep/intrinsics.h. 625883529b6Schristos(define-attr 626883529b6Schristos (type enum) 627883529b6Schristos (for operand) 628883529b6Schristos (name CDATA) 629883529b6Schristos (comment "datatype to use for C intrinsics mapping") 630883529b6Schristos (values LABEL REGNUM FMAX_FLOAT FMAX_INT 631883529b6Schristos POINTER LONG ULONG SHORT USHORT CHAR UCHAR CP_DATA_BUS_INT) 632883529b6Schristos (default LONG)) 633883529b6Schristos 634883529b6Schristos(define-attr 635883529b6Schristos (type enum) 636883529b6Schristos (for insn) 637883529b6Schristos (name CPTYPE) 638883529b6Schristos (comment "datatype to use for coprocessor values") 639883529b6Schristos (values CP_DATA_BUS_INT VECT V2SI V4HI V8QI V2USI V4UHI V8UQI) 640883529b6Schristos (default CP_DATA_BUS_INT)) 641883529b6Schristos 642883529b6Schristos(define-attr 643883529b6Schristos (type enum) 644883529b6Schristos (for insn) 645883529b6Schristos (name CRET) 646883529b6Schristos ;; VOID - all arguments are passed as parameters; if any are written, pointers to them are passed. 647883529b6Schristos ;; FIRST - the first argument is the return value. 648883529b6Schristos ;; FIRSTCOPY - the first argument is the return value, but a copy is also the first parameter. 649883529b6Schristos (values VOID FIRST FIRSTCOPY) 650883529b6Schristos (default VOID) 651883529b6Schristos (comment "Insn's intrinsic returns void, or the first argument rather than (or in addition to) passing it.")) 652883529b6Schristos 653883529b6Schristos(define-attr 654883529b6Schristos (type integer) 655883529b6Schristos (for operand) 656883529b6Schristos (name ALIGN) 657883529b6Schristos (comment "alignment of immediate operands") 658883529b6Schristos (default 1)) 659883529b6Schristos 660883529b6Schristos(define-attr 661883529b6Schristos (for operand) 662883529b6Schristos (type boolean) 663883529b6Schristos (name RELOC_IMPLIES_OVERFLOW) 664883529b6Schristos (comment "Operand should not be considered as a candidate for relocs")) 665883529b6Schristos 666883529b6Schristos(define-attr 667883529b6Schristos (for hardware) 668883529b6Schristos (type boolean) 669883529b6Schristos (name IS_FLOAT) 670883529b6Schristos (comment "Register contains a floating point value")) 671883529b6Schristos 672883529b6Schristos(define-pmacro (dpop name commment attrib hwr field func) 673883529b6Schristos (define-full-operand name comment attrib 674883529b6Schristos hwr DFLT field ((parse func)) () ())) 675883529b6Schristos(define-pmacro (dprp name commment attrib hwr field pafunc prfunc) 676883529b6Schristos (define-full-operand name comment attrib 677883529b6Schristos hwr DFLT field ((parse pafunc) (print prfunc)) () ())) 678883529b6Schristos 679883529b6Schristos(dnop r0 "register 0" (all-mep-core-isas) h-gpr 0) 680883529b6Schristos(dnop rn "register Rn" (all-mep-core-isas) h-gpr f-rn) 681883529b6Schristos(dnop rm "register Rm" (all-mep-core-isas) h-gpr f-rm) 682883529b6Schristos(dnop rl "register Rl" (all-mep-core-isas) h-gpr f-rl) 683883529b6Schristos(dnop rn3 "register 0-7" (all-mep-core-isas) h-gpr f-rn3) 684883529b6Schristos 685883529b6Schristos;; Variants of RM/RN with different CDATA attributes. See comment above 686883529b6Schristos;; CDATA for more details. 687883529b6Schristos 688883529b6Schristos(dnop rma "register Rm holding pointer" (all-mep-core-isas (CDATA POINTER)) h-gpr f-rm) 689883529b6Schristos 690883529b6Schristos(dnop rnc "register Rn holding char" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn) 691883529b6Schristos(dnop rnuc "register Rn holding unsigned char" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn) 692883529b6Schristos(dnop rns "register Rn holding short" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn) 693883529b6Schristos(dnop rnus "register Rn holding unsigned short" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn) 694883529b6Schristos(dnop rnl "register Rn holding long" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn) 695883529b6Schristos(dnop rnul "register Rn holding unsigned long" (all-mep-core-isas (CDATA ULONG)) h-gpr f-rn) 696883529b6Schristos 697883529b6Schristos(dnop rn3c "register 0-7 holding unsigned char" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn3) 698883529b6Schristos(dnop rn3uc "register 0-7 holding byte" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn3) 699883529b6Schristos(dnop rn3s "register 0-7 holding unsigned short" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn3) 700883529b6Schristos(dnop rn3us "register 0-7 holding short" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn3) 701883529b6Schristos(dnop rn3l "register 0-7 holding unsigned long" (all-mep-core-isas (CDATA LONG)) h-gpr f-rn3) 702883529b6Schristos(dnop rn3ul "register 0-7 holding long" (all-mep-core-isas (CDATA ULONG)) h-gpr f-rn3) 703883529b6Schristos 704883529b6Schristos 705883529b6Schristos(dnop lp "link pointer" (all-mep-core-isas) h-csr 1) 706883529b6Schristos(dnop sar "shift amount register" (all-mep-core-isas) h-csr 2) 707883529b6Schristos(dnop hi "high result" (all-mep-core-isas) h-csr 7) 708883529b6Schristos(dnop lo "low result" (all-mep-core-isas) h-csr 8) 709883529b6Schristos(dnop mb0 "modulo begin register 0" (all-mep-core-isas) h-csr 12) 710883529b6Schristos(dnop me0 "modulo end register 0" (all-mep-core-isas) h-csr 13) 711883529b6Schristos(dnop mb1 "modulo begin register 1" (all-mep-core-isas) h-csr 14) 712883529b6Schristos(dnop me1 "modulo end register 1" (all-mep-core-isas) h-csr 15) 713883529b6Schristos(dnop psw "program status word" (all-mep-core-isas) h-csr 16) 714883529b6Schristos(dnop epc "exception prog counter" (all-mep-core-isas) h-csr 19) 715883529b6Schristos(dnop exc "exception cause" (all-mep-core-isas) h-csr 20) 716883529b6Schristos(dnop npc "nmi program counter" (all-mep-core-isas) h-csr 23) 717883529b6Schristos(dnop dbg "debug register" (all-mep-core-isas) h-csr 24) 718883529b6Schristos(dnop depc "debug exception pc" (all-mep-core-isas) h-csr 25) 719883529b6Schristos(dnop opt "option register" (all-mep-core-isas) h-csr 26) 720883529b6Schristos(dnop r1 "register 1" (all-mep-core-isas) h-gpr 1) 721883529b6Schristos(dnop tp "tiny data area pointer" (all-mep-core-isas) h-gpr 13) 722883529b6Schristos(dnop sp "stack pointer" (all-mep-core-isas) h-gpr 15) 723883529b6Schristos(dprp tpr "TP register" (all-mep-core-isas) h-gpr 13 "tpreg" "tpreg") 724883529b6Schristos(dprp spr "SP register" (all-mep-core-isas) h-gpr 15 "spreg" "spreg") 725883529b6Schristos 726883529b6Schristos(define-full-operand 727883529b6Schristos csrn "control/special register" (all-mep-core-isas (CDATA REGNUM)) h-csr 728883529b6Schristos DFLT f-csrn ((parse "csrn")) () () 729883529b6Schristos) 730883529b6Schristos 731883529b6Schristos(dnop csrn-idx "control/special reg idx" (all-mep-core-isas) h-uint f-csrn) 732883529b6Schristos(dnop crn64 "copro Rn (64-bit)" (all-mep-core-isas (CDATA CP_DATA_BUS_INT)) h-cr64 f-crn) 733883529b6Schristos(dnop crn "copro Rn (32-bit)" (all-mep-core-isas (CDATA CP_DATA_BUS_INT)) h-cr f-crn) 734883529b6Schristos(dnop crnx64 "copro Rn (0-31, 64-bit)" (all-mep-core-isas (CDATA CP_DATA_BUS_INT)) h-cr64 f-crnx) 735883529b6Schristos(dnop crnx "copro Rn (0-31, 32-bit)" (all-mep-core-isas (CDATA CP_DATA_BUS_INT)) h-cr f-crnx) 736883529b6Schristos(dnop ccrn "copro control reg CCRn" (all-mep-core-isas (CDATA REGNUM)) h-ccr f-ccrn) 737883529b6Schristos(dnop cccc "copro flags" (all-mep-core-isas) h-uint f-rm) 738883529b6Schristos 739883529b6Schristos(dprp pcrel8a2 "pc-rel addr (8 bits)" (all-mep-core-isas (CDATA LABEL) RELAX) h-sint f-8s8a2 "mep_align" "address") 740883529b6Schristos(dprp pcrel12a2 "pc-rel addr (12 bits)" (all-mep-core-isas (CDATA LABEL) RELAX) h-sint f-12s4a2 "mep_align" "address") 741883529b6Schristos(dprp pcrel17a2 "pc-rel addr (17 bits)" (all-mep-core-isas (CDATA LABEL) RELAX) h-sint f-17s16a2 "mep_align" "address") 742883529b6Schristos(dprp pcrel24a2 "pc-rel addr (24 bits)" (all-mep-core-isas (CDATA LABEL)) h-sint f-24s5a2n "mep_align" "address") 743883529b6Schristos(dprp pcabs24a2 "pc-abs addr (24 bits)" (all-mep-core-isas (CDATA LABEL)) h-uint f-24u5a2n "mep_alignu" "address") 744883529b6Schristos 745883529b6Schristos(dpop sdisp16 "displacement (16 bits)" (all-mep-core-isas) h-sint f-16s16 "signed16") 746883529b6Schristos(dpop simm16 "signed imm (16 bits)" (all-mep-core-isas) h-sint f-16s16 "signed16") 747883529b6Schristos(dpop uimm16 "unsigned imm (16 bits)" (all-mep-core-isas) h-uint f-16u16 "unsigned16") 748883529b6Schristos(dnop code16 "uci/dsp code (16 bits)" (all-mep-core-isas) h-uint f-16u16) 749883529b6Schristos 750883529b6Schristos(dnop udisp2 "SSARB addend (2 bits)" (all-mep-core-isas) h-sint f-2u6) 751883529b6Schristos(dnop uimm2 "interrupt (2 bits)" (all-mep-core-isas) h-uint f-2u10) 752883529b6Schristos 753883529b6Schristos(dnop simm6 "add const (6 bits)" (all-mep-core-isas) h-sint f-6s8) 754883529b6Schristos(dnop simm8 "mov const (8 bits)" (all-mep-core-isas RELOC_IMPLIES_OVERFLOW) 755883529b6Schristos h-sint f-8s8) 756883529b6Schristos 757883529b6Schristos(dpop addr24a4 "sw/lw addr (24 bits)" (all-mep-core-isas (ALIGN 4)) h-uint f-24u8a4n "mep_alignu") 758883529b6Schristos(dnop code24 "coprocessor code" (all-mep-core-isas) h-uint f-24u4n) 759883529b6Schristos 760883529b6Schristos(dnop callnum "system call number" (all-mep-core-isas) h-uint f-callnum) 761883529b6Schristos(dnop uimm3 "bit immediate (3 bits)" (all-mep-core-isas) h-uint f-3u5) 762883529b6Schristos(dnop uimm4 "bCC const (4 bits)" (all-mep-core-isas) h-uint f-4u8) 763883529b6Schristos(dnop uimm5 "bit/shift val (5 bits)" (all-mep-core-isas) h-uint f-5u8) 764883529b6Schristos 765883529b6Schristos(dpop udisp7 "tp-rel b (7 bits)" (all-mep-core-isas) h-uint f-7u9 "unsigned7") 766883529b6Schristos(dpop udisp7a2 "tp-rel h (7 bits)" (all-mep-core-isas (ALIGN 2)) h-uint f-7u9a2 "unsigned7") 767883529b6Schristos(dpop udisp7a4 "tp/sp-rel w (7 bits)" (all-mep-core-isas (ALIGN 4)) h-uint f-7u9a4 "unsigned7") 768883529b6Schristos(dpop uimm7a4 "sp w-addend (7 bits)" (all-mep-core-isas (ALIGN 4)) h-uint f-7u9a4 "mep_alignu") 769883529b6Schristos 770883529b6Schristos(dnop uimm24 "immediate (24 bits)" (all-mep-core-isas) h-uint f-24u8n) 771883529b6Schristos 772883529b6Schristos(dnop cimm4 "cache immed'te (4 bits)" (all-mep-core-isas) h-uint f-rn) 773883529b6Schristos(dnop cimm5 "clip immediate (5 bits)" (all-mep-core-isas) h-uint f-5u24) 774883529b6Schristos 775883529b6Schristos(dpop cdisp10 "copro addend (8/10 bits)" (all-mep-core-isas) h-sint f-cdisp10 "cdisp10") 776883529b6Schristos(dpop cdisp10a2 "copro addend (8/10 bits)" (all-mep-core-isas) h-sint f-cdisp10 "cdisp10") 777883529b6Schristos(dpop cdisp10a4 "copro addend (8/10 bits)" (all-mep-core-isas) h-sint f-cdisp10 "cdisp10") 778883529b6Schristos(dpop cdisp10a8 "copro addend (8/10 bits)" (all-mep-core-isas) h-sint f-cdisp10 "cdisp10") 779883529b6Schristos 780883529b6Schristos; Special operand representing the various ways that the literal zero can be 781883529b6Schristos; specified. 782883529b6Schristos(define-full-operand 783883529b6Schristos zero "Zero operand" (all-mep-core-isas) h-sint DFLT f-nil 784883529b6Schristos ((parse "zero")) () () 785883529b6Schristos) 786883529b6Schristos 787883529b6Schristos; Attributes. 788883529b6Schristos 789883529b6Schristos(define-attr 790883529b6Schristos (for insn) 791883529b6Schristos (type boolean) 792883529b6Schristos (name OPTIONAL_BIT_INSN) 793883529b6Schristos (comment "optional bit manipulation instruction")) 794883529b6Schristos 795883529b6Schristos(define-attr 796883529b6Schristos (for insn) 797883529b6Schristos (type boolean) 798883529b6Schristos (name OPTIONAL_MUL_INSN) 799883529b6Schristos (comment "optional 32-bit multiply instruction")) 800883529b6Schristos 801883529b6Schristos(define-attr 802883529b6Schristos (for insn) 803883529b6Schristos (type boolean) 804883529b6Schristos (name OPTIONAL_DIV_INSN) 805883529b6Schristos (comment "optional 32-bit divide instruction")) 806883529b6Schristos 807883529b6Schristos(define-attr 808883529b6Schristos (for insn) 809883529b6Schristos (type boolean) 810883529b6Schristos (name OPTIONAL_DEBUG_INSN) 811883529b6Schristos (comment "optional debug instruction")) 812883529b6Schristos 813883529b6Schristos(define-attr 814883529b6Schristos (for insn) 815883529b6Schristos (type boolean) 816883529b6Schristos (name OPTIONAL_LDZ_INSN) 817883529b6Schristos (comment "optional leading zeroes instruction")) 818883529b6Schristos 819883529b6Schristos(define-attr 820883529b6Schristos (for insn) 821883529b6Schristos (type boolean) 822883529b6Schristos (name OPTIONAL_ABS_INSN) 823883529b6Schristos (comment "optional absolute difference instruction")) 824883529b6Schristos 825883529b6Schristos(define-attr 826883529b6Schristos (for insn) 827883529b6Schristos (type boolean) 828883529b6Schristos (name OPTIONAL_AVE_INSN) 829883529b6Schristos (comment "optional average instruction")) 830883529b6Schristos 831883529b6Schristos(define-attr 832883529b6Schristos (for insn) 833883529b6Schristos (type boolean) 834883529b6Schristos (name OPTIONAL_MINMAX_INSN) 835883529b6Schristos (comment "optional min/max instruction")) 836883529b6Schristos 837883529b6Schristos(define-attr 838883529b6Schristos (for insn) 839883529b6Schristos (type boolean) 840883529b6Schristos (name OPTIONAL_CLIP_INSN) 841883529b6Schristos (comment "optional clipping instruction")) 842883529b6Schristos 843883529b6Schristos(define-attr 844883529b6Schristos (for insn) 845883529b6Schristos (type boolean) 846883529b6Schristos (name OPTIONAL_SAT_INSN) 847883529b6Schristos (comment "optional saturation instruction")) 848883529b6Schristos 849883529b6Schristos(define-attr 850883529b6Schristos (for insn) 851883529b6Schristos (type boolean) 852883529b6Schristos (name OPTIONAL_UCI_INSN) 853883529b6Schristos (comment "optional UCI instruction")) 854883529b6Schristos 855883529b6Schristos(define-attr 856883529b6Schristos (for insn) 857883529b6Schristos (type boolean) 858883529b6Schristos (name OPTIONAL_DSP_INSN) 859883529b6Schristos (comment "optional DSP instruction")) 860883529b6Schristos 861883529b6Schristos(define-attr 862883529b6Schristos (for insn) 863883529b6Schristos (type boolean) 864883529b6Schristos (name OPTIONAL_CP_INSN) 865883529b6Schristos (comment "optional coprocessor-related instruction")) 866883529b6Schristos 867883529b6Schristos(define-attr 868883529b6Schristos (for insn) 869883529b6Schristos (type boolean) 870883529b6Schristos (name OPTIONAL_CP64_INSN) 871883529b6Schristos (comment "optional coprocessor-related 64 data bit instruction")) 872883529b6Schristos 873883529b6Schristos(define-attr 874883529b6Schristos (for insn) 875883529b6Schristos (type boolean) 876883529b6Schristos (name OPTIONAL_VLIW64) 877883529b6Schristos (comment "optional vliw64 mode (vliw32 is default)")) 878883529b6Schristos 879883529b6Schristos(define-attr 880883529b6Schristos (for insn) 881883529b6Schristos (type enum) 882883529b6Schristos (name STALL) 883883529b6Schristos (attrs META) 884883529b6Schristos (values NONE SHIFTI INT2 LOAD STORE LDC STC LDCB STCB SSARB FSFT RET 885883529b6Schristos ADVCK MUL MULR DIV) 886883529b6Schristos (default NONE) 887883529b6Schristos (comment "gcc stall attribute")) 888883529b6Schristos 889883529b6Schristos(define-attr 890883529b6Schristos (for insn) 891883529b6Schristos (type string) 892883529b6Schristos (name INTRINSIC) 893883529b6Schristos (attrs META) 894883529b6Schristos (comment "gcc intrinsic name")) 895883529b6Schristos 896883529b6Schristos(define-attr 897883529b6Schristos (for insn) 898883529b6Schristos (type enum) 899883529b6Schristos (name SLOT) 900883529b6Schristos (attrs META) 901883529b6Schristos (values NONE C3 V1 V3 P0S P0 P1) 902883529b6Schristos (default NONE) 903883529b6Schristos (comment "coprocessor slot type")) 904883529b6Schristos 905883529b6Schristos(define-attr 906883529b6Schristos (for insn) 907883529b6Schristos (type boolean) 908883529b6Schristos (name MAY_TRAP) 909883529b6Schristos (comment "instruction may generate an exception")) 910883529b6Schristos 911883529b6Schristos; Attributes for scheduling restrictions in vliw mode 912883529b6Schristos 913883529b6Schristos(define-attr 914883529b6Schristos (for insn) 915883529b6Schristos (type boolean) 916883529b6Schristos (name VLIW_ALONE) 917883529b6Schristos (comment "instruction can be scheduled alone in vliw mode")) 918883529b6Schristos 919883529b6Schristos(define-attr 920883529b6Schristos (for insn) 921883529b6Schristos (type boolean) 922883529b6Schristos (name VLIW_NO_CORE_NOP) 923883529b6Schristos (comment "there is no corresponding nop core instruction")) 924883529b6Schristos 925883529b6Schristos(define-attr 926883529b6Schristos (for insn) 927883529b6Schristos (type boolean) 928883529b6Schristos (name VLIW_NO_COP_NOP) 929883529b6Schristos (comment "there is no corresponding nop coprocessor instruction")) 930883529b6Schristos 931883529b6Schristos(define-attr 932883529b6Schristos (for insn) 933883529b6Schristos (type boolean) 934883529b6Schristos (name VLIW64_NO_MATCHING_NOP) 935883529b6Schristos (comment "there is no corresponding nop coprocessor instruction")) 936883529b6Schristos(define-attr 937883529b6Schristos (for insn) 938883529b6Schristos (type boolean) 939883529b6Schristos (name VLIW32_NO_MATCHING_NOP) 940883529b6Schristos (comment "there is no corresponding nop coprocessor instruction")) 941883529b6Schristos 942883529b6Schristos(define-attr 943883529b6Schristos (for insn) 944883529b6Schristos (type boolean) 945883529b6Schristos (name VOLATILE) 946883529b6Schristos (comment "Insn is volatile.")) 947883529b6Schristos 948883529b6Schristos(define-attr 949883529b6Schristos (for insn) 950883529b6Schristos (type integer) 951883529b6Schristos (name LATENCY) 952883529b6Schristos (comment "The latency of this insn, used for scheduling as an intrinsic in gcc") 953883529b6Schristos (default 0)) 954883529b6Schristos 955883529b6Schristos; The MeP config tool will edit this. 956883529b6Schristos(define-attr 957883529b6Schristos (type enum) 958883529b6Schristos (for insn) 959883529b6Schristos (name CONFIG) 960883529b6Schristos (values NONE ; config-attr-start 961883529b6Schristos default 962883529b6Schristos ) ; config-attr-end 963883529b6Schristos) 964883529b6Schristos 965883529b6Schristos 966883529b6Schristos; Enumerations. 967883529b6Schristos 968883529b6Schristos(define-normal-insn-enum major "major opcodes" (all-mep-core-isas) MAJ_ 969883529b6Schristos f-major 970883529b6Schristos (.map .str (.iota 16)) 971883529b6Schristos) 972883529b6Schristos 973883529b6Schristos 974883529b6Schristos(define-pmacro (dni-isa xname xcomment xattrs xsyntax xformat xsemantics xtiming isa) 975883529b6Schristos (define-insn 976883529b6Schristos (name xname) 977883529b6Schristos (comment xcomment) 978883529b6Schristos (.splice attrs (.unsplice xattrs) (ISA isa)) 979883529b6Schristos (syntax xsyntax) 980883529b6Schristos (format xformat) 981883529b6Schristos (semantics xsemantics) 982883529b6Schristos (.splice timing (.unsplice xtiming)) 983883529b6Schristos ) 984883529b6Schristos) 985883529b6Schristos 986883529b6Schristos(define-pmacro (dnmi-isa xname xcomment xattrs xsyntax xemit isa) 987883529b6Schristos (dnmi xname xcomment (.splice (.unsplice xattrs) (ISA isa)) xsyntax xemit) 988883529b6Schristos) 989883529b6Schristos 990883529b6Schristos; For making profiling calls and dynamic configuration 991883529b6Schristos(define-pmacro (cg-profile caller callee) 992883529b6Schristos (c-call "cg_profile" caller callee) 993883529b6Schristos) 994883529b6Schristos; For dynamic configuration only 995883529b6Schristos(define-pmacro (cg-profile-jump caller callee) 996883529b6Schristos (c-call "cg_profile_jump" caller callee) 997883529b6Schristos) 998883529b6Schristos 999883529b6Schristos; For defining Core Instructions 1000883529b6Schristos(define-pmacro (dnci xname xcomment xattrs xsyntax xformat xsemantics xtiming) 1001883529b6Schristos (dni-isa xname xcomment xattrs xsyntax xformat xsemantics xtiming all-core-isa-list) 1002883529b6Schristos) 1003883529b6Schristos(define-pmacro (dncmi xname xcomment xattrs xsyntax xemit) 1004883529b6Schristos (dnmi-isa xname xcomment xattrs xsyntax xemit all-core-isa-list) 1005883529b6Schristos) 1006883529b6Schristos 1007883529b6Schristos; For defining Coprocessor Instructions 1008883529b6Schristos;(define-pmacro (dncpi xname xcomment xattrs xsyntax xformat xsemantics xtiming) (dni-isa xname xcomment xattrs xsyntax xformat xsemantics xtiming cop) 1009883529b6Schristos;) 1010883529b6Schristos 1011883529b6Schristos;; flag setting macro 1012883529b6Schristos(define-pmacro (set-bit xop xbitnum xval) 1013883529b6Schristos (set xop (or 1014883529b6Schristos (and xop (inv (sll 1 xbitnum))) 1015883529b6Schristos (and (sll 1 xbitnum) (sll xval xbitnum))))) 1016883529b6Schristos 1017883529b6Schristos;; some flags we commonly use in vliw reasoning / mode-switching etc. 1018883529b6Schristos(define-pmacro (get-opt.vliw64) (and (srl opt 6) 1)) 1019883529b6Schristos(define-pmacro (get-opt.vliw32) (and (srl opt 5) 1)) 1020883529b6Schristos(define-pmacro (get-rm.lsb) (and rm 1)) 1021883529b6Schristos(define-pmacro (get-psw.om) (and (srl psw 12) 1)) 1022883529b6Schristos(define-pmacro (get-psw.nmi) (and (srl psw 9) 1)) 1023883529b6Schristos(define-pmacro (get-psw.iep) (and (srl psw 1) 1)) 1024883529b6Schristos(define-pmacro (get-psw.ump) (and (srl psw 3) 1)) 1025883529b6Schristos(define-pmacro (get-epc.etom) (and epc 1)) 1026883529b6Schristos(define-pmacro (get-npc.ntom) (and npc 1)) 1027883529b6Schristos(define-pmacro (get-lp.ltom) (and lp 1)) 1028883529b6Schristos 1029883529b6Schristos(define-pmacro (set-psw.om zval) (set-bit (raw-reg h-csr 16) 12 zval)) 1030883529b6Schristos(define-pmacro (set-psw.nmi zval) (set-bit (raw-reg h-csr 16) 9 zval)) 1031883529b6Schristos(define-pmacro (set-psw.umc zval) (set-bit (raw-reg h-csr 16) 2 zval)) 1032883529b6Schristos(define-pmacro (set-psw.iec zval) (set-bit (raw-reg h-csr 16) 0 zval)) 1033883529b6Schristos(define-pmacro (set-rpe.elr zval) (set-bit (raw-reg h-csr 5) 0 zval)) 1034883529b6Schristos 1035883529b6Schristos 1036883529b6Schristos;; the "3 way switch" depending on our current operating mode and vliw status flags 1037883529b6Schristos(define-pmacro (core-vliw-switch core-rtl vliw32-rtl vliw64-rtl) 1038883529b6Schristos (cond 1039883529b6Schristos ((andif (get-psw.om) (get-opt.vliw64)) vliw64-rtl) 1040883529b6Schristos ((andif (get-psw.om) (get-opt.vliw32)) vliw32-rtl) 1041883529b6Schristos (else core-rtl))) 1042883529b6Schristos 1043883529b6Schristos;; the varying-pcrel idiom 1044883529b6Schristos(define-pmacro (set-vliw-modified-pcrel-offset xtarg xa xb xc) 1045883529b6Schristos (core-vliw-switch (set xtarg (add pc xa)) 1046883529b6Schristos (set xtarg (add pc xb)) 1047883529b6Schristos (set xtarg (add pc xc)))) 1048883529b6Schristos 1049883529b6Schristos;; the increasing-alignment idiom in branch displacements 1050883529b6Schristos(define-pmacro (set-vliw-alignment-modified xtarg zaddr) 1051883529b6Schristos (core-vliw-switch (set xtarg (and zaddr (inv 1))) 1052883529b6Schristos (set xtarg (and zaddr (inv 3))) 1053883529b6Schristos (set xtarg (and zaddr (inv 7))))) 1054883529b6Schristos 1055883529b6Schristos;; the increasing-alignment idiom in option-only form 1056883529b6Schristos(define-pmacro (set-vliw-aliignment-modified-by-option xtarg zaddr) 1057883529b6Schristos (if (get-opt.vliw32) 1058883529b6Schristos (set xtarg (and zaddr (inv 3))) 1059883529b6Schristos (set xtarg (and zaddr (inv 7))))) 1060883529b6Schristos 1061883529b6Schristos 1062883529b6Schristos 1063883529b6Schristos; pmacros needed for coprocessor modulo addressing. 1064883529b6Schristos 1065883529b6Schristos; Taken from supplement ``The operation of the modulo addressing'' in 1066883529b6Schristos; Toshiba documentation rev 2.2, p. 34. 1067883529b6Schristos 1068883529b6Schristos(define-pmacro (compute-mask0) 1069883529b6Schristos (sequence SI ((SI temp)) 1070883529b6Schristos (set temp (or mb0 me0)) 1071883529b6Schristos (srl (const SI -1) (c-call SI "do_ldz" temp)))) 1072883529b6Schristos 1073883529b6Schristos(define-pmacro (mod0 immed) 1074883529b6Schristos (sequence SI ((SI modulo-mask)) 1075883529b6Schristos (set modulo-mask (compute-mask0)) 1076883529b6Schristos (if SI (eq (and rma modulo-mask) me0) 1077883529b6Schristos (or (and rma (inv modulo-mask)) mb0) 1078883529b6Schristos (add rma (ext SI immed))))) 1079883529b6Schristos 1080883529b6Schristos(define-pmacro (compute-mask1) 1081883529b6Schristos (sequence SI ((SI temp)) 1082883529b6Schristos (set temp (or mb1 me1)) 1083883529b6Schristos (srl (const SI -1) (c-call SI "do_ldz" temp)))) 1084883529b6Schristos 1085883529b6Schristos(define-pmacro (mod1 immed) 1086883529b6Schristos (sequence SI ((SI modulo-mask)) 1087883529b6Schristos (set modulo-mask (compute-mask1)) 1088883529b6Schristos (if SI (eq (and rma modulo-mask) me1) 1089883529b6Schristos (or (and rma (inv modulo-mask)) mb1) 1090883529b6Schristos (add rma (ext SI immed))))) 1091883529b6Schristos 1092883529b6Schristos 1093883529b6Schristos; Instructions. 1094883529b6Schristos 1095883529b6Schristos; A pmacro for use in semantic bodies of unimplemented insns. 1096883529b6Schristos(define-pmacro (unimp mnemonic) (nop)) 1097883529b6Schristos 1098883529b6Schristos; Core specific instructions 1099883529b6Schristos; (include "mep-h1.cpu") ; -- exposed by MeP-Integrator 1100883529b6Schristos(include "mep-c5.cpu") ; -- exposed by MeP-Integrator 1101883529b6Schristos 1102883529b6Schristos; Load/store instructions. 1103883529b6Schristos 1104883529b6Schristos(dnci sb "store byte (register indirect)" ((STALL STORE)) 1105883529b6Schristos "sb $rnc,($rma)" 1106883529b6Schristos (+ MAJ_0 rnc rma (f-sub4 8)) 1107883529b6Schristos (sequence () 1108883529b6Schristos (c-call VOID "check_write_to_text" rma) 1109883529b6Schristos (set (mem UQI rma) (and rnc #xff))) 1110883529b6Schristos ((mep (unit u-use-gpr (in usereg rnc)) 1111883529b6Schristos (unit u-use-gpr (in usereg rma)) 1112883529b6Schristos (unit u-exec)))) 1113883529b6Schristos 1114883529b6Schristos(dnci sh "store half-word (register indirect)" ((STALL STORE)) 1115883529b6Schristos "sh $rns,($rma)" 1116883529b6Schristos (+ MAJ_0 rns rma (f-sub4 9)) 1117883529b6Schristos (sequence () 1118883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv 1))) 1119883529b6Schristos (set (mem UHI (and rma (inv 1))) (and rns #xffff))) 1120883529b6Schristos ((mep (unit u-use-gpr (in usereg rns)) 1121883529b6Schristos (unit u-use-gpr (in usereg rma)) 1122883529b6Schristos (unit u-exec)))) 1123883529b6Schristos 1124883529b6Schristos(dnci sw "store word (register indirect)" ((STALL STORE)) 1125883529b6Schristos "sw $rnl,($rma)" 1126883529b6Schristos (+ MAJ_0 rnl rma (f-sub4 10)) 1127883529b6Schristos (sequence () 1128883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv 3))) 1129883529b6Schristos (set (mem USI (and rma (inv 3))) rnl)) 1130883529b6Schristos ((mep (unit u-use-gpr (in usereg rnl)) 1131883529b6Schristos (unit u-use-gpr (in usereg rma)) 1132883529b6Schristos (unit u-exec)))) 1133883529b6Schristos 1134883529b6Schristos(dnci lb "load byte (register indirect)" ((STALL LOAD) (LATENCY 2)) 1135883529b6Schristos "lb $rnc,($rma)" 1136883529b6Schristos (+ MAJ_0 rnc rma (f-sub4 12)) 1137883529b6Schristos (set rnc (ext SI (mem QI rma))) 1138883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1139883529b6Schristos (unit u-exec) 1140883529b6Schristos (unit u-load-gpr (out loadreg rnc))))) 1141883529b6Schristos 1142883529b6Schristos(dnci lh "load half-word (register indirect)" ((STALL LOAD) (LATENCY 2)) 1143883529b6Schristos "lh $rns,($rma)" 1144883529b6Schristos (+ MAJ_0 rns rma (f-sub4 13)) 1145883529b6Schristos (set rns (ext SI (mem HI (and rma (inv 1))))) 1146883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1147883529b6Schristos (unit u-exec) 1148883529b6Schristos (unit u-load-gpr (out loadreg rns))))) 1149883529b6Schristos 1150883529b6Schristos(dnci lw "load word (register indirect)" ((STALL LOAD) (LATENCY 2)) 1151883529b6Schristos "lw $rnl,($rma)" 1152883529b6Schristos (+ MAJ_0 rnl rma (f-sub4 14)) 1153883529b6Schristos (set rnl (mem SI (and rma (inv 3)))) 1154883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1155883529b6Schristos (unit u-exec) 1156883529b6Schristos (unit u-load-gpr (out loadreg rnl))))) 1157883529b6Schristos 1158883529b6Schristos(dnci lbu "load unsigned byte (register indirect)" ((STALL LOAD) (LATENCY 2)) 1159883529b6Schristos "lbu $rnuc,($rma)" 1160883529b6Schristos (+ MAJ_0 rnuc rma (f-sub4 11)) 1161883529b6Schristos (set rnuc (zext SI (mem UQI rma))) 1162883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1163883529b6Schristos (unit u-exec) 1164883529b6Schristos (unit u-load-gpr (out loadreg rnuc))))) 1165883529b6Schristos 1166883529b6Schristos(dnci lhu "load unsigned half-word (register indirect)" ((STALL LOAD) (LATENCY 2)) 1167883529b6Schristos "lhu $rnus,($rma)" 1168883529b6Schristos (+ MAJ_0 rnus rma (f-sub4 15)) 1169883529b6Schristos (set rnus (zext SI (mem UHI (and rma (inv 1))))) 1170883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1171883529b6Schristos (unit u-exec) 1172883529b6Schristos (unit u-load-gpr (out loadreg rnus))))) 1173883529b6Schristos 1174883529b6Schristos(dnci sw-sp "store word (sp relative)" ((STALL STORE)) 1175883529b6Schristos "sw $rnl,$udisp7a4($spr)" 1176883529b6Schristos (+ MAJ_4 rnl (f-8 0) udisp7a4 (f-sub2 2)) 1177883529b6Schristos (sequence () 1178883529b6Schristos (c-call VOID "check_write_to_text" (and (add udisp7a4 sp) (inv 3))) 1179883529b6Schristos (set (mem SI (and (add udisp7a4 sp) (inv 3))) rnl)) 1180883529b6Schristos ((mep (unit u-use-gpr (in usereg rnl)) 1181883529b6Schristos (unit u-use-gpr (in usereg sp)) 1182883529b6Schristos (unit u-exec)))) 1183883529b6Schristos 1184883529b6Schristos 1185883529b6Schristos(dnci lw-sp "load word (sp relative)" ((STALL LOAD) (LATENCY 2)) 1186883529b6Schristos "lw $rnl,$udisp7a4($spr)" 1187883529b6Schristos (+ MAJ_4 rnl (f-8 0) udisp7a4 (f-sub2 3)) 1188883529b6Schristos (set rnl (mem SI (and (add udisp7a4 sp) (inv 3)))) 1189883529b6Schristos ((mep (unit u-use-gpr (in usereg sp)) 1190883529b6Schristos (unit u-exec) 1191883529b6Schristos (unit u-load-gpr (out loadreg rnl))))) 1192883529b6Schristos 1193883529b6Schristos(dnci sb-tp "store byte (tp relative)" ((STALL STORE)) 1194883529b6Schristos "sb $rn3c,$udisp7($tpr)" 1195883529b6Schristos (+ MAJ_8 (f-4 0) rn3c (f-8 0) udisp7) 1196883529b6Schristos (sequence () 1197883529b6Schristos (c-call VOID "check_write_to_text" (add (zext SI udisp7) tp)) 1198883529b6Schristos (set (mem QI (add (zext SI udisp7) tp)) (and rn3c #xff))) 1199883529b6Schristos ((mep (unit u-use-gpr (in usereg rn3c)) 1200883529b6Schristos (unit u-use-gpr (in usereg tp)) 1201883529b6Schristos (unit u-exec)))) 1202883529b6Schristos 1203883529b6Schristos(dnci sh-tp "store half-word (tp relative)" ((STALL STORE)) 1204883529b6Schristos "sh $rn3s,$udisp7a2($tpr)" 1205883529b6Schristos (+ MAJ_8 (f-4 0) rn3s (f-8 1) udisp7a2 (f-15 0)) 1206883529b6Schristos (sequence () 1207883529b6Schristos (c-call VOID "check_write_to_text" (and (add (zext SI udisp7a2) tp) (inv 1))) 1208883529b6Schristos (set (mem HI (and (add (zext SI udisp7a2) tp) (inv 1))) (and rn3s #xffff))) 1209883529b6Schristos ((mep (unit u-use-gpr (in usereg rn3s)) 1210883529b6Schristos (unit u-use-gpr (in usereg tp)) 1211883529b6Schristos (unit u-exec)))) 1212883529b6Schristos 1213883529b6Schristos(dnci sw-tp "store word (tp relative)" ((STALL STORE)) 1214883529b6Schristos "sw $rn3l,$udisp7a4($tpr)" 1215883529b6Schristos (+ MAJ_4 (f-4 0) rn3l (f-8 1) udisp7a4 (f-sub2 2)) 1216883529b6Schristos (sequence () 1217883529b6Schristos (c-call VOID "check_write_to_text" (and (add (zext SI udisp7a4) tp) (inv 3))) 1218883529b6Schristos (set (mem SI (and (add (zext SI udisp7a4) tp) (inv 3))) rn3l)) 1219883529b6Schristos ((mep (unit u-use-gpr (in usereg rn3l)) 1220883529b6Schristos (unit u-use-gpr (in usereg tp)) 1221883529b6Schristos (unit u-exec)))) 1222883529b6Schristos 1223883529b6Schristos(dnci lb-tp "load byte (tp relative)" ((STALL LOAD) (LATENCY 2)) 1224883529b6Schristos "lb $rn3c,$udisp7($tpr)" 1225883529b6Schristos (+ MAJ_8 (f-4 1) rn3c (f-8 0) udisp7) 1226883529b6Schristos (set rn3c (ext SI (mem QI (add (zext SI udisp7) tp)))) 1227883529b6Schristos ((mep (unit u-use-gpr (in usereg tp)) 1228883529b6Schristos (unit u-exec) 1229883529b6Schristos (unit u-load-gpr (out loadreg rn3c))))) 1230883529b6Schristos 1231883529b6Schristos(dnci lh-tp "load half-word (tp relative)" ((STALL LOAD) (LATENCY 2)) 1232883529b6Schristos "lh $rn3s,$udisp7a2($tpr)" 1233883529b6Schristos (+ MAJ_8 (f-4 1) rn3s (f-8 1) udisp7a2 (f-15 0)) 1234883529b6Schristos (set rn3s (ext SI (mem HI (and (add (zext SI udisp7a2) tp) (inv 1))))) 1235883529b6Schristos ((mep (unit u-use-gpr (in usereg tp)) 1236883529b6Schristos (unit u-exec) 1237883529b6Schristos (unit u-load-gpr (out loadreg rn3s))))) 1238883529b6Schristos 1239883529b6Schristos(dnci lw-tp "load word (tp relative)" ((STALL LOAD) (LATENCY 2)) 1240883529b6Schristos "lw $rn3l,$udisp7a4($tpr)" 1241883529b6Schristos (+ MAJ_4 (f-4 0) rn3l (f-8 1) udisp7a4 (f-sub2 3)) 1242883529b6Schristos (set rn3l (mem SI (and (add (zext SI udisp7a4) tp) (inv 3)))) 1243883529b6Schristos ((mep (unit u-use-gpr (in usereg tp)) 1244883529b6Schristos (unit u-exec) 1245883529b6Schristos (unit u-load-gpr (out loadreg rn3l))))) 1246883529b6Schristos 1247883529b6Schristos(dnci lbu-tp "load unsigned byte (tp relative)" ((STALL LOAD) (LATENCY 2)) 1248883529b6Schristos "lbu $rn3uc,$udisp7($tpr)" 1249883529b6Schristos (+ MAJ_4 (f-4 1) rn3uc (f-8 1) udisp7) 1250883529b6Schristos (set rn3uc (zext SI (mem QI (add (zext SI udisp7) tp)))) 1251883529b6Schristos ((mep (unit u-use-gpr (in usereg tp)) 1252883529b6Schristos (unit u-exec) 1253883529b6Schristos (unit u-load-gpr (out loadreg rn3uc))))) 1254883529b6Schristos 1255883529b6Schristos(dnci lhu-tp "load unsigned half-word (tp relative)" ((STALL LOAD) (LATENCY 2)) 1256883529b6Schristos "lhu $rn3us,$udisp7a2($tpr)" 1257883529b6Schristos (+ MAJ_8 (f-4 1) rn3us (f-8 1) udisp7a2 (f-15 1)) 1258883529b6Schristos (set rn3us (zext SI (mem HI (and (add (zext SI udisp7a2) tp) (inv 1))))) 1259883529b6Schristos ((mep (unit u-use-gpr (in usereg tp)) 1260883529b6Schristos (unit u-exec) 1261883529b6Schristos (unit u-load-gpr (out loadreg rn3us))))) 1262883529b6Schristos 1263883529b6Schristos(dnci sb16 "store byte (16 bit displacement)" ((STALL STORE)) 1264883529b6Schristos "sb $rnc,$sdisp16($rma)" 1265883529b6Schristos (+ MAJ_12 rnc rma (f-sub4 8) sdisp16) 1266883529b6Schristos (sequence () 1267883529b6Schristos (c-call VOID "check_write_to_text" (add rma (ext SI sdisp16))) 1268883529b6Schristos (set (mem QI (add rma (ext SI sdisp16))) (and rnc #xff))) 1269883529b6Schristos ((mep (unit u-use-gpr (in usereg rnc)) 1270883529b6Schristos (unit u-use-gpr (in usereg rma)) 1271883529b6Schristos (unit u-exec)))) 1272883529b6Schristos 1273883529b6Schristos(dnci sh16 "store half-word (16 bit displacement)" ((STALL STORE)) 1274883529b6Schristos "sh $rns,$sdisp16($rma)" 1275883529b6Schristos (+ MAJ_12 rns rma (f-sub4 9) sdisp16) 1276883529b6Schristos (sequence () 1277883529b6Schristos (c-call VOID "check_write_to_text" (and (add rma (ext SI sdisp16)) (inv 1))) 1278883529b6Schristos (set (mem HI (and (add rma (ext SI sdisp16)) (inv 1))) (and rns #xffff))) 1279883529b6Schristos ((mep (unit u-use-gpr (in usereg rns)) 1280883529b6Schristos (unit u-use-gpr (in usereg rma)) 1281883529b6Schristos (unit u-exec)))) 1282883529b6Schristos 1283883529b6Schristos(dnci sw16 "store word (16 bit displacement)" ((STALL STORE)) 1284883529b6Schristos "sw $rnl,$sdisp16($rma)" 1285883529b6Schristos (+ MAJ_12 rnl rma (f-sub4 10) sdisp16) 1286883529b6Schristos (sequence () 1287883529b6Schristos (c-call "check_write_to_text" (and (add rma (ext SI sdisp16)) (inv 3))) 1288883529b6Schristos (set (mem SI (and (add rma (ext SI sdisp16)) (inv 3))) rnl)) 1289883529b6Schristos ((mep (unit u-use-gpr (in usereg rnl)) 1290883529b6Schristos (unit u-use-gpr (in usereg rma)) 1291883529b6Schristos (unit u-exec)))) 1292883529b6Schristos 1293883529b6Schristos(dnci lb16 "load byte (16 bit displacement)" ((STALL LOAD) (LATENCY 2)) 1294883529b6Schristos "lb $rnc,$sdisp16($rma)" 1295883529b6Schristos (+ MAJ_12 rnc rma (f-sub4 12) sdisp16) 1296883529b6Schristos (set rnc (ext SI (mem QI (add rma (ext SI sdisp16))))) 1297883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1298883529b6Schristos (unit u-exec) 1299883529b6Schristos (unit u-load-gpr (out loadreg rnc))))) 1300883529b6Schristos 1301883529b6Schristos(dnci lh16 "load half-word (16 bit displacement)" ((STALL LOAD) (LATENCY 2)) 1302883529b6Schristos "lh $rns,$sdisp16($rma)" 1303883529b6Schristos (+ MAJ_12 rns rma (f-sub4 13) sdisp16) 1304883529b6Schristos (set rns (ext SI (mem HI (and (add rma (ext SI sdisp16)) (inv 1))))) 1305883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1306883529b6Schristos (unit u-exec) 1307883529b6Schristos (unit u-load-gpr (out loadreg rns))))) 1308883529b6Schristos 1309883529b6Schristos(dnci lw16 "load word (16 bit displacement)" ((STALL LOAD) (LATENCY 2)) 1310883529b6Schristos "lw $rnl,$sdisp16($rma)" 1311883529b6Schristos (+ MAJ_12 rnl rma (f-sub4 14) sdisp16) 1312883529b6Schristos (set rnl (mem SI (and (add rma (ext SI sdisp16)) (inv 3)))) 1313883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1314883529b6Schristos (unit u-exec) 1315883529b6Schristos (unit u-load-gpr (out loadreg rnl))))) 1316883529b6Schristos 1317883529b6Schristos(dnci lbu16 "load unsigned byte (16 bit displacement)" ((STALL LOAD) (LATENCY 2)) 1318883529b6Schristos "lbu $rnuc,$sdisp16($rma)" 1319883529b6Schristos (+ MAJ_12 rnuc rma (f-sub4 11) sdisp16) 1320883529b6Schristos (set rnuc (zext SI (mem QI (add rma (ext SI sdisp16))))) 1321883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1322883529b6Schristos (unit u-exec) 1323883529b6Schristos (unit u-load-gpr (out loadreg rnuc))))) 1324883529b6Schristos 1325883529b6Schristos(dnci lhu16 "load unsigned half-word (16 bit displacement)" ((STALL LOAD) (LATENCY 2)) 1326883529b6Schristos "lhu $rnus,$sdisp16($rma)" 1327883529b6Schristos (+ MAJ_12 rnus rma (f-sub4 15) sdisp16) 1328883529b6Schristos (set rnus (zext SI (mem HI (and (add rma (ext SI sdisp16)) (inv 1))))) 1329883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 1330883529b6Schristos (unit u-exec) 1331883529b6Schristos (unit u-load-gpr (out loadreg rnus))))) 1332883529b6Schristos 1333883529b6Schristos(dnci sw24 "store word (24 bit absolute addressing)" ((STALL STORE)) 1334883529b6Schristos "sw $rnl,($addr24a4)" 1335883529b6Schristos (+ MAJ_14 rnl addr24a4 (f-sub2 2)) 1336883529b6Schristos (sequence () 1337883529b6Schristos (c-call VOID "check_write_to_text" (zext SI addr24a4)) 1338883529b6Schristos (set (mem SI (zext SI addr24a4)) rnl)) 1339883529b6Schristos ((mep (unit u-use-gpr (in usereg rnl)) 1340883529b6Schristos (unit u-exec)))) 1341883529b6Schristos 1342883529b6Schristos(dnci lw24 "load word (24 bit absolute addressing)" ((STALL LOAD) (LATENCY 2)) 1343883529b6Schristos "lw $rnl,($addr24a4)" 1344883529b6Schristos (+ MAJ_14 rnl addr24a4 (f-sub2 3)) 1345883529b6Schristos (set rnl (mem SI (zext SI addr24a4))) 1346883529b6Schristos ((mep (unit u-exec) 1347883529b6Schristos (unit u-load-gpr (out loadreg rnl))))) 1348883529b6Schristos 1349883529b6Schristos 1350883529b6Schristos; Extension instructions. 1351883529b6Schristos 1352883529b6Schristos(dnci extb "sign extend byte" () 1353883529b6Schristos "extb $rn" 1354883529b6Schristos (+ MAJ_1 rn (f-rm 0) (f-sub4 13)) 1355883529b6Schristos (set rn (ext SI (and QI rn #xff))) 1356883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1357883529b6Schristos (unit u-exec)))) 1358883529b6Schristos 1359883529b6Schristos(dnci exth "sign extend half-word" () 1360883529b6Schristos "exth $rn" 1361883529b6Schristos (+ MAJ_1 rn (f-rm 2) (f-sub4 13)) 1362883529b6Schristos (set rn (ext SI (and HI rn #xffff))) 1363883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1364883529b6Schristos (unit u-exec)))) 1365883529b6Schristos 1366883529b6Schristos(dnci extub "zero extend byte" () 1367883529b6Schristos "extub $rn" 1368883529b6Schristos (+ MAJ_1 rn (f-rm 8) (f-sub4 13)) 1369883529b6Schristos (set rn (zext SI (and rn #xff))) 1370883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1371883529b6Schristos (unit u-exec)))) 1372883529b6Schristos 1373883529b6Schristos(dnci extuh "zero extend half-word" () 1374883529b6Schristos "extuh $rn" 1375883529b6Schristos (+ MAJ_1 rn (f-rm 10) (f-sub4 13)) 1376883529b6Schristos (set rn (zext SI (and rn #xffff))) 1377883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1378883529b6Schristos (unit u-exec)))) 1379883529b6Schristos 1380883529b6Schristos 1381883529b6Schristos; Shift amount manipulation instructions. 1382883529b6Schristos 1383883529b6Schristos(dnci ssarb "set sar to bytes" ((STALL SSARB) VOLATILE) 1384883529b6Schristos "ssarb $udisp2($rm)" 1385883529b6Schristos (+ MAJ_1 (f-4 0) (f-5 0) udisp2 rm (f-sub4 12)) 1386883529b6Schristos (if (c-call BI "big_endian_p") 1387883529b6Schristos (set sar (zext SI (mul (and (add udisp2 rm) 3) 8))) 1388883529b6Schristos (set sar (sub 32 (zext SI (mul (and (add udisp2 rm) 3) 8))))) 1389883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1390883529b6Schristos (unit u-exec)))) 1391883529b6Schristos 1392883529b6Schristos 1393883529b6Schristos; Move instructions. 1394883529b6Schristos 1395883529b6Schristos(dnci mov "move" () 1396883529b6Schristos "mov $rn,$rm" 1397883529b6Schristos (+ MAJ_0 rn rm (f-sub4 0)) 1398883529b6Schristos (set rn rm) 1399883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1400883529b6Schristos (unit u-exec)))) 1401883529b6Schristos 1402883529b6Schristos(dnci movi8 "move 8-bit immediate" () 1403883529b6Schristos "mov $rn,$simm8" 1404883529b6Schristos (+ MAJ_5 rn simm8) 1405883529b6Schristos (set rn (ext SI simm8)) 1406883529b6Schristos ()) 1407883529b6Schristos 1408883529b6Schristos(dnci movi16 "move 16-bit immediate" () 1409883529b6Schristos "mov $rn,$simm16" 1410883529b6Schristos (+ MAJ_12 rn (f-rm 0) (f-sub4 1) simm16) 1411883529b6Schristos (set rn (ext SI simm16)) 1412883529b6Schristos ()) 1413883529b6Schristos 1414883529b6Schristos(dnci movu24 "move 24-bit unsigned immediate" () 1415883529b6Schristos "movu $rn3,$uimm24" 1416883529b6Schristos (+ MAJ_13 (f-4 0) rn3 uimm24) 1417883529b6Schristos (set rn3 (zext SI uimm24)) 1418883529b6Schristos ()) 1419883529b6Schristos 1420883529b6Schristos(dnci movu16 "move 16-bit unsigned immediate" () 1421883529b6Schristos "movu $rn,$uimm16" 1422883529b6Schristos (+ MAJ_12 rn (f-rm 1) (f-sub4 1) uimm16) 1423883529b6Schristos (set rn (zext SI uimm16)) 1424883529b6Schristos ()) 1425883529b6Schristos 1426883529b6Schristos(dnci movh "move high 16-bit immediate" () 1427883529b6Schristos "movh $rn,$uimm16" 1428883529b6Schristos (+ MAJ_12 rn (f-rm 2) (f-sub4 1) uimm16) 1429883529b6Schristos (set rn (sll uimm16 16)) 1430883529b6Schristos ()) 1431883529b6Schristos 1432883529b6Schristos 1433883529b6Schristos; Arithmetic instructions. 1434883529b6Schristos 1435883529b6Schristos(dnci add3 "add three registers" () 1436883529b6Schristos "add3 $rl,$rn,$rm" 1437883529b6Schristos (+ MAJ_9 rn rm rl) 1438883529b6Schristos (set rl (add rn rm)) 1439883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1440883529b6Schristos (unit u-use-gpr (in usereg rm)) 1441883529b6Schristos (unit u-exec)))) 1442883529b6Schristos 1443883529b6Schristos(dnci add "add" () 1444883529b6Schristos "add $rn,$simm6" 1445883529b6Schristos (+ MAJ_6 rn simm6 (f-sub2 0)) 1446883529b6Schristos (set rn (add rn (ext SI simm6))) 1447883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1448883529b6Schristos (unit u-exec)))) 1449883529b6Schristos 1450883529b6Schristos(dnci add3i "add two registers and immediate" () 1451883529b6Schristos "add3 $rn,$spr,$uimm7a4" 1452883529b6Schristos (+ MAJ_4 rn (f-8 0) uimm7a4 (f-sub2 0)) 1453883529b6Schristos (set rn (add sp (zext SI uimm7a4))) 1454883529b6Schristos ((mep (unit u-use-gpr (in usereg sp)) 1455883529b6Schristos (unit u-exec)))) 1456883529b6Schristos 1457883529b6Schristos(dnci advck3 "add overflow check" ((STALL ADVCK)) 1458883529b6Schristos "advck3 \\$0,$rn,$rm" 1459883529b6Schristos (+ MAJ_0 rn rm (f-sub4 7)) 1460883529b6Schristos (if (add-oflag rn rm 0) 1461883529b6Schristos (set r0 1) 1462883529b6Schristos (set r0 0)) 1463883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1464883529b6Schristos (unit u-use-gpr (in usereg rm)) 1465883529b6Schristos (unit u-exec)))) 1466883529b6Schristos 1467883529b6Schristos(dnci sub "subtract" () 1468883529b6Schristos "sub $rn,$rm" 1469883529b6Schristos (+ MAJ_0 rn rm (f-sub4 4)) 1470883529b6Schristos (set rn (sub rn rm)) 1471883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1472883529b6Schristos (unit u-use-gpr (in usereg rm))))) 1473883529b6Schristos 1474883529b6Schristos(dnci sbvck3 "subtraction overflow check" ((STALL ADVCK)) 1475883529b6Schristos "sbvck3 \\$0,$rn,$rm" 1476883529b6Schristos (+ MAJ_0 rn rm (f-sub4 5)) 1477883529b6Schristos (if (sub-oflag rn rm 0) 1478883529b6Schristos (set r0 1) 1479883529b6Schristos (set r0 0)) 1480883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1481883529b6Schristos (unit u-use-gpr (in usereg rm)) 1482883529b6Schristos (unit u-exec)))) 1483883529b6Schristos 1484883529b6Schristos(dnci neg "negate" () 1485883529b6Schristos "neg $rn,$rm" 1486883529b6Schristos (+ MAJ_0 rn rm (f-sub4 1)) 1487883529b6Schristos (set rn (neg rm)) 1488883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1489883529b6Schristos (unit u-exec)))) 1490883529b6Schristos 1491883529b6Schristos(dnci slt3 "set if less than" () 1492883529b6Schristos "slt3 \\$0,$rn,$rm" 1493883529b6Schristos (+ MAJ_0 rn rm (f-sub4 2)) 1494883529b6Schristos (if (lt rn rm) 1495883529b6Schristos (set r0 1) 1496883529b6Schristos (set r0 0)) 1497883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1498883529b6Schristos (unit u-use-gpr (in usereg rm)) 1499883529b6Schristos (unit u-exec)))) 1500883529b6Schristos 1501883529b6Schristos(dnci sltu3 "set less than unsigned" () 1502883529b6Schristos "sltu3 \\$0,$rn,$rm" 1503883529b6Schristos (+ MAJ_0 rn rm (f-sub4 3)) 1504883529b6Schristos (if (ltu rn rm) 1505883529b6Schristos (set r0 1) 1506883529b6Schristos (set r0 0)) 1507883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1508883529b6Schristos (unit u-use-gpr (in usereg rm)) 1509883529b6Schristos (unit u-exec)))) 1510883529b6Schristos 1511883529b6Schristos(dnci slt3i "set if less than immediate" () 1512883529b6Schristos "slt3 \\$0,$rn,$uimm5" 1513883529b6Schristos (+ MAJ_6 rn uimm5 (f-sub3 1)) 1514883529b6Schristos (if (lt rn (zext SI uimm5)) 1515883529b6Schristos (set r0 1) 1516883529b6Schristos (set r0 0)) 1517883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1518883529b6Schristos (unit u-exec)))) 1519883529b6Schristos 1520883529b6Schristos(dnci sltu3i "set if less than unsigned immediate" () 1521883529b6Schristos "sltu3 \\$0,$rn,$uimm5" 1522883529b6Schristos (+ MAJ_6 rn uimm5 (f-sub3 5)) 1523883529b6Schristos (if (ltu rn (zext SI uimm5)) 1524883529b6Schristos (set r0 1) 1525883529b6Schristos (set r0 0)) 1526883529b6Schristos ()) 1527883529b6Schristos 1528883529b6Schristos(dnci sl1ad3 "shift left one and add" ((STALL INT2)) 1529883529b6Schristos "sl1ad3 \\$0,$rn,$rm" 1530883529b6Schristos (+ MAJ_2 rn rm (f-sub4 6)) 1531883529b6Schristos (set r0 (add (sll rn 1) rm)) 1532883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1533883529b6Schristos (unit u-use-gpr (in usereg rm)) 1534883529b6Schristos (unit u-exec)))) 1535883529b6Schristos 1536883529b6Schristos(dnci sl2ad3 "shift left two and add" ((STALL INT2)) 1537883529b6Schristos "sl2ad3 \\$0,$rn,$rm" 1538883529b6Schristos (+ MAJ_2 rn rm (f-sub4 7)) 1539883529b6Schristos (set r0 (add (sll rn 2) rm)) 1540883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1541883529b6Schristos (unit u-use-gpr (in usereg rm)) 1542883529b6Schristos (unit u-exec)))) 1543883529b6Schristos 1544883529b6Schristos(dnci add3x "three operand add (extended)" () 1545883529b6Schristos "add3 $rn,$rm,$simm16" 1546883529b6Schristos (+ MAJ_12 rn rm (f-sub4 0) simm16) 1547883529b6Schristos (set rn (add rm (ext SI simm16))) 1548883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1549883529b6Schristos (unit u-exec)))) 1550883529b6Schristos 1551883529b6Schristos(dnci slt3x "set if less than (extended)" () 1552883529b6Schristos "slt3 $rn,$rm,$simm16" 1553883529b6Schristos (+ MAJ_12 rn rm (f-sub4 2) simm16) 1554883529b6Schristos (if (lt rm (ext SI simm16)) 1555883529b6Schristos (set rn 1) 1556883529b6Schristos (set rn 0)) 1557883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1558883529b6Schristos (unit u-exec)))) 1559883529b6Schristos 1560883529b6Schristos(dnci sltu3x "set if less than unsigned (extended)" () 1561883529b6Schristos "sltu3 $rn,$rm,$uimm16" 1562883529b6Schristos (+ MAJ_12 rn rm (f-sub4 3) uimm16) 1563883529b6Schristos (if (ltu rm (zext SI uimm16)) 1564883529b6Schristos (set rn 1) 1565883529b6Schristos (set rn 0)) 1566883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1567883529b6Schristos (unit u-exec)))) 1568883529b6Schristos 1569883529b6Schristos 1570883529b6Schristos; Logical instructions. 1571883529b6Schristos 1572883529b6Schristos(dnci or "bitwise or" () 1573883529b6Schristos "or $rn,$rm" 1574883529b6Schristos (+ MAJ_1 rn rm (f-sub4 0)) 1575883529b6Schristos (set rn (or rn rm)) 1576883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1577883529b6Schristos (unit u-use-gpr (in usereg rm)) 1578883529b6Schristos (unit u-exec)))) 1579883529b6Schristos 1580883529b6Schristos(dnci and "bitwise and" () 1581883529b6Schristos "and $rn,$rm" 1582883529b6Schristos (+ MAJ_1 rn rm (f-sub4 1)) 1583883529b6Schristos (set rn (and rn rm)) 1584883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1585883529b6Schristos (unit u-use-gpr (in usereg rm)) 1586883529b6Schristos (unit u-exec)))) 1587883529b6Schristos 1588883529b6Schristos(dnci xor "bitwise exclusive or" () 1589883529b6Schristos "xor $rn,$rm" 1590883529b6Schristos (+ MAJ_1 rn rm (f-sub4 2)) 1591883529b6Schristos (set rn (xor rn rm)) 1592883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1593883529b6Schristos (unit u-use-gpr (in usereg rm)) 1594883529b6Schristos (unit u-exec)))) 1595883529b6Schristos 1596883529b6Schristos(dnci nor "bitwise negated or" () 1597883529b6Schristos "nor $rn,$rm" 1598883529b6Schristos (+ MAJ_1 rn rm (f-sub4 3)) 1599883529b6Schristos (set rn (inv (or rn rm))) 1600883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1601883529b6Schristos (unit u-use-gpr (in usereg rm)) 1602883529b6Schristos (unit u-exec)))) 1603883529b6Schristos 1604883529b6Schristos(dnci or3 "or three operand" () 1605883529b6Schristos "or3 $rn,$rm,$uimm16" 1606883529b6Schristos (+ MAJ_12 rn rm (f-sub4 4) uimm16) 1607883529b6Schristos (set rn (or rm (zext SI uimm16))) 1608883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1609883529b6Schristos (unit u-exec)))) 1610883529b6Schristos 1611883529b6Schristos(dnci and3 "and three operand" () 1612883529b6Schristos "and3 $rn,$rm,$uimm16" 1613883529b6Schristos (+ MAJ_12 rn rm (f-sub4 5) uimm16) 1614883529b6Schristos (set rn (and rm (zext SI uimm16))) 1615883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1616883529b6Schristos (unit u-exec)))) 1617883529b6Schristos 1618883529b6Schristos(dnci xor3 "exclusive or three operand" () 1619883529b6Schristos "xor3 $rn,$rm,$uimm16" 1620883529b6Schristos (+ MAJ_12 rn rm (f-sub4 6) uimm16) 1621883529b6Schristos (set rn (xor rm (zext SI uimm16))) 1622883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1623883529b6Schristos (unit u-exec)))) 1624883529b6Schristos 1625883529b6Schristos 1626883529b6Schristos; Shift instructions. 1627883529b6Schristos 1628883529b6Schristos(dnci sra "shift right arithmetic" ((STALL INT2)) 1629883529b6Schristos "sra $rn,$rm" 1630883529b6Schristos (+ MAJ_2 rn rm (f-sub4 13)) 1631883529b6Schristos (set rn (sra rn (and rm #x1f))) 1632883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1633883529b6Schristos (unit u-use-gpr (in usereg rm)) 1634883529b6Schristos (unit u-exec)))) 1635883529b6Schristos 1636883529b6Schristos(dnci srl "shift right logical" ((STALL INT2)) 1637883529b6Schristos "srl $rn,$rm" 1638883529b6Schristos (+ MAJ_2 rn rm (f-sub4 12)) 1639883529b6Schristos (set rn (srl rn (and rm #x1f))) 1640883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1641883529b6Schristos (unit u-use-gpr (in usereg rm)) 1642883529b6Schristos (unit u-exec)))) 1643883529b6Schristos 1644883529b6Schristos(dnci sll "shift left logical" ((STALL INT2)) 1645883529b6Schristos "sll $rn,$rm" 1646883529b6Schristos (+ MAJ_2 rn rm (f-sub4 14)) 1647883529b6Schristos (set rn (sll rn (and rm #x1f))) 1648883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1649883529b6Schristos (unit u-use-gpr (in usereg rm)) 1650883529b6Schristos (unit u-exec)))) 1651883529b6Schristos 1652883529b6Schristos(dnci srai "shift right arithmetic (immediate)" ((STALL SHIFTI)) 1653883529b6Schristos "sra $rn,$uimm5" 1654883529b6Schristos (+ MAJ_6 rn uimm5 (f-sub3 3)) 1655883529b6Schristos (set rn (sra rn uimm5)) 1656883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1657883529b6Schristos (unit u-exec)))) 1658883529b6Schristos 1659883529b6Schristos(dnci srli "shift right logical (immediate)" ((STALL SHIFTI)) 1660883529b6Schristos "srl $rn,$uimm5" 1661883529b6Schristos (+ MAJ_6 rn uimm5 (f-sub3 2)) 1662883529b6Schristos (set rn (srl rn uimm5)) 1663883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1664883529b6Schristos (unit u-exec)))) 1665883529b6Schristos 1666883529b6Schristos(dnci slli "shift left logical (immediate)" ((STALL SHIFTI)) 1667883529b6Schristos "sll $rn,$uimm5" 1668883529b6Schristos (+ MAJ_6 rn uimm5 (f-sub3 6)) 1669883529b6Schristos (set rn (sll rn uimm5)) 1670883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1671883529b6Schristos (unit u-exec)))) 1672883529b6Schristos 1673883529b6Schristos(dnci sll3 "three-register shift left logical" ((STALL INT2)) 1674883529b6Schristos "sll3 \\$0,$rn,$uimm5" 1675883529b6Schristos (+ MAJ_6 rn uimm5 (f-sub3 7)) 1676883529b6Schristos (set r0 (sll rn uimm5)) 1677883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1678883529b6Schristos (unit u-exec)))) 1679883529b6Schristos 1680883529b6Schristos(dnci fsft "field shift" ((STALL FSFT) VOLATILE) 1681883529b6Schristos "fsft $rn,$rm" 1682883529b6Schristos (+ MAJ_2 rn rm (f-sub4 15)) 1683883529b6Schristos (sequence ((DI temp) (QI shamt)) 1684883529b6Schristos (set shamt (and sar #x3f)) 1685883529b6Schristos (set temp (sll (or (sll (zext DI rn) 32) (zext DI rm)) shamt)) 1686883529b6Schristos (set rn (subword SI (srl temp 32) 1))) 1687883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1688883529b6Schristos (unit u-use-gpr (in usereg rm)) 1689883529b6Schristos (unit u-exec)))) 1690883529b6Schristos 1691883529b6Schristos 1692883529b6Schristos; Branch/jump instructions. 1693883529b6Schristos 1694883529b6Schristos(dnci bra "branch" (RELAXABLE) 1695883529b6Schristos "bra $pcrel12a2" 1696883529b6Schristos (+ MAJ_11 pcrel12a2 (f-15 0)) 1697883529b6Schristos (set-vliw-alignment-modified pc pcrel12a2) 1698883529b6Schristos ((mep (unit u-branch) 1699883529b6Schristos (unit u-exec)))) 1700883529b6Schristos 1701883529b6Schristos(dnci beqz "branch if equal zero" (RELAXABLE) 1702883529b6Schristos "beqz $rn,$pcrel8a2" 1703883529b6Schristos (+ MAJ_10 rn pcrel8a2 (f-15 0)) 1704883529b6Schristos (if (eq rn 0) 1705883529b6Schristos (set-vliw-alignment-modified pc pcrel8a2)) 1706883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1707883529b6Schristos (unit u-exec) 1708883529b6Schristos (unit u-branch)))) 1709883529b6Schristos 1710883529b6Schristos(dnci bnez "branch if not equal zero" (RELAXABLE) 1711883529b6Schristos "bnez $rn,$pcrel8a2" 1712883529b6Schristos (+ MAJ_10 rn pcrel8a2 (f-15 1)) 1713883529b6Schristos (if (ne rn 0) 1714883529b6Schristos (set-vliw-alignment-modified pc pcrel8a2)) 1715883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1716883529b6Schristos (unit u-exec) 1717883529b6Schristos (unit u-branch)))) 1718883529b6Schristos 1719883529b6Schristos(dnci beqi "branch equal immediate" (RELAXABLE) 1720883529b6Schristos "beqi $rn,$uimm4,$pcrel17a2" 1721883529b6Schristos (+ MAJ_14 rn uimm4 (f-sub4 0) pcrel17a2) 1722883529b6Schristos (if (eq rn (zext SI uimm4)) 1723883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2)) 1724883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1725883529b6Schristos (unit u-exec) 1726883529b6Schristos (unit u-branch)))) 1727883529b6Schristos 1728883529b6Schristos(dnci bnei "branch not equal immediate" (RELAXABLE) 1729883529b6Schristos "bnei $rn,$uimm4,$pcrel17a2" 1730883529b6Schristos (+ MAJ_14 rn uimm4 (f-sub4 4) pcrel17a2) 1731883529b6Schristos (if (ne rn (zext SI uimm4)) 1732883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2)) 1733883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1734883529b6Schristos (unit u-exec) 1735883529b6Schristos (unit u-branch)))) 1736883529b6Schristos 1737883529b6Schristos(dnci blti "branch less than immediate" (RELAXABLE) 1738883529b6Schristos "blti $rn,$uimm4,$pcrel17a2" 1739883529b6Schristos (+ MAJ_14 rn uimm4 (f-sub4 12) pcrel17a2) 1740883529b6Schristos (if (lt rn (zext SI uimm4)) 1741883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2)) 1742883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1743883529b6Schristos (unit u-exec) 1744883529b6Schristos (unit u-branch)))) 1745883529b6Schristos 1746883529b6Schristos(dnci bgei "branch greater than immediate" (RELAXABLE) 1747883529b6Schristos "bgei $rn,$uimm4,$pcrel17a2" 1748883529b6Schristos (+ MAJ_14 rn uimm4 (f-sub4 8) pcrel17a2) 1749883529b6Schristos (if (ge rn (zext SI uimm4)) 1750883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2)) 1751883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1752883529b6Schristos (unit u-exec) 1753883529b6Schristos (unit u-branch)))) 1754883529b6Schristos 1755883529b6Schristos(dnci beq "branch equal" () 1756883529b6Schristos "beq $rn,$rm,$pcrel17a2" 1757883529b6Schristos (+ MAJ_14 rn rm (f-sub4 1) pcrel17a2) 1758883529b6Schristos (if (eq rn rm) 1759883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2)) 1760883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1761883529b6Schristos (unit u-use-gpr (in usereg rm)) 1762883529b6Schristos (unit u-exec) 1763883529b6Schristos (unit u-branch)))) 1764883529b6Schristos 1765883529b6Schristos(dnci bne "branch not equal" () 1766883529b6Schristos "bne $rn,$rm,$pcrel17a2" 1767883529b6Schristos (+ MAJ_14 rn rm (f-sub4 5) pcrel17a2) 1768883529b6Schristos (if (ne rn rm) 1769883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2)) 1770883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1771883529b6Schristos (unit u-use-gpr (in usereg rm)) 1772883529b6Schristos (unit u-exec) 1773883529b6Schristos (unit u-branch)))) 1774883529b6Schristos 1775883529b6Schristos(dnci bsr12 "branch to subroutine (12 bit displacement)" (RELAXABLE) 1776883529b6Schristos "bsr $pcrel12a2" 1777883529b6Schristos (+ MAJ_11 pcrel12a2 (f-15 1)) 1778883529b6Schristos (sequence () 1779883529b6Schristos (cg-profile pc pcrel12a2) 1780883529b6Schristos (set-vliw-modified-pcrel-offset lp 2 4 8) 1781883529b6Schristos (set-vliw-alignment-modified pc pcrel12a2)) 1782883529b6Schristos ((mep (unit u-exec) 1783883529b6Schristos (unit u-branch)))) 1784883529b6Schristos 1785883529b6Schristos(dnci bsr24 "branch to subroutine (24 bit displacement)" () 1786883529b6Schristos "bsr $pcrel24a2" 1787883529b6Schristos (+ MAJ_13 (f-4 1) (f-sub4 9) pcrel24a2) 1788883529b6Schristos (sequence () 1789883529b6Schristos (cg-profile pc pcrel24a2) 1790883529b6Schristos (set-vliw-modified-pcrel-offset lp 4 4 8) 1791883529b6Schristos (set-vliw-alignment-modified pc pcrel24a2)) 1792883529b6Schristos ((mep (unit u-exec) 1793883529b6Schristos (unit u-branch)))) 1794883529b6Schristos 1795883529b6Schristos(dnci jmp "jump" () 1796883529b6Schristos "jmp $rm" 1797883529b6Schristos (+ MAJ_1 (f-rn 0) rm (f-sub4 14)) 1798883529b6Schristos (sequence () 1799883529b6Schristos (if (eq (get-psw.om) 0) 1800883529b6Schristos ;; core mode 1801883529b6Schristos (if (get-rm.lsb) 1802883529b6Schristos (sequence () 1803883529b6Schristos (set-psw.om 1) ;; enter VLIW mode 1804883529b6Schristos (set-vliw-aliignment-modified-by-option pc rm)) 1805883529b6Schristos (set pc (and rm (inv 1)))) 1806883529b6Schristos ;; VLIW mode 1807883529b6Schristos (if (get-rm.lsb) 1808883529b6Schristos (sequence () 1809883529b6Schristos (set-psw.om 0) ;; enter core mode 1810883529b6Schristos (set pc (and rm (inv 1)))) 1811883529b6Schristos (set-vliw-aliignment-modified-by-option pc rm))) 1812883529b6Schristos (cg-profile-jump pc rm)) 1813883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1814883529b6Schristos (unit u-exec) 1815883529b6Schristos (unit u-branch)))) 1816883529b6Schristos 1817883529b6Schristos(dnci jmp24 "jump (24 bit target)" () 1818883529b6Schristos "jmp $pcabs24a2" 1819883529b6Schristos (+ MAJ_13 (f-4 1) (f-sub4 8) pcabs24a2) 1820883529b6Schristos (sequence () 1821883529b6Schristos (set-vliw-alignment-modified pc (or (and pc #xf0000000) pcabs24a2)) 1822883529b6Schristos (cg-profile-jump pc pcabs24a2)) 1823883529b6Schristos ((mep (unit u-exec) 1824883529b6Schristos (unit u-branch)))) 1825883529b6Schristos 1826883529b6Schristos(dnci jsr "jump to subroutine" () 1827883529b6Schristos "jsr $rm" 1828883529b6Schristos (+ MAJ_1 (f-rn 0) rm (f-sub4 15)) 1829883529b6Schristos (sequence () 1830883529b6Schristos (cg-profile pc rm) 1831883529b6Schristos (set-vliw-modified-pcrel-offset lp 2 4 8) 1832883529b6Schristos (set-vliw-alignment-modified pc rm)) 1833883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 1834883529b6Schristos (unit u-exec) 1835883529b6Schristos (unit u-branch)))) 1836883529b6Schristos 1837883529b6Schristos(dnci ret "return from subroutine" ((STALL RET)) 1838883529b6Schristos "ret" 1839883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 0) (f-sub4 2)) 1840883529b6Schristos (sequence () 1841883529b6Schristos (if (eq (get-psw.om) 0) 1842883529b6Schristos ;; core mode 1843883529b6Schristos (if (get-lp.ltom) ;; link-pointer "toggle mode" bit 1844883529b6Schristos (sequence () 1845883529b6Schristos (set-psw.om 1) ;; enter VLIW mode 1846883529b6Schristos (set-vliw-aliignment-modified-by-option pc lp)) 1847883529b6Schristos (set pc (and lp (inv 1)))) 1848883529b6Schristos ;; VLIW mode 1849883529b6Schristos (if (get-lp.ltom) ;; link-pointer "toggle mode" bit 1850883529b6Schristos (sequence () 1851883529b6Schristos (set-psw.om 0) ;; enter VLIW mode 1852883529b6Schristos (set pc (and lp (inv 1)))) 1853883529b6Schristos (set-vliw-aliignment-modified-by-option pc lp))) 1854883529b6Schristos (c-call VOID "notify_ret" pc)) 1855883529b6Schristos ((mep (unit u-exec) 1856883529b6Schristos (unit u-branch)))) 1857883529b6Schristos 1858883529b6Schristos 1859883529b6Schristos; Repeat instructions. 1860883529b6Schristos 1861883529b6Schristos(dnci repeat "repeat specified repeat block" () 1862883529b6Schristos "repeat $rn,$pcrel17a2" 1863883529b6Schristos (+ MAJ_14 rn (f-rm 0) (f-sub4 9) pcrel17a2) 1864883529b6Schristos (sequence () 1865883529b6Schristos (set-vliw-modified-pcrel-offset (reg h-csr 4) 4 4 8) 1866883529b6Schristos (set-vliw-alignment-modified (reg h-csr 5) pcrel17a2) 1867883529b6Schristos (set (reg h-csr 6) rn)) 1868883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1869883529b6Schristos (unit u-exec)))) 1870883529b6Schristos 1871883529b6Schristos(dnci erepeat "endless repeat" () 1872883529b6Schristos "erepeat $pcrel17a2" 1873883529b6Schristos (+ MAJ_14 (f-rn 0) (f-rm 1) (f-sub4 9) pcrel17a2) 1874883529b6Schristos (sequence () 1875883529b6Schristos (set-vliw-modified-pcrel-offset (reg h-csr 4) 4 4 8) 1876883529b6Schristos (set-vliw-alignment-modified (reg h-csr 5) pcrel17a2) 1877883529b6Schristos (set-rpe.elr 1) 1878883529b6Schristos ; rpc may be undefined for erepeat 1879883529b6Schristos ; use 1 to trigger repeat logic in the sim's main loop 1880883529b6Schristos (set (reg h-csr 6) 1)) 1881883529b6Schristos ()) 1882883529b6Schristos 1883883529b6Schristos 1884883529b6Schristos; Control instructions. 1885883529b6Schristos 1886883529b6Schristos;; special store variants 1887883529b6Schristos 1888883529b6Schristos(dnci stc_lp "store to control register lp" ((STALL STC)) 1889883529b6Schristos "stc $rn,\\$lp" 1890883529b6Schristos (+ MAJ_7 rn (f-csrn-lo 1) (f-csrn-hi 0) (f-12 1) (f-13 0) (f-14 0)) 1891883529b6Schristos (set lp rn) 1892883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1893883529b6Schristos (unit u-store-ctrl-reg (out storereg lp)) 1894883529b6Schristos (unit u-exec)))) 1895883529b6Schristos 1896883529b6Schristos(dnci stc_hi "store to control register hi" ((STALL STC)) 1897883529b6Schristos "stc $rn,\\$hi" 1898883529b6Schristos (+ MAJ_7 rn (f-csrn-lo 7) (f-csrn-hi 0) (f-12 1) (f-13 0) (f-14 0)) 1899883529b6Schristos (set hi rn) 1900883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1901883529b6Schristos (unit u-store-ctrl-reg (out storereg hi)) 1902883529b6Schristos (unit u-exec)))) 1903883529b6Schristos 1904883529b6Schristos(dnci stc_lo "store to control register lo" ((STALL STC)) 1905883529b6Schristos "stc $rn,\\$lo" 1906883529b6Schristos (+ MAJ_7 rn (f-csrn-lo 8) (f-csrn-hi 0) (f-12 1) (f-13 0) (f-14 0)) 1907883529b6Schristos (set lo rn) 1908883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1909883529b6Schristos (unit u-store-ctrl-reg (out storereg lo)) 1910883529b6Schristos (unit u-exec)))) 1911883529b6Schristos 1912883529b6Schristos;; general store 1913883529b6Schristos 1914883529b6Schristos(dnci stc "store to control register" (VOLATILE (STALL STC)) 1915883529b6Schristos "stc $rn,$csrn" 1916883529b6Schristos (+ MAJ_7 rn csrn (f-12 1) (f-13 0) (f-14 0)) 1917883529b6Schristos (set csrn rn) 1918883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 1919883529b6Schristos (unit u-store-ctrl-reg (out storereg csrn)) 1920883529b6Schristos (unit u-exec)))) 1921883529b6Schristos 1922883529b6Schristos;; special load variants 1923883529b6Schristos 1924883529b6Schristos(dnci ldc_lp "load from control register lp" ((STALL LDC)) 1925883529b6Schristos "ldc $rn,\\$lp" 1926883529b6Schristos (+ MAJ_7 rn (f-csrn-lo 1) (f-csrn-hi 0) (f-12 1) (f-13 0) (f-14 1)) 1927883529b6Schristos (set rn lp) 1928883529b6Schristos ((mep (unit u-use-ctrl-reg (in usereg lp)) 1929883529b6Schristos (unit u-exec) 1930883529b6Schristos (unit u-load-gpr (out loadreg rn))))) 1931883529b6Schristos 1932883529b6Schristos 1933883529b6Schristos(dnci ldc_hi "load from control register hi" ((STALL LDC)) 1934883529b6Schristos "ldc $rn,\\$hi" 1935883529b6Schristos (+ MAJ_7 rn (f-csrn-lo 7) (f-csrn-hi 0) (f-12 1) (f-13 0) (f-14 1)) 1936883529b6Schristos (set rn hi) 1937883529b6Schristos ((mep (unit u-use-ctrl-reg (in usereg hi)) 1938883529b6Schristos (unit u-exec) 1939883529b6Schristos (unit u-load-gpr (out loadreg rn))))) 1940883529b6Schristos 1941883529b6Schristos(dnci ldc_lo "load from control register lo" ((STALL LDC)) 1942883529b6Schristos "ldc $rn,\\$lo" 1943883529b6Schristos (+ MAJ_7 rn (f-csrn-lo 8) (f-csrn-hi 0) (f-12 1) (f-13 0) (f-14 1)) 1944883529b6Schristos (set rn lo) 1945883529b6Schristos ((mep (unit u-use-ctrl-reg (in usereg lo)) 1946883529b6Schristos (unit u-exec) 1947883529b6Schristos (unit u-load-gpr (out loadreg rn))))) 1948883529b6Schristos 1949883529b6Schristos;; general load 1950883529b6Schristos 1951883529b6Schristos(dnci ldc "load from control register" (VOLATILE (STALL LDC) (LATENCY 2)) 1952883529b6Schristos "ldc $rn,$csrn" 1953883529b6Schristos (+ MAJ_7 rn csrn (f-12 1) (f-13 0) (f-14 1)) 1954883529b6Schristos (if (eq (ifield f-csrn) 0) 1955883529b6Schristos ;; loading from the pc 1956883529b6Schristos (set-vliw-modified-pcrel-offset rn 2 4 8) 1957883529b6Schristos ;; loading from something else 1958883529b6Schristos (set rn csrn)) 1959883529b6Schristos ((mep (unit u-use-ctrl-reg (in usereg csrn)) 1960883529b6Schristos (unit u-exec) 1961883529b6Schristos (unit u-load-gpr (out loadreg rn))))) 1962883529b6Schristos 1963883529b6Schristos(dnci di "disable interrupt" (VOLATILE) 1964883529b6Schristos "di" 1965883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 0) (f-sub4 0)) 1966883529b6Schristos ; clear psw.iec 1967883529b6Schristos (set psw (sll (srl psw 1) 1)) 1968883529b6Schristos ()) 1969883529b6Schristos 1970883529b6Schristos(dnci ei "enable interrupt" (VOLATILE) 1971883529b6Schristos "ei" 1972883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 1) (f-sub4 0)) 1973883529b6Schristos ; set psw.iec 1974883529b6Schristos (set psw (or psw 1)) 1975883529b6Schristos ()) 1976883529b6Schristos 1977883529b6Schristos(dnci reti "return from interrupt" ((STALL RET)) 1978883529b6Schristos "reti" 1979883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 1) (f-sub4 2)) 1980883529b6Schristos (if (eq (get-psw.om) 0) 1981883529b6Schristos ;; core operation mode 1982883529b6Schristos (if (get-psw.nmi) 1983883529b6Schristos ;; return from NMI 1984883529b6Schristos (if (get-npc.ntom) 1985883529b6Schristos ;; return in VLIW operation mode 1986883529b6Schristos (sequence () 1987883529b6Schristos (set-psw.om 1) 1988883529b6Schristos (set-vliw-aliignment-modified-by-option pc npc) 1989883529b6Schristos (set-psw.nmi 0)) 1990883529b6Schristos ;; return in core mode 1991883529b6Schristos (sequence () 1992883529b6Schristos (set pc (and npc (inv 1))) 1993883529b6Schristos (set-psw.nmi 0))) 1994883529b6Schristos ;; return from non-NMI 1995883529b6Schristos (if (get-epc.etom) 1996883529b6Schristos ;; return in VLIW mode 1997883529b6Schristos (sequence () 1998883529b6Schristos (set-psw.om 1) 1999883529b6Schristos (set-vliw-aliignment-modified-by-option pc epc) 2000883529b6Schristos (set-psw.umc (get-psw.ump)) 2001883529b6Schristos (set-psw.iec (get-psw.iep))) 2002883529b6Schristos ;; return in core mode 2003883529b6Schristos (sequence () 2004883529b6Schristos (set pc (and epc (inv 1))) 2005883529b6Schristos (set-psw.umc (get-psw.ump)) 2006883529b6Schristos (set-psw.iec (get-psw.iep))))) 2007883529b6Schristos ;; VLIW operation mode 2008883529b6Schristos ;; xxx undefined 2009883529b6Schristos (nop)) 2010883529b6Schristos ((mep (unit u-exec) 2011883529b6Schristos (unit u-branch)))) 2012883529b6Schristos 2013883529b6Schristos(dnci halt "halt pipeline" (VOLATILE) 2014883529b6Schristos "halt" 2015883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 2) (f-sub4 2)) 2016883529b6Schristos ; set psw.halt 2017883529b6Schristos (set (raw-reg h-csr 16) (or psw (sll 1 11))) 2018883529b6Schristos ()) 2019883529b6Schristos 2020883529b6Schristos(dnci sleep "sleep pipeline" (VOLATILE) 2021883529b6Schristos "sleep" 2022883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 6) (f-sub4 2)) 2023883529b6Schristos (c-call VOID "do_sleep") 2024883529b6Schristos ()) 2025883529b6Schristos 2026883529b6Schristos(dnci swi "software interrupt" (MAY_TRAP VOLATILE) 2027883529b6Schristos "swi $uimm2" 2028883529b6Schristos (+ MAJ_7 (f-rn 0) (f-8 0) (f-9 0) uimm2 (f-sub4 6)) 2029883529b6Schristos (cond 2030883529b6Schristos ((eq uimm2 0) (set exc (or exc (sll 1 4)))) 2031883529b6Schristos ((eq uimm2 1) (set exc (or exc (sll 1 5)))) 2032883529b6Schristos ((eq uimm2 2) (set exc (or exc (sll 1 6)))) 2033883529b6Schristos ((eq uimm2 3) (set exc (or exc (sll 1 7))))) 2034883529b6Schristos ()) 2035883529b6Schristos 2036883529b6Schristos(dnci break "break exception" (MAY_TRAP VOLATILE) 2037883529b6Schristos "break" 2038883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 3) (f-sub4 2)) 2039883529b6Schristos (set pc (c-call USI "break_exception" pc)) 2040883529b6Schristos ((mep (unit u-exec) 2041883529b6Schristos (unit u-branch)))) 2042883529b6Schristos 2043883529b6Schristos(dnci syncm "synchronise with memory" (VOLATILE) 2044883529b6Schristos "syncm" 2045883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 1) (f-sub4 1)) 2046883529b6Schristos (unimp "syncm") 2047883529b6Schristos ()) 2048883529b6Schristos 2049883529b6Schristos(dnci stcb "store in control bus space" (VOLATILE (STALL STCB)) 2050883529b6Schristos "stcb $rn,$uimm16" 2051883529b6Schristos (+ MAJ_15 rn (f-rm 0) (f-sub4 4) uimm16) 2052883529b6Schristos (c-call VOID "do_stcb" rn uimm16) 2053883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2054883529b6Schristos (unit u-exec) 2055883529b6Schristos (unit u-stcb)))) 2056883529b6Schristos 2057883529b6Schristos(dnci ldcb "load from control bus space" (VOLATILE (STALL LDCB) (LATENCY 3)) 2058883529b6Schristos "ldcb $rn,$uimm16" 2059883529b6Schristos (+ MAJ_15 rn (f-rm 1) (f-sub4 4) uimm16) 2060883529b6Schristos (set rn (c-call SI "do_ldcb" uimm16)) 2061883529b6Schristos ((mep (unit u-ldcb) 2062883529b6Schristos (unit u-exec) 2063883529b6Schristos (unit u-ldcb-gpr (out loadreg rn))))) 2064883529b6Schristos 2065883529b6Schristos 2066883529b6Schristos; Bit manipulation instructions. 2067883529b6Schristos; The following instructions become the reserved instruction when the 2068883529b6Schristos; bit manipulation option is off. 2069883529b6Schristos 2070883529b6Schristos(dnci bsetm "set bit in memory" (OPTIONAL_BIT_INSN) 2071883529b6Schristos "bsetm ($rma),$uimm3" 2072883529b6Schristos (+ MAJ_2 (f-4 0) uimm3 rma (f-sub4 0)) 2073883529b6Schristos (sequence () 2074883529b6Schristos (c-call "check_option_bit" pc) 2075883529b6Schristos (set (mem UQI rma) (or (mem UQI rma) (sll 1 uimm3)))) 2076883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2077883529b6Schristos (unit u-exec)))) 2078883529b6Schristos 2079883529b6Schristos(dnci bclrm "clear bit in memory" (OPTIONAL_BIT_INSN) 2080883529b6Schristos "bclrm ($rma),$uimm3" 2081883529b6Schristos (+ MAJ_2 (f-4 0) uimm3 rma (f-sub4 1)) 2082883529b6Schristos (sequence () 2083883529b6Schristos (c-call "check_option_bit" pc) 2084883529b6Schristos (set (mem UQI rma) (and (mem UQI rma) (inv (sll 1 uimm3))))) 2085883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2086883529b6Schristos (unit u-exec)))) 2087883529b6Schristos 2088883529b6Schristos(dnci bnotm "toggle bit in memory" (OPTIONAL_BIT_INSN) 2089883529b6Schristos "bnotm ($rma),$uimm3" 2090883529b6Schristos (+ MAJ_2 (f-4 0) uimm3 rma (f-sub4 2)) 2091883529b6Schristos (sequence () 2092883529b6Schristos (c-call "check_option_bit" pc) 2093883529b6Schristos (set (mem UQI rma) (xor (mem UQI rma) (sll 1 uimm3)))) 2094883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2095883529b6Schristos (unit u-exec)))) 2096883529b6Schristos 2097883529b6Schristos(dnci btstm "test bit in memory" (OPTIONAL_BIT_INSN) 2098883529b6Schristos "btstm \\$0,($rma),$uimm3" 2099883529b6Schristos (+ MAJ_2 (f-4 0) uimm3 rma (f-sub4 3)) 2100883529b6Schristos (sequence () 2101883529b6Schristos (c-call "check_option_bit" pc) 2102883529b6Schristos (set r0 (zext SI (and UQI (mem UQI rma) (sll 1 uimm3))))) 2103883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2104883529b6Schristos (unit u-exec)))) 2105883529b6Schristos 2106883529b6Schristos(dnci tas "test and set" (OPTIONAL_BIT_INSN) 2107883529b6Schristos "tas $rn,($rma)" 2108883529b6Schristos (+ MAJ_2 rn rma (f-sub4 4)) 2109883529b6Schristos (sequence ((SI result)) 2110883529b6Schristos (c-call "check_option_bit" pc) 2111883529b6Schristos (set result (zext SI (mem UQI rma))) 2112883529b6Schristos (set (mem UQI rma) 1) 2113883529b6Schristos (set rn result)) 2114883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2115883529b6Schristos (unit u-exec)))) 2116883529b6Schristos 2117883529b6Schristos 2118883529b6Schristos; Data cache instruction. 2119883529b6Schristos 2120883529b6Schristos(dnci cache "cache operations" (VOLATILE) 2121883529b6Schristos "cache $cimm4,($rma)" 2122883529b6Schristos (+ MAJ_7 cimm4 rma (f-sub4 4)) 2123883529b6Schristos (c-call VOID "do_cache" cimm4 rma pc) 2124883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2125883529b6Schristos (unit u-exec)))) 2126883529b6Schristos 2127883529b6Schristos 2128883529b6Schristos; Multiply instructions. 2129883529b6Schristos; These instructions become the RI when the 32-bit multiply 2130883529b6Schristos; instruction option is off. 2131883529b6Schristos 2132883529b6Schristos(dnci mul "multiply" (OPTIONAL_MUL_INSN (STALL MUL)) 2133883529b6Schristos "mul $rn,$rm" 2134883529b6Schristos (+ MAJ_1 rn rm (f-sub4 4)) 2135883529b6Schristos (sequence ((DI result)) 2136883529b6Schristos (c-call "check_option_mul" pc) 2137883529b6Schristos (set result (mul (ext DI rn) (ext DI rm))) 2138883529b6Schristos (set hi (subword SI result 0)) 2139883529b6Schristos (set lo (subword SI result 1))) 2140883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2141883529b6Schristos (unit u-use-gpr (in usereg rm)) 2142883529b6Schristos (unit u-exec) 2143883529b6Schristos (unit u-multiply)))) 2144883529b6Schristos 2145883529b6Schristos(dnci mulu "multiply unsigned" (OPTIONAL_MUL_INSN (STALL MUL)) 2146883529b6Schristos "mulu $rn,$rm" 2147883529b6Schristos (+ MAJ_1 rn rm (f-sub4 5)) 2148883529b6Schristos (sequence ((DI result)) 2149883529b6Schristos (c-call "check_option_mul" pc) 2150883529b6Schristos (set result (mul (zext UDI rn) (zext UDI rm))) 2151883529b6Schristos (set hi (subword SI result 0)) 2152883529b6Schristos (set lo (subword SI result 1))) 2153883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2154883529b6Schristos (unit u-use-gpr (in usereg rm)) 2155883529b6Schristos (unit u-exec) 2156883529b6Schristos (unit u-multiply)))) 2157883529b6Schristos 2158883529b6Schristos(dnci mulr "multiply, lo -> reg" (OPTIONAL_MUL_INSN (STALL MULR) (LATENCY 3)) 2159883529b6Schristos "mulr $rn,$rm" 2160883529b6Schristos (+ MAJ_1 rn rm (f-sub4 6)) 2161883529b6Schristos (sequence ((DI result)) 2162883529b6Schristos (c-call "check_option_mul" pc) 2163883529b6Schristos (set result (mul (ext DI rn) (ext DI rm))) 2164883529b6Schristos (set hi (subword SI result 0)) 2165883529b6Schristos (set lo (subword SI result 1)) 2166883529b6Schristos (set rn (subword SI result 1))) 2167883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2168883529b6Schristos (unit u-use-gpr (in usereg rm)) 2169883529b6Schristos (unit u-exec) 2170883529b6Schristos (unit u-multiply) 2171883529b6Schristos (unit u-mul-gpr (out resultreg rn))))) 2172883529b6Schristos 2173883529b6Schristos(dnci mulru "multiply unsigned, lo -> reg" (OPTIONAL_MUL_INSN (STALL MULR) (LATENCY 3)) 2174883529b6Schristos "mulru $rn,$rm" 2175883529b6Schristos (+ MAJ_1 rn rm (f-sub4 7)) 2176883529b6Schristos (sequence ((DI result)) 2177883529b6Schristos (c-call "check_option_mul" pc) 2178883529b6Schristos (set result (mul (zext UDI rn) (zext UDI rm))) 2179883529b6Schristos (set hi (subword SI result 0)) 2180883529b6Schristos (set lo (subword SI result 1)) 2181883529b6Schristos (set rn (subword SI result 1))) 2182883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2183883529b6Schristos (unit u-use-gpr (in usereg rm)) 2184883529b6Schristos (unit u-exec) 2185883529b6Schristos (unit u-multiply) 2186883529b6Schristos (unit u-mul-gpr (out resultreg rn))))) 2187883529b6Schristos 2188883529b6Schristos(dnci madd "multiply accumulate" (OPTIONAL_MUL_INSN (STALL MUL)) 2189883529b6Schristos "madd $rn,$rm" 2190883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 #x3004)) 2191883529b6Schristos (sequence ((DI result)) 2192883529b6Schristos (c-call "check_option_mul" pc) 2193883529b6Schristos (set result (or (sll (zext DI hi) 32) (zext DI lo))) 2194883529b6Schristos (set result (add result (mul (ext DI rn) (ext DI rm)))) 2195883529b6Schristos (set hi (subword SI result 0)) 2196883529b6Schristos (set lo (subword SI result 1))) 2197883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2198883529b6Schristos (unit u-use-gpr (in usereg rm)) 2199883529b6Schristos (unit u-exec) 2200883529b6Schristos (unit u-multiply)))) 2201883529b6Schristos 2202883529b6Schristos(dnci maddu "multiply accumulate unsigned" (OPTIONAL_MUL_INSN (STALL MUL)) 2203883529b6Schristos "maddu $rn,$rm" 2204883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 #x3005)) 2205883529b6Schristos (sequence ((DI result)) 2206883529b6Schristos (c-call "check_option_mul" pc) 2207883529b6Schristos (set result (or (sll (zext DI hi) 32) (zext DI lo))) 2208883529b6Schristos (set result (add result (mul (zext UDI rn) (zext UDI rm)))) 2209883529b6Schristos (set hi (subword SI result 0)) 2210883529b6Schristos (set lo (subword SI result 1))) 2211883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2212883529b6Schristos (unit u-use-gpr (in usereg rm)) 2213883529b6Schristos (unit u-exec) 2214883529b6Schristos (unit u-multiply)))) 2215883529b6Schristos 2216883529b6Schristos 2217883529b6Schristos(dnci maddr "multiply accumulate, lo -> reg" (OPTIONAL_MUL_INSN (STALL MULR) (LATENCY 3)) 2218883529b6Schristos "maddr $rn,$rm" 2219883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 #x3006)) 2220883529b6Schristos (sequence ((DI result)) 2221883529b6Schristos (c-call "check_option_mul" pc) 2222883529b6Schristos (set result (or (sll (zext DI hi) 32) (zext DI lo))) 2223883529b6Schristos (set result (add result (mul (ext DI rn) (ext DI rm)))) 2224883529b6Schristos (set hi (subword SI result 0)) 2225883529b6Schristos (set lo (subword SI result 1)) 2226883529b6Schristos (set rn (subword SI result 1))) 2227883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2228883529b6Schristos (unit u-use-gpr (in usereg rm)) 2229883529b6Schristos (unit u-exec) 2230883529b6Schristos (unit u-multiply) 2231883529b6Schristos (unit u-mul-gpr (out resultreg rn))))) 2232883529b6Schristos 2233883529b6Schristos(dnci maddru "multiple accumulate unsigned, lo -> reg" (OPTIONAL_MUL_INSN (STALL MULR) (LATENCY 3)) 2234883529b6Schristos "maddru $rn,$rm" 2235883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 #x3007)) 2236883529b6Schristos (sequence ((DI result)) 2237883529b6Schristos (c-call "check_option_mul" pc) 2238883529b6Schristos (set result (or (sll (zext DI hi) 32) (zext DI lo))) 2239883529b6Schristos (set result (add result (mul (zext UDI rn) (zext UDI rm)))) 2240883529b6Schristos (set hi (subword SI result 0)) 2241883529b6Schristos (set lo (subword SI result 1)) 2242883529b6Schristos (set rn (subword SI result 1))) 2243883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2244883529b6Schristos (unit u-use-gpr (in usereg rm)) 2245883529b6Schristos (unit u-exec) 2246883529b6Schristos (unit u-multiply) 2247883529b6Schristos (unit u-mul-gpr (out resultreg rn))))) 2248883529b6Schristos 2249883529b6Schristos 2250883529b6Schristos; Divide instructions. 2251883529b6Schristos; These instructions become the RI when the 32-bit divide instruction 2252883529b6Schristos; option is off. 2253883529b6Schristos 2254883529b6Schristos(dnci div "divide" (OPTIONAL_DIV_INSN (STALL DIV) (LATENCY 34) MAY_TRAP) 2255883529b6Schristos "div $rn,$rm" 2256883529b6Schristos (+ MAJ_1 rn rm (f-sub4 8)) 2257883529b6Schristos (sequence () 2258883529b6Schristos (c-call "check_option_div" pc) 2259883529b6Schristos (if (eq rm 0) 2260883529b6Schristos (set pc (c-call USI "zdiv_exception" pc)) 2261883529b6Schristos ; Special case described on p. 76. 2262883529b6Schristos (if (and (eq rn #x80000000) 2263883529b6Schristos (eq rm #xffffffff)) 2264883529b6Schristos (sequence () 2265883529b6Schristos (set lo #x80000000) 2266883529b6Schristos (set hi 0)) 2267883529b6Schristos (sequence () 2268883529b6Schristos (set lo (div rn rm)) 2269883529b6Schristos (set hi (mod rn rm)))))) 2270883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2271883529b6Schristos (unit u-use-gpr (in usereg rm)) 2272883529b6Schristos (unit u-exec) 2273883529b6Schristos (unit u-divide) 2274883529b6Schristos (unit u-branch)))) 2275883529b6Schristos 2276883529b6Schristos(dnci divu "divide unsigned" (OPTIONAL_DIV_INSN (STALL DIV) (LATENCY 34) MAY_TRAP) 2277883529b6Schristos "divu $rn,$rm" 2278883529b6Schristos (+ MAJ_1 rn rm (f-sub4 9)) 2279883529b6Schristos (sequence () 2280883529b6Schristos (c-call "check_option_div" pc) 2281883529b6Schristos (if (eq rm 0) 2282883529b6Schristos (set pc (c-call USI "zdiv_exception" pc)) 2283883529b6Schristos (sequence () 2284883529b6Schristos (set lo (udiv rn rm)) 2285883529b6Schristos (set hi (umod rn rm))))) 2286883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2287883529b6Schristos (unit u-use-gpr (in usereg rm)) 2288883529b6Schristos (unit u-exec) 2289883529b6Schristos (unit u-divide) 2290883529b6Schristos (unit u-branch)))) 2291883529b6Schristos 2292883529b6Schristos 2293883529b6Schristos; Debug functions. 2294883529b6Schristos; These instructions become the RI when the debug function option is 2295883529b6Schristos; off. 2296883529b6Schristos 2297883529b6Schristos(dnci dret "return from debug exception" (OPTIONAL_DEBUG_INSN) 2298883529b6Schristos "dret" 2299883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 1) (f-sub4 3)) 2300883529b6Schristos (sequence () 2301883529b6Schristos (c-call "check_option_debug" pc) 2302883529b6Schristos ; set DBG.DM. 2303883529b6Schristos (set dbg (and dbg (inv (sll SI 1 15)))) 2304883529b6Schristos (set pc depc)) 2305883529b6Schristos ((mep (unit u-exec) 2306883529b6Schristos (unit u-branch)))) 2307883529b6Schristos 2308883529b6Schristos(dnci dbreak "generate debug exception" (OPTIONAL_DEBUG_INSN MAY_TRAP VOLATILE) 2309883529b6Schristos "dbreak" 2310883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 3) (f-sub4 3)) 2311883529b6Schristos (sequence () 2312883529b6Schristos (c-call "check_option_debug" pc) 2313883529b6Schristos ; set DBG.DPB. 2314883529b6Schristos (set dbg (or dbg 1))) 2315883529b6Schristos ()) 2316883529b6Schristos 2317883529b6Schristos 2318883529b6Schristos; Leading zero instruction. 2319883529b6Schristos 2320883529b6Schristos(dnci ldz "leading zeroes" (OPTIONAL_LDZ_INSN (STALL INT2)) 2321883529b6Schristos "ldz $rn,$rm" 2322883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 0)) 2323883529b6Schristos (sequence () 2324883529b6Schristos (c-call "check_option_ldz" pc) 2325883529b6Schristos (set rn (c-call SI "do_ldz" rm))) 2326883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2327883529b6Schristos (unit u-exec)))) 2328883529b6Schristos 2329883529b6Schristos 2330883529b6Schristos; Absolute difference instruction. 2331883529b6Schristos 2332883529b6Schristos(dnci abs "absolute difference" (OPTIONAL_ABS_INSN (STALL INT2)) 2333883529b6Schristos "abs $rn,$rm" 2334883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 3)) 2335883529b6Schristos (sequence () 2336883529b6Schristos (c-call "check_option_abs" pc) 2337883529b6Schristos (set rn (abs (sub rn rm)))) 2338883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2339883529b6Schristos (unit u-use-gpr (in usereg rn)) 2340883529b6Schristos (unit u-exec)))) 2341883529b6Schristos 2342883529b6Schristos 2343883529b6Schristos; Average instruction. 2344883529b6Schristos 2345883529b6Schristos(dnci ave "average" (OPTIONAL_AVE_INSN (STALL INT2)) 2346883529b6Schristos "ave $rn,$rm" 2347883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 2)) 2348883529b6Schristos (sequence () 2349883529b6Schristos (c-call "check_option_ave" pc) 2350883529b6Schristos (set rn (sra (add (add rn rm) 1) 1))) 2351883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2352883529b6Schristos (unit u-use-gpr (in usereg rn)) 2353883529b6Schristos (unit u-exec)))) 2354883529b6Schristos 2355883529b6Schristos 2356883529b6Schristos; MIN/MAX instructions. 2357883529b6Schristos 2358883529b6Schristos(dnci min "minimum" (OPTIONAL_MINMAX_INSN (STALL INT2)) 2359883529b6Schristos "min $rn,$rm" 2360883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 4)) 2361883529b6Schristos (sequence () 2362883529b6Schristos (c-call "check_option_minmax" pc) 2363883529b6Schristos (if (gt rn rm) 2364883529b6Schristos (set rn rm))) 2365883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2366883529b6Schristos (unit u-use-gpr (in usereg rn)) 2367883529b6Schristos (unit u-exec)))) 2368883529b6Schristos 2369883529b6Schristos(dnci max "maximum" (OPTIONAL_MINMAX_INSN (STALL INT2)) 2370883529b6Schristos "max $rn,$rm" 2371883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 5)) 2372883529b6Schristos (sequence () 2373883529b6Schristos (c-call "check_option_minmax" pc) 2374883529b6Schristos (if (lt rn rm) 2375883529b6Schristos (set rn rm))) 2376883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2377883529b6Schristos (unit u-use-gpr (in usereg rn)) 2378883529b6Schristos (unit u-exec)))) 2379883529b6Schristos 2380883529b6Schristos(dnci minu "minimum unsigned" (OPTIONAL_MINMAX_INSN (STALL INT2)) 2381883529b6Schristos "minu $rn,$rm" 2382883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 6)) 2383883529b6Schristos (sequence () 2384883529b6Schristos (c-call "check_option_minmax" pc) 2385883529b6Schristos (if (gtu rn rm) 2386883529b6Schristos (set rn rm))) 2387883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2388883529b6Schristos (unit u-use-gpr (in usereg rn)) 2389883529b6Schristos (unit u-exec)))) 2390883529b6Schristos 2391883529b6Schristos(dnci maxu "maximum unsigned" (OPTIONAL_MINMAX_INSN (STALL INT2)) 2392883529b6Schristos "maxu $rn,$rm" 2393883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 7)) 2394883529b6Schristos (sequence () 2395883529b6Schristos (c-call "check_option_minmax" pc) 2396883529b6Schristos (if (ltu rn rm) 2397883529b6Schristos (set rn rm))) 2398883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2399883529b6Schristos (unit u-use-gpr (in usereg rn)) 2400883529b6Schristos (unit u-exec)))) 2401883529b6Schristos 2402883529b6Schristos 2403883529b6Schristos; Clipping instruction. 2404883529b6Schristos 2405883529b6Schristos(dnci clip "clip" (OPTIONAL_CLIP_INSN (STALL INT2)) 2406883529b6Schristos "clip $rn,$cimm5" 2407883529b6Schristos (+ MAJ_15 rn (f-rm 0) (f-sub4 1) (f-ext #x10) cimm5 (f-29 0) (f-30 0) (f-31 0)) 2408883529b6Schristos (sequence ((SI min) (SI max)) 2409883529b6Schristos (c-call "check_option_clip" pc) 2410883529b6Schristos (set max (sub (sll 1 (sub cimm5 1)) 1)) 2411883529b6Schristos (set min (neg (sll 1 (sub cimm5 1)))) 2412883529b6Schristos (cond 2413883529b6Schristos ((eq cimm5 0) (set rn 0)) 2414883529b6Schristos ((gt rn max) (set rn max)) 2415883529b6Schristos ((lt rn min) (set rn min)))) 2416883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2417883529b6Schristos (unit u-exec)))) 2418883529b6Schristos 2419883529b6Schristos(dnci clipu "clip unsigned" (OPTIONAL_CLIP_INSN (STALL INT2)) 2420883529b6Schristos "clipu $rn,$cimm5" 2421883529b6Schristos (+ MAJ_15 rn (f-rm 0) (f-sub4 1) (f-ext #x10) cimm5 (f-29 0) (f-30 0) (f-31 1)) 2422883529b6Schristos (sequence ((SI max)) 2423883529b6Schristos (c-call "check_option_clip" pc) 2424883529b6Schristos (set max (sub (sll 1 cimm5) 1)) 2425883529b6Schristos (cond 2426883529b6Schristos ((eq cimm5 0) (set rn 0)) 2427883529b6Schristos ((gt rn max) (set rn max)) 2428883529b6Schristos ((lt rn 0) (set rn 0)))) 2429883529b6Schristos ((mep (unit u-use-gpr (in usereg rn)) 2430883529b6Schristos (unit u-exec)))) 2431883529b6Schristos 2432883529b6Schristos 2433883529b6Schristos; Saturation instructions. 2434883529b6Schristos 2435883529b6Schristos(dnci sadd "saturating addition" (OPTIONAL_SAT_INSN (STALL INT2)) 2436883529b6Schristos "sadd $rn,$rm" 2437883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 8)) 2438883529b6Schristos (sequence () 2439883529b6Schristos (c-call "check_option_sat" pc) 2440883529b6Schristos (if (add-oflag rn rm 0) 2441883529b6Schristos (if (nflag rn) 2442883529b6Schristos ; underflow 2443883529b6Schristos (set rn (neg (sll 1 31))) 2444883529b6Schristos ; overflow 2445883529b6Schristos (set rn (sub (sll 1 31) 1))) 2446883529b6Schristos (set rn (add rn rm)))) 2447883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2448883529b6Schristos (unit u-use-gpr (in usereg rn)) 2449883529b6Schristos (unit u-exec)))) 2450883529b6Schristos 2451883529b6Schristos(dnci ssub "saturating subtraction" (OPTIONAL_SAT_INSN (STALL INT2)) 2452883529b6Schristos "ssub $rn,$rm" 2453883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 10)) 2454883529b6Schristos (sequence () 2455883529b6Schristos (c-call "check_option_sat" pc) 2456883529b6Schristos (if (sub-oflag rn rm 0) 2457883529b6Schristos (if (nflag rn) 2458883529b6Schristos ; underflow 2459883529b6Schristos (set rn (neg (sll 1 31))) 2460883529b6Schristos ; overflow 2461883529b6Schristos (set rn (sub (sll 1 31) 1))) 2462883529b6Schristos (set rn (sub rn rm)))) 2463883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2464883529b6Schristos (unit u-use-gpr (in usereg rn)) 2465883529b6Schristos (unit u-exec)))) 2466883529b6Schristos 2467883529b6Schristos(dnci saddu "saturating unsigned addition" (OPTIONAL_SAT_INSN (STALL INT2)) 2468883529b6Schristos "saddu $rn,$rm" 2469883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 9)) 2470883529b6Schristos (sequence () 2471883529b6Schristos (c-call "check_option_sat" pc) 2472883529b6Schristos (if (add-cflag rn rm 0) 2473883529b6Schristos (set rn (inv 0)) 2474883529b6Schristos (set rn (add rn rm)))) 2475883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2476883529b6Schristos (unit u-use-gpr (in usereg rn)) 2477883529b6Schristos (unit u-exec)))) 2478883529b6Schristos 2479883529b6Schristos(dnci ssubu "saturating unsigned subtraction" (OPTIONAL_SAT_INSN (STALL INT2)) 2480883529b6Schristos "ssubu $rn,$rm" 2481883529b6Schristos (+ MAJ_15 rn rm (f-sub4 1) (f-16u16 11)) 2482883529b6Schristos (sequence () 2483883529b6Schristos (c-call "check_option_sat" pc) 2484883529b6Schristos (if (sub-cflag rn rm 0) 2485883529b6Schristos (set rn 0) 2486883529b6Schristos (set rn (sub rn rm)))) 2487883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2488883529b6Schristos (unit u-use-gpr (in usereg rn)) 2489883529b6Schristos (unit u-exec)))) 2490883529b6Schristos 2491883529b6Schristos 2492883529b6Schristos; UCI and DSP options are defined in an external file. 2493883529b6Schristos; See `mep-sample-ucidsp.cpu' for a sample. 2494883529b6Schristos 2495883529b6Schristos 2496883529b6Schristos; Coprocessor instructions. 2497883529b6Schristos 2498883529b6Schristos(dnci swcp "store word coprocessor" (OPTIONAL_CP_INSN (STALL STORE)) 2499883529b6Schristos "swcp $crn,($rma)" 2500883529b6Schristos (+ MAJ_3 crn rma (f-sub4 8)) 2501883529b6Schristos (sequence () 2502883529b6Schristos (c-call "check_option_cp" pc) 2503883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv SI 3))) 2504883529b6Schristos (set (mem SI (and rma (inv SI 3))) crn)) 2505883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2506883529b6Schristos (unit u-exec)))) 2507883529b6Schristos 2508883529b6Schristos(dnci lwcp "load word coprocessor" (OPTIONAL_CP_INSN (STALL LOAD)) 2509883529b6Schristos "lwcp $crn,($rma)" 2510883529b6Schristos (+ MAJ_3 crn rma (f-sub4 9)) 2511883529b6Schristos (sequence () 2512883529b6Schristos (c-call "check_option_cp" pc) 2513883529b6Schristos (set crn (mem SI (and rma (inv SI 3))))) 2514883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2515883529b6Schristos (unit u-exec)))) 2516883529b6Schristos 2517883529b6Schristos(dnci smcp "smcp" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN (STALL STORE)) 2518883529b6Schristos "smcp $crn64,($rma)" 2519883529b6Schristos (+ MAJ_3 crn64 rma (f-sub4 10)) 2520883529b6Schristos (sequence () 2521883529b6Schristos (c-call "check_option_cp" pc) 2522883529b6Schristos (c-call "check_option_cp64" pc) 2523883529b6Schristos (c-call VOID "check_write_to_text" rma) 2524883529b6Schristos (c-call "do_smcp" rma crn64 pc)) 2525883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2526883529b6Schristos (unit u-exec)))) 2527883529b6Schristos 2528883529b6Schristos(dnci lmcp "lmcp" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN (STALL LOAD)) 2529883529b6Schristos "lmcp $crn64,($rma)" 2530883529b6Schristos (+ MAJ_3 crn64 rma (f-sub4 11)) 2531883529b6Schristos (sequence () 2532883529b6Schristos (c-call "check_option_cp" pc) 2533883529b6Schristos (c-call "check_option_cp64" pc) 2534883529b6Schristos (set crn64 (c-call DI "do_lmcp" rma pc))) 2535883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2536883529b6Schristos (unit u-exec)))) 2537883529b6Schristos 2538883529b6Schristos(dnci swcpi "swcp (post-increment)" (OPTIONAL_CP_INSN (STALL STORE)) 2539883529b6Schristos "swcpi $crn,($rma+)" 2540883529b6Schristos (+ MAJ_3 crn rma (f-sub4 0)) 2541883529b6Schristos (sequence () 2542883529b6Schristos (c-call "check_option_cp" pc) 2543883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv SI 3))) 2544883529b6Schristos (set (mem SI (and rma (inv SI 3))) crn) 2545883529b6Schristos (set rma (add rma 4))) 2546883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2547883529b6Schristos (unit u-exec)))) 2548883529b6Schristos 2549883529b6Schristos(dnci lwcpi "lwcp (post-increment)" (OPTIONAL_CP_INSN (STALL LOAD)) 2550883529b6Schristos "lwcpi $crn,($rma+)" 2551883529b6Schristos (+ MAJ_3 crn rma (f-sub4 1)) 2552883529b6Schristos (sequence () 2553883529b6Schristos (c-call "check_option_cp" pc) 2554883529b6Schristos (set crn (mem SI (and rma (inv SI 3)))) 2555883529b6Schristos (set rma (add rma 4))) 2556883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2557883529b6Schristos (unit u-exec)))) 2558883529b6Schristos 2559883529b6Schristos(dnci smcpi "smcp (post-increment)" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN (STALL STORE)) 2560883529b6Schristos "smcpi $crn64,($rma+)" 2561883529b6Schristos (+ MAJ_3 crn64 rma (f-sub4 2)) 2562883529b6Schristos (sequence () 2563883529b6Schristos (c-call "check_option_cp" pc) 2564883529b6Schristos (c-call "check_option_cp64" pc) 2565883529b6Schristos (c-call VOID "check_write_to_text" rma) 2566883529b6Schristos (c-call "do_smcpi" (index-of rma) crn64 pc) 2567883529b6Schristos (set rma rma)) ; reference as output for intrinsic generation 2568883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2569883529b6Schristos (unit u-exec)))) 2570883529b6Schristos 2571883529b6Schristos(dnci lmcpi "lmcp (post-increment)" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN (STALL LOAD)) 2572883529b6Schristos "lmcpi $crn64,($rma+)" 2573883529b6Schristos (+ MAJ_3 crn64 rma (f-sub4 3)) 2574883529b6Schristos (sequence () 2575883529b6Schristos (c-call "check_option_cp" pc) 2576883529b6Schristos (c-call "check_option_cp64" pc) 2577883529b6Schristos (set crn64 (c-call DI "do_lmcpi" (index-of rma) pc)) 2578883529b6Schristos (set rma rma)) ; reference as output for intrinsic generation 2579883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2580883529b6Schristos (unit u-exec)))) 2581883529b6Schristos 2582883529b6Schristos(dnci swcp16 "swcp (16-bit displacement)" (OPTIONAL_CP_INSN (STALL STORE)) 2583883529b6Schristos "swcp $crn,$sdisp16($rma)" 2584883529b6Schristos (+ MAJ_15 crn rma (f-sub4 12) sdisp16) 2585883529b6Schristos (sequence () 2586883529b6Schristos (c-call "check_option_cp" pc) 2587883529b6Schristos (set (mem SI (and (add rma sdisp16) (inv SI 3))) crn)) 2588883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2589883529b6Schristos (unit u-exec)))) 2590883529b6Schristos 2591883529b6Schristos(dnci lwcp16 "lwcp (16-bit displacement)" (OPTIONAL_CP_INSN (STALL LOAD)) 2592883529b6Schristos "lwcp $crn,$sdisp16($rma)" 2593883529b6Schristos (+ MAJ_15 crn rma (f-sub4 13) sdisp16) 2594883529b6Schristos (sequence () 2595883529b6Schristos (c-call "check_option_cp" pc) 2596883529b6Schristos (set crn (mem SI (and (add rma sdisp16) (inv SI 3))))) 2597883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2598883529b6Schristos (unit u-exec)))) 2599883529b6Schristos 2600883529b6Schristos(dnci smcp16 "smcp (16-bit displacement)" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN (STALL STORE)) 2601883529b6Schristos "smcp $crn64,$sdisp16($rma)" 2602883529b6Schristos (+ MAJ_15 crn64 rma (f-sub4 14) sdisp16) 2603883529b6Schristos (sequence () 2604883529b6Schristos (c-call "check_option_cp" pc) 2605883529b6Schristos (c-call "check_option_cp64" pc) 2606883529b6Schristos (c-call "do_smcp16" rma sdisp16 crn64 pc)) 2607883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2608883529b6Schristos (unit u-exec)))) 2609883529b6Schristos 2610883529b6Schristos(dnci lmcp16 "lmcp (16-bit displacement)" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN (STALL LOAD)) 2611883529b6Schristos "lmcp $crn64,$sdisp16($rma)" 2612883529b6Schristos (+ MAJ_15 crn64 rma (f-sub4 15) sdisp16) 2613883529b6Schristos (sequence () 2614883529b6Schristos (c-call "check_option_cp" pc) 2615883529b6Schristos (c-call "check_option_cp64" pc) 2616883529b6Schristos (set crn64 (c-call DI "do_lmcp16" rma sdisp16 pc))) 2617883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2618883529b6Schristos (unit u-exec)))) 2619883529b6Schristos 2620883529b6Schristos(dnci sbcpa "store byte coprocessor" (OPTIONAL_CP_INSN (STALL STORE)) 2621883529b6Schristos "sbcpa $crn,($rma+),$cdisp10" 2622883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 0) (f-ext62 0) cdisp10) 2623883529b6Schristos (sequence () 2624883529b6Schristos (c-call "check_option_cp" pc) 2625883529b6Schristos (c-call VOID "check_write_to_text" rma) 2626883529b6Schristos (set (mem QI rma) (and crn #xff)) 2627883529b6Schristos (set rma (add rma (ext SI cdisp10)))) 2628883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2629883529b6Schristos (unit u-exec)))) 2630883529b6Schristos 2631883529b6Schristos(dnci lbcpa "load byte coprocessor" (OPTIONAL_CP_INSN (STALL LOAD)) 2632883529b6Schristos "lbcpa $crn,($rma+),$cdisp10" 2633883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x4) (f-ext62 #x0) cdisp10) 2634883529b6Schristos (sequence () 2635883529b6Schristos (c-call "check_option_cp" pc) 2636883529b6Schristos (set crn (ext SI (mem QI rma))) 2637883529b6Schristos (set rma (add rma (ext SI cdisp10)))) 2638883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2639883529b6Schristos (unit u-exec)))) 2640883529b6Schristos 2641883529b6Schristos(dnci shcpa "store half-word coprocessor" (OPTIONAL_CP_INSN (STALL STORE)) 2642883529b6Schristos "shcpa $crn,($rma+),$cdisp10a2" 2643883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x1) (f-ext62 #x0) cdisp10a2) 2644883529b6Schristos (sequence () 2645883529b6Schristos (c-call "check_option_cp" pc) 2646883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv SI 1))) 2647883529b6Schristos (set (mem HI (and rma (inv SI 1))) (and crn #xffff)) 2648883529b6Schristos (set rma (add rma (ext SI cdisp10a2)))) 2649883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2650883529b6Schristos (unit u-exec)))) 2651883529b6Schristos 2652883529b6Schristos(dnci lhcpa "load half-word coprocessor" (OPTIONAL_CP_INSN (STALL LOAD)) 2653883529b6Schristos "lhcpa $crn,($rma+),$cdisp10a2" 2654883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x5) (f-ext62 #x0) cdisp10a2) 2655883529b6Schristos (sequence () 2656883529b6Schristos (c-call "check_option_cp" pc) 2657883529b6Schristos (set crn (ext SI (mem HI (and rma (inv SI 1))))) 2658883529b6Schristos (set rma (add rma (ext SI cdisp10a2)))) 2659883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2660883529b6Schristos (unit u-exec)))) 2661883529b6Schristos 2662883529b6Schristos(dnci swcpa "store word coprocessor" (OPTIONAL_CP_INSN (STALL STORE)) 2663883529b6Schristos "swcpa $crn,($rma+),$cdisp10a4" 2664883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x2) (f-ext62 #x0) cdisp10a4) 2665883529b6Schristos (sequence () 2666883529b6Schristos (c-call "check_option_cp" pc) 2667883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv SI 3))) 2668883529b6Schristos (set (mem SI (and rma (inv SI 3))) crn) 2669883529b6Schristos (set rma (add rma (ext SI cdisp10a4)))) 2670883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2671883529b6Schristos (unit u-exec)))) 2672883529b6Schristos 2673883529b6Schristos(dnci lwcpa "load word coprocessor" (OPTIONAL_CP_INSN (STALL LOAD)) 2674883529b6Schristos "lwcpa $crn,($rma+),$cdisp10a4" 2675883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x6) (f-ext62 #x0) cdisp10a4) 2676883529b6Schristos (sequence () 2677883529b6Schristos (c-call "check_option_cp" pc) 2678883529b6Schristos (set crn (mem SI (and rma (inv SI 3)))) 2679883529b6Schristos (set rma (add rma (ext SI cdisp10a4)))) 2680883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2681883529b6Schristos (unit u-exec)))) 2682883529b6Schristos 2683883529b6Schristos(dnci smcpa "smcpa" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN (STALL STORE)) 2684883529b6Schristos "smcpa $crn64,($rma+),$cdisp10a8" 2685883529b6Schristos (+ MAJ_15 crn64 rma (f-sub4 5) (f-ext4 #x3) (f-ext62 #x0) cdisp10a8) 2686883529b6Schristos (sequence () 2687883529b6Schristos (c-call "check_option_cp" pc) 2688883529b6Schristos (c-call "check_option_cp64" pc) 2689883529b6Schristos (c-call VOID "check_write_to_text" rma) 2690883529b6Schristos (c-call "do_smcpa" (index-of rma) cdisp10a8 crn64 pc) 2691883529b6Schristos (set rma rma)) ; reference as output for intrinsic generation 2692883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2693883529b6Schristos (unit u-exec)))) 2694883529b6Schristos 2695883529b6Schristos(dnci lmcpa "lmcpa" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN (STALL LOAD)) 2696883529b6Schristos "lmcpa $crn64,($rma+),$cdisp10a8" 2697883529b6Schristos (+ MAJ_15 crn64 rma (f-sub4 5) (f-ext4 #x7) (f-ext62 #x0) cdisp10a8) 2698883529b6Schristos (sequence () 2699883529b6Schristos (c-call "check_option_cp" pc) 2700883529b6Schristos (c-call "check_option_cp64" pc) 2701883529b6Schristos (set crn64 (c-call DI "do_lmcpa" (index-of rma) cdisp10a8 pc)) 2702883529b6Schristos (set rma rma)) ; reference as output for intrinsic generation 2703883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2704883529b6Schristos (unit u-exec)))) 2705883529b6Schristos 2706883529b6Schristos 2707883529b6Schristos(dnci sbcpm0 "sbcpm0" (OPTIONAL_CP_INSN) 2708883529b6Schristos "sbcpm0 $crn,($rma+),$cdisp10" 2709883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x0) (f-ext62 #x2) cdisp10) 2710883529b6Schristos (sequence () 2711883529b6Schristos (c-call "check_option_cp" pc) 2712883529b6Schristos (c-call VOID "check_write_to_text" rma) 2713883529b6Schristos (set (mem QI rma) (and crn #xff)) 2714883529b6Schristos (set rma (mod0 cdisp10))) 2715883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2716883529b6Schristos (unit u-exec)))) 2717883529b6Schristos 2718883529b6Schristos(dnci lbcpm0 "lbcpm0" (OPTIONAL_CP_INSN) 2719883529b6Schristos "lbcpm0 $crn,($rma+),$cdisp10" 2720883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x4) (f-ext62 #x2) cdisp10) 2721883529b6Schristos (sequence () 2722883529b6Schristos (c-call "check_option_cp" pc) 2723883529b6Schristos (set crn (ext SI (mem QI rma))) 2724883529b6Schristos (set rma (mod0 cdisp10))) 2725883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2726883529b6Schristos (unit u-exec)))) 2727883529b6Schristos 2728883529b6Schristos(dnci shcpm0 "shcpm0" (OPTIONAL_CP_INSN) 2729883529b6Schristos "shcpm0 $crn,($rma+),$cdisp10a2" 2730883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x1) (f-ext62 #x2) cdisp10a2) 2731883529b6Schristos (sequence () 2732883529b6Schristos (c-call "check_option_cp" pc) 2733883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv SI 1))) 2734883529b6Schristos (set (mem HI (and rma (inv SI 1))) (and crn #xffff)) 2735883529b6Schristos (set rma (mod0 cdisp10a2))) 2736883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2737883529b6Schristos (unit u-exec)))) 2738883529b6Schristos 2739883529b6Schristos(dnci lhcpm0 "lhcpm0" (OPTIONAL_CP_INSN) 2740883529b6Schristos "lhcpm0 $crn,($rma+),$cdisp10a2" 2741883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x5) (f-ext62 #x2) cdisp10a2) 2742883529b6Schristos (sequence () 2743883529b6Schristos (c-call "check_option_cp" pc) 2744883529b6Schristos (set crn (ext SI (mem HI (and rma (inv SI 1))))) 2745883529b6Schristos (set rma (mod0 cdisp10a2))) 2746883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2747883529b6Schristos (unit u-exec)))) 2748883529b6Schristos 2749883529b6Schristos(dnci swcpm0 "swcpm0" (OPTIONAL_CP_INSN) 2750883529b6Schristos "swcpm0 $crn,($rma+),$cdisp10a4" 2751883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x2) (f-ext62 #x2) cdisp10a4) 2752883529b6Schristos (sequence () 2753883529b6Schristos (c-call "check_option_cp" pc) 2754883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv SI 3))) 2755883529b6Schristos (set (mem SI (and rma (inv SI 3))) crn) 2756883529b6Schristos (set rma (mod0 cdisp10a4))) 2757883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2758883529b6Schristos (unit u-exec)))) 2759883529b6Schristos 2760883529b6Schristos(dnci lwcpm0 "lwcpm0" (OPTIONAL_CP_INSN) 2761883529b6Schristos "lwcpm0 $crn,($rma+),$cdisp10a4" 2762883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x6) (f-ext62 #x2) cdisp10a4) 2763883529b6Schristos (sequence () 2764883529b6Schristos (c-call "check_option_cp" pc) 2765883529b6Schristos (set crn (mem SI (and rma (inv SI 3)))) 2766883529b6Schristos (set rma (mod0 cdisp10a4))) 2767883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2768883529b6Schristos (unit u-exec)))) 2769883529b6Schristos 2770883529b6Schristos(dnci smcpm0 "smcpm0" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN) 2771883529b6Schristos "smcpm0 $crn64,($rma+),$cdisp10a8" 2772883529b6Schristos (+ MAJ_15 crn64 rma (f-sub4 5) (f-ext4 #x3) (f-ext62 #x2) cdisp10a8) 2773883529b6Schristos (sequence () 2774883529b6Schristos (c-call "check_option_cp" pc) 2775883529b6Schristos (c-call "check_option_cp64" pc) 2776883529b6Schristos (c-call VOID "check_write_to_text" rma) 2777883529b6Schristos (c-call "do_smcp" rma crn64 pc) 2778883529b6Schristos (set rma (mod0 cdisp10a8))) 2779883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2780883529b6Schristos (unit u-exec)))) 2781883529b6Schristos 2782883529b6Schristos(dnci lmcpm0 "lmcpm0" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN) 2783883529b6Schristos "lmcpm0 $crn64,($rma+),$cdisp10a8" 2784883529b6Schristos (+ MAJ_15 crn64 rma (f-sub4 5) (f-ext4 #x7) (f-ext62 #x2) cdisp10a8) 2785883529b6Schristos (sequence () 2786883529b6Schristos (c-call "check_option_cp" pc) 2787883529b6Schristos (c-call "check_option_cp64" pc) 2788883529b6Schristos (set crn64 (c-call DI "do_lmcp" rma pc)) 2789883529b6Schristos (set rma (mod0 cdisp10a8))) 2790883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2791883529b6Schristos (unit u-exec)))) 2792883529b6Schristos 2793883529b6Schristos(dnci sbcpm1 "sbcpm1" (OPTIONAL_CP_INSN) 2794883529b6Schristos "sbcpm1 $crn,($rma+),$cdisp10" 2795883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x0) (f-ext62 #x3) cdisp10) 2796883529b6Schristos (sequence () 2797883529b6Schristos (c-call "check_option_cp" pc) 2798883529b6Schristos (c-call VOID "check_write_to_text" rma) 2799883529b6Schristos (set (mem QI rma) (and crn #xff)) 2800883529b6Schristos (set rma (mod1 cdisp10))) 2801883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2802883529b6Schristos (unit u-exec)))) 2803883529b6Schristos 2804883529b6Schristos(dnci lbcpm1 "lbcpm1" (OPTIONAL_CP_INSN) 2805883529b6Schristos "lbcpm1 $crn,($rma+),$cdisp10" 2806883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x4) (f-ext62 #x3) cdisp10) 2807883529b6Schristos (sequence () 2808883529b6Schristos (c-call "check_option_cp" pc) 2809883529b6Schristos (set crn (ext SI (mem QI rma))) 2810883529b6Schristos (set rma (mod1 cdisp10))) 2811883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2812883529b6Schristos (unit u-exec)))) 2813883529b6Schristos 2814883529b6Schristos(dnci shcpm1 "shcpm1" (OPTIONAL_CP_INSN) 2815883529b6Schristos "shcpm1 $crn,($rma+),$cdisp10a2" 2816883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x1) (f-ext62 #x3) cdisp10a2) 2817883529b6Schristos (sequence () 2818883529b6Schristos (c-call "check_option_cp" pc) 2819883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv SI 1))) 2820883529b6Schristos (set (mem HI (and rma (inv SI 1))) (and crn #xffff)) 2821883529b6Schristos (set rma (mod1 cdisp10a2))) 2822883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2823883529b6Schristos (unit u-exec)))) 2824883529b6Schristos 2825883529b6Schristos(dnci lhcpm1 "lhcpm1" (OPTIONAL_CP_INSN) 2826883529b6Schristos "lhcpm1 $crn,($rma+),$cdisp10a2" 2827883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x5) (f-ext62 #x3) cdisp10a2) 2828883529b6Schristos (sequence () 2829883529b6Schristos (c-call "check_option_cp" pc) 2830883529b6Schristos (set crn (ext SI (mem HI (and rma (inv SI 1))))) 2831883529b6Schristos (set rma (mod1 cdisp10a2))) 2832883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2833883529b6Schristos (unit u-exec)))) 2834883529b6Schristos 2835883529b6Schristos(dnci swcpm1 "swcpm1" (OPTIONAL_CP_INSN) 2836883529b6Schristos "swcpm1 $crn,($rma+),$cdisp10a4" 2837883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x2) (f-ext62 #x3) cdisp10a4) 2838883529b6Schristos (sequence () 2839883529b6Schristos (c-call "check_option_cp" pc) 2840883529b6Schristos (c-call VOID "check_write_to_text" (and rma (inv SI 3))) 2841883529b6Schristos (set (mem SI (and rma (inv SI 3))) crn) 2842883529b6Schristos (set rma (mod1 cdisp10a4))) 2843883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2844883529b6Schristos (unit u-exec)))) 2845883529b6Schristos 2846883529b6Schristos(dnci lwcpm1 "lwcpm1" (OPTIONAL_CP_INSN) 2847883529b6Schristos "lwcpm1 $crn,($rma+),$cdisp10a4" 2848883529b6Schristos (+ MAJ_15 crn rma (f-sub4 5) (f-ext4 #x6) (f-ext62 #x3) cdisp10a4) 2849883529b6Schristos (sequence () 2850883529b6Schristos (c-call "check_option_cp" pc) 2851883529b6Schristos (set crn (ext SI (mem SI (and rma (inv SI 3))))) 2852883529b6Schristos (set rma (mod1 cdisp10a4))) 2853883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2854883529b6Schristos (unit u-exec)))) 2855883529b6Schristos 2856883529b6Schristos(dnci smcpm1 "smcpm1" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN) 2857883529b6Schristos "smcpm1 $crn64,($rma+),$cdisp10a8" 2858883529b6Schristos (+ MAJ_15 crn64 rma (f-sub4 5) (f-ext4 #x3) (f-ext62 #x3) cdisp10a8) 2859883529b6Schristos (sequence () 2860883529b6Schristos (c-call "check_option_cp" pc) 2861883529b6Schristos (c-call "check_option_cp64" pc) 2862883529b6Schristos (c-call "do_smcp" rma crn64 pc) 2863883529b6Schristos (c-call VOID "check_write_to_text" rma) 2864883529b6Schristos (set rma (mod1 cdisp10a8))) 2865883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2866883529b6Schristos (unit u-exec)))) 2867883529b6Schristos 2868883529b6Schristos(dnci lmcpm1 "lmcpm1" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN) 2869883529b6Schristos "lmcpm1 $crn64,($rma+),$cdisp10a8" 2870883529b6Schristos (+ MAJ_15 crn64 rma (f-sub4 5) (f-ext4 #x7) (f-ext62 #x3) cdisp10a8) 2871883529b6Schristos (sequence () 2872883529b6Schristos (c-call "check_option_cp" pc) 2873883529b6Schristos (c-call "check_option_cp64" pc) 2874883529b6Schristos (set crn64 (c-call DI "do_lmcp" rma pc)) 2875883529b6Schristos (set rma (mod1 cdisp10a8))) 2876883529b6Schristos ((mep (unit u-use-gpr (in usereg rma)) 2877883529b6Schristos (unit u-exec)))) 2878883529b6Schristos 2879883529b6Schristos(dnop cp_flag "branch condition register" (all-mep-isas) h-ccr 1) 2880883529b6Schristos 2881883529b6Schristos(dnci bcpeq "branch coprocessor equal" (OPTIONAL_CP_INSN RELAXABLE) 2882883529b6Schristos "bcpeq $cccc,$pcrel17a2" 2883883529b6Schristos (+ MAJ_13 (f-rn 8) cccc (f-sub4 4) pcrel17a2) 2884883529b6Schristos (sequence () 2885883529b6Schristos (c-call "check_option_cp" pc) 2886883529b6Schristos (if (eq (xor cccc cp_flag) 0) 2887883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2))) 2888883529b6Schristos ()) 2889883529b6Schristos 2890883529b6Schristos(dnci bcpne "branch coprocessor not equal" (OPTIONAL_CP_INSN RELAXABLE) 2891883529b6Schristos "bcpne $cccc,$pcrel17a2" 2892883529b6Schristos (+ MAJ_13 (f-rn 8) cccc (f-sub4 5) pcrel17a2) 2893883529b6Schristos (sequence () 2894883529b6Schristos (c-call "check_option_cp" pc) 2895883529b6Schristos (if (ne (xor cccc cp_flag) 0) 2896883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2))) 2897883529b6Schristos ()) 2898883529b6Schristos 2899883529b6Schristos(dnci bcpat "branch coprocessor and true" (OPTIONAL_CP_INSN RELAXABLE) 2900883529b6Schristos "bcpat $cccc,$pcrel17a2" 2901883529b6Schristos (+ MAJ_13 (f-rn 8) cccc (f-sub4 6) pcrel17a2) 2902883529b6Schristos (sequence () 2903883529b6Schristos (c-call "check_option_cp" pc) 2904883529b6Schristos (if (ne (and cccc cp_flag) 0) 2905883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2))) 2906883529b6Schristos ()) 2907883529b6Schristos 2908883529b6Schristos(dnci bcpaf "branch coprocessor and false" (OPTIONAL_CP_INSN RELAXABLE) 2909883529b6Schristos "bcpaf $cccc,$pcrel17a2" 2910883529b6Schristos (+ MAJ_13 (f-rn 8) cccc (f-sub4 7) pcrel17a2) 2911883529b6Schristos (sequence () 2912883529b6Schristos (c-call "check_option_cp" pc) 2913883529b6Schristos (if (eq (and cccc cp_flag) 0) 2914883529b6Schristos (set-vliw-alignment-modified pc pcrel17a2))) 2915883529b6Schristos ()) 2916883529b6Schristos 2917883529b6Schristos(dnci synccp "synchronise with coprocessor" (OPTIONAL_CP_INSN) 2918883529b6Schristos "synccp" 2919883529b6Schristos (+ MAJ_7 (f-rn 0) (f-rm 2) (f-sub4 1)) 2920883529b6Schristos (sequence () 2921883529b6Schristos (c-call "check_option_cp" pc) 2922883529b6Schristos (unimp "synccp")) 2923883529b6Schristos ()) 2924883529b6Schristos 2925883529b6Schristos(dnci jsrv "jump to vliw subroutine " (OPTIONAL_CP_INSN) 2926883529b6Schristos "jsrv $rm" 2927883529b6Schristos (+ MAJ_1 (f-rn 8) rm (f-sub4 15)) 2928883529b6Schristos (sequence () 2929883529b6Schristos (cg-profile pc rm) 2930883529b6Schristos (c-call "check_option_cp" pc) 2931883529b6Schristos (core-vliw-switch 2932883529b6Schristos 2933883529b6Schristos ;; in core operating mode 2934883529b6Schristos (sequence () 2935883529b6Schristos (set lp (or (add pc 2) 1)) 2936883529b6Schristos (set-vliw-aliignment-modified-by-option pc rm) 2937883529b6Schristos (set-psw.om 1)) ;; to VLIW operation mode 2938883529b6Schristos 2939883529b6Schristos ;; in VLIW32 operating mode 2940883529b6Schristos (sequence () 2941883529b6Schristos (set lp (or (add pc 4) 1)) 2942883529b6Schristos (set pc (and rm (inv 1))) 2943883529b6Schristos (set-psw.om 0)) ;; to core operation mode 2944883529b6Schristos 2945883529b6Schristos ;; in VLIW64 operating mode 2946883529b6Schristos (sequence () 2947883529b6Schristos (set lp (or (add pc 8) 1)) 2948883529b6Schristos (set pc (and rm (inv 1))) 2949883529b6Schristos (set-psw.om 0)))) ;; to core operation mode 2950883529b6Schristos ((mep (unit u-use-gpr (in usereg rm)) 2951883529b6Schristos (unit u-exec) 2952883529b6Schristos (unit u-branch)))) 2953883529b6Schristos 2954883529b6Schristos(dnci bsrv "branch to vliw subroutine" (OPTIONAL_CP_INSN) 2955883529b6Schristos "bsrv $pcrel24a2" 2956883529b6Schristos (+ MAJ_13 (f-4 1) (f-sub4 11) pcrel24a2) 2957883529b6Schristos (sequence () 2958883529b6Schristos (cg-profile pc pcrel24a2) 2959883529b6Schristos (c-call "check_option_cp" pc) 2960883529b6Schristos (core-vliw-switch 2961883529b6Schristos 2962883529b6Schristos ;; in core operating mode 2963883529b6Schristos (sequence () 2964883529b6Schristos (set lp (or (add pc 4) 1)) 2965883529b6Schristos (set-vliw-aliignment-modified-by-option pc pcrel24a2) 2966883529b6Schristos (set-psw.om 1)) ;; to VLIW operation mode 2967883529b6Schristos 2968883529b6Schristos ;; in VLIW32 operating mode 2969883529b6Schristos (sequence () 2970883529b6Schristos (set lp (or (add pc 4) 1)) 2971883529b6Schristos (set pc (and pcrel24a2 (inv 1))) 2972883529b6Schristos (set-psw.om 0)) ;; to core operation mode 2973883529b6Schristos 2974883529b6Schristos ;; in VLIW64 operating mode 2975883529b6Schristos (sequence () 2976883529b6Schristos (set lp (or (add pc 8) 1)) 2977883529b6Schristos (set pc (and pcrel24a2 (inv 1))) 2978883529b6Schristos (set-psw.om 0)))) ;; to core operation mode 2979883529b6Schristos ((mep (unit u-exec) 2980883529b6Schristos (unit u-branch)))) 2981883529b6Schristos 2982883529b6Schristos 2983883529b6Schristos; An instruction for test instrumentation. 2984883529b6Schristos; Using a reserved opcode. 2985883529b6Schristos 2986883529b6Schristos(dnci sim-syscall "simulator system call" () 2987883529b6Schristos "--syscall--" 2988883529b6Schristos (+ MAJ_7 (f-4 1) callnum (f-8 0) (f-9 0) (f-10 0) (f-sub4 0)) 2989883529b6Schristos (c-call "do_syscall" pc callnum) 2990883529b6Schristos ()) 2991883529b6Schristos 2992883529b6Schristos(define-pmacro (dnri n major minor) 2993883529b6Schristos (dnci (.sym ri- n) "reserved instruction" () 2994883529b6Schristos "--reserved--" 2995883529b6Schristos (+ major rn rm (f-sub4 minor)) 2996883529b6Schristos (set pc (c-call USI "ri_exception" pc)) 2997883529b6Schristos ((mep (unit u-exec) 2998883529b6Schristos (unit u-branch))))) 2999883529b6Schristos 3000883529b6Schristos(dnri 0 MAJ_0 6) 3001883529b6Schristos(dnri 1 MAJ_1 10) 3002883529b6Schristos(dnri 2 MAJ_1 11) 3003883529b6Schristos(dnri 3 MAJ_2 5) 3004883529b6Schristos(dnri 4 MAJ_2 8) 3005883529b6Schristos(dnri 5 MAJ_2 9) 3006883529b6Schristos(dnri 6 MAJ_2 10) 3007883529b6Schristos(dnri 7 MAJ_2 11) 3008883529b6Schristos(dnri 8 MAJ_3 4) 3009883529b6Schristos(dnri 9 MAJ_3 5) 3010883529b6Schristos(dnri 10 MAJ_3 6) 3011883529b6Schristos(dnri 11 MAJ_3 7) 3012883529b6Schristos(dnri 12 MAJ_3 12) 3013883529b6Schristos(dnri 13 MAJ_3 13) 3014883529b6Schristos(dnri 14 MAJ_3 14) 3015883529b6Schristos(dnri 15 MAJ_3 15) 3016883529b6Schristos(dnri 17 MAJ_7 7) 3017883529b6Schristos(dnri 20 MAJ_7 14) 3018883529b6Schristos(dnri 21 MAJ_7 15) 3019883529b6Schristos(dnri 22 MAJ_12 7) 3020883529b6Schristos(dnri 23 MAJ_14 13) 3021883529b6Schristos;(dnri 24 MAJ_15 3) 3022883529b6Schristos(dnri 26 MAJ_15 8) 3023883529b6Schristos; begin core-specific reserved insns 3024883529b6Schristos; end core-specific reserved insns 3025883529b6Schristos 3026883529b6Schristos 3027883529b6Schristos; Macro instructions. 3028883529b6Schristos 3029883529b6Schristos(dnmi nop "nop" 3030883529b6Schristos () 3031883529b6Schristos "nop" 3032883529b6Schristos (emit mov (rn 0) (rm 0))) 3033883529b6Schristos 3034883529b6Schristos; Emit the 16 bit form of these 32 bit insns when the displacement is zero. 3035883529b6Schristos; 3036883529b6Schristos(dncmi sb16-0 "store byte (explicit 16 bit displacement of zero)" (NO-DIS) 3037883529b6Schristos "sb $rnc,$zero($rma)" 3038883529b6Schristos (emit sb rnc rma)) 3039883529b6Schristos 3040883529b6Schristos(dncmi sh16-0 "store half (explicit 16 bit displacement of zero)" (NO-DIS) 3041883529b6Schristos "sh $rns,$zero($rma)" 3042883529b6Schristos (emit sh rns rma)) 3043883529b6Schristos 3044883529b6Schristos(dncmi sw16-0 "store word (explicit 16 bit displacement of zero)" (NO-DIS) 3045883529b6Schristos "sw $rnl,$zero($rma)" 3046883529b6Schristos (emit sw rnl rma)) 3047883529b6Schristos 3048883529b6Schristos(dncmi lb16-0 "load byte (explicit 16 bit displacement of zero)" (NO-DIS) 3049883529b6Schristos "lb $rnc,$zero($rma)" 3050883529b6Schristos (emit lb rnc rma)) 3051883529b6Schristos 3052883529b6Schristos(dncmi lh16-0 "load half (explicit 16 bit displacement of zero)" (NO-DIS) 3053883529b6Schristos "lh $rns,$zero($rma)" 3054883529b6Schristos (emit lh rns rma)) 3055883529b6Schristos 3056883529b6Schristos(dncmi lw16-0 "load word (explicit 16 bit displacement of zero)" (NO-DIS) 3057883529b6Schristos "lw $rnl,$zero($rma)" 3058883529b6Schristos (emit lw rnl rma)) 3059883529b6Schristos 3060883529b6Schristos(dncmi lbu16-0 "load unsigned byte (explicit 16 bit displacement of zero)" (NO-DIS) 3061883529b6Schristos "lbu $rnuc,$zero($rma)" 3062883529b6Schristos (emit lbu rnuc rma)) 3063883529b6Schristos 3064883529b6Schristos(dncmi lhu16-0 "load unsigned half (explicit 16 bit displacement of zero)" (NO-DIS) 3065883529b6Schristos "lhu $rnus,$zero($rma)" 3066883529b6Schristos (emit lhu rnus rma)) 3067883529b6Schristos 3068883529b6Schristos(dncmi swcp16-0 "swcp (explicit 16-bit displacement of zero)" (OPTIONAL_CP_INSN NO-DIS) 3069883529b6Schristos "swcp $crn,$zero($rma)" 3070883529b6Schristos (emit swcp crn rma)) 3071883529b6Schristos 3072883529b6Schristos(dncmi lwcp16-0 "lwcp (explicit 16-bit displacement of zero)" (OPTIONAL_CP_INSN NO-DIS) 3073883529b6Schristos "lwcp $crn,$zero($rma)" 3074883529b6Schristos (emit lwcp crn rma)) 3075883529b6Schristos 3076883529b6Schristos(dncmi smcp16-0 "smcp (explicit 16-bit displacement of zero)" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN NO-DIS) 3077883529b6Schristos "smcp $crn64,$zero($rma)" 3078883529b6Schristos (emit smcp crn64 rma)) 3079883529b6Schristos 3080883529b6Schristos(dncmi lmcp16-0 "lmcp (explicit 16-bit displacement of zero)" (OPTIONAL_CP_INSN OPTIONAL_CP64_INSN NO-DIS) 3081883529b6Schristos "lmcp $crn64,$zero($rma)" 3082883529b6Schristos (emit lmcp crn64 rma)) 3083