X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=cpu%2Fxc16x.cpu;h=4903b814c91d505f0d3d446a68ab0656aa67307f;hb=cbd7581f343d85b4216db2eefdf601f6d988062d;hp=efa687d2b9f03f550e1a1737a8189fc7533343fe;hpb=ab5f875d24fd1eee651b37a7a01d069dd3b56f00;p=deliverable%2Fbinutils-gdb.git diff --git a/cpu/xc16x.cpu b/cpu/xc16x.cpu index efa687d2b9..4903b814c9 100644 --- a/cpu/xc16x.cpu +++ b/cpu/xc16x.cpu @@ -528,6 +528,15 @@ (comment "segment") ) +;; Define an operand that takes a set of handlers. +;; dowh: define-operand-with-handlers +(define-pmacro (dowh x-name x-comment x-attrs x-type x-index x-handlers) + (define-operand (name x-name) (comment x-comment) + (.splice attrs (.unsplice x-attrs)) + (type x-type) (index x-index) + (.splice handlers (.unsplice x-handlers))) +) + (dnop sr "source register" () h-gr f-r2) (dnop dr "destination register" () h-gr f-r1) (dnop dri "destination register" () h-gr f-r4) @@ -544,7 +553,7 @@ (dnop uimm7 "7 bit trap number" (HASH-PREFIX) h-uint f-uimm7) (dnop uimm8 "8 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm8) (dnop uimm16 "16 bit unsigned immediate" (HASH-PREFIX) h-uint f-uimm16) -(dnop upof16 "16 bit unsigned immediate" (POF-PREFIX) h-addr f-memory) +(dowh upof16 "16 bit unsigned immediate" (POF-PREFIX) h-addr f-memory ((print "with_pof_prefix"))) (dnop reg8 "8 bit word register number" () h-r8 f-reg8) (dnop regmem8 "8 bit word register number" () h-regmem8 f-regmem8) (dnop regbmem8 "8 bit byte register number" () h-regbmem8 f-regmem8) @@ -573,16 +582,16 @@ (dnop memory "16 bit memory" () h-addr f-memory) (dnop memgr8 "16 bit memory" () h-memgr8 f-memgr8) (dnop cbit "carry bit" (SEM-ONLY) h-cbit f-nil) -(dnop qbit "bit addr" (DOT-PREFIX) h-uint f-qbit) -(dnop qlobit "bit addr" (DOT-PREFIX) h-uint f-qlobit) -(dnop qhibit "bit addr" (DOT-PREFIX) h-uint f-qhibit) +(dowh qbit "bit addr" (DOT-PREFIX) h-uint f-qbit ((print "with_dot_prefix"))) +(dowh qlobit "bit addr" (DOT-PREFIX) h-uint f-qlobit ((print "with_dot_prefix"))) +(dowh qhibit "bit addr" (DOT-PREFIX) h-uint f-qhibit ((print "with_dot_prefix"))) (dnop mask8 "8 bit mask" (HASH-PREFIX) h-uint f-mask8) (dnop masklo8 "8 bit mask" (HASH-PREFIX) h-uint f-datahi8) (dnop pagenum "10 bit page number" (HASH-PREFIX) h-uint f-pagenum) (dnop data8 "8 bit data" (HASH-PREFIX) h-uint f-data8) (dnop datahi8 "8 bit data" (HASH-PREFIX) h-uint f-datahi8) (dnop sgtdisbit "segmentation enable bit" (SEM-ONLY) h-sgtdis f-nil) -(dnop upag16 "16 bit unsigned immediate" (PAG-PREFIX) h-uint f-uimm16) +(dowh upag16 "16 bit unsigned immediate" (PAG-PREFIX) h-uint f-uimm16 ((print "with_pag_prefix"))) (dnop useg8 "8 bit segment " (SEG-PREFIX) h-uint f-seg8) (dnop useg16 "16 bit address offset" (SEG-PREFIX) h-uint f-offset16) (dnop usof16 "16 bit address offset" (SOF-PREFIX) h-uint f-offset16) @@ -1476,7 +1485,7 @@ ((PIPE OS) (IDOC MOVE)) (.str insn " [-$"op2 "],$"op1) (+ opc1 opc2 op1 op2) - (sequence HI () + (sequence () (set op1 (sub op2 (const HI 2))) (set HI (mem HI op2) op1) ) @@ -1558,7 +1567,7 @@ ((PIPE OS) (IDOC MOVE)) (.str insn " $"op1 ",[$"op2"+$hash$"uimm16"]") (+ opc1 opc2 op1 op2 uimm16) - (sequence mode ((mode tmp1)) + (sequence ((mode tmp1)) (set mode tmp1 (add HI op2 uimm16)) (set mode op1 (mem HI tmp1)) ) @@ -1575,7 +1584,7 @@ ((PIPE OS) (IDOC MOVE)) (.str insn " [$"op2"+$hash$"uimm16 "],$"op1) (+ opc1 opc2 op1 op2 uimm16) - (sequence mode ((mode tmp1)) + (sequence ((mode tmp1)) (set mode tmp1 (add HI op1 uimm16)) (set mode (mem HI tmp1) op1) ) @@ -1722,8 +1731,8 @@ "movbs $sr,$drb" (+ OP1_13 OP2_0 drb sr) (sequence () - (if QI (and QI drb (const 128)) - (set HI sr (or HI (const HI 65280) drb))) + (if (and QI drb (const 128)) + (set HI sr (or HI (const HI 65280) drb))) (set HI sr (and HI (const HI 255) drb)) ) () @@ -1815,8 +1824,8 @@ (.str insn " $"op2 ",$"op1) (+ opc1 opc2 op1 op2) (sequence () - (if QI (and QI op1 (const 128)) - (set HI op2 (or HI (const HI 65280) op1))) + (if (and QI op1 (const 128)) + (set HI op2 (or HI (const HI 65280) op1))) (set HI op2 (and HI (const HI 255) op1)) ) () @@ -1896,13 +1905,13 @@ (sequence () (if (eq cond (const 1)) (sequence () - (if QI (lt QI rel (const 0)) - (sequence () - ;; FIXME: (neg QI rel) - ;; FIXME: (add QI rel (const 1)) - ;; FIXME: (mul QI rel (const 2)) - (set HI pc (sub HI pc rel)) - )) + (if (lt QI rel (const 0)) + (sequence () + ;; FIXME: (neg QI rel) + ;; FIXME: (add QI rel (const 1)) + ;; FIXME: (mul QI rel (const 2)) + (set HI pc (sub HI pc rel)) + )) (set HI pc (add HI pc (mul QI rel (const 2)))) ) ) @@ -1942,9 +1951,11 @@ "jmps $hash$segm$useg8,$hash$sof$usof16" (+ OP1_15 OP2_10 seg usof16) (sequence () - (if QI (eq BI sgtdisbit (const BI 0)) - (set QI (reg h-cr 10) useg8)) - (nop) + (if (eq BI sgtdisbit (const BI 0)) + (set QI (reg h-cr 10) useg8)) + ;; FIXME: previous indentation suggested this nop was the `else' + ;; clause of the previous `if'. + (nop) (set HI pc usof16) ) () @@ -1956,9 +1967,11 @@ "jmps $seg,$caddr" (+ OP1_15 OP2_10 seg caddr) (sequence () - (if QI (eq BI sgtdisbit (const BI 0)) - (set QI (reg h-cr 10) seg)) - (nop) + (if (eq BI sgtdisbit (const BI 0)) + (set QI (reg h-cr 10) seg)) + ;; FIXME: previous indentation suggested this nop was the `else' + ;; clause of the previous `if'. + (nop) (set HI pc caddr) ) () @@ -1974,14 +1987,14 @@ (sequence ((HI tmp1) (HI tmp2)) (set HI tmp1 genreg) (set HI tmp2 (const 1)) - (sll HI tmp2 qlobit) + ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...) (set HI tmp2 (and tmp1 tmp2)) - (if (eq tmp2 (const 1)) + (if (eq tmp2 (const 1)) ;; FIXME: (ne tmp2 0)? (sequence () - (if QI (lt QI relhi (const 0)) - (set HI pc (add HI pc (mul QI relhi (const 2))))) + (if (lt QI relhi (const 0)) + (set HI pc (add HI pc (mul QI relhi (const 2))))) )) - (set HI pc (add HI pc (const 4))) + (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right? ) () ) @@ -1995,20 +2008,21 @@ (sequence ((HI tmp1) (HI tmp2)) (set HI tmp1 genreg) (set HI tmp2 (const 1)) - (sll HI tmp2 qlobit) + ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...) (set HI tmp2 (and tmp1 tmp2)) - (if (eq tmp2 (const 1)) + (if (eq tmp2 (const 1)) ;; FIXME: (ne tmp2 0)? (sequence () - (if QI (lt QI relhi (const 0)) - (set tmp2 (const 1)) - (set tmp1 genreg) - ;; FIXME: (sll tmp2 qlobit) - ;; FIXME: (inv tmp2) - (set HI tmp1(and tmp1 tmp2)) - (set HI genreg tmp1) - (set HI pc (add HI pc (mul QI relhi (const 2))))) + ;; FIXME: The `else' clause has several statements. + (if (lt QI relhi (const 0)) + (set tmp2 (const 1)) + (set tmp1 genreg) + ;; FIXME: (sll tmp2 qlobit) + ;; FIXME: (inv tmp2) + (set HI tmp1 (and tmp1 tmp2)) + (set HI genreg tmp1) + (set HI pc (add HI pc (mul QI relhi (const 2))))) )) - (set HI pc (add HI pc (const 4))) + (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right? ) () ) @@ -2022,14 +2036,14 @@ (sequence ((HI tmp1) (HI tmp2)) (set HI tmp1 genreg) (set HI tmp2 (const 1)) - (sll HI tmp2 qlobit) + ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...) (set HI tmp2 (and tmp1 tmp2)) - (if (eq tmp2 (const 0)) + (if (eq tmp2 (const 0)) ;; FIXME: (ne tmp2 0)? (sequence () - (if QI (lt QI relhi (const 0)) - (set HI pc (add HI pc (mul QI relhi (const 2))))) + (if (lt QI relhi (const 0)) + (set HI pc (add HI pc (mul QI relhi (const 2))))) )) - (set HI pc (add HI pc (const 4))) + (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right? ) () ) @@ -2043,19 +2057,20 @@ (sequence ((HI tmp1) (HI tmp2)) (set HI tmp1 genreg) (set HI tmp2 (const 1)) - (sll HI tmp2 qlobit) + ;;(sll HI tmp2 qlobit) - FIXME: missing (set ...) (set HI tmp2 (and tmp1 tmp2)) (if (eq tmp2 (const 0)) (sequence () - (if QI (lt QI relhi (const 0)) - (set tmp2 (const 1)) - (set tmp1 reg8) - ;; FIXME: (sll tmp2 qbit) - (set BI tmp1(or tmp1 tmp2)) - (set HI reg8 tmp1) - (set HI pc (add HI pc (mul QI relhi (const 2))))) + ;; FIXME: The `else' clause has several statements. + (if (lt QI relhi (const 0)) + (set tmp2 (const 1)) + (set tmp1 reg8) + ;; FIXME: (sll tmp2 qbit) + (set BI tmp1(or tmp1 tmp2)) + (set HI reg8 tmp1) + (set HI pc (add HI pc (mul QI relhi (const 2))))) )) - (set HI pc (add HI pc (const 4))) + (set HI pc (add HI pc (const 4))) ;; FIXME: Is this right? ) () ) @@ -2127,13 +2142,13 @@ (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2))) (set HI (mem HI (reg h-cr 9)) pc) (sequence () - (if QI (lt QI rel (const 0)) - (sequence () - ;; FIXME: (neg QI rel) - ;; FIXME: (add QI rel (const 1)) - ;; FIXME: (mul QI rel (const 2)) - (set HI pc (sub HI pc rel)) - )) + (if (lt QI rel (const 0)) + (sequence () + ;; FIXME: (neg QI rel) + ;; FIXME: (add QI rel (const 1)) + ;; FIXME: (mul QI rel (const 2)) + (set HI pc (sub HI pc rel)) + )) (set HI pc (add HI pc (mul QI rel (const 2)))) ) ) @@ -2151,9 +2166,11 @@ (set HI (mem HI (reg h-cr 9)) (reg h-cr 10)) (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2))) (set HI (mem HI (reg h-cr 9)) pc) - (if QI (eq BI sgtdisbit (const BI 0)) - (set QI (reg h-cr 10) useg8)) - (nop) + (if (eq BI sgtdisbit (const BI 0)) + (set QI (reg h-cr 10) useg8)) + ;; FIXME: previous indentation suggested this nop was the `else' + ;; clause of the previous `if'. + (nop) (set HI pc usof16) ) () @@ -2169,9 +2186,11 @@ (set HI (mem HI (reg h-cr 9)) (reg h-cr 10)) (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2))) (set HI (mem HI (reg h-cr 9)) pc) - (if QI (eq BI sgtdisbit (const BI 0)) - (set QI (reg h-cr 10) seg)) - (nop) + (if (eq BI sgtdisbit (const BI 0)) + (set QI (reg h-cr 10) seg)) + ;; FIXME: previous indentation suggested this nop was the `else' + ;; clause of the previous `if'. + (nop) (set HI pc caddr) ) () @@ -2201,11 +2220,11 @@ (sequence () (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2))) (set HI (mem HI (reg h-cr 9)) (reg h-cr 4)) - (if QI (eq BI sgtdisbit (const BI 0)) - (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2))) - (set HI (mem HI (reg h-cr 9)) (reg h-cr 10) ) - ) - (nop) + (if (eq BI sgtdisbit (const BI 0)) + (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2))) + (set HI (mem HI (reg h-cr 9)) (reg h-cr 10) ) + ) + (nop) (set HI (reg h-cr 10) (reg h-cr 11)) (set (reg h-cr 9) (sub HI (reg h-cr 9) (const 2))) (set HI (mem HI (reg h-cr 9)) pc) @@ -2235,10 +2254,10 @@ (sequence () (set HI pc (mem HI (reg h-cr 9))) (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2))) - (if QI (eq BI sgtdisbit (const BI 0)) - (set HI (reg h-cr 10) (mem HI (reg h-cr 9))) - ) - (nop) + (if (eq BI sgtdisbit (const BI 0)) + (set HI (reg h-cr 10) (mem HI (reg h-cr 9))) + ) + (nop) (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2))) ) () @@ -2267,13 +2286,13 @@ (sequence () (set HI pc (mem HI (reg h-cr 9))) (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2))) - (if QI (eq BI sgtdisbit (const BI 0)) - (sequence () - (set HI (reg h-cr 10) (mem HI (reg h-cr 9))) - (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2))) - ) - ) - (nop) + (if (eq BI sgtdisbit (const BI 0)) + (sequence () + (set HI (reg h-cr 10) (mem HI (reg h-cr 9))) + (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2))) + ) + ) + (nop) (set HI (reg h-cr 4) (mem HI (reg h-cr 9))) (set (reg h-cr 9) (add HI (reg h-cr 9) (const 2))) ) @@ -2411,7 +2430,7 @@ (+ OP1_13 OP2_1 (f-op-lbit2 0) uimm2 (f-op-bit4 0)) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2431,7 +2450,7 @@ (+ OP1_13 OP2_1 (f-op-lbit2 2) uimm2 (f-op-bit4 0)) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2451,7 +2470,7 @@ (+ OP1_13 OP2_12 (f-op-lbit2 1) uimm2 sr) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2471,7 +2490,7 @@ (+ OP1_13 OP2_7 (f-op-lbit2 1) uimm2 (f-op-bit4 0) pagenum (f-qlobit 0) (f-qlobit2 0)) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2490,7 +2509,7 @@ (+ OP1_13 OP2_7 (f-op-lbit2 1) uimm2 (f-op-bit4 0) upag16 ) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2510,7 +2529,7 @@ (+ OP1_13 OP2_12 (f-op-lbit2 3) uimm2 sr) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2530,7 +2549,7 @@ (+ OP1_13 OP2_7 (f-op-lbit2 3) uimm2 (f-op-bit4 0) pagenum (f-qlobit 0) (f-qlobit2 0)) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2550,7 +2569,7 @@ (+ OP1_13 OP2_12 (f-op-lbit2 0) uimm2 sr) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2570,7 +2589,7 @@ (+ OP1_13 OP2_7 (f-op-lbit2 0) uimm2 (f-op-bit4 0) seghi8 (f-op-bit8 0)) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2590,7 +2609,7 @@ (+ OP1_13 OP2_12 (f-op-lbit2 2) uimm2 sr) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2610,7 +2629,7 @@ (+ OP1_13 OP2_7 (f-op-lbit2 2) uimm2 (f-op-bit4 0) seghi8 (f-op-bit8 0)) (sequence ((HI count)) (set HI count uimm2) - (cond HI + (cond ((ne HI count (const 0)) (sequence () (set HI pc (add HI pc (const 2))) @@ -2632,9 +2651,9 @@ (set HI count (const 0)) (set HI tmp1 sr) (set HI tmp2 (and tmp1 (const 32768))) - (cond HI - ((ne HI tmp2 (const 1)) (ne HI sr (const 0)) - (sll HI tmp1 (const 1)) + (cond + ((ne HI tmp2 (const 1)) ;;(ne HI sr (const 0)) - FIXME: and? or? + ;;(sll HI tmp1 (const 1)) - FIXME: missing (set ...) (set HI tmp2 (and tmp1 (const 32768))) (set HI count (add HI count (const 1))) )