From 8b6626faeca6b41a0c7aacb5293c54d115cec154 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Wed, 8 Feb 2006 19:19:28 +0000 Subject: [PATCH] 0.9.9.23: More fixes courtesy of PFD's ansi-tests: ...%LOGBITP had its arglist reversed. Oops; ...be more proactive in declaring the types of constant arguments in the %LOGBITP VOPs to avoid bogosity. --- src/compiler/ppc/arith.lisp | 5 ++++- src/compiler/x86/arith.lisp | 6 ++++-- tests/compiler.pure.lisp | 22 ++++++++++++++++++++++ version.lisp-expr | 2 +- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/compiler/ppc/arith.lisp b/src/compiler/ppc/arith.lisp index c8f1eae..a0288fb 100644 --- a/src/compiler/ppc/arith.lisp +++ b/src/compiler/ppc/arith.lisp @@ -832,7 +832,7 @@ (defknown %logbitp (integer unsigned-byte) boolean (movable foldable flushable)) -(defun %logbitp (index integer) +(defun %logbitp (integer index) (logbitp index integer)) ;;; We only handle the constant cases because those are the only ones @@ -840,6 +840,7 @@ ;;; --njf, 06-02-2006 (define-vop (fast-logbitp-c/fixnum fast-conditional-c/fixnum) (:translate %logbitp) + (:arg-types tagged-num (:constant (integer 0 29))) (:temporary (:scs (any-reg) :to (:result 0)) test) (:generator 4 (if (< y 14) @@ -849,6 +850,7 @@ (define-vop (fast-logbitp-c/signed fast-conditional-c/signed) (:translate %logbitp) + (:arg-types signed-num (:constant (integer 0 31))) (:temporary (:scs (signed-reg) :to (:result 0)) test) (:generator 4 (if (< y 16) @@ -858,6 +860,7 @@ (define-vop (fast-logbitp-c/unsigned fast-conditional-c/unsigned) (:translate %logbitp) + (:arg-types unsigned-num (:constant (integer 0 31))) (:temporary (:scs (unsigned-reg) :to (:result 0)) test) (:generator 4 (if (< y 16) diff --git a/src/compiler/x86/arith.lisp b/src/compiler/x86/arith.lisp index 3c08693..3910de9 100644 --- a/src/compiler/x86/arith.lisp +++ b/src/compiler/x86/arith.lisp @@ -1059,14 +1059,14 @@ (defknown %logbitp (integer unsigned-byte) boolean (movable foldable flushable)) -(defun %logbitp (index integer) +(defun %logbitp (integer index) (logbitp index integer)) ;;; too much work to do the non-constant case (maybe?) (define-vop (fast-logbitp-c/fixnum fast-conditional-c/fixnum) (:translate %logbitp) + (:arg-types tagged-num (:constant (integer 0 29))) (:generator 4 - (aver (<= y 29)) (inst bt x (+ y n-fixnum-tag-bits)) (inst jmp (if not-p :nc :c) target))) @@ -1078,6 +1078,7 @@ (define-vop (fast-logbitp-c/signed fast-conditional-c/signed) (:translate %logbitp) + (:arg-types signed-num (:constant (integer 0 31))) (:generator 5 (inst bt x y) (inst jmp (if not-p :nc :c) target))) @@ -1090,6 +1091,7 @@ (define-vop (fast-logbitp-c/unsigned fast-conditional-c/unsigned) (:translate %logbitp) + (:arg-types unsigned-num (:constant (integer 0 31))) (:generator 5 (inst bt x y) (inst jmp (if not-p :nc :c) target))) diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index f5652e7..e68cfe0 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -1955,3 +1955,25 @@ (%f3 0 a)))) 0))) 22))) + +;;; MISC.626: bandaged AVER was still wrong +(assert (eql -829253 + (funcall + (compile + nil + '(lambda (a) + (declare (type (integer -902970 2) a)) + (declare (optimize (space 2) (debug 0) (compilation-speed 1) + (speed 0) (safety 3))) + (prog2 (if (logbitp 30 a) 0 (block b3 0)) a))) + -829253))) + +;; MISC.628: constant-folding %LOGBITP was buggy +(assert (eql t + (funcall + (compile + nil + '(lambda () + (declare (optimize (safety 3) (space 3) (compilation-speed 3) + (speed 0) (debug 1))) + (not (not (logbitp 0 (floor 2147483651 (min -23 0)))))))))) diff --git a/version.lisp-expr b/version.lisp-expr index 561ef7a..d37beec 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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.9.9.22" +"0.9.9.23" -- 1.7.10.4