* [patch] xstormy16: fix add/sub bug
@ 2003-03-06 0:33 DJ Delorie
0 siblings, 0 replies; only message in thread
From: DJ Delorie @ 2003-03-06 0:33 UTC (permalink / raw)
To: cgen, sid
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 <dj@redhat.com>
* 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 <dj@redhat.com>
* 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-06 0:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-06 0:33 [patch] xstormy16: fix add/sub bug DJ Delorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).