<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/1b8b84be82ebb9fb86ddd5159c7a36067ee27257">1b8b84be</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-01T21:41:49Z</i>
</div>
<pre class='commit-message'>Handle large (fixed) shift amounts for the digit shifters.
Make the vops handle the case when the known constant shift amount is
so large that the result is a known value. Plus, the instructions
have a fixed immediate argument size and the amount is taken mod 32
which would produce the wrong result if the actual shift amount were
used.</pre>
</li>
</ul>
<h4>1 changed file:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/compiler/x86/arith.lisp
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/commit/1b8b84be82ebb9fb86ddd5159c7a36067ee27257#diff-0'>
<strong>
src/compiler/x86/arith.lisp
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/compiler/x86/arith.lisp
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/compiler/x86/arith.lisp
</span><span style="color: #aaaaaa">@@ -1459,29 +1459,48 @@
</span> (move ecx count)
(inst sar result :cl))
(immediate
<span style="color: #000000;background-color: #ffdddd">- (inst sar result (tn-value count))))))
</span><span style="color: #000000;background-color: #ddffdd">+ (let ((amount (tn-value count)))
+ ;; If the amount is greater than 31, it's the same as
+ ;; shifting by 31, leaving just the sign bit.
+ (inst sar result (if (>= amount vm:word-bits)
+ (1- vm:word-bits)
+ amount)))))))
</span>
(define-vop (digit-lshr digit-ashr)
(:translate bignum::%digit-logical-shift-right)
(:generator 2
<span style="color: #000000;background-color: #ffdddd">- (move result digit)
</span> (sc-case count
(unsigned-reg
<span style="color: #000000;background-color: #ddffdd">+ (move result digit)
</span> (move ecx count)
(inst shr result :cl))
(immediate
<span style="color: #000000;background-color: #ffdddd">- (inst shr result (tn-value count))))))
</span><span style="color: #000000;background-color: #ddffdd">+ (let ((amount (tn-value count)))
+ ;; If the amount is greater than 31, the result is 0 because
+ ;; all the bits get shifted right and out.
+ (cond ((>= amount vm:word-bits)
+ (inst mov result 0))
+ (t
+ (move result digit)
+ (inst shr result count))))))))
</span>
(define-vop (digit-ashl digit-ashr)
(:translate bignum::%ashl)
(:generator 2
<span style="color: #000000;background-color: #ffdddd">- (move result digit)
</span> (sc-case count
(unsigned-reg
<span style="color: #000000;background-color: #ddffdd">+ (move result digit)
</span> (move ecx count)
(inst shl result :cl))
(immediate
<span style="color: #000000;background-color: #ffdddd">- (inst shl result (tn-value count))))))
</span><span style="color: #000000;background-color: #ddffdd">+ (let ((amount (tn-value count)))
+ ;; If the amount is greater than 31, the result is 0 because
+ ;; all the bits get shifted left and out.
+ (cond ((>= amount vm:word-bits)
+ (inst mov result 0))
+ (t
+ (move result digit)
+ (inst shl result amount))))))))
</span>
;;;; Static functions.
</code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/1b8b84be82ebb9fb86ddd5159c7a36067ee27257">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.common-lisp.net.
If you'd like to receive fewer emails, you can adjust your notification settings.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://gitlab.common-lisp.net/cmucl/cmucl/commit/1b8b84be82ebb9fb86ddd5159c7a36067ee27257"}}</script>
</p>
</div>
</body>
</html>