From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17208 invoked by alias); 14 Nov 2009 19:52:13 -0000 Received: (qmail 17173 invoked by uid 22791); 14 Nov 2009 19:52:07 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL,BAYES_00,DNS_FROM_RFC_BOGUSMX X-Spam-Check-By: sourceware.org Received: from sebabeach.org (HELO sebabeach.org) (64.165.110.50) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 14 Nov 2009 19:51:03 +0000 Received: by sebabeach.org (Postfix, from userid 500) id CC9196E3D9; Sat, 14 Nov 2009 11:51:01 -0800 (PST) From: Doug Evans To: binutils@sourceware.org, cgen@sourceware.org Subject: [commit] Fix xc16x.cpu void-expression issues Message-Id: <20091114195101.CC9196E3D9@sebabeach.org> Date: Sat, 14 Nov 2009 19:52:00 -0000 X-IsSubscribed: yes Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00036.txt.bz2 Hi. I checked this in. cgen now flags an error when non-void expressions are used in void contexts. Tested by regenerating opcodes/xc16x*, no changes. 2009-11-14 Doug Evans Must use VOID expression in VOID context. * xc16x.cpu (mov4): Fix mode of `sequence'. (mov9, mov10): Ditto. (movbsrr, moveb1, jmprel, jmpseg, jmps): Fix mode of `if'. (callr, callseg, calls, trap, rets, reti): Ditto. (jb, jbc, jnb, jnbs): Fix mode of `if'. Comment out no-op `sll'. (atomic, extr, extp, extp1, extpg1, extpr, extpr1): Fix mode of `cond'. (exts, exts1, extsr, extsr1, prior): Ditto. Index: xc16x.cpu =================================================================== RCS file: /cvs/src/src/cpu/xc16x.cpu,v retrieving revision 1.6 diff -u -p -r1.6 xc16x.cpu --- xc16x.cpu 23 Sep 2009 22:30:55 -0000 1.6 +++ xc16x.cpu 14 Nov 2009 19:26:50 -0000 @@ -1476,7 +1476,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 +1558,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 +1575,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 +1722,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 +1815,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 +1896,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 +1942,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 +1958,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 +1978,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 +1999,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 +2027,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 +2048,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 +2133,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 +2157,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 +2177,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 +2211,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 +2245,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 +2277,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 +2421,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 +2441,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 +2461,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 +2481,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 +2500,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 +2520,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 +2540,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 +2560,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 +2580,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 +2600,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 +2620,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 +2642,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))) )