From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22358 invoked by alias); 6 Mar 2003 00:33:49 -0000 Mailing-List: contact sid-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: sid-owner@sources.redhat.com Received: (qmail 22335 invoked from network); 6 Mar 2003 00:33:48 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 6 Mar 2003 00:33:48 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h260XmQ24551; Wed, 5 Mar 2003 19:33:48 -0500 Received: from post-office.corp.redhat.com (post-office.corp.redhat.com [172.16.52.227]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h260XmV01726; Wed, 5 Mar 2003 19:33:48 -0500 Received: from greed.delorie.com (dj.cipe.redhat.com [10.0.0.222]) by post-office.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h260Xmq14600; Wed, 5 Mar 2003 19:33:48 -0500 Received: (from dj@localhost) by greed.delorie.com (8.11.6/8.11.6) id h260XlN21712; Wed, 5 Mar 2003 19:33:47 -0500 Date: Thu, 06 Mar 2003 00:33:00 -0000 Message-Id: <200303060033.h260XlN21712@greed.delorie.com> From: DJ Delorie To: cgen@sources.redhat.com, sid@sources.redhat.com Subject: [patch] xstormy16: fix add/sub bug X-SW-Source: 2003-q1/txt/msg00060.txt.bz2 The psw needs to be set last, but its value depends on the inputs *before* they are possibly changed by setting the destination, so... Index: cgen/ChangeLog 2002-03-05 DJ Delorie * cpu/xstormy16.cpu (set-psw-add): Use temporaries to prevent prematurely overwriting needed inputs. (set-psw-sub): Likewise. Index: sid/component/cgen-cpu/xstormy16/ChangeLog 2002-03-05 DJ Delorie * xstormy16-sem.cxx: Regenerate. Index: cgen/cpu/xstormy16.cpu =================================================================== RCS file: /cvs/src/src/cgen/cpu/xstormy16.cpu,v retrieving revision 1.6 diff -p -2 -r1.6 cgen/cpu/xstormy16.cpu *** cgen/cpu/xstormy16.cpu 18 Feb 2003 22:57:08 -0000 1.6 --- cgen/cpu/xstormy16.cpu 6 Mar 2003 00:30:17 -0000 *************** *** 425,438 **** ; The all-purpose addition operation. (define-pmacro (set-psw-add Rd index a b c) ! (sequence ((HI value)) (set value (addc a b c)) (set (reg HI h-gr index) value) ! (set psw (or (or (and psw #x0F80) ! (basic-psw value)) ! (or (or (sll HI (add-oflag HI a b c) 4) ! (sll HI (add-cflag HI a b c) 2)) ! (or (and (srl HI (addc HI (and a #xF) (and b #xF) c) ! 1) #x8) ! (sll index 12))))))) ; Set the PSW for a subtraction of a-b into Rd, but don't actually --- 425,440 ---- ; The all-purpose addition operation. (define-pmacro (set-psw-add Rd index a b c) ! (sequence ((HI value) (HI newpsw)) (set value (addc a b c)) + (set newpsw (or (or (and psw #x0F80) + (basic-psw value)) + (or (or (sll HI (add-oflag HI a b c) 4) + (sll HI (add-cflag HI a b c) 2)) + (or (and (srl HI (addc HI (and a #xF) (and b #xF) c) + 1) #x8) + (sll index 12))))) (set (reg HI h-gr index) value) ! (set psw newpsw) ! )) ; Set the PSW for a subtraction of a-b into Rd, but don't actually *************** *** 453,460 **** ; just using a carry for both). (define-pmacro (set-psw-sub Rd index a b c) ! (sequence ((HI value)) (set value (subc a b c)) ! (set (reg HI h-gr index) value) ! (set psw (or (or (and psw #x0F80) (basic-psw value)) (or (or (sll HI (sub-oflag HI a b c) 4) --- 455,461 ---- ; just using a carry for both). (define-pmacro (set-psw-sub Rd index a b c) ! (sequence ((HI value) (HI newpsw)) (set value (subc a b c)) ! (set newpsw (or (or (and psw #x0F80) (basic-psw value)) (or (or (sll HI (sub-oflag HI a b c) 4) *************** *** 462,466 **** (or (and (srl HI (subc HI (and a #xF) (and b #xF) c) 1) #x8) ! (sll index 12))))))) ; A 17-bit rotate-left operation --- 463,470 ---- (or (and (srl HI (subc HI (and a #xF) (and b #xF) c) 1) #x8) ! (sll index 12))))) ! (set (reg HI h-gr index) value) ! (set psw newpsw) ! )) ; A 17-bit rotate-left operation