summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-28 21:56:45 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-28 21:56:45 -0700
commit5461d44208db295ea0b43f308d295aaf6c340459 (patch)
treeca442d73004e6966f4574cd0d5255d33390af878 /share
parent126ea8accfe3d5e9c06e34e5c40f22a0fbe2c53f (diff)
downloadtxr-5461d44208db295ea0b43f308d295aaf6c340459.tar.gz
txr-5461d44208db295ea0b43f308d295aaf6c340459.tar.bz2
txr-5461d44208db295ea0b43f308d295aaf6c340459.zip
compiler: bugfix: wrong immediate op width calculation.
* share/txr/stdlib/compiler.tl (compiler comp-atom): The calculation which determines whether an integer operand fits into an immediate move instruction is incorrect. The width function doesn't include a sign bit, so that must be counted. Also, the immediate operand includes a two bit type tag: thus we are off by three.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/compiler.tl2
1 files changed, 1 insertions, 1 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 572cb396..886cad47 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -340,7 +340,7 @@
(cond
((null form) (new (frag '(t 0) nil)))
((or (and (integerp form)
- (< (width form) %imm-width%))
+ (<= (width form) (- %imm-width% 3)))
(chrp form))
(new (frag oreg ^((movi ,oreg ,form)))))
(t (let ((dreg me.(get-dreg form)))