From 89cca90ae60dbaeaaa17cca714f842dc71713981 Mon Sep 17 00:00:00 2001 From: Mark Friedman Date: Fri, 28 Oct 1988 17:47:53 +0000 Subject: [PATCH] Fixed bug when multiplying a number by itself. --- v7/src/compiler/machines/bobcat/lapgen.scm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/v7/src/compiler/machines/bobcat/lapgen.scm b/v7/src/compiler/machines/bobcat/lapgen.scm index 638c79cbc..85d1aa446 100644 --- a/v7/src/compiler/machines/bobcat/lapgen.scm +++ b/v7/src/compiler/machines/bobcat/lapgen.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/lapgen.scm,v 4.12 1988/10/20 16:19:58 markf Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/compiler/machines/bobcat/lapgen.scm,v 4.13 1988/10/28 17:47:53 markf Exp $ Copyright (c) 1988 Massachusetts Institute of Technology @@ -430,9 +430,19 @@ MIT in each case. |# (define-fixnum-method 'MULTIPLY-FIXNUM fixnum-methods/2-args (lambda (target source) - (LAP - (AS R L (& 8) ,target) - (MUL S L ,source ,target)))) + (if (equal? target source) + (let ((new-source (reference-temporary-register! 'DATA))) + ;;; I should add new-source as an alias for source, but I + ;;; don't have a handle on the actual register here (I just + ;;; have the register-reference). Maybe this should be + ;;; moved into the rules. + (LAP + (MOV L ,source ,new-source) + (AS R L (& 8) ,target) + (MUL S L ,new-source ,target))) + (LAP + (AS R L (& 8) ,target) + (MUL S L ,source ,target))))) (define-fixnum-method 'MULTIPLY-FIXNUM fixnum-methods/2-args-constant (lambda (target n) -- 2.25.1