From b920c143c893dc029c37d511f4270110ba07c17c Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 28 Apr 2018 21:56:45 -0700 Subject: 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. --- share/txr/stdlib/compiler.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))) -- cgit v1.2.3