X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fcompiler.pure.lisp;h=cadd0b07358dc2978b012fe9005b08af59903c66;hb=8902b8b6bd2e9285749dd39d313b33b6c69c5213;hp=ae0fe96f8494b6fd9f98f40dab9c3c5fed940009;hpb=a2e72ddcfa3308ed7eb02c7b1bdfe3120d71b423;p=sbcl.git diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index ae0fe96..cadd0b0 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -1413,3 +1413,30 @@ (frob nil (defgeneric #:foo (x &optional y z))) (frob nil (defgeneric #:foo (x &key y z))) (frob t (defun #:foo (x) (flet ((foo (x &optional y &key z) (list x y z))) (foo x x :z x))))) + +;;; this was a bug in the LOGXOR type deriver. The top form gave a +;;; note, because the system failed to derive the fact that the return +;;; from LOGXOR was small and negative, though the bottom one worked. +(handler-bind ((sb-ext:compiler-note #'error)) + (compile nil '(lambda () + (declare (optimize speed (safety 0))) + (lambda (x y) + (declare (type (integer 3 6) x) + (type (integer -6 -3) y)) + (+ (logxor x y) most-positive-fixnum))))) +(handler-bind ((sb-ext:compiler-note #'error)) + (compile nil '(lambda () + (declare (optimize speed (safety 0))) + (lambda (x y) + (declare (type (integer 3 6) y) + (type (integer -6 -3) x)) + (+ (logxor x y) most-positive-fixnum))))) + +;;; check that modular ash gives the right answer, to protect against +;;; possible misunderstandings about the hardware shift instruction. +(assert (zerop (funcall + (compile nil '(lambda (x y) + (declare (optimize speed) + (type (unsigned-byte 32) x y)) + (logand #xffffffff (ash x y)))) + 1 257)))