0.8.3.45:
authorChristophe Rhodes <csr21@cam.ac.uk>
Mon, 8 Sep 2003 13:42:12 +0000 (13:42 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Mon, 8 Sep 2003 13:42:12 +0000 (13:42 +0000)
Fix bug 285
... %MULTIPLY vop was feeling free to scribble over its inputs
... add :FROM and :TO clauses to try to prevent this
... %MULTIPLY-AND-ADD vops are unchanged, but could quite easily be
wrong
OK, OK, I give in
... relax the type declaration on signed-immediate instructions
to allow (unsigned-byte 16)s through

BUGS
NEWS
src/compiler/ppc/arith.lisp
src/compiler/ppc/float.lisp
src/compiler/ppc/insts.lisp
tests/arith.pure.lisp
version.lisp-expr

diff --git a/BUGS b/BUGS
index 13c5cc4..29b0af6 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1204,31 +1204,6 @@ WORKAROUND:
   least some of them are indicative of potentially thread-unsafe 
   parts of the system.  See doc/internals/notes/threading-specials
 
-285: PPC randomness
-  In SBCL 0.8.3.1x on a powerpc running Linux (dunno if Darwin is
-    similarly affected):
-  * (dotimes (i 100) (random 1663553320000000))
-
-  NIL
-  * (dotimes (i 100) (random 1663553340000000))
-
-  NIL
-  * (dotimes (i 100) (random 1663553350000000))
-
-  debugger invoked on condition of type TYPE-ERROR:
-    The value -30653269094906
-      is not of type
-      (OR (SINGLE-FLOAT 0.0) (DOUBLE-FLOAT 0.0d0) (RATIONAL 0)).
-
-    and, weirdly, the frame is:
-  ("hairy arg processor for top level local call RANDOM"
-   1663553347392000
-   #S(RANDOM-STATE
-      :STATE #(0 2567483615 188 1503590015 2333049409 322761517 ...)))
-
-  (the type error doesn't seem to be terribly deterministic in when it
-  occurs.  Bigger numbers seem better able to trigger the error)
-
 286: "recursive known functions"
   Self-call recognition conflicts with known function
   recognition. Currently cross compiler and target COMPILE do not
diff --git a/NEWS b/NEWS
index faea919..fbbdb39 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2018,6 +2018,9 @@ changes in sbcl-0.8.4 relative to sbcl-0.8.3:
     (reported by Rainer Joswig)
   * bug fix: ASH on an (UNSIGNED-BYTE 32) with a shift of -32 or lower
     no longer ever returns 1 instead of 0.  (thanks to Lars Brinkhoff)
+  * fixed bug 285: TRUNCATE on bignum arguments, and indeed bignum
+    arithmetic in general, is now much more reliable on the PPC
+    platform.
   * optimization: restored some effective method precomputation in
     CLOS (turned off by an ANSI fix in sbcl-0.8.3); the amount of
     precomputation is now tunable.
index 9cc48ee..91f23bf 100644 (file)
 (define-vop (bignum-mult)
   (:translate sb!bignum::%multiply)
   (:policy :fast-safe)
-  (:args (x :scs (unsigned-reg) :to (:result 1))
-        (y :scs (unsigned-reg) :to (:result 1)))
+  (:args (x :scs (unsigned-reg) :to (:eval 1))
+        (y :scs (unsigned-reg) :to (:eval 1)))
   (:arg-types unsigned-num unsigned-num)
-  (:results (hi :scs (unsigned-reg))
-           (lo :scs (unsigned-reg)))
+  (:results (hi :scs (unsigned-reg) :from (:eval 1))
+           (lo :scs (unsigned-reg) :from (:eval 0)))
   (:result-types unsigned-num unsigned-num)
   (:generator 40
     (inst mullw lo x y)
index 86a5a9d..d2bd56f 100644 (file)
                          (temp-offset-low (* (1+ stack-offset) sb!vm:n-word-bytes)))
                     (inst lis rtemp #x4330)   ; High word of magic constant
                     (inst stw rtemp nfp-tn temp-offset-high)
-                    (inst lis rtemp #x-8000)
+                    (inst lis rtemp #x8000)
                     (inst stw rtemp nfp-tn temp-offset-low)
                     (inst lfd fmagic nfp-tn temp-offset-high)
                     (inst xor rtemp rtemp x)          ; invert sign bit of x : rtemp had #x80000000
index 81e9b76..26bad5c 100644 (file)
                (multiple-value-bind (other-reads other-writes) (classify-dependencies other-dependencies)
                  `(define-instruction ,name (segment rt ra si)
                    (:declare (type (or ,@(when fixup '(fixup))
-                                      (signed-byte 16)) si))
+                                      (unsigned-byte 16) (signed-byte 16)) 
+                                  si))
                    (:printer d-si ((op ,op)))
                    (:delay ,cost)
                    (:cost ,cost)
index de583e5..00ff6af 100644 (file)
   (assert (= (gcd 0 x) (abs x))))
 ;;; LCM returns a non-negative number
 (assert (= (lcm 4 -10) 20))
+
+;;; PPC bignum arithmetic bug:
+(multiple-value-bind (quo rem)
+    (truncate 291351647815394962053040658028983955 10000000000000000000000000)
+  (assert (= quo 29135164781))
+  (assert (= rem 5394962053040658028983955)))
index 9d398ae..cefce68 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.8.3.44"
+"0.8.3.45"