OSDN Git Service

* cpu/xstormy16.cpu (set-psw-add): Use temporaries to prevent
authordj <dj>
Thu, 6 Mar 2003 00:34:06 +0000 (00:34 +0000)
committerdj <dj>
Thu, 6 Mar 2003 00:34:06 +0000 (00:34 +0000)
prematurely overwriting needed inputs.
(set-psw-sub): Likewise.

cgen/ChangeLog
cgen/cpu/xstormy16.cpu

index 5ae7d6d..59ba59f 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 Fri Feb 21 19:48:19 2003  J"orn Rennecke <joern.rennecke@superh.com>
 
        * cpu/sh64-media.cpu (make-mextr): Fix setting of count.
index f904fe9..aa7fcc9 100644 (file)
 
 ; 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.
 ; (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)