From ea2db63bad9e175af0821dd55921f7709468aa38 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Thu, 6 Mar 2003 00:34:06 +0000 Subject: [PATCH] * cpu/xstormy16.cpu (set-psw-add): Use temporaries to prevent prematurely overwriting needed inputs. (set-psw-sub): Likewise. --- ChangeLog | 6 ++++++ cpu/xstormy16.cpu | 28 ++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ae7d6d..59ba59f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-03-05 DJ Delorie + + * cpu/xstormy16.cpu (set-psw-add): Use temporaries to prevent + prematurely overwriting needed inputs. + (set-psw-sub): Likewise. + Fri Feb 21 19:48:19 2003 J"orn Rennecke * cpu/sh64-media.cpu (make-mextr): Fix setting of count. diff --git a/cpu/xstormy16.cpu b/cpu/xstormy16.cpu index f904fe9..aa7fcc9 100644 --- a/cpu/xstormy16.cpu +++ b/cpu/xstormy16.cpu @@ -424,16 +424,18 @@ ; The all-purpose addition operation. (define-pmacro (set-psw-add Rd index a b c) - (sequence ((HI value)) + (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 (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 psw newpsw) + )) ; Set the PSW for a subtraction of a-b into Rd, but don't actually ; do the subtract. @@ -452,16 +454,18 @@ ; (this chip has a borrow for subtraction, rather than ; just using a carry for both). (define-pmacro (set-psw-sub Rd index a b c) - (sequence ((HI value)) + (sequence ((HI value) (HI newpsw)) (set value (subc a b c)) - (set (reg HI h-gr index) value) - (set psw (or (or (and psw #x0F80) + (set newpsw (or (or (and psw #x0F80) (basic-psw value)) (or (or (sll HI (sub-oflag HI a b c) 4) (sll HI (sub-cflag HI a b c) 2)) (or (and (srl HI (subc HI (and a #xF) (and b #xF) c) 1) #x8) - (sll index 12))))))) + (sll index 12))))) + (set (reg HI h-gr index) value) + (set psw newpsw) + )) ; A 17-bit rotate-left operation (define-pmacro (set-psw-rotate17 Rd index src c rot) -- 2.43.5