summaryrefslogtreecommitdiffstats
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
commitb920c143c893dc029c37d511f4270110ba07c17c (patch)
treeca442d73004e6966f4574cd0d5255d33390af878
parent79b0b1e78501f66f5c3d08133d15a1e0fbeb5de1 (diff)
downloadtxr-b920c143c893dc029c37d511f4270110ba07c17c.tar.gz
txr-b920c143c893dc029c37d511f4270110ba07c17c.tar.bz2
txr-b920c143c893dc029c37d511f4270110ba07c17c.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.
-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)))