* bug fix: ROUND and TRUNCATE could, under certain circumstances on
the PPC platform, lead to stack corruption; this has been fixed.
(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)
* 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.
(:effects)
(:affected))
-
(define-vop (fixnum-unop fast-safe-arith-op)
(:args (x :scs (any-reg)))
(:results (res :scs (any-reg)))
(:translate lognot)
(:generator 1
(inst not res x)))
-
-
\f
;;;; Binary fixnum operations.
(:result-types signed-num)
(:note "inline (signed-byte 32) arithmetic"))
-
(define-vop (fast-fixnum-binop-c fast-safe-arith-op)
(:args (x :target r :scs (any-reg zero)))
(:info y)
(inst cmpwi ndesc 31)
(inst srw result number ndesc)
(inst ble done)
- (inst srwi result number 31)
+ (move result zero-tn)
(inst b done)
(emit-label positive)
(inst slw result number amount)
(emit-label done)))
-
(immediate
(let ((amount (tn-value amount)))
- (if (minusp amount)
- (let ((amount (min 31 (- amount))))
- (inst srwi result number amount))
- (inst slwi result number amount)))))))
-
+ (cond
+ ((and (minusp amount) (< amount -31)) (move result zero-tn))
+ ((minusp amount) (inst srwi result number (- amount)))
+ (t (inst slwi result number amount))))))))
(define-vop (fast-ash/signed=>signed)
(:note "inline ASH")
(assert (= (compiled-logxor -6) -6))
(assert (raises-error? (coerce (expt 10 1000) 'single-float) type-error))
+\f
+(defun are-we-getting-ash-right (x y)
+ (declare (optimize speed)
+ (type (unsigned-byte 32) x)
+ (type (integer -40 0) y))
+ (ash x y))
+(defun what-about-with-constants (x)
+ (declare (optimize speed) (type (unsigned-byte 32) x))
+ (ash x -32))
+
+(dotimes (i 41)
+ (assert (= (are-we-getting-ash-right (1- (ash 1 32)) (- i))
+ (if (< i 32)
+ (1- (ash 1 (- 32 i)))
+ 0))))
+
+(assert (= (what-about-with-constants (1- (ash 1 32))) 0))
+
+(defun one-more-test-case-to-catch-sparc (x y)
+ (declare (optimize speed (safety 0))
+ (type (unsigned-byte 32) x) (type (integer -40 2) y))
+ (the (unsigned-byte 32) (ash x y)))
+
+(assert (= (one-more-test-case-to-catch-sparc (1- (ash 1 32)) -40) 0))
+\f
(sb-ext:quit :unix-status 104)
;;; 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.30"
+"0.8.3.31"