X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-rotate-byte%2Frotate-byte-tests.lisp;fp=contrib%2Fsb-rotate-byte%2Frotate-byte-tests.lisp;h=252e06d0590e9b2f29c4f38ac68a2d65ccef2ed9;hb=6df5926c567b40b0217e0cc16fd604197add804f;hp=518f8cbba2cb24ad9a4c10531fc4c55030f458ae;hpb=e29d49125e00509720546382bfc073f7563fddc4;p=sbcl.git diff --git a/contrib/sb-rotate-byte/rotate-byte-tests.lisp b/contrib/sb-rotate-byte/rotate-byte-tests.lisp index 518f8cb..252e06d 100644 --- a/contrib/sb-rotate-byte/rotate-byte-tests.lisp +++ b/contrib/sb-rotate-byte/rotate-byte-tests.lisp @@ -51,3 +51,17 @@ (assert (= (ub32 5 1) 32)) (assert (= (ub32 5 (ash 1 26)) (ash 1 31))) (assert (= (ub32 5 (ash 1 27)) 1)) + +;;; test with (contrived) register pressure on the x86 to ensure that the +;;; rotatee doesn't get clobbered by the count. + +(defun ub32-reg-pressure (count integer) + (declare (type (unsigned-byte 32) integer) + (type (integer -31 31) count)) + (rotate-byte count (byte 32 0) (ldb (byte 32 0) (+ (* 67 count) + integer)))) + +(assert (= (ub32-reg-pressure 1 5) 144)) +(assert (= (ub32-reg-pressure 5 5) 10880)) +(assert (= (ub32-reg-pressure 5 (ash 1 26)) 2147494368)) +(assert (= (ub32-reg-pressure 5 (ash 1 27)) 10721))