148596154Schristos; Fujitsu FR30 CPU description. -*- Scheme -*- 248596154Schristos; Copyright 2011 Free Software Foundation, Inc. 348596154Schristos; 448596154Schristos; Contributed by Red Hat Inc; 548596154Schristos; 648596154Schristos; This file is part of the GNU Binutils. 748596154Schristos; 848596154Schristos; This program is free software; you can redistribute it and/or modify 948596154Schristos; it under the terms of the GNU General Public License as published by 1048596154Schristos; the Free Software Foundation; either version 3 of the License, or 1148596154Schristos; (at your option) any later version. 1248596154Schristos; 1348596154Schristos; This program is distributed in the hope that it will be useful, 1448596154Schristos; but WITHOUT ANY WARRANTY; without even the implied warranty of 1548596154Schristos; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1648596154Schristos; GNU General Public License for more details. 1748596154Schristos; 1848596154Schristos; You should have received a copy of the GNU General Public License 1948596154Schristos; along with this program; if not, write to the Free Software 2048596154Schristos; Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 2148596154Schristos; MA 02110-1301, USA. 2248596154Schristos 2348596154Schristos(define-rtl-version 0 8) 2448596154Schristos 2548596154Schristos(include "simplify.inc") 2648596154Schristos 2748596154Schristos; define-arch must appear first 2848596154Schristos 2948596154Schristos(define-arch 3048596154Schristos (name fr30) ; name of cpu family 3148596154Schristos (comment "Fujitsu FR30") 3248596154Schristos (default-alignment forced) 3348596154Schristos (insn-lsb0? #f) 3448596154Schristos (machs fr30) 3548596154Schristos (isas fr30) 3648596154Schristos) 3748596154Schristos 3848596154Schristos(define-isa 3948596154Schristos (name fr30) 4048596154Schristos (base-insn-bitsize 16) 4148596154Schristos (decode-assist (0 1 2 3 4 5 6 7)) ; Initial bitnumbers to decode insns by. 4248596154Schristos (liw-insns 1) ; The fr30 fetches 1 insn at a time. 4348596154Schristos (parallel-insns 1) ; The fr30 executes 1 insn at a time. 4448596154Schristos) 4548596154Schristos 4648596154Schristos(define-cpu 4748596154Schristos ; cpu names must be distinct from the architecture name and machine names. 4848596154Schristos ; The "b" suffix stands for "base" and is the convention. 4948596154Schristos ; The "f" suffix stands for "family" and is the convention. 5048596154Schristos (name fr30bf) 5148596154Schristos (comment "Fujitsu FR30 base family") 5248596154Schristos (endian big) 5348596154Schristos (word-bitsize 32) 5448596154Schristos) 5548596154Schristos 5648596154Schristos(define-mach 5748596154Schristos (name fr30) 5848596154Schristos (comment "Generic FR30 cpu") 5948596154Schristos (cpu fr30bf) 6048596154Schristos) 6148596154Schristos 6248596154Schristos; Model descriptions. 6348596154Schristos; 6448596154Schristos(define-model 6548596154Schristos (name fr30-1) (comment "fr30-1") (attrs) 6648596154Schristos (mach fr30) 6748596154Schristos 6848596154Schristos (pipeline all "" () ((fetch) (decode) (execute) (writeback))) 6948596154Schristos 7048596154Schristos ; `state' is a list of variables for recording model state 7148596154Schristos (state 7248596154Schristos ; bit mask of h-gr registers loaded from memory by previous insn 7348596154Schristos (load-regs UINT) 7448596154Schristos ; bit mask of h-gr registers loaded from memory by current insn 7548596154Schristos (load-regs-pending UINT) 7648596154Schristos ) 7748596154Schristos 7848596154Schristos (unit u-exec "Execution Unit" () 7948596154Schristos 1 1 ; issue done 8048596154Schristos () ; state 8148596154Schristos ((Ri INT -1) (Rj INT -1)) ; inputs 8248596154Schristos ((Ri INT -1)) ; outputs 8348596154Schristos () ; profile action (default) 8448596154Schristos ) 8548596154Schristos (unit u-cti "Branch Unit" () 8648596154Schristos 1 1 ; issue done 8748596154Schristos () ; state 8848596154Schristos ((Ri INT -1)) ; inputs 8948596154Schristos ((pc)) ; outputs 9048596154Schristos () ; profile action (default) 9148596154Schristos ) 9248596154Schristos (unit u-load "Memory Load Unit" () 9348596154Schristos 1 1 ; issue done 9448596154Schristos () ; state 9548596154Schristos ((Rj INT -1) 9648596154Schristos ;(ld-mem AI) 9748596154Schristos ) ; inputs 9848596154Schristos ((Ri INT -1)) ; outputs 9948596154Schristos () ; profile action (default) 10048596154Schristos ) 10148596154Schristos (unit u-store "Memory Store Unit" () 10248596154Schristos 1 1 ; issue done 10348596154Schristos () ; state 10448596154Schristos ((Ri INT -1) (Rj INT -1)) ; inputs 10548596154Schristos () ; ((st-mem AI)) ; outputs 10648596154Schristos () ; profile action (default) 10748596154Schristos ) 10848596154Schristos (unit u-ldm "LDM Memory Load Unit" () 10948596154Schristos 1 1 ; issue done 11048596154Schristos () ; state 11148596154Schristos ((reglist INT)) ; inputs 11248596154Schristos () ; outputs 11348596154Schristos () ; profile action (default) 11448596154Schristos ) 11548596154Schristos (unit u-stm "STM Memory Store Unit" () 11648596154Schristos 1 1 ; issue done 11748596154Schristos () ; state 11848596154Schristos ((reglist INT)) ; inputs 11948596154Schristos () ; outputs 12048596154Schristos () ; profile action (default) 12148596154Schristos ) 12248596154Schristos) 12348596154Schristos 12448596154Schristos; The instruction fetch/execute cycle. 12548596154Schristos; 12648596154Schristos; This is how to fetch and decode an instruction. 12748596154Schristos; Leave it out for now 12848596154Schristos 12948596154Schristos; (define-extract (const SI 0)) 13048596154Schristos 13148596154Schristos; This is how to execute a decoded instruction. 13248596154Schristos; Leave it out for now 13348596154Schristos 13448596154Schristos; (define-execute (const SI 0)) 13548596154Schristos 13648596154Schristos; Instruction fields. 13748596154Schristos; 13848596154Schristos; Attributes: 13948596154Schristos; PCREL-ADDR: pc relative value (for reloc and disassembly purposes) 14048596154Schristos; ABS-ADDR: absolute address (for reloc and disassembly purposes?) 14148596154Schristos; RESERVED: bits are not used to decode insn, must be all 0 14248596154Schristos 14348596154Schristos(dnf f-op1 "1st 4 bits of opcode" () 0 4) 14448596154Schristos(dnf f-op2 "2nd 4 bits of opcode" () 4 4) 14548596154Schristos(dnf f-op3 "3rd 4 bits of opcode" () 8 4) 14648596154Schristos(dnf f-op4 "4th 4 bits of opcode" () 12 4) 14748596154Schristos(dnf f-op5 "5th bit of opcode" () 4 1) 14848596154Schristos(dnf f-cc "condition code" () 4 4) 14948596154Schristos(dnf f-ccc "coprocessor calc code" () 16 8) 15048596154Schristos(dnf f-Rj "register Rj" () 8 4) 15148596154Schristos(dnf f-Ri "register Ri" () 12 4) 15248596154Schristos(dnf f-Rs1 "register Rs" () 8 4) 15348596154Schristos(dnf f-Rs2 "register Rs" () 12 4) 15448596154Schristos(dnf f-Rjc "register Rj" () 24 4) 15548596154Schristos(dnf f-Ric "register Ri" () 28 4) 15648596154Schristos(dnf f-CRj "coprocessor register" () 24 4) 15748596154Schristos(dnf f-CRi "coprocessor register" () 28 4) 15848596154Schristos(dnf f-u4 "4 bit 0 extended" () 8 4) 15948596154Schristos(dnf f-u4c "4 bit 0 extended" () 12 4) 16048596154Schristos(df f-i4 "4 bit sign extended" () 8 4 INT #f #f) 16148596154Schristos(df f-m4 "4 bit minus extended" () 8 4 UINT 162c03b94e9Schristos ; ??? This field takes a value in the range [-16,-1] but there 163c03b94e9Schristos ; doesn't seem a way to tell CGEN that. Use an unsigned field and 164c03b94e9Schristos ; disable range checks on insertion by masking. Restore the sign 165c03b94e9Schristos ; on extraction. CGEN generated documentation for insns that use 166c03b94e9Schristos ; this field will be wrong. 16748596154Schristos ((value pc) (and WI value (const #xf))) 168c03b94e9Schristos ((value pc) (or WI value (const -16))) 16948596154Schristos) 17048596154Schristos(dnf f-u8 "8 bit unsigned" () 8 8) 17148596154Schristos(dnf f-i8 "8 bit unsigned" () 4 8) 17248596154Schristos 17348596154Schristos(dnf f-i20-4 "upper 4 bits of i20" () 8 4) 17448596154Schristos(dnf f-i20-16 "lower 16 bits of i20" () 16 16) 17548596154Schristos(dnmf f-i20 "20 bit unsigned" () UINT 17648596154Schristos (f-i20-4 f-i20-16) 17748596154Schristos (sequence () ; insert 17848596154Schristos (set (ifield f-i20-4) (srl (ifield f-i20) (const 16))) 17948596154Schristos (set (ifield f-i20-16) (and (ifield f-i20) (const #xffff))) 18048596154Schristos ) 18148596154Schristos (sequence () ; extract 18248596154Schristos (set (ifield f-i20) (or (sll (ifield f-i20-4) (const 16)) 18348596154Schristos (ifield f-i20-16))) 18448596154Schristos ) 18548596154Schristos) 18648596154Schristos 18748596154Schristos(dnf f-i32 "32 bit immediate" (SIGN-OPT) 16 32) 18848596154Schristos 18948596154Schristos(df f-udisp6 "6 bit unsigned offset" () 8 4 UINT 19048596154Schristos ((value pc) (srl UWI value (const 2))) 19148596154Schristos ((value pc) (sll UWI value (const 2))) 19248596154Schristos) 19348596154Schristos(df f-disp8 "8 bit signed offset" () 4 8 INT #f #f) 19448596154Schristos(df f-disp9 "9 bit signed offset" () 4 8 INT 19548596154Schristos ((value pc) (sra WI value (const 1))) 196*1424dfb3Schristos ((value pc) (mul WI value (const 2))) 19748596154Schristos) 19848596154Schristos(df f-disp10 "10 bit signed offset" () 4 8 INT 19948596154Schristos ((value pc) (sra WI value (const 2))) 200*1424dfb3Schristos ((value pc) (mul WI value (const 4))) 20148596154Schristos) 20248596154Schristos(df f-s10 "10 bit signed offset" () 8 8 INT 20348596154Schristos ((value pc) (sra WI value (const 2))) 204*1424dfb3Schristos ((value pc) (mul WI value (const 4))) 20548596154Schristos) 20648596154Schristos(df f-u10 "10 bit unsigned offset" () 8 8 UINT 20748596154Schristos ((value pc) (srl UWI value (const 2))) 20848596154Schristos ((value pc) (sll UWI value (const 2))) 20948596154Schristos) 21048596154Schristos(df f-rel9 "9 pc relative signed offset" (PCREL-ADDR) 8 8 INT 21148596154Schristos ((value pc) (sra WI (sub WI value (add WI pc (const 2))) (const 1))) 212*1424dfb3Schristos ((value pc) (add WI (mul WI value (const 2)) (add WI pc (const 2)))) 21348596154Schristos) 21448596154Schristos(dnf f-dir8 "8 bit direct address" () 8 8) 21548596154Schristos(df f-dir9 "9 bit direct address" () 8 8 UINT 21648596154Schristos ((value pc) (srl UWI value (const 1))) 21748596154Schristos ((value pc) (sll UWI value (const 1))) 21848596154Schristos) 21948596154Schristos(df f-dir10 "10 bit direct address" () 8 8 UINT 22048596154Schristos ((value pc) (srl UWI value (const 2))) 22148596154Schristos ((value pc) (sll UWI value (const 2))) 22248596154Schristos) 22348596154Schristos(df f-rel12 "12 bit pc relative signed offset" (PCREL-ADDR) 5 11 INT 22448596154Schristos ((value pc) (sra WI (sub WI value (add WI pc (const 2))) (const 1))) 225*1424dfb3Schristos ((value pc) (add WI (mul WI value (const 2)) (add WI pc (const 2)))) 22648596154Schristos) 22748596154Schristos 22848596154Schristos(dnf f-reglist_hi_st "8 bit register mask for stm" () 8 8) 22948596154Schristos(dnf f-reglist_low_st "8 bit register mask for stm" () 8 8) 23048596154Schristos(dnf f-reglist_hi_ld "8 bit register mask for ldm" () 8 8) 23148596154Schristos(dnf f-reglist_low_ld "8 bit register mask for ldm" () 8 8) 23248596154Schristos 23348596154Schristos; Enums. 23448596154Schristos 23548596154Schristos; insn-op1: bits 0-3 23648596154Schristos; FIXME: should use die macro or some such 23748596154Schristos(define-normal-insn-enum insn-op1 "insn op1 enums" () OP1_ f-op1 23848596154Schristos ("0" "1" "2" "3" "4" "5" "6" "7" 23948596154Schristos "8" "9" "A" "B" "C" "D" "E" "F") 24048596154Schristos) 24148596154Schristos 24248596154Schristos; insn-op2: bits 4-7 24348596154Schristos; FIXME: should use die macro or some such 24448596154Schristos(define-normal-insn-enum insn-op2 "insn op2 enums" () OP2_ f-op2 24548596154Schristos ("0" "1" "2" "3" "4" "5" "6" "7" 24648596154Schristos "8" "9" "A" "B" "C" "D" "E" "F") 24748596154Schristos) 24848596154Schristos 24948596154Schristos; insn-op3: bits 8-11 25048596154Schristos; FIXME: should use die macro or some such 25148596154Schristos(define-normal-insn-enum insn-op3 "insn op3 enums" () OP3_ f-op3 25248596154Schristos ("0" "1" "2" "3" "4" "5" "6" "7" 25348596154Schristos "8" "9" "A" "B" "C" "D" "E" "F") 25448596154Schristos) 25548596154Schristos 25648596154Schristos; insn-op4: bits 12-15 25748596154Schristos; FIXME: should use die macro or some such 25848596154Schristos(define-normal-insn-enum insn-op4 "insn op4 enums" () OP4_ f-op4 25948596154Schristos ("0") 26048596154Schristos) 26148596154Schristos 26248596154Schristos; insn-op5: bit 4 (5th bit origin 0) 26348596154Schristos; FIXME: should use die macro or some such 26448596154Schristos(define-normal-insn-enum insn-op5 "insn op5 enums" () OP5_ f-op5 26548596154Schristos ("0" "1") 26648596154Schristos) 26748596154Schristos 26848596154Schristos; insn-cc: condition codes 26948596154Schristos; FIXME: should use die macro or some such 27048596154Schristos(define-normal-insn-enum insn-cc "insn cc enums" () CC_ f-cc 27148596154Schristos ("ra" "no" "eq" "ne" "c" "nc" "n" "p" "v" "nv" "lt" "ge" "le" "gt" "ls" "hi") 27248596154Schristos) 27348596154Schristos 27448596154Schristos; Hardware pieces. 27548596154Schristos; These entries list the elements of the raw hardware. 27648596154Schristos; They're also used to provide tables and other elements of the assembly 27748596154Schristos; language. 27848596154Schristos 27948596154Schristos(dnh h-pc "program counter" (PC PROFILE) (pc) () () ()) 28048596154Schristos 28148596154Schristos(define-keyword 28248596154Schristos (name gr-names) 28348596154Schristos (enum-prefix H-GR-) 28448596154Schristos (values (r0 0) (r1 1) (r2 2) (r3 3) (r4 4) (r5 5) (r6 6) (r7 7) 28548596154Schristos (r8 8) (r9 9) (r10 10) (r11 11) (r12 12) (r13 13) (r14 14) (r15 15) 28648596154Schristos (ac 13) (fp 14) (sp 15)) 28748596154Schristos) 28848596154Schristos 28948596154Schristos(define-hardware 29048596154Schristos (name h-gr) 29148596154Schristos (comment "general registers") 29248596154Schristos (attrs PROFILE CACHE-ADDR) 29348596154Schristos (type register WI (16)) 29448596154Schristos (indices extern-keyword gr-names) 29548596154Schristos) 29648596154Schristos 29748596154Schristos(define-keyword 29848596154Schristos (name cr-names) 29948596154Schristos (enum-prefix H-CR-) 30048596154Schristos (values (cr0 0) (cr1 1) (cr2 2) (cr3 3) 30148596154Schristos (cr4 4) (cr5 5) (cr6 6) (cr7 7) 30248596154Schristos (cr8 8) (cr9 9) (cr10 10) (cr11 11) 30348596154Schristos (cr12 12) (cr13 13) (cr14 14) (cr15 15)) 30448596154Schristos) 30548596154Schristos 30648596154Schristos(define-hardware 30748596154Schristos (name h-cr) 30848596154Schristos (comment "coprocessor registers") 30948596154Schristos (attrs) 31048596154Schristos (type register WI (16)) 31148596154Schristos (indices extern-keyword cr-names) 31248596154Schristos) 31348596154Schristos 31448596154Schristos(define-keyword 31548596154Schristos (name dr-names) 31648596154Schristos (enum-prefix H-DR-) 31748596154Schristos (values (tbr 0) (rp 1) (ssp 2) (usp 3) (mdh 4) (mdl 5)) 31848596154Schristos) 31948596154Schristos 32048596154Schristos(define-hardware 32148596154Schristos (name h-dr) 32248596154Schristos (comment "dedicated registers") 32348596154Schristos (type register WI (6)) 32448596154Schristos (indices extern-keyword dr-names) 32548596154Schristos (get (index) (c-call WI "@cpu@_h_dr_get_handler" index)) 32648596154Schristos (set (index newval) (c-call VOID "@cpu@_h_dr_set_handler" index newval)) 32748596154Schristos) 32848596154Schristos 32948596154Schristos(define-hardware 33048596154Schristos (name h-ps) 33148596154Schristos (comment "processor status") 33248596154Schristos (type register UWI) 33348596154Schristos (indices keyword "" ((ps 0))) 33448596154Schristos (get () (c-call UWI "@cpu@_h_ps_get_handler")) 33548596154Schristos (set (newval) (c-call VOID "@cpu@_h_ps_set_handler" newval)) 33648596154Schristos) 33748596154Schristos 33848596154Schristos(dnh h-r13 "General Register 13 explicitly required" 33948596154Schristos () 34048596154Schristos (register WI) 34148596154Schristos (keyword "" ((r13 0))) 34248596154Schristos () () 34348596154Schristos) 34448596154Schristos 34548596154Schristos(dnh h-r14 "General Register 14 explicitly required" 34648596154Schristos () 34748596154Schristos (register WI) 34848596154Schristos (keyword "" ((r14 0))) 34948596154Schristos () () 35048596154Schristos) 35148596154Schristos 35248596154Schristos(dnh h-r15 "General Register 15 explicitly required" 35348596154Schristos () 35448596154Schristos (register WI) 35548596154Schristos (keyword "" ((r15 0))) 35648596154Schristos () () 35748596154Schristos) 35848596154Schristos 35948596154Schristos; These bits are actually part of the PS register but are accessed more 36048596154Schristos; often than the entire register, so define them directly. We can assemble 36148596154Schristos; the PS register from its components when necessary. 36248596154Schristos 36348596154Schristos(dsh h-nbit "negative bit" () (register BI)) 36448596154Schristos(dsh h-zbit "zero bit" () (register BI)) 36548596154Schristos(dsh h-vbit "overflow bit" () (register BI)) 36648596154Schristos(dsh h-cbit "carry bit" () (register BI)) 36748596154Schristos(dsh h-ibit "interrupt enable bit" () (register BI)) 36848596154Schristos(define-hardware 36948596154Schristos (name h-sbit) 37048596154Schristos (comment "stack bit") 37148596154Schristos (type register BI) 37248596154Schristos (get () (c-call BI "@cpu@_h_sbit_get_handler")) 37348596154Schristos (set (newval) (c-call VOID "@cpu@_h_sbit_set_handler" newval)) 37448596154Schristos) 37548596154Schristos(dsh h-tbit "trace trap bit" () (register BI)) 37648596154Schristos(dsh h-d0bit "division 0 bit" () (register BI)) 37748596154Schristos(dsh h-d1bit "division 1 bit" () (register BI)) 37848596154Schristos 37948596154Schristos; These represent sub-registers within the program status register 38048596154Schristos 38148596154Schristos(define-hardware 38248596154Schristos (name h-ccr) 38348596154Schristos (comment "condition code bits") 38448596154Schristos (type register UQI) 38548596154Schristos (get () (c-call UQI "@cpu@_h_ccr_get_handler")) 38648596154Schristos (set (newval) (c-call VOID "@cpu@_h_ccr_set_handler" newval)) 38748596154Schristos) 38848596154Schristos(define-hardware 38948596154Schristos (name h-scr) 39048596154Schristos (comment "system condition bits") 39148596154Schristos (type register UQI) 39248596154Schristos (get () (c-call UQI "@cpu@_h_scr_get_handler")) 39348596154Schristos (set (newval) (c-call VOID "@cpu@_h_scr_set_handler" newval)) 39448596154Schristos) 39548596154Schristos(define-hardware 39648596154Schristos (name h-ilm) 39748596154Schristos (comment "interrupt level mask") 39848596154Schristos (type register UQI) 39948596154Schristos (get () (c-call UQI "@cpu@_h_ilm_get_handler")) 40048596154Schristos (set (newval) (c-call VOID "@cpu@_h_ilm_set_handler" newval)) 40148596154Schristos) 40248596154Schristos 40348596154Schristos; Instruction Operands. 40448596154Schristos; These entries provide a layer between the assembler and the raw hardware 40548596154Schristos; description, and are used to refer to hardware elements in the semantic 40648596154Schristos; code. Usually there's a bit of over-specification, but in more complicated 40748596154Schristos; instruction sets there isn't. 40848596154Schristos 40948596154Schristos; FR30 specific operand attributes: 41048596154Schristos 41148596154Schristos(define-attr 41248596154Schristos (for operand) 41348596154Schristos (type boolean) 41448596154Schristos (name HASH-PREFIX) 41548596154Schristos (comment "immediates have an optional '#' prefix") 41648596154Schristos) 41748596154Schristos 41848596154Schristos; ??? Convention says this should be o-sr, but then the insn definitions 41948596154Schristos; should refer to o-sr which is clumsy. The "o-" could be implicit, but 42048596154Schristos; then it should be implicit for all the symbols here, but then there would 42148596154Schristos; be confusion between (f-)simm8 and (h-)simm8. 42248596154Schristos; So for now the rule is exactly as it appears here. 42348596154Schristos 42448596154Schristos(dnop Ri "destination register" () h-gr f-Ri) 42548596154Schristos(dnop Rj "source register" () h-gr f-Rj) 42648596154Schristos(dnop Ric "target register coproc insn" () h-gr f-Ric) 42748596154Schristos(dnop Rjc "source register coproc insn" () h-gr f-Rjc) 42848596154Schristos(dnop CRi "coprocessor register" () h-cr f-CRi) 42948596154Schristos(dnop CRj "coprocessor register" () h-cr f-CRj) 43048596154Schristos(dnop Rs1 "dedicated register" () h-dr f-Rs1) 43148596154Schristos(dnop Rs2 "dedicated register" () h-dr f-Rs2) 43248596154Schristos(dnop R13 "General Register 13" () h-r13 f-nil) 43348596154Schristos(dnop R14 "General Register 14" () h-r14 f-nil) 43448596154Schristos(dnop R15 "General Register 15" () h-r15 f-nil) 43548596154Schristos(dnop ps "Program Status register" () h-ps f-nil) 43648596154Schristos(dnop u4 "4 bit unsigned immediate" (HASH-PREFIX) h-uint f-u4) 43748596154Schristos(dnop u4c "4 bit unsigned immediate" (HASH-PREFIX) h-uint f-u4c) 43848596154Schristos(dnop u8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-u8) 43948596154Schristos(dnop i8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-i8) 44048596154Schristos(dnop udisp6 "6 bit unsigned immediate" (HASH-PREFIX) h-uint f-udisp6) 44148596154Schristos(dnop disp8 "8 bit signed immediate" (HASH-PREFIX) h-sint f-disp8) 44248596154Schristos(dnop disp9 "9 bit signed immediate" (HASH-PREFIX) h-sint f-disp9) 44348596154Schristos(dnop disp10 "10 bit signed immediate" (HASH-PREFIX) h-sint f-disp10) 44448596154Schristos 44548596154Schristos(dnop s10 "10 bit signed immediate" (HASH-PREFIX) h-sint f-s10) 44648596154Schristos(dnop u10 "10 bit unsigned immediate" (HASH-PREFIX) h-uint f-u10) 44748596154Schristos(dnop i32 "32 bit immediate" (HASH-PREFIX) h-uint f-i32) 44848596154Schristos 44948596154Schristos(define-operand 45048596154Schristos (name m4) 45148596154Schristos (comment "4 bit negative immediate") 45248596154Schristos (attrs HASH-PREFIX) 45348596154Schristos (type h-sint) 45448596154Schristos (index f-m4) 45548596154Schristos (handlers (print "m4")) 45648596154Schristos) 45748596154Schristos 45848596154Schristos(define-operand 45948596154Schristos (name i20) 46048596154Schristos (comment "20 bit immediate") 46148596154Schristos (attrs HASH-PREFIX) 46248596154Schristos (type h-uint) 46348596154Schristos (index f-i20) 46448596154Schristos) 46548596154Schristos 46648596154Schristos(dnop dir8 "8 bit direct address" () h-uint f-dir8) 46748596154Schristos(dnop dir9 "9 bit direct address" () h-uint f-dir9) 46848596154Schristos(dnop dir10 "10 bit direct address" () h-uint f-dir10) 46948596154Schristos 47048596154Schristos(dnop label9 "9 bit pc relative address" () h-iaddr f-rel9) 47148596154Schristos(dnop label12 "12 bit pc relative address" () h-iaddr f-rel12) 47248596154Schristos 47348596154Schristos(define-operand 47448596154Schristos (name reglist_low_ld) 47548596154Schristos (comment "8 bit low register mask for ldm") 47648596154Schristos (attrs) 47748596154Schristos (type h-uint) 47848596154Schristos (index f-reglist_low_ld) 47948596154Schristos (handlers (parse "low_register_list_ld") 48048596154Schristos (print "low_register_list_ld")) 48148596154Schristos) 48248596154Schristos 48348596154Schristos(define-operand 48448596154Schristos (name reglist_hi_ld) 48548596154Schristos (comment "8 bit high register mask for ldm") 48648596154Schristos (attrs) 48748596154Schristos (type h-uint) 48848596154Schristos (index f-reglist_hi_ld) 48948596154Schristos (handlers (parse "hi_register_list_ld") 49048596154Schristos (print "hi_register_list_ld")) 49148596154Schristos) 49248596154Schristos 49348596154Schristos(define-operand 49448596154Schristos (name reglist_low_st) 49548596154Schristos (comment "8 bit low register mask for stm") 49648596154Schristos (attrs) 49748596154Schristos (type h-uint) 49848596154Schristos (index f-reglist_low_st) 49948596154Schristos (handlers (parse "low_register_list_st") 50048596154Schristos (print "low_register_list_st")) 50148596154Schristos) 50248596154Schristos 50348596154Schristos(define-operand 50448596154Schristos (name reglist_hi_st) 50548596154Schristos (comment "8 bit high register mask for stm") 50648596154Schristos (attrs) 50748596154Schristos (type h-uint) 50848596154Schristos (index f-reglist_hi_st) 50948596154Schristos (handlers (parse "hi_register_list_st") 51048596154Schristos (print "hi_register_list_st")) 51148596154Schristos) 51248596154Schristos 51348596154Schristos(dnop cc "condition codes" () h-uint f-cc) 51448596154Schristos(dnop ccc "coprocessor calc" (HASH-PREFIX) h-uint f-ccc) 51548596154Schristos 51648596154Schristos(dnop nbit "negative bit" (SEM-ONLY) h-nbit f-nil) 51748596154Schristos(dnop vbit "overflow bit" (SEM-ONLY) h-vbit f-nil) 51848596154Schristos(dnop zbit "zero bit" (SEM-ONLY) h-zbit f-nil) 51948596154Schristos(dnop cbit "carry bit" (SEM-ONLY) h-cbit f-nil) 52048596154Schristos(dnop ibit "interrupt bit" (SEM-ONLY) h-ibit f-nil) 52148596154Schristos(dnop sbit "stack bit" (SEM-ONLY) h-sbit f-nil) 52248596154Schristos(dnop tbit "trace trap bit" (SEM-ONLY) h-tbit f-nil) 52348596154Schristos(dnop d0bit "division 0 bit" (SEM-ONLY) h-d0bit f-nil) 52448596154Schristos(dnop d1bit "division 1 bit" (SEM-ONLY) h-d1bit f-nil) 52548596154Schristos 52648596154Schristos(dnop ccr "condition code bits" (SEM-ONLY) h-ccr f-nil) 52748596154Schristos(dnop scr "system condition bits" (SEM-ONLY) h-scr f-nil) 52848596154Schristos(dnop ilm "interrupt level mask" (SEM-ONLY) h-ilm f-nil) 52948596154Schristos 53048596154Schristos; Instruction definitions. 53148596154Schristos; 53248596154Schristos; Notes: 53348596154Schristos; - dni is short for "define-normal-instruction" 53448596154Schristos 53548596154Schristos; FR30 specific insn attributes: 53648596154Schristos 53748596154Schristos(define-attr 53848596154Schristos (for insn) 53948596154Schristos (type boolean) 54048596154Schristos (name NOT-IN-DELAY-SLOT) 54148596154Schristos (comment "insn can't go in delay slot") 54248596154Schristos) 54348596154Schristos 54448596154Schristos; Sets zbit and nbit based on the value of x 54548596154Schristos; 54648596154Schristos(define-pmacro (set-z-and-n x) 54748596154Schristos (sequence () 54848596154Schristos (set zbit (eq x (const 0))) 54948596154Schristos (set nbit (lt x (const 0)))) 55048596154Schristos) 55148596154Schristos 55248596154Schristos; Binary integer instruction which sets status bits 55348596154Schristos; 55448596154Schristos(define-pmacro (binary-int-op name insn comment opc1 opc2 op arg1 arg2) 55548596154Schristos (dni name 55648596154Schristos (.str insn " " comment) 55748596154Schristos () 55848596154Schristos (.str insn " $" arg1 ",$" arg2) 55948596154Schristos (+ opc1 opc2 arg1 arg2) 56048596154Schristos (sequence () 56148596154Schristos (set vbit ((.sym op -oflag) arg2 arg1 (const 0))) 56248596154Schristos (set cbit ((.sym op -cflag) arg2 arg1 (const 0))) 56348596154Schristos (set arg2 (op arg2 arg1)) 56448596154Schristos (set-z-and-n arg2)) 56548596154Schristos () 56648596154Schristos ) 56748596154Schristos) 56848596154Schristos 56948596154Schristos; Binary integer instruction which does *not* set status bits 57048596154Schristos; 57148596154Schristos(define-pmacro (binary-int-op-n name insn comment opc1 opc2 op arg1 arg2) 57248596154Schristos (dni name 57348596154Schristos (.str insn " " comment) 57448596154Schristos () 57548596154Schristos (.str insn " $" arg1 ",$" arg2) 57648596154Schristos (+ opc1 opc2 arg1 arg2) 57748596154Schristos (set arg2 (op arg2 arg1)) 57848596154Schristos () 57948596154Schristos ) 58048596154Schristos) 58148596154Schristos 58248596154Schristos; Binary integer instruction with carry which sets status bits 58348596154Schristos; 58448596154Schristos(define-pmacro (binary-int-op-c name insn comment opc1 opc2 op arg1 arg2) 58548596154Schristos (dni name 58648596154Schristos (.str insn " " comment) 58748596154Schristos () 58848596154Schristos (.str insn " $" arg1 ",$" arg2) 58948596154Schristos (+ opc1 opc2 arg1 arg2) 59048596154Schristos (sequence ((WI tmp)) 59148596154Schristos (set tmp ((.sym op c) arg2 arg1 cbit)) 59248596154Schristos (set vbit ((.sym op -oflag) arg2 arg1 cbit)) 59348596154Schristos (set cbit ((.sym op -cflag) arg2 arg1 cbit)) 59448596154Schristos (set arg2 tmp) 59548596154Schristos (set-z-and-n arg2)) 59648596154Schristos () 59748596154Schristos ) 59848596154Schristos) 59948596154Schristos 60048596154Schristos(binary-int-op add add "reg/reg" OP1_A OP2_6 add Rj Ri) 60148596154Schristos(binary-int-op addi add "immed/reg" OP1_A OP2_4 add u4 Ri) 60248596154Schristos(binary-int-op add2 add2 "immed/reg" OP1_A OP2_5 add m4 Ri) 60348596154Schristos(binary-int-op-c addc addc "reg/reg" OP1_A OP2_7 add Rj Ri) 60448596154Schristos(binary-int-op-n addn addn "reg/reg" OP1_A OP2_2 add Rj Ri) 60548596154Schristos(binary-int-op-n addni addn "immed/reg" OP1_A OP2_0 add u4 Ri) 60648596154Schristos(binary-int-op-n addn2 addn2 "immed/reg" OP1_A OP2_1 add m4 Ri) 60748596154Schristos 60848596154Schristos(binary-int-op sub sub "reg/reg" OP1_A OP2_C sub Rj Ri) 60948596154Schristos(binary-int-op-c subc subc "reg/reg" OP1_A OP2_D sub Rj Ri) 61048596154Schristos(binary-int-op-n subn subn "reg/reg" OP1_A OP2_E sub Rj Ri) 61148596154Schristos 61248596154Schristos; Integer compare instruction 61348596154Schristos; 61448596154Schristos(define-pmacro (int-cmp name insn comment opc1 opc2 arg1 arg2) 61548596154Schristos (dni name 61648596154Schristos (.str insn " " comment) 61748596154Schristos () 61848596154Schristos (.str insn " $" arg1 ",$" arg2) 61948596154Schristos (+ opc1 opc2 arg1 arg2) 62048596154Schristos (sequence ((WI tmp1)) 62148596154Schristos (set vbit (sub-oflag arg2 arg1 (const 0))) 62248596154Schristos (set cbit (sub-cflag arg2 arg1 (const 0))) 62348596154Schristos (set tmp1 (sub arg2 arg1)) 62448596154Schristos (set-z-and-n tmp1) 62548596154Schristos ) 62648596154Schristos () 62748596154Schristos ) 62848596154Schristos) 62948596154Schristos 63048596154Schristos(int-cmp cmp cmp "reg/reg" OP1_A OP2_A Rj Ri) 63148596154Schristos(int-cmp cmpi cmp "immed/reg" OP1_A OP2_8 u4 Ri) 63248596154Schristos(int-cmp cmp2 cmp2 "immed/reg" OP1_A OP2_9 m4 Ri) 63348596154Schristos 63448596154Schristos; Binary logical instruction 63548596154Schristos; 63648596154Schristos(define-pmacro (binary-logical-op name insn comment opc1 opc2 op arg1 arg2) 63748596154Schristos (dni name 63848596154Schristos (.str insn " " comment) 63948596154Schristos () 64048596154Schristos (.str insn " $" arg1 ",$" arg2) 64148596154Schristos (+ opc1 opc2 arg1 arg2) 64248596154Schristos (sequence () 64348596154Schristos (set arg2 (op arg2 arg1)) 64448596154Schristos (set-z-and-n arg2)) 64548596154Schristos () 64648596154Schristos ) 64748596154Schristos) 64848596154Schristos 64948596154Schristos(binary-logical-op and and "reg/reg" OP1_8 OP2_2 and Rj Ri) 65048596154Schristos(binary-logical-op or or "reg/reg" OP1_9 OP2_2 or Rj Ri) 65148596154Schristos(binary-logical-op eor eor "reg/reg" OP1_9 OP2_A xor Rj Ri) 65248596154Schristos 65348596154Schristos(define-pmacro (les-units model) ; les: load-exec-store 65448596154Schristos (model (unit u-exec) (unit u-load) (unit u-store)) 65548596154Schristos) 65648596154Schristos 65748596154Schristos; Binary logical instruction to memory 65848596154Schristos; 65948596154Schristos(define-pmacro (binary-logical-op-m name insn comment opc1 opc2 mode op arg1 arg2) 66048596154Schristos (dni name 66148596154Schristos (.str insn " " comment) 66248596154Schristos (NOT-IN-DELAY-SLOT) 66348596154Schristos (.str insn " $" arg1 ",@$" arg2) 66448596154Schristos (+ opc1 opc2 arg1 arg2) 66548596154Schristos (sequence ((mode tmp)) 66648596154Schristos (set mode tmp (op mode (mem mode arg2) arg1)) 66748596154Schristos (set-z-and-n tmp) 66848596154Schristos (set mode (mem mode arg2) tmp)) 66948596154Schristos ((les-units fr30-1)) 67048596154Schristos ) 67148596154Schristos) 67248596154Schristos 67348596154Schristos(binary-logical-op-m andm and "reg/mem" OP1_8 OP2_4 WI and Rj Ri) 67448596154Schristos(binary-logical-op-m andh andh "reg/mem" OP1_8 OP2_5 HI and Rj Ri) 67548596154Schristos(binary-logical-op-m andb andb "reg/mem" OP1_8 OP2_6 QI and Rj Ri) 67648596154Schristos(binary-logical-op-m orm or "reg/mem" OP1_9 OP2_4 WI or Rj Ri) 67748596154Schristos(binary-logical-op-m orh orh "reg/mem" OP1_9 OP2_5 HI or Rj Ri) 67848596154Schristos(binary-logical-op-m orb orb "reg/mem" OP1_9 OP2_6 QI or Rj Ri) 67948596154Schristos(binary-logical-op-m eorm eor "reg/mem" OP1_9 OP2_C WI xor Rj Ri) 68048596154Schristos(binary-logical-op-m eorh eorh "reg/mem" OP1_9 OP2_D HI xor Rj Ri) 68148596154Schristos(binary-logical-op-m eorb eorb "reg/mem" OP1_9 OP2_E QI xor Rj Ri) 68248596154Schristos 68348596154Schristos; Binary logical instruction to low half of byte in memory 68448596154Schristos; 68548596154Schristos(dni bandl 68648596154Schristos "bandl #u4,@Ri" 68748596154Schristos (NOT-IN-DELAY-SLOT) 68848596154Schristos "bandl $u4,@$Ri" 68948596154Schristos (+ OP1_8 OP2_0 u4 Ri) 69048596154Schristos (set QI (mem QI Ri) 69148596154Schristos (and QI 69248596154Schristos (or QI u4 (const #xf0)) 69348596154Schristos (mem QI Ri))) 69448596154Schristos ((les-units fr30-1)) 69548596154Schristos) 69648596154Schristos 69748596154Schristos(dni borl 69848596154Schristos "borl #u4,@Ri" 69948596154Schristos (NOT-IN-DELAY-SLOT) 70048596154Schristos "borl $u4,@$Ri" 70148596154Schristos (+ OP1_9 OP2_0 u4 Ri) 70248596154Schristos (set QI (mem QI Ri) (or QI u4 (mem QI Ri))) 70348596154Schristos ((les-units fr30-1)) 70448596154Schristos) 70548596154Schristos 70648596154Schristos(dni beorl 70748596154Schristos "beorl #u4,@Ri" 70848596154Schristos (NOT-IN-DELAY-SLOT) 70948596154Schristos "beorl $u4,@$Ri" 71048596154Schristos (+ OP1_9 OP2_8 u4 Ri) 71148596154Schristos (set QI (mem QI Ri) (xor QI u4 (mem QI Ri))) 71248596154Schristos ((les-units fr30-1)) 71348596154Schristos) 71448596154Schristos 71548596154Schristos; Binary logical instruction to high half of byte in memory 71648596154Schristos; 71748596154Schristos(dni bandh 71848596154Schristos "bandh #u4,@Ri" 71948596154Schristos (NOT-IN-DELAY-SLOT) 72048596154Schristos "bandh $u4,@$Ri" 72148596154Schristos (+ OP1_8 OP2_1 u4 Ri) 72248596154Schristos (set QI (mem QI Ri) 72348596154Schristos (and QI 72448596154Schristos (or QI (sll QI u4 (const 4)) (const #x0f)) 72548596154Schristos (mem QI Ri))) 72648596154Schristos ((les-units fr30-1)) 72748596154Schristos) 72848596154Schristos 72948596154Schristos(define-pmacro (binary-or-op-mh name insn opc1 opc2 op arg1 arg2) 73048596154Schristos (dni name 73148596154Schristos (.str name " #" arg1 ",@" args) 73248596154Schristos (NOT-IN-DELAY-SLOT) 73348596154Schristos (.str name " $" arg1 ",@$" arg2) 73448596154Schristos (+ opc1 opc2 arg1 arg2) 73548596154Schristos (set QI (mem QI arg2) 73648596154Schristos (insn QI 73748596154Schristos (sll QI arg1 (const 4)) 73848596154Schristos (mem QI arg2))) 73948596154Schristos ((les-units fr30-1)) 74048596154Schristos ) 74148596154Schristos) 74248596154Schristos 74348596154Schristos(binary-or-op-mh borh or OP1_9 OP2_1 or u4 Ri) 74448596154Schristos(binary-or-op-mh beorh xor OP1_9 OP2_9 xor u4 Ri) 74548596154Schristos 74648596154Schristos(dni btstl 74748596154Schristos "btstl #u4,@Ri" 74848596154Schristos (NOT-IN-DELAY-SLOT) 74948596154Schristos "btstl $u4,@$Ri" 75048596154Schristos (+ OP1_8 OP2_8 u4 Ri) 75148596154Schristos (sequence ((QI tmp)) 75248596154Schristos (set tmp (and QI u4 (mem QI Ri))) 75348596154Schristos (set zbit (eq tmp (const 0))) 75448596154Schristos (set nbit (const 0))) 75548596154Schristos ((fr30-1 (unit u-load) (unit u-exec (cycles 2)))) 75648596154Schristos) 75748596154Schristos 75848596154Schristos(dni btsth 75948596154Schristos "btsth #u4,@Ri" 76048596154Schristos (NOT-IN-DELAY-SLOT) 76148596154Schristos "btsth $u4,@$Ri" 76248596154Schristos (+ OP1_8 OP2_9 u4 Ri) 76348596154Schristos (sequence ((QI tmp)) 76448596154Schristos (set tmp (and QI (sll QI u4 (const 4)) (mem QI Ri))) 76548596154Schristos (set zbit (eq tmp (const 0))) 76648596154Schristos (set nbit (lt tmp (const 0)))) 76748596154Schristos ((fr30-1 (unit u-load) (unit u-exec (cycles 2)))) 76848596154Schristos) 76948596154Schristos 77048596154Schristos(dni mul 77148596154Schristos "mul Rj,Ri" 77248596154Schristos (NOT-IN-DELAY-SLOT) 77348596154Schristos "mul $Rj,$Ri" 77448596154Schristos (+ OP1_A OP2_F Rj Ri) 77548596154Schristos (sequence ((DI tmp)) 77648596154Schristos (set tmp (mul DI (ext DI Rj) (ext DI Ri))) 77748596154Schristos (set (reg h-dr 5) (trunc WI tmp)) 77848596154Schristos (set (reg h-dr 4) (trunc WI (srl tmp (const 32)))) 77948596154Schristos (set nbit (lt (reg h-dr 5) (const 0))) 78048596154Schristos (set zbit (eq tmp (const DI 0))) 78148596154Schristos (set vbit (orif 78248596154Schristos (gt tmp (const DI #x7fffffff)) 78348596154Schristos (lt tmp (neg (const DI #x80000000)))))) 78448596154Schristos ((fr30-1 (unit u-exec (cycles 5)))) 78548596154Schristos) 78648596154Schristos 78748596154Schristos(dni mulu 78848596154Schristos "mulu Rj,Ri" 78948596154Schristos (NOT-IN-DELAY-SLOT) 79048596154Schristos "mulu $Rj,$Ri" 79148596154Schristos (+ OP1_A OP2_B Rj Ri) 79248596154Schristos (sequence ((DI tmp)) 79348596154Schristos (set tmp (mul DI (zext DI Rj) (zext DI Ri))) 79448596154Schristos (set (reg h-dr 5) (trunc WI tmp)) 79548596154Schristos (set (reg h-dr 4) (trunc WI (srl tmp (const 32)))) 79648596154Schristos (set nbit (lt (reg h-dr 4) (const 0))) 79748596154Schristos (set zbit (eq (reg h-dr 5) (const 0))) 79848596154Schristos (set vbit (ne (reg h-dr 4) (const 0)))) 79948596154Schristos ((fr30-1 (unit u-exec (cycles 5)))) 80048596154Schristos) 80148596154Schristos 80248596154Schristos(dni mulh 80348596154Schristos "mulh Rj,Ri" 80448596154Schristos (NOT-IN-DELAY-SLOT) 80548596154Schristos "mulh $Rj,$Ri" 80648596154Schristos (+ OP1_B OP2_F Rj Ri) 80748596154Schristos (sequence () 80848596154Schristos (set (reg h-dr 5) (mul (trunc HI Rj) (trunc HI Ri))) 80948596154Schristos (set nbit (lt (reg h-dr 5) (const 0))) 81048596154Schristos (set zbit (ge (reg h-dr 5) (const 0)))) 81148596154Schristos ((fr30-1 (unit u-exec (cycles 3)))) 81248596154Schristos) 81348596154Schristos 81448596154Schristos(dni muluh 81548596154Schristos "muluh Rj,Ri" 81648596154Schristos (NOT-IN-DELAY-SLOT) 81748596154Schristos "muluh $Rj,$Ri" 81848596154Schristos (+ OP1_B OP2_B Rj Ri) 81948596154Schristos (sequence () 82048596154Schristos (set (reg h-dr 5) (mul (and Rj (const #xffff)) 82148596154Schristos (and Ri (const #xffff)))) 82248596154Schristos (set nbit (lt (reg h-dr 5) (const 0))) 82348596154Schristos (set zbit (ge (reg h-dr 5) (const 0)))) 82448596154Schristos ((fr30-1 (unit u-exec (cycles 3)))) 82548596154Schristos) 82648596154Schristos 82748596154Schristos(dni div0s 82848596154Schristos "div0s Ri" 82948596154Schristos () 83048596154Schristos "div0s $Ri" 83148596154Schristos (+ OP1_9 OP2_7 OP3_4 Ri) 83248596154Schristos (sequence () 83348596154Schristos (set d0bit (lt (reg h-dr 5) (const 0))) 83448596154Schristos (set d1bit (xor d0bit (lt Ri (const 0)))) 83548596154Schristos (if (ne d0bit (const 0)) 83648596154Schristos (set (reg h-dr 4) (const #xffffffff)) 83748596154Schristos (set (reg h-dr 4) (const 0)))) 83848596154Schristos () 83948596154Schristos) 84048596154Schristos 84148596154Schristos(dni div0u 84248596154Schristos "div0u Ri" 84348596154Schristos () 84448596154Schristos "div0u $Ri" 84548596154Schristos (+ OP1_9 OP2_7 OP3_5 Ri) 84648596154Schristos (sequence () 84748596154Schristos (set d0bit (const 0)) 84848596154Schristos (set d1bit (const 0)) 84948596154Schristos (set (reg h-dr 4) (const 0))) 85048596154Schristos () 85148596154Schristos) 85248596154Schristos 85348596154Schristos(dni div1 85448596154Schristos "div1 Ri" 85548596154Schristos () 85648596154Schristos "div1 $Ri" 85748596154Schristos (+ OP1_9 OP2_7 OP3_6 Ri) 85848596154Schristos (sequence ((WI tmp)) 85948596154Schristos (set (reg h-dr 4) (sll (reg h-dr 4) (const 1))) 86048596154Schristos (if (lt (reg h-dr 5) (const 0)) 86148596154Schristos (set (reg h-dr 4) (add (reg h-dr 4) (const 1)))) 86248596154Schristos (set (reg h-dr 5) (sll (reg h-dr 5) (const 1))) 86348596154Schristos (if (eq d1bit (const 1)) 86448596154Schristos (sequence () 86548596154Schristos (set tmp (add (reg h-dr 4) Ri)) 86648596154Schristos (set cbit (add-cflag (reg h-dr 4) Ri (const 0)))) 86748596154Schristos (sequence () 86848596154Schristos (set tmp (sub (reg h-dr 4) Ri)) 86948596154Schristos (set cbit (sub-cflag (reg h-dr 4) Ri (const 0))))) 87048596154Schristos (if (not (xor (xor d0bit d1bit) cbit)) 87148596154Schristos (sequence () 87248596154Schristos (set (reg h-dr 4) tmp) 87348596154Schristos (set (reg h-dr 5) (or (reg h-dr 5) (const 1))))) 87448596154Schristos (set zbit (eq (reg h-dr 4) (const 0)))) 87548596154Schristos () 87648596154Schristos) 87748596154Schristos 87848596154Schristos(dni div2 87948596154Schristos "div2 Ri" 88048596154Schristos () 88148596154Schristos "div2 $Ri" 88248596154Schristos (+ OP1_9 OP2_7 OP3_7 Ri) 88348596154Schristos (sequence ((WI tmp)) 88448596154Schristos (if (eq d1bit (const 1)) 88548596154Schristos (sequence () 88648596154Schristos (set tmp (add (reg h-dr 4) Ri)) 88748596154Schristos (set cbit (add-cflag (reg h-dr 4) Ri (const 0)))) 88848596154Schristos (sequence () 88948596154Schristos (set tmp (sub (reg h-dr 4) Ri)) 89048596154Schristos (set cbit (sub-cflag (reg h-dr 4) Ri (const 0))))) 89148596154Schristos (if (eq tmp (const 0)) 89248596154Schristos (sequence () 89348596154Schristos (set zbit (const 1)) 89448596154Schristos (set (reg h-dr 4) (const 0))) 89548596154Schristos (set zbit (const 0)))) 89648596154Schristos () 89748596154Schristos) 89848596154Schristos 89948596154Schristos(dni div3 90048596154Schristos "div3" 90148596154Schristos () 90248596154Schristos "div3" 90348596154Schristos (+ OP1_9 OP2_F OP3_6 OP4_0) 90448596154Schristos (if (eq zbit (const 1)) 90548596154Schristos (set (reg h-dr 5) (add (reg h-dr 5) (const 1)))) 90648596154Schristos () 90748596154Schristos) 90848596154Schristos 90948596154Schristos(dni div4s 91048596154Schristos "div4s" 91148596154Schristos () 91248596154Schristos "div4s" 91348596154Schristos (+ OP1_9 OP2_F OP3_7 OP4_0) 91448596154Schristos (if (eq d1bit (const 1)) 91548596154Schristos (set (reg h-dr 5) (neg (reg h-dr 5)))) 91648596154Schristos () 91748596154Schristos) 91848596154Schristos 91948596154Schristos(define-pmacro (leftshift-op name insn opc1 opc2 arg1 arg2 shift-expr) 92048596154Schristos (dni name 92148596154Schristos (.str insn " " arg1 "," arg2) 92248596154Schristos () 92348596154Schristos (.str insn " $" arg1 ",$" arg2) 92448596154Schristos (+ opc1 opc2 arg1 arg2) 92548596154Schristos (sequence ((WI shift)) 92648596154Schristos (set shift shift-expr) 92748596154Schristos (if (ne shift (const 0)) 92848596154Schristos (sequence () 92948596154Schristos (set cbit (ne (and arg2 93048596154Schristos (sll (const 1) 93148596154Schristos (sub (const 32) shift))) 93248596154Schristos (const 0))) 93348596154Schristos (set arg2 (sll arg2 shift))) 93448596154Schristos (set cbit (const 0))) 93548596154Schristos (set nbit (lt arg2 (const 0))) 93648596154Schristos (set zbit (eq arg2 (const 0)))) 93748596154Schristos () 93848596154Schristos ) 93948596154Schristos) 94048596154Schristos(leftshift-op lsl lsl OP1_B OP2_6 Rj Ri (and Rj (const #x1f))) 94148596154Schristos(leftshift-op lsli lsl OP1_B OP2_4 u4 Ri u4) 94248596154Schristos(leftshift-op lsl2 lsl2 OP1_B OP2_5 u4 Ri (add u4 (const #x10))) 94348596154Schristos 94448596154Schristos(define-pmacro (rightshift-op name insn opc1 opc2 op arg1 arg2 shift-expr) 94548596154Schristos (dni name 94648596154Schristos (.str insn " " arg1 "," arg2) 94748596154Schristos () 94848596154Schristos (.str insn " $" arg1 ",$" arg2) 94948596154Schristos (+ opc1 opc2 arg1 arg2) 95048596154Schristos (sequence ((WI shift)) 95148596154Schristos (set shift shift-expr) 95248596154Schristos (if (ne shift (const 0)) 95348596154Schristos (sequence () 95448596154Schristos (set cbit (ne (and arg2 95548596154Schristos (sll (const 1) 95648596154Schristos (sub shift (const 1)))) 95748596154Schristos (const 0))) 95848596154Schristos (set arg2 (op arg2 shift))) 95948596154Schristos (set cbit (const 0))) 96048596154Schristos (set nbit (lt arg2 (const 0))) 96148596154Schristos (set zbit (eq arg2 (const 0)))) 96248596154Schristos () 96348596154Schristos ) 96448596154Schristos) 96548596154Schristos(rightshift-op lsr lsr OP1_B OP2_2 srl Rj Ri (and Rj (const #x1f))) 96648596154Schristos(rightshift-op lsri lsr OP1_B OP2_0 srl u4 Ri u4) 96748596154Schristos(rightshift-op lsr2 lsr2 OP1_B OP2_1 srl u4 Ri (add u4 (const #x10))) 96848596154Schristos(rightshift-op asr asr OP1_B OP2_A sra Rj Ri (and Rj (const #x1f))) 96948596154Schristos(rightshift-op asri asr OP1_B OP2_8 sra u4 Ri u4) 97048596154Schristos(rightshift-op asr2 asr2 OP1_B OP2_9 sra u4 Ri (add u4 (const #x10))) 97148596154Schristos 97248596154Schristos(dni ldi8 97348596154Schristos "load 8 bit unsigned immediate" 97448596154Schristos () 97548596154Schristos "ldi:8 $i8,$Ri" 97648596154Schristos (+ OP1_C i8 Ri) 97748596154Schristos (set Ri i8) 97848596154Schristos () 97948596154Schristos) 98048596154Schristos 98148596154Schristos; Typing ldi:8 in in emacs is a pain. 98248596154Schristos(dnmi ldi8m "ldi:8 without the colon" 98348596154Schristos (NO-DIS) 98448596154Schristos "ldi8 $i8,$Ri" 98548596154Schristos (emit ldi8 i8 Ri) 98648596154Schristos) 98748596154Schristos 98848596154Schristos(dni ldi20 98948596154Schristos "load 20 bit unsigned immediate" 99048596154Schristos (NOT-IN-DELAY-SLOT) 99148596154Schristos "ldi:20 $i20,$Ri" 99248596154Schristos (+ OP1_9 OP2_B Ri i20) 99348596154Schristos (set Ri i20) 99448596154Schristos ((fr30-1 (unit u-exec (cycles 2)))) 99548596154Schristos) 99648596154Schristos 99748596154Schristos; Typing ldi:20 in in emacs is a pain. 99848596154Schristos(dnmi ldi20m "ldi:20 without the colon" 99948596154Schristos (NO-DIS) 100048596154Schristos "ldi20 $i20,$Ri" 100148596154Schristos (emit ldi20 i20 Ri) 100248596154Schristos) 100348596154Schristos 100448596154Schristos(dni ldi32 100548596154Schristos "load 32 bit immediate" 100648596154Schristos (NOT-IN-DELAY-SLOT) 100748596154Schristos "ldi:32 $i32,$Ri" 100848596154Schristos (+ OP1_9 OP2_F OP3_8 Ri i32) 100948596154Schristos (set Ri i32) 101048596154Schristos ((fr30-1 (unit u-exec (cycles 3)))) 101148596154Schristos) 101248596154Schristos 101348596154Schristos; Typing ldi:32 in in emacs is a pain. 101448596154Schristos(dnmi ldi32m "ldi:32 without the colon" 101548596154Schristos (NO-DIS) 101648596154Schristos "ldi32 $i32,$Ri" 101748596154Schristos (emit ldi32 i32 Ri) 101848596154Schristos) 101948596154Schristos 102048596154Schristos(define-pmacro (basic-ld name insn opc1 opc2 mode arg1 arg2) 102148596154Schristos (dni name 102248596154Schristos (.str name " @" arg1 "," arg2) 102348596154Schristos () 102448596154Schristos (.str name " @$" arg1 ",$" arg2) 102548596154Schristos (+ opc1 opc2 arg1 arg2) 102648596154Schristos (set arg2 (mem mode arg1)) 102748596154Schristos ((fr30-1 (unit u-load))) 102848596154Schristos ) 102948596154Schristos) 103048596154Schristos 103148596154Schristos(basic-ld ld ld OP1_0 OP2_4 WI Rj Ri) 103248596154Schristos(basic-ld lduh lduh OP1_0 OP2_5 UHI Rj Ri) 103348596154Schristos(basic-ld ldub ldub OP1_0 OP2_6 UQI Rj Ri) 103448596154Schristos 103548596154Schristos(define-pmacro (r13base-ld name insn opc1 opc2 mode arg1 arg2) 103648596154Schristos (dni name 103748596154Schristos (.str insn " @(R13," arg1 ")," arg2) 103848596154Schristos () 103948596154Schristos (.str insn " @($R13,$" arg1 "),$" arg2) 104048596154Schristos (+ opc1 opc2 arg1 arg2) 104148596154Schristos (set arg2 (mem mode (add arg1 (reg h-gr 13)))) 104248596154Schristos ((fr30-1 (unit u-load))) 104348596154Schristos ) 104448596154Schristos) 104548596154Schristos 104648596154Schristos(r13base-ld ldr13 ld OP1_0 OP2_0 WI Rj Ri) 104748596154Schristos(r13base-ld ldr13uh lduh OP1_0 OP2_1 UHI Rj Ri) 104848596154Schristos(r13base-ld ldr13ub ldub OP1_0 OP2_2 UQI Rj Ri) 104948596154Schristos 105048596154Schristos(define-pmacro (r14base-ld name insn opc1 mode arg1 arg2) 105148596154Schristos (dni name 105248596154Schristos (.str insn " @(R14," arg1 ")," arg2) 105348596154Schristos () 105448596154Schristos (.str insn " @($R14,$" arg1 "),$" arg2) 105548596154Schristos (+ opc1 arg1 arg2) 105648596154Schristos (set arg2 (mem mode (add arg1 (reg h-gr 14)))) 105748596154Schristos ((fr30-1 (unit u-load))) 105848596154Schristos ) 105948596154Schristos) 106048596154Schristos 106148596154Schristos(r14base-ld ldr14 ld OP1_2 WI disp10 Ri) 106248596154Schristos(r14base-ld ldr14uh lduh OP1_4 UHI disp9 Ri) 106348596154Schristos(r14base-ld ldr14ub ldub OP1_6 UQI disp8 Ri) 106448596154Schristos 106548596154Schristos(dni ldr15 106648596154Schristos "ld @(R15,udisp6),Ri mem/reg" 106748596154Schristos () 106848596154Schristos "ld @($R15,$udisp6),$Ri" 106948596154Schristos (+ OP1_0 OP2_3 udisp6 Ri) 107048596154Schristos (set Ri (mem WI (add udisp6 (reg h-gr 15)))) 107148596154Schristos ((fr30-1 (unit u-load))) 107248596154Schristos) 107348596154Schristos 107448596154Schristos(dni ldr15gr 107548596154Schristos "ld @R15+,Ri" 107648596154Schristos () 107748596154Schristos "ld @$R15+,$Ri" 107848596154Schristos (+ OP1_0 OP2_7 OP3_0 Ri) 107948596154Schristos (sequence () 108048596154Schristos (set Ri (mem WI (reg h-gr 15))) 108148596154Schristos (if (ne (ifield f-Ri) (const 15)) 108248596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 108348596154Schristos ((fr30-1 (unit u-load))) 108448596154Schristos) 108548596154Schristos 108648596154Schristos; This insn loads a value from where r15 points into the target register and 108748596154Schristos; then increments r15. If the target register is also r15, then the post 108848596154Schristos; increment is not performed. 108948596154Schristos; 109048596154Schristos(dni ldr15dr 109148596154Schristos "ld @R15+,Rs2" 109248596154Schristos () 109348596154Schristos "ld @$R15+,$Rs2" 109448596154Schristos (+ OP1_0 OP2_7 OP3_8 Rs2) 109548596154Schristos; This seems more straight forward, but doesn't work due to a problem in 109648596154Schristos; cgen. We're trying to not increment r15 if it is the target register. 109748596154Schristos; (sequence () 109848596154Schristos; (set Rs2 (mem WI (reg h-gr 15))) 109948596154Schristos; (if (not (or (and (eq (ifield f-Rs2) (const 2)) 110048596154Schristos; (eq sbit (const 0))) 110148596154Schristos; (and (eq (ifield f-Rs2) (const 3)) 110248596154Schristos; (eq sbit (const 1))))) 110348596154Schristos; (set (reg h-gr 15) (add (reg h-gr 15) (const 4))) 110448596154Schristos; ) 110548596154Schristos; ) 110648596154Schristos (sequence ((WI tmp)) 110748596154Schristos (set tmp (mem WI (reg h-gr 15))) ; save in case target is r15 110848596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))) 110948596154Schristos (set Rs2 tmp)) 111048596154Schristos ((fr30-1 (unit u-load))) 111148596154Schristos) 111248596154Schristos 111348596154Schristos(dni ldr15ps 111448596154Schristos "ld @R15+,ps mem/reg" 111548596154Schristos (NOT-IN-DELAY-SLOT) 111648596154Schristos "ld @$R15+,$ps" 111748596154Schristos (+ OP1_0 OP2_7 OP3_9 OP4_0) 111848596154Schristos (sequence () 111948596154Schristos (set ps (mem WI (reg h-gr 15))) 112048596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4)))) 112148596154Schristos ((fr30-1 (unit u-load))) 112248596154Schristos) 112348596154Schristos 112448596154Schristos(define-pmacro (basic-st name insn opc1 opc2 mode arg1 arg2) 112548596154Schristos (dni name 112648596154Schristos (.str name " " arg1 ",@" arg2) 112748596154Schristos () 112848596154Schristos (.str name " $" arg1 ",@$" arg2) 112948596154Schristos (+ opc1 opc2 arg1 arg2) 113048596154Schristos (set (mem mode arg2) arg1) 113148596154Schristos ((fr30-1 (unit u-store))) 113248596154Schristos ) 113348596154Schristos) 113448596154Schristos 113548596154Schristos(basic-st st st OP1_1 OP2_4 WI Ri Rj) 113648596154Schristos(basic-st sth sth OP1_1 OP2_5 HI Ri Rj) 113748596154Schristos(basic-st stb stb OP1_1 OP2_6 QI Ri Rj) 113848596154Schristos 113948596154Schristos(define-pmacro (r13base-st name insn opc1 opc2 mode arg1 arg2) 114048596154Schristos (dni name 114148596154Schristos (.str insn " " arg1 ",@(R13," arg2 ")") 114248596154Schristos () 114348596154Schristos (.str insn " $" arg1 ",@($R13,$" arg2 ")") 114448596154Schristos (+ opc1 opc2 arg1 arg2) 114548596154Schristos (set (mem mode (add arg2 (reg h-gr 13))) arg1) 114648596154Schristos ((fr30-1 (unit u-store))) 114748596154Schristos ) 114848596154Schristos) 114948596154Schristos 115048596154Schristos(r13base-st str13 st OP1_1 OP2_0 WI Ri Rj) 115148596154Schristos(r13base-st str13h sth OP1_1 OP2_1 HI Ri Rj) 115248596154Schristos(r13base-st str13b stb OP1_1 OP2_2 QI Ri Rj) 115348596154Schristos 115448596154Schristos(define-pmacro (r14base-st name insn opc1 mode arg1 arg2) 115548596154Schristos (dni name 115648596154Schristos (.str insn " " arg1 ",@(R14," arg2 ")") 115748596154Schristos () 115848596154Schristos (.str insn " $" arg1 ",@($R14,$" arg2 ")") 115948596154Schristos (+ opc1 arg1 arg2) 116048596154Schristos (set (mem mode (add arg2 (reg h-gr 14))) arg1) 116148596154Schristos ((fr30-1 (unit u-store))) 116248596154Schristos ) 116348596154Schristos) 116448596154Schristos 116548596154Schristos(r14base-st str14 st OP1_3 WI Ri disp10) 116648596154Schristos(r14base-st str14h sth OP1_5 HI Ri disp9) 116748596154Schristos(r14base-st str14b stb OP1_7 QI Ri disp8) 116848596154Schristos 116948596154Schristos(dni str15 117048596154Schristos "st Ri,@(R15,udisp6) reg/mem" 117148596154Schristos () 117248596154Schristos "st $Ri,@($R15,$udisp6)" 117348596154Schristos (+ OP1_1 OP2_3 udisp6 Ri) 117448596154Schristos (set (mem WI (add (reg h-gr 15) udisp6)) Ri) 117548596154Schristos ((fr30-1 (unit u-store))) 117648596154Schristos) 117748596154Schristos 117848596154Schristos; These store insns predecrement r15 and then store the contents of the source 117948596154Schristos; register where r15 then points. If the source register is also r15, then the 118048596154Schristos; original value of r15 is stored. 118148596154Schristos; 118248596154Schristos(dni str15gr 118348596154Schristos "st Ri,@-R15 reg/mem" 118448596154Schristos () 118548596154Schristos "st $Ri,@-$R15" 118648596154Schristos (+ OP1_1 OP2_7 OP3_0 Ri) 118748596154Schristos (sequence ((WI tmp)) 118848596154Schristos (set tmp Ri) ; save in case it's r15 118948596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 119048596154Schristos (set (mem WI (reg h-gr 15)) tmp)) 119148596154Schristos ((fr30-1 (unit u-store))) 119248596154Schristos) 119348596154Schristos 119448596154Schristos(dni str15dr 119548596154Schristos "st Rs,@-R15 reg/mem" 119648596154Schristos () 119748596154Schristos "st $Rs2,@-$R15" 119848596154Schristos (+ OP1_1 OP2_7 OP3_8 Rs2) 119948596154Schristos (sequence ((WI tmp)) 120048596154Schristos (set tmp Rs2) ; save in case it's r15 120148596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 120248596154Schristos (set (mem WI (reg h-gr 15)) tmp)) 120348596154Schristos ((fr30-1 (unit u-store))) 120448596154Schristos) 120548596154Schristos 120648596154Schristos(dni str15ps 120748596154Schristos "st ps,@-R15 reg/mem" 120848596154Schristos () 120948596154Schristos "st $ps,@-$R15" 121048596154Schristos (+ OP1_1 OP2_7 OP3_9 OP4_0) 121148596154Schristos (sequence () 121248596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 121348596154Schristos (set (mem WI (reg h-gr 15)) ps)) 121448596154Schristos ((fr30-1 (unit u-store))) 121548596154Schristos) 121648596154Schristos 121748596154Schristos(define-pmacro (mov2gr name opc1 opc2 arg1 arg2) 121848596154Schristos (dni name 121948596154Schristos (.str "mov " arg1 "," arg2) 122048596154Schristos () 122148596154Schristos (.str "mov $" arg1 ",$" arg2) 122248596154Schristos (+ opc1 opc2 arg1 arg2) 122348596154Schristos (set arg2 arg1) 122448596154Schristos () 122548596154Schristos ) 122648596154Schristos) 122748596154Schristos 122848596154Schristos(mov2gr mov OP1_8 OP2_B Rj Ri) 122948596154Schristos(mov2gr movdr OP1_B OP2_7 Rs1 Ri) 123048596154Schristos 123148596154Schristos(dni movps 123248596154Schristos "mov ps,Ri reg/reg" 123348596154Schristos () 123448596154Schristos "mov $ps,$Ri" 123548596154Schristos (+ OP1_1 OP2_7 OP3_1 Ri) 123648596154Schristos (set Ri ps) 123748596154Schristos () 123848596154Schristos) 123948596154Schristos 124048596154Schristos(dni mov2dr 124148596154Schristos "mov Ri,Rs reg/reg" 124248596154Schristos () 124348596154Schristos "mov $Ri,$Rs1" 124448596154Schristos (+ OP1_B OP2_3 Rs1 Ri) 124548596154Schristos (set Rs1 Ri) 124648596154Schristos () 124748596154Schristos) 124848596154Schristos 124948596154Schristos(dni mov2ps 125048596154Schristos "mov Ri,ps reg/reg" 125148596154Schristos () 125248596154Schristos "mov $Ri,$ps" 125348596154Schristos (+ OP1_0 OP2_7 OP3_1 Ri) 125448596154Schristos (set ps Ri) 125548596154Schristos () 125648596154Schristos) 125748596154Schristos 125848596154Schristos(dni jmp 125948596154Schristos "jmp with no delay slot" 126048596154Schristos (NOT-IN-DELAY-SLOT) 126148596154Schristos "jmp @$Ri" 126248596154Schristos (+ OP1_9 OP2_7 OP3_0 Ri) 126348596154Schristos (set pc Ri) 126448596154Schristos ((fr30-1 (unit u-cti))) 126548596154Schristos) 126648596154Schristos 126748596154Schristos(dni jmpd "jmp with delay slot" 126848596154Schristos (NOT-IN-DELAY-SLOT) 126948596154Schristos "jmp:d @$Ri" 127048596154Schristos (+ OP1_9 OP2_F OP3_0 Ri) 127148596154Schristos (delay (const 1) 127248596154Schristos (set pc Ri)) 127348596154Schristos ((fr30-1 (unit u-cti))) 127448596154Schristos) 127548596154Schristos 127648596154Schristos; These versions which use registers must appear before the other 127748596154Schristos; versions which use relative addresses due to a problem in cgen 127848596154Schristos; - DB. 127948596154Schristos(dni callr 128048596154Schristos "call @Ri" 128148596154Schristos (NOT-IN-DELAY-SLOT) 128248596154Schristos "call @$Ri" 128348596154Schristos (+ OP1_9 OP2_7 OP3_1 Ri) 128448596154Schristos (sequence () 128548596154Schristos (set (reg h-dr 1) (add pc (const 2))) 128648596154Schristos (set pc Ri)) 128748596154Schristos ((fr30-1 (unit u-cti))) 128848596154Schristos) 128948596154Schristos(dni callrd 129048596154Schristos "call:d @Ri" 129148596154Schristos (NOT-IN-DELAY-SLOT) 129248596154Schristos "call:d @$Ri" 129348596154Schristos (+ OP1_9 OP2_F OP3_1 Ri) 129448596154Schristos (delay (const 1) 129548596154Schristos (sequence () 129648596154Schristos (set (reg h-dr 1) (add pc (const 4))) 129748596154Schristos (set pc Ri))) 129848596154Schristos ((fr30-1 (unit u-cti))) 129948596154Schristos) 130048596154Schristos; end of reordered insns 130148596154Schristos 130248596154Schristos(dni call 130348596154Schristos "call relative to pc" 130448596154Schristos (NOT-IN-DELAY-SLOT) 130548596154Schristos "call $label12" 130648596154Schristos (+ OP1_D OP5_0 label12) 130748596154Schristos (sequence () 130848596154Schristos (set (reg h-dr 1) (add pc (const 2))) 130948596154Schristos (set pc label12)) 131048596154Schristos ((fr30-1 (unit u-cti))) 131148596154Schristos) 131248596154Schristos(dni calld 131348596154Schristos "call relative to pc" 131448596154Schristos (NOT-IN-DELAY-SLOT) 131548596154Schristos "call:d $label12" 131648596154Schristos (+ OP1_D OP5_1 label12) 131748596154Schristos (delay (const 1) 131848596154Schristos (sequence () 131948596154Schristos (set (reg h-dr 1) (add pc (const 4))) 132048596154Schristos (set pc label12))) 132148596154Schristos ((fr30-1 (unit u-cti))) 132248596154Schristos) 132348596154Schristos 132448596154Schristos(dni ret 132548596154Schristos "return from subroutine" 132648596154Schristos (NOT-IN-DELAY-SLOT) 132748596154Schristos "ret" 132848596154Schristos (+ OP1_9 OP2_7 OP3_2 OP4_0) 132948596154Schristos (set pc (reg h-dr 1)) 133048596154Schristos ((fr30-1 (unit u-cti))) 133148596154Schristos) 133248596154Schristos 133348596154Schristos(dni ret:d 133448596154Schristos "return from subroutine with delay slot" 133548596154Schristos (NOT-IN-DELAY-SLOT) 133648596154Schristos "ret:d" 133748596154Schristos (+ OP1_9 OP2_F OP3_2 OP4_0) 133848596154Schristos (delay (const 1) 133948596154Schristos (set pc (reg h-dr 1))) 134048596154Schristos ((fr30-1 (unit u-cti))) 134148596154Schristos) 134248596154Schristos 134348596154Schristos(dni int 134448596154Schristos "interrupt" 134548596154Schristos (NOT-IN-DELAY-SLOT) 134648596154Schristos "int $u8" 134748596154Schristos (+ OP1_1 OP2_F u8) 134848596154Schristos (sequence () 134948596154Schristos ; This is defered to fr30_int because for the breakpoint case 135048596154Schristos ; we want to change as little of the machine state as possible. 135148596154Schristos ; Push PS onto the system stack 135248596154Schristos ;(set (reg h-dr 2) (sub (reg h-dr 2) (const 4))) 135348596154Schristos ;(set UWI (mem UWI (reg h-dr 2)) ps) 135448596154Schristos ; Push the return address onto the system stack 135548596154Schristos ;(set (reg h-dr 2) (sub (reg h-dr 2) (const 4))) 135648596154Schristos ;(set UWI (mem UWI (reg h-dr 2)) (add pc (const 2))) 135748596154Schristos ; Set status bits 135848596154Schristos ;(set ibit (const 0)) 135948596154Schristos ;(set sbit (const 0)) 136048596154Schristos 136148596154Schristos ; We still should indicate what is modified by this insn. 136248596154Schristos (clobber (reg h-dr 2)) 136348596154Schristos (clobber ibit) 136448596154Schristos (clobber sbit) 136548596154Schristos ; ??? (clobber memory)? 136648596154Schristos 136748596154Schristos ; fr30_int handles operating vs user mode 136848596154Schristos (set WI pc (c-call WI "fr30_int" pc u8)) 136948596154Schristos ) 137048596154Schristos ; This is more properly a cti, but branch stall calculation is different. 137148596154Schristos ((fr30-1 (unit u-exec (cycles 6)))) 137248596154Schristos) 137348596154Schristos 137448596154Schristos(dni inte 137548596154Schristos "interrupt for emulator" 137648596154Schristos (NOT-IN-DELAY-SLOT) 137748596154Schristos "inte" 137848596154Schristos (+ OP1_9 OP2_F OP3_3 OP4_0) 137948596154Schristos (sequence () 138048596154Schristos ; This is defered to fr30_inte because for the breakpoint case 138148596154Schristos ; we want to change as little of the machine state as possible. 138248596154Schristos ; Push PS onto the system stack 138348596154Schristos ;(set (reg h-dr 2) (sub (reg h-dr 2) (const 4))) 138448596154Schristos ;(set UWI (mem UWI (reg h-dr 2)) ps) 138548596154Schristos ; Push the return address onto the system stack 138648596154Schristos ;(set (reg h-dr 2) (sub (reg h-dr 2) (const 4))) 138748596154Schristos ;(set UWI (mem UWI (reg h-dr 2)) (add pc (const 2))) 138848596154Schristos ; Set status bits 138948596154Schristos ;(set ibit (const 0)) 139048596154Schristos ;(set ilm (const 4)) 139148596154Schristos 139248596154Schristos ; We still should indicate what is modified by this insn. 139348596154Schristos (clobber (reg h-dr 2)) 139448596154Schristos (clobber ibit) 139548596154Schristos (clobber ilm) 139648596154Schristos ; ??? (clobber memory)? 139748596154Schristos 139848596154Schristos ; fr30_int handles operating vs user mode 139948596154Schristos (set WI pc (c-call WI "fr30_inte" pc)) 140048596154Schristos ) 140148596154Schristos ; This is more properly a cti, but branch stall calculation is different. 140248596154Schristos ((fr30-1 (unit u-exec (cycles 6)))) 140348596154Schristos) 140448596154Schristos 140548596154Schristos(dni reti 140648596154Schristos "return from interrupt" 140748596154Schristos (NOT-IN-DELAY-SLOT) 140848596154Schristos "reti" 140948596154Schristos (+ OP1_9 OP2_7 OP3_3 OP4_0) 141048596154Schristos (if (eq sbit (const 0)) 141148596154Schristos (sequence () 141248596154Schristos ; Pop the return address from the system stack 141348596154Schristos (set UWI pc (mem UWI (reg h-dr 2))) 141448596154Schristos (set (reg h-dr 2) (add (reg h-dr 2) (const 4))) 141548596154Schristos ; Pop PS from the system stack 141648596154Schristos (set UWI ps (mem UWI (reg h-dr 2))) 141748596154Schristos (set (reg h-dr 2) (add (reg h-dr 2) (const 4))) 141848596154Schristos ) 141948596154Schristos (sequence () 142048596154Schristos ; Pop the return address from the user stack 142148596154Schristos (set UWI pc (mem UWI (reg h-dr 3))) 142248596154Schristos (set (reg h-dr 3) (add (reg h-dr 3) (const 4))) 142348596154Schristos ; Pop PS from the user stack 142448596154Schristos (set UWI ps (mem UWI (reg h-dr 3))) 142548596154Schristos (set (reg h-dr 3) (add (reg h-dr 3) (const 4))) 142648596154Schristos ) 142748596154Schristos ) 142848596154Schristos ; This is more properly a cti, but branch stall calculation is different. 142948596154Schristos ((fr30-1 (unit u-exec (cycles 4)))) 143048596154Schristos) 143148596154Schristos 143248596154Schristos; Conditional branches with and without delay slots 143348596154Schristos; 143448596154Schristos(define-pmacro (cond-branch cc condition) 143548596154Schristos (begin 143648596154Schristos (dni (.sym b cc d) 143748596154Schristos (.str (.sym b cc :d) " label9") 143848596154Schristos (NOT-IN-DELAY-SLOT) 143948596154Schristos (.str (.sym b cc :d) " $label9") 144048596154Schristos (+ OP1_F (.sym CC_ cc) label9) 144148596154Schristos (delay (const 1) 144248596154Schristos (if condition (set pc label9))) 144348596154Schristos ((fr30-1 (unit u-cti))) 144448596154Schristos ) 144548596154Schristos (dni (.sym b cc) 144648596154Schristos (.str (.sym b cc) " label9") 144748596154Schristos (NOT-IN-DELAY-SLOT) 144848596154Schristos (.str (.sym b cc) " $label9") 144948596154Schristos (+ OP1_E (.sym CC_ cc) label9) 145048596154Schristos (if condition (set pc label9)) 145148596154Schristos ((fr30-1 (unit u-cti))) 145248596154Schristos ) 145348596154Schristos ) 145448596154Schristos) 145548596154Schristos 145648596154Schristos(cond-branch ra (const BI 1)) 145748596154Schristos(cond-branch no (const BI 0)) 145848596154Schristos(cond-branch eq zbit) 145948596154Schristos(cond-branch ne (not zbit)) 146048596154Schristos(cond-branch c cbit) 146148596154Schristos(cond-branch nc (not cbit)) 146248596154Schristos(cond-branch n nbit) 146348596154Schristos(cond-branch p (not nbit)) 146448596154Schristos(cond-branch v vbit) 146548596154Schristos(cond-branch nv (not vbit)) 146648596154Schristos(cond-branch lt (xor vbit nbit)) 146748596154Schristos(cond-branch ge (not (xor vbit nbit))) 146848596154Schristos(cond-branch le (or (xor vbit nbit) zbit)) 146948596154Schristos(cond-branch gt (not (or (xor vbit nbit) zbit))) 147048596154Schristos(cond-branch ls (or cbit zbit)) 147148596154Schristos(cond-branch hi (not (or cbit zbit))) 147248596154Schristos 147348596154Schristos(define-pmacro (dir2r13 name insn opc1 opc2 mode arg1) 147448596154Schristos (dni name 147548596154Schristos (.str insn " @" arg1 ",R13") 147648596154Schristos () 147748596154Schristos (.str insn " @$" arg1 ",$R13") 147848596154Schristos (+ opc1 opc2 arg1) 147948596154Schristos (set (reg h-gr 13) (mem mode arg1)) 148048596154Schristos ((fr30-1 (unit u-load))) 148148596154Schristos ) 148248596154Schristos) 148348596154Schristos 148448596154Schristos(define-pmacro (dir2r13-postinc name insn opc1 opc2 mode arg1 incr) 148548596154Schristos (dni name 148648596154Schristos (.str insn " @" arg1 ",@R13+") 148748596154Schristos (NOT-IN-DELAY-SLOT) 148848596154Schristos (.str insn " @$" arg1 ",@$R13+") 148948596154Schristos (+ opc1 opc2 arg1) 149048596154Schristos (sequence () 149148596154Schristos (set (mem mode (reg h-gr 13)) (mem mode arg1)) 149248596154Schristos (set (reg h-gr 13) (add (reg h-gr 13) incr))) 149348596154Schristos ((fr30-1 (unit u-load) (unit u-store))) 149448596154Schristos ) 149548596154Schristos) 149648596154Schristos 149748596154Schristos(define-pmacro (r132dir name insn opc1 opc2 mode arg1) 149848596154Schristos (dni name 149948596154Schristos (.str insn " R13,@" arg1) 150048596154Schristos () 150148596154Schristos (.str insn " $R13,@$" arg1) 150248596154Schristos (+ opc1 opc2 arg1) 150348596154Schristos (set (mem mode arg1) (reg h-gr 13)) 150448596154Schristos ((fr30-1 (unit u-store))) 150548596154Schristos ) 150648596154Schristos) 150748596154Schristos 150848596154Schristos(define-pmacro (r13-postinc2dir name insn opc1 opc2 mode arg1 incr) 150948596154Schristos (dni name 151048596154Schristos (.str insn " @R13+,@" arg1) 151148596154Schristos (NOT-IN-DELAY-SLOT) 151248596154Schristos (.str insn " @$R13+,@$" arg1) 151348596154Schristos (+ opc1 opc2 arg1) 151448596154Schristos (sequence () 151548596154Schristos (set (mem mode arg1) (mem mode (reg h-gr 13))) 151648596154Schristos (set (reg h-gr 13) (add (reg h-gr 13) incr))) 151748596154Schristos ((fr30-1 (unit u-load) (unit u-store))) 151848596154Schristos ) 151948596154Schristos) 152048596154Schristos 152148596154Schristos; These versions which move from reg to mem must appear before the other 152248596154Schristos; versions which use immediate addresses due to a problem in cgen 152348596154Schristos; - DB. 152448596154Schristos(r132dir dmovr13 dmov OP1_1 OP2_8 WI dir10) 152548596154Schristos(r132dir dmovr13h dmovh OP1_1 OP2_9 HI dir9) 152648596154Schristos(r132dir dmovr13b dmovb OP1_1 OP2_A QI dir8) 152748596154Schristos 152848596154Schristos(r13-postinc2dir dmovr13pi dmov OP1_1 OP2_C WI dir10 (const 4)) 152948596154Schristos(r13-postinc2dir dmovr13pih dmovh OP1_1 OP2_D HI dir9 (const 2)) 153048596154Schristos(r13-postinc2dir dmovr13pib dmovb OP1_1 OP2_E QI dir8 (const 1)) 153148596154Schristos 153248596154Schristos(dni dmovr15pi 153348596154Schristos "dmov @R15+,@dir10" 153448596154Schristos (NOT-IN-DELAY-SLOT) 153548596154Schristos "dmov @$R15+,@$dir10" 153648596154Schristos (+ OP1_1 OP2_B dir10) 153748596154Schristos (sequence () 153848596154Schristos (set (mem WI dir10) (mem WI (reg h-gr 15))) 153948596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4)))) 154048596154Schristos ((fr30-1 (unit u-load) (unit u-store))) 154148596154Schristos) 154248596154Schristos; End of reordered insns. 154348596154Schristos 154448596154Schristos(dir2r13 dmov2r13 dmov OP1_0 OP2_8 WI dir10) 154548596154Schristos(dir2r13 dmov2r13h dmovh OP1_0 OP2_9 HI dir9) 154648596154Schristos(dir2r13 dmov2r13b dmovb OP1_0 OP2_A QI dir8) 154748596154Schristos 154848596154Schristos(dir2r13-postinc dmov2r13pi dmov OP1_0 OP2_C WI dir10 (const 4)) 154948596154Schristos(dir2r13-postinc dmov2r13pih dmovh OP1_0 OP2_D HI dir9 (const 2)) 155048596154Schristos(dir2r13-postinc dmov2r13pib dmovb OP1_0 OP2_E QI dir8 (const 1)) 155148596154Schristos 155248596154Schristos(dni dmov2r15pd 155348596154Schristos "dmov @dir10,@-R15" 155448596154Schristos (NOT-IN-DELAY-SLOT) 155548596154Schristos "dmov @$dir10,@-$R15" 155648596154Schristos (+ OP1_0 OP2_B dir10) 155748596154Schristos (sequence () 155848596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 155948596154Schristos (set (mem WI (reg h-gr 15)) (mem WI dir10))) 156048596154Schristos ((fr30-1 (unit u-load) (unit u-store))) 156148596154Schristos) 156248596154Schristos 156348596154Schristos; Leave these insns as stubs for now, except for the increment of $Ri 156448596154Schristos; 156548596154Schristos(dni ldres 156648596154Schristos "ldres @Ri+,#u4" 156748596154Schristos () 156848596154Schristos "ldres @$Ri+,$u4" 156948596154Schristos (+ OP1_B OP2_C u4 Ri) 157048596154Schristos (set Ri (add Ri (const 4))) 157148596154Schristos () 157248596154Schristos) 157348596154Schristos 157448596154Schristos(dni stres 157548596154Schristos "stres #u4,@Ri+" 157648596154Schristos () 157748596154Schristos "stres $u4,@$Ri+" 157848596154Schristos (+ OP1_B OP2_D u4 Ri) 157948596154Schristos (set Ri (add Ri (const 4))) 158048596154Schristos () 158148596154Schristos) 158248596154Schristos 158348596154Schristos; Leave the coprocessor insns as stubs for now. 158448596154Schristos; 158548596154Schristos(define-pmacro (cop-stub name insn opc1 opc2 opc3 arg1 arg2) 158648596154Schristos (dni name 158748596154Schristos (.str insn " u4c,ccc,CRj," arg1 "," arg2) 158848596154Schristos (NOT-IN-DELAY-SLOT) 158948596154Schristos (.str insn " $u4c,$ccc,$" arg1 ",$" arg2) 159048596154Schristos (+ opc1 opc2 opc3 u4c ccc arg1 arg2) 159148596154Schristos (nop) ; STUB 159248596154Schristos () 159348596154Schristos ) 159448596154Schristos) 159548596154Schristos 159648596154Schristos(cop-stub copop copop OP1_9 OP2_F OP3_C CRj CRi) 159748596154Schristos(cop-stub copld copld OP1_9 OP2_F OP3_D Rjc CRi) 159848596154Schristos(cop-stub copst copst OP1_9 OP2_F OP3_E CRj Ric) 159948596154Schristos(cop-stub copsv copsv OP1_9 OP2_F OP3_F CRj Ric) 160048596154Schristos 160148596154Schristos(dni nop 160248596154Schristos "nop" 160348596154Schristos () 160448596154Schristos "nop" 160548596154Schristos (+ OP1_9 OP2_F OP3_A OP4_0) 160648596154Schristos (nop) 160748596154Schristos () 160848596154Schristos) 160948596154Schristos 161048596154Schristos(dni andccr 161148596154Schristos "andccr #u8" 161248596154Schristos () 161348596154Schristos "andccr $u8" 161448596154Schristos (+ OP1_8 OP2_3 u8) 161548596154Schristos (set ccr (and ccr u8)) 161648596154Schristos () 161748596154Schristos) 161848596154Schristos 161948596154Schristos(dni orccr 162048596154Schristos "orccr #u8" 162148596154Schristos () 162248596154Schristos "orccr $u8" 162348596154Schristos (+ OP1_9 OP2_3 u8) 162448596154Schristos (set ccr (or ccr u8)) 162548596154Schristos () 162648596154Schristos) 162748596154Schristos 162848596154Schristos(dni stilm 162948596154Schristos "stilm #u8" 163048596154Schristos () 163148596154Schristos "stilm $u8" 163248596154Schristos (+ OP1_8 OP2_7 u8) 163348596154Schristos (set ilm (and u8 (const #x1f))) 163448596154Schristos () 163548596154Schristos) 163648596154Schristos 163748596154Schristos(dni addsp 163848596154Schristos "addsp #s10" 163948596154Schristos () 164048596154Schristos "addsp $s10" 164148596154Schristos (+ OP1_A OP2_3 s10) 164248596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) s10)) 164348596154Schristos () 164448596154Schristos) 164548596154Schristos 164648596154Schristos(define-pmacro (ext-op name opc1 opc2 opc3 op mode mask) 164748596154Schristos (dni name 164848596154Schristos (.str name " Ri") 164948596154Schristos () 165048596154Schristos (.str name " $Ri") 165148596154Schristos (+ opc1 opc2 opc3 Ri) 165248596154Schristos (set Ri (op WI (and mode Ri mask))) 165348596154Schristos () 165448596154Schristos ) 165548596154Schristos) 165648596154Schristos 165748596154Schristos(ext-op extsb OP1_9 OP2_7 OP3_8 ext QI (const #xff)) 165848596154Schristos(ext-op extub OP1_9 OP2_7 OP3_9 zext UQI (const #xff)) 165948596154Schristos(ext-op extsh OP1_9 OP2_7 OP3_A ext HI (const #xffff)) 166048596154Schristos(ext-op extuh OP1_9 OP2_7 OP3_B zext UHI (const #xffff)) 166148596154Schristos 166248596154Schristos(dni ldm0 166348596154Schristos "ldm0 (reglist_low_ld)" 166448596154Schristos (NOT-IN-DELAY-SLOT) 166548596154Schristos "ldm0 ($reglist_low_ld)" 166648596154Schristos (+ OP1_8 OP2_C reglist_low_ld) 166748596154Schristos (sequence () 166848596154Schristos (if (and reglist_low_ld (const #x1)) 166948596154Schristos (sequence () 167048596154Schristos (set (reg h-gr 0) (mem WI (reg h-gr 15))) 167148596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 167248596154Schristos (if (and reglist_low_ld (const #x2)) 167348596154Schristos (sequence () 167448596154Schristos (set (reg h-gr 1) (mem WI (reg h-gr 15))) 167548596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 167648596154Schristos (if (and reglist_low_ld (const #x4)) 167748596154Schristos (sequence () 167848596154Schristos (set (reg h-gr 2) (mem WI (reg h-gr 15))) 167948596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 168048596154Schristos (if (and reglist_low_ld (const #x8)) 168148596154Schristos (sequence () 168248596154Schristos (set (reg h-gr 3) (mem WI (reg h-gr 15))) 168348596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 168448596154Schristos (if (and reglist_low_ld (const #x10)) 168548596154Schristos (sequence () 168648596154Schristos (set (reg h-gr 4) (mem WI (reg h-gr 15))) 168748596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 168848596154Schristos (if (and reglist_low_ld (const #x20)) 168948596154Schristos (sequence () 169048596154Schristos (set (reg h-gr 5) (mem WI (reg h-gr 15))) 169148596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 169248596154Schristos (if (and reglist_low_ld (const #x40)) 169348596154Schristos (sequence () 169448596154Schristos (set (reg h-gr 6) (mem WI (reg h-gr 15))) 169548596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 169648596154Schristos (if (and reglist_low_ld (const #x80)) 169748596154Schristos (sequence () 169848596154Schristos (set (reg h-gr 7) (mem WI (reg h-gr 15))) 169948596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 170048596154Schristos ) 170148596154Schristos ((fr30-1 (unit u-ldm))) 170248596154Schristos) 170348596154Schristos 170448596154Schristos(dni ldm1 170548596154Schristos "ldm1 (reglist_hi_ld)" 170648596154Schristos (NOT-IN-DELAY-SLOT) 170748596154Schristos "ldm1 ($reglist_hi_ld)" 170848596154Schristos (+ OP1_8 OP2_D reglist_hi_ld) 170948596154Schristos (sequence () 171048596154Schristos (if (and reglist_hi_ld (const #x1)) 171148596154Schristos (sequence () 171248596154Schristos (set (reg h-gr 8) (mem WI (reg h-gr 15))) 171348596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 171448596154Schristos (if (and reglist_hi_ld (const #x2)) 171548596154Schristos (sequence () 171648596154Schristos (set (reg h-gr 9) (mem WI (reg h-gr 15))) 171748596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 171848596154Schristos (if (and reglist_hi_ld (const #x4)) 171948596154Schristos (sequence () 172048596154Schristos (set (reg h-gr 10) (mem WI (reg h-gr 15))) 172148596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 172248596154Schristos (if (and reglist_hi_ld (const #x8)) 172348596154Schristos (sequence () 172448596154Schristos (set (reg h-gr 11) (mem WI (reg h-gr 15))) 172548596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 172648596154Schristos (if (and reglist_hi_ld (const #x10)) 172748596154Schristos (sequence () 172848596154Schristos (set (reg h-gr 12) (mem WI (reg h-gr 15))) 172948596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 173048596154Schristos (if (and reglist_hi_ld (const #x20)) 173148596154Schristos (sequence () 173248596154Schristos (set (reg h-gr 13) (mem WI (reg h-gr 15))) 173348596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 173448596154Schristos (if (and reglist_hi_ld (const #x40)) 173548596154Schristos (sequence () 173648596154Schristos (set (reg h-gr 14) (mem WI (reg h-gr 15))) 173748596154Schristos (set (reg h-gr 15) (add (reg h-gr 15) (const 4))))) 173848596154Schristos (if (and reglist_hi_ld (const #x80)) 173948596154Schristos (set (reg h-gr 15) (mem WI (reg h-gr 15)))) 174048596154Schristos ) 174148596154Schristos ((fr30-1 (unit u-ldm))) 174248596154Schristos) 174348596154Schristos 174448596154Schristos(dni stm0 174548596154Schristos "stm0 (reglist_low_st)" 174648596154Schristos (NOT-IN-DELAY-SLOT) 174748596154Schristos "stm0 ($reglist_low_st)" 174848596154Schristos (+ OP1_8 OP2_E reglist_low_st) 174948596154Schristos (sequence () 175048596154Schristos (if (and reglist_low_st (const #x1)) 175148596154Schristos (sequence () 175248596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 175348596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 7)))) 175448596154Schristos (if (and reglist_low_st (const #x2)) 175548596154Schristos (sequence () 175648596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 175748596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 6)))) 175848596154Schristos (if (and reglist_low_st (const #x4)) 175948596154Schristos (sequence () 176048596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 176148596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 5)))) 176248596154Schristos (if (and reglist_low_st (const #x8)) 176348596154Schristos (sequence () 176448596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 176548596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 4)))) 176648596154Schristos (if (and reglist_low_st (const #x10)) 176748596154Schristos (sequence () 176848596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 176948596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 3)))) 177048596154Schristos (if (and reglist_low_st (const #x20)) 177148596154Schristos (sequence () 177248596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 177348596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 2)))) 177448596154Schristos (if (and reglist_low_st (const #x40)) 177548596154Schristos (sequence () 177648596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 177748596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 1)))) 177848596154Schristos (if (and reglist_low_st (const #x80)) 177948596154Schristos (sequence () 178048596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 178148596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 0)))) 178248596154Schristos ) 178348596154Schristos ((fr30-1 (unit u-stm))) 178448596154Schristos) 178548596154Schristos 178648596154Schristos(dni stm1 178748596154Schristos "stm1 (reglist_hi_st)" 178848596154Schristos (NOT-IN-DELAY-SLOT) 178948596154Schristos "stm1 ($reglist_hi_st)" 179048596154Schristos (+ OP1_8 OP2_F reglist_hi_st) 179148596154Schristos (sequence () 179248596154Schristos (if (and reglist_hi_st (const #x1)) 179348596154Schristos (sequence ((WI save-r15)) 179448596154Schristos (set save-r15 (reg h-gr 15)) 179548596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 179648596154Schristos (set (mem WI (reg h-gr 15)) save-r15))) 179748596154Schristos (if (and reglist_hi_st (const #x2)) 179848596154Schristos (sequence () 179948596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 180048596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 14)))) 180148596154Schristos (if (and reglist_hi_st (const #x4)) 180248596154Schristos (sequence () 180348596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 180448596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 13)))) 180548596154Schristos (if (and reglist_hi_st (const #x8)) 180648596154Schristos (sequence () 180748596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 180848596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 12)))) 180948596154Schristos (if (and reglist_hi_st (const #x10)) 181048596154Schristos (sequence () 181148596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 181248596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 11)))) 181348596154Schristos (if (and reglist_hi_st (const #x20)) 181448596154Schristos (sequence () 181548596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 181648596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 10)))) 181748596154Schristos (if (and reglist_hi_st (const #x40)) 181848596154Schristos (sequence () 181948596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 182048596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 9)))) 182148596154Schristos (if (and reglist_hi_st (const #x80)) 182248596154Schristos (sequence () 182348596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) (const 4))) 182448596154Schristos (set (mem WI (reg h-gr 15)) (reg h-gr 8)))) 182548596154Schristos ) 182648596154Schristos ((fr30-1 (unit u-stm))) 182748596154Schristos) 182848596154Schristos 182948596154Schristos(dni enter 183048596154Schristos "enter #u10" 183148596154Schristos (NOT-IN-DELAY-SLOT) 183248596154Schristos "enter $u10" 183348596154Schristos (+ OP1_0 OP2_F u10) 183448596154Schristos (sequence ((WI tmp)) 183548596154Schristos (set tmp (sub (reg h-gr 15) (const 4))) 183648596154Schristos (set (mem WI tmp) (reg h-gr 14)) 183748596154Schristos (set (reg h-gr 14) tmp) 183848596154Schristos (set (reg h-gr 15) (sub (reg h-gr 15) u10))) 183948596154Schristos ((fr30-1 (unit u-exec (cycles 2)))) 184048596154Schristos) 184148596154Schristos 184248596154Schristos(dni leave 184348596154Schristos "leave" 184448596154Schristos () 184548596154Schristos "leave" 184648596154Schristos (+ OP1_9 OP2_F OP3_9 OP4_0) 184748596154Schristos (sequence () 184848596154Schristos (set (reg h-gr 15) (add (reg h-gr 14) (const 4))) 184948596154Schristos (set (reg h-gr 14) (mem WI (sub (reg h-gr 15) (const 4))))) 185048596154Schristos () 185148596154Schristos) 185248596154Schristos 185348596154Schristos(dni xchb 185448596154Schristos "xchb @Rj,Ri" 185548596154Schristos (NOT-IN-DELAY-SLOT) 185648596154Schristos "xchb @$Rj,$Ri" 185748596154Schristos (+ OP1_8 OP2_A Rj Ri) 185848596154Schristos (sequence ((WI tmp)) 185948596154Schristos (set tmp Ri) 186048596154Schristos (set Ri (mem UQI Rj)) 186148596154Schristos (set (mem UQI Rj) tmp)) 186248596154Schristos ((fr30-1 (unit u-load) (unit u-store))) 186348596154Schristos) 1864