X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Farith.pure.lisp;h=32cff239e38d544a2004eb0bd9616409f95b1179;hb=5fca28334e00c7e1ad159924ac2db4a3e1c9e354;hp=3b1b86c5c9ac6c94a75f1826414fcb5d499749e2;hpb=b111015a7111501231c7b61990c61c046392796b;p=sbcl.git diff --git a/tests/arith.pure.lisp b/tests/arith.pure.lisp index 3b1b86c..32cff23 100644 --- a/tests/arith.pure.lisp +++ b/tests/arith.pure.lisp @@ -598,3 +598,33 @@ (logand 8459622733968096971 x))) 12417237222845306758) 2612793697039849090))) + +;; Also reported by Eric Marsden on sbcl-devel (2013-06-06) +(with-test (:name :more-recursive-cut-to-width) + (assert (eql (funcall + (compile nil `(lambda (a b) + (declare (optimize (speed 2) (safety 0))) + (logand (the (eql 16779072918521075607) a) + (the (integer 21371810342718833225 21371810343571293860) b)))) + 16779072918521075607 21371810342718833263) + 2923729245085762055))) + +(with-test (:name :complicated-logand-identity) + (loop for k from -8 upto 8 do + (loop for min from -16 upto 16 do + (loop for max from min upto 16 do + (let ((f (compile nil `(lambda (x) + (declare (type (integer ,min ,max) x)) + (logand x ,k))))) + (loop for x from min upto max do + (assert (eql (logand x k) (funcall f x))))))))) + +(with-test (:name :complicated-logior-identity) + (loop for k from -8 upto 8 do + (loop for min from -16 upto 16 do + (loop for max from min upto 16 do + (let ((f (compile nil `(lambda (x) + (declare (type (integer ,min ,max) x)) + (logior x ,k))))) + (loop for x from min upto max do + (assert (eql (logior x k) (funcall f x)))))))))