<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/7a1457da0f9169bcd0007a7ac8f8028b021c004b">7a1457da</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-11T19:25:30Z</i>
</div>
<pre class='commit-message'>New implementation of the digit shifters.
Define new vops for the digit shifters that take a constant
(unsigned-byte 5) value. The previous version, while correct, still
causes the ecx register to spill because it was a temporary. This
doens't cause the compiler to spill ecx unnecessarily anymore.</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/7a1457da0f9169bcd0007a7ac8f8028b021c004b#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">@@ -1445,7 +1445,7 @@
</span> (:translate bignum::%ashr)
(:policy :fast-safe)
(:args (digit :scs (unsigned-reg unsigned-stack) :target result)
<span style="color: #000000;background-color: #ffdddd">- (count :scs (unsigned-reg immediate)))
</span><span style="color: #000000;background-color: #ddffdd">+ (count :scs (unsigned-reg)))
</span> (:arg-types unsigned-num positive-fixnum)
(:temporary (:sc unsigned-reg :offset ecx-offset :from (:argument 1)) ecx)
(:results (result :scs (unsigned-reg) :from (:argument 0)
<span style="color: #aaaaaa">@@ -1454,53 +1454,52 @@
</span> (:result-types unsigned-num)
(:generator 2
(move result digit)
<span style="color: #000000;background-color: #ffdddd">- (sc-case count
- (unsigned-reg
- (move ecx count)
- (inst sar result :cl))
- (immediate
- (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><span style="color: #000000;background-color: #ddffdd">+ (move ecx count)
+ (inst sar result :cl)))
+
+(define-vop (digit-ashr-c)
+ (:translate bignum::%ashr)
+ (:policy :fast-safe)
+ (:args (digit :scs (unsigned-reg unsigned-stack) :target result))
+ (:info count)
+ (:arg-types unsigned-num (:constant (unsigned-byte #.(1- (integer-length vm:word-bits)))))
+ (:results (result :scs (unsigned-reg) :from (:argument 0)
+ :load-if (not (and (sc-is result unsigned-stack)
+ (location= digit result)))))
+ (:result-types unsigned-num)
+ (:generator 1
+ (move result digit)
+ ;; If the count is greater than 31, it's the same as
+ ;; shifting by 31, leaving just the sign bit.
+ (inst sar result count)))
</span>
(define-vop (digit-lshr digit-ashr)
(:translate bignum::%digit-logical-shift-right)
(:generator 2
<span style="color: #000000;background-color: #ffdddd">- (sc-case count
- (unsigned-reg
- (move result digit)
- (move ecx count)
- (inst shr result :cl))
- (immediate
- (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><span style="color: #000000;background-color: #ddffdd">+ (move result digit)
+ (move ecx count)
+ (inst shr result :cl)))
+
+(define-vop (digit-lshr-c digit-ashr-c)
+ (:translate bignum::%digit-logical-shift-right)
+ (:generator 1
+ (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">- (sc-case count
- (unsigned-reg
- (move result digit)
- (move ecx count)
- (inst shl result :cl))
- (immediate
- (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><span style="color: #000000;background-color: #ddffdd">+ (move result digit)
+ (move ecx count)
+ (inst shl result :cl)))
+
+(define-vop (digit-ashl-c digit-ashr-c)
+ (:translate bignum::%ashl)
+ (:generator 1
+ (move result digit)
+ (inst shl result count)))
+
+
</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/7a1457da0f9169bcd0007a7ac8f8028b021c004b">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/7a1457da0f9169bcd0007a7ac8f8028b021c004b"}}</script>
</p>
</div>
</body>
</html>