Fixed bug when multiplying a number by itself.
authorMark Friedman <edu/mit/csail/zurich/markf>
Fri, 28 Oct 1988 17:47:53 +0000 (17:47 +0000)
committerMark Friedman <edu/mit/csail/zurich/markf>
Fri, 28 Oct 1988 17:47:53 +0000 (17:47 +0000)
v7/src/compiler/machines/bobcat/lapgen.scm

index 638c79cbcdeb550f305e6ce797e67150461e5a9c..85d1aa4460786c88f98661f790a83fc7d9f9e9da 100644 (file)
@@ -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)