<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
  img {
    max-width: 100%;
    height: auto;
  }
  p.details {
    font-style:italic;
    color:#777
  }
  .footer p {
    font-size:small;
    color:#777
  }
  pre.commit-message {
    white-space: pre-wrap;
  }
  .file-stats a {
    text-decoration: none;
  }
  .file-stats .new-file {
    color: #090;
  }
  .file-stats .deleted-file {
    color: #B00;
  }
</style>
<body>
<div class='content'>
<h3>Raymond Toy pushed to branch master at <a href="https://gitlab.common-lisp.net/cmucl/cmucl">cmucl / cmucl</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/3c373507f33ea6c854eec7058ceb0ef895ade913">3c373507</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-10-16T21:33:50Z</i>
</div>
<pre class='commit-message'>Fix data-vector-set-c for unsigned-byte 1, 2, and 4

For simple-arrays of 1, 2, or 4-bit elements, data-vector-set-c was
incorrectly merging the new value into the array when the index is a
multiple of the number of elements per (32-bit) word.  Thus, for 4-bit
elements, the new value was not merged in when the index is a multiple
of 8.  In these cases, there's no need to shift the array value or the
new value to move them into the correct place.  When the shift is
zero, the code accidentally removed the part that merges in the new
value.

Fix #10.</pre>
</li>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/b239ce3f44b62821701e3447437705d3d914a5b4">b239ce3f</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-10-16T21:35:16Z</i>
</div>
<pre class='commit-message'>Add tests for issue #10.

Covers 1, 2, and 4-bit arrays.

Manually verified that the cmucl 21a fails these tests, as expected,
when the index is a multiple of the number of elements per 32-bit
word.</pre>
</li>
</ul>
<h4>2 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/compiler/x86/array.lisp
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
tests/issues.lisp
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/704b1ae0c0a023bf315a9652410a59d2bd8f375b...b239ce3f44b62821701e3447437705d3d914a5b4#diff-0'>
<strong>
src/compiler/x86/array.lisp
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/compiler/x86/array.lisp
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/compiler/x86/array.lisp
</span><span style="color: #aaaaaa">@@ -288,9 +288,10 @@
</span>          (unsigned-reg
                (let ((shift (* extra ,bits)))
                  (unless (zerop shift)
<span style="color: #000000;background-color: #ffdddd">-                    (inst ror old shift)
-                   (inst and old (lognot ,(1- (ash 1 bits))))
-                   (inst or old value)
</span><span style="color: #000000;background-color: #ddffdd">+               (inst ror old shift))
+                 (inst and old (lognot ,(1- (ash 1 bits))))
+                 (inst or old value)
+                 (unless (zerop shift)
</span>               (inst rol old shift)))))
             (inst mov (make-ea :dword :base object
                                :disp (- (* (+ word vector-data-offset) word-bytes)
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/704b1ae0c0a023bf315a9652410a59d2bd8f375b...b239ce3f44b62821701e3447437705d3d914a5b4#diff-1'>
<strong>
tests/issues.lisp
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/issues.lisp
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/issues.lisp
</span><span style="color: #aaaaaa">@@ -119,3 +119,84 @@
</span>           (let ((z (list 1 2)))
                  (flet ((frob (x) (cdr x)))
                    (xpop (frob z))))))
<span style="color: #000000;background-color: #ddffdd">+
+(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)))
</span></code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://gitlab.common-lisp.net/cmucl/cmucl/compare/704b1ae0c0a023bf315a9652410a59d2bd8f375b...b239ce3f44b62821701e3447437705d3d914a5b4">View it on GitLab</a>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":["merge_requests","issues","commit"],"url":"https://gitlab.common-lisp.net/cmucl/cmucl/compare/704b1ae0c0a023bf315a9652410a59d2bd8f375b...b239ce3f44b62821701e3447437705d3d914a5b4"}}</script>
</p>
</div>
</body>
</html>