Raymond Toy pushed to branch master at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/compiler/x86/array.lisp
    --- a/src/compiler/x86/array.lisp
    +++ b/src/compiler/x86/array.lisp
    @@ -288,9 +288,10 @@
     	       (unsigned-reg
     		(let ((shift (* extra ,bits)))
     		  (unless (zerop shift)
    -		    (inst ror old shift)
    -		    (inst and old (lognot ,(1- (ash 1 bits))))
    -		    (inst or old value)
    +		    (inst ror old shift))
    +		  (inst and old (lognot ,(1- (ash 1 bits))))
    +		  (inst or old value)
    +		  (unless (zerop shift)
     		    (inst rol old shift)))))
     	     (inst mov (make-ea :dword :base object
     				:disp (- (* (+ word vector-data-offset) word-bytes)
    

  • tests/issues.lisp
    --- a/tests/issues.lisp
    +++ b/tests/issues.lisp
    @@ -119,3 +119,84 @@
     		(let ((z (list 1 2)))
     		  (flet ((frob (x) (cdr x)))
     		    (xpop (frob z))))))
    +
    +(define-test issue.10-unsigned-byte-4
    +    (:tag :issues)
    +  (macrolet
    +      ((compiled-test-function (constant-index)
    +	 ;; Compile the test function from the issue.
    +	 (compile nil `(lambda (v x)
    +			 (declare (type (integer 0 5) v)
    +				  (optimize (safety 0)))
    +			 (setf (aref (the (simple-array (integer 0 5) (1)) x)
    +				     ,constant-index)
    +			       (the (integer 0 5) v))
    +			 x)))
    +       (make-tests ()
    +	 ;; Create a set of tests for a set of fixed constant indices,
    +	 ;; one test for each constant index from 0 to 15.
    +	 (let (tests)
    +	   (dotimes (k 16)
    +	     (push 
    +	      `(assert-equal 1
    +			     (aref (funcall (compiled-test-function ,k)
    +					    1
    +					    (make-array 16 :element-type '(integer 0 5) :initial-element 0))
    +				   ,k))
    +	      tests))
    +	   `(progn ,@(nreverse tests)))))
    +    (make-tests)))
    +
    +(define-test issue.10-unsigned-byte-2
    +    (:tag :issues)
    +  (macrolet
    +      ((compiled-test-function (constant-index)
    +	 ;; Compile the test function from the issue.
    +	 (compile nil `(lambda (v x)
    +			 (declare (type (integer 0 2) v)
    +				  (optimize (safety 0)))
    +			 (setf (aref (the (simple-array (integer 0 2) (1)) x)
    +				     ,constant-index)
    +			       (the (integer 0 2) v))
    +			 x)))
    +       (make-tests ()
    +	 ;; Create a set of tests for a set of fixed constant indices,
    +	 ;; one test for each constant index from 0 to 31.
    +	 (let (tests)
    +	   (dotimes (k 32)
    +	     (push 
    +	      `(assert-equal 1
    +			     (aref (funcall (compiled-test-function ,k)
    +					    1
    +					    (make-array 32 :element-type '(integer 0 2) :initial-element 0))
    +				   ,k))
    +	      tests))
    +	   `(progn ,@(nreverse tests)))))
    +    (make-tests)))
    +
    +(define-test issue.10-unsigned-byte-1
    +    (:tag :issues)
    +  (macrolet
    +      ((compiled-test-function (constant-index)
    +	 ;; Compile the test function from the issue.
    +	 (compile nil `(lambda (v x)
    +			 (declare (type (integer 0 1) v)
    +				  (optimize (safety 0)))
    +			 (setf (aref (the (simple-array (integer 0 1) (1)) x)
    +				     ,constant-index)
    +			       (the (integer 0 1) v))
    +			 x)))
    +       (make-tests ()
    +	 ;; Create a set of tests for a set of fixed constant indices,
    +	 ;; one test for each constant index from 0 to 31.
    +	 (let (tests)
    +	   (dotimes (k 64)
    +	     (push 
    +	      `(assert-equal 1
    +			     (aref (funcall (compiled-test-function ,k)
    +					    1
    +					    (make-array 64 :element-type '(integer 0 1) :initial-element 0))
    +				   ,k))
    +	      tests))
    +	   `(progn ,@(nreverse tests)))))
    +    (make-tests)))