From c4f8aab819ddba72f1b89cc3e5f3688ee502e73d Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Sat, 17 Jan 1998 05:47:18 +0000
Subject: [PATCH] Fix some recently introduced calls to sc-or-lose which were
 using the default *target-backend* rather than the *backend*, breaking the
 cross compiler.

---
 compiler/x86/array.lisp     |  92 +++++++---------------
 compiler/x86/float.lisp     | 148 ++++++++++++++----------------------
 compiler/x86/type-vops.lisp |   8 +-
 3 files changed, 89 insertions(+), 159 deletions(-)

diff --git a/compiler/x86/array.lisp b/compiler/x86/array.lisp
index 45f205a05..f886bb28c 100644
--- a/compiler/x86/array.lisp
+++ b/compiler/x86/array.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
- "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/array.lisp,v 1.9 1997/11/19 03:00:33 dtc Exp $")
+ "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/array.lisp,v 1.10 1998/01/17 05:47:17 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -16,7 +16,7 @@
 ;;; Written by William Lott
 ;;;
 ;;; Debugged by Paul F. Werkowski Spring/Summer 1995.
-;;; Enhancements/debugging by Douglas T. Crosher 1996,1997.
+;;; Enhancements/debugging by Douglas T. Crosher 1996,1997,1998.
 ;;;
 (in-package :x86)
 
@@ -502,14 +502,12 @@
   (:results (value :scs (complex-single-reg)))
   (:result-types complex-single-float)
   (:generator 5
-    (let ((real-tn (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-				   :offset (tn-offset value))))
+    (let ((real-tn (complex-single-reg-real-tn value)))
       (with-empty-tn@fp-top (real-tn)
 	(inst fld (make-ea :dword :base object :index index :scale 2
 			   :disp (- (* vm:vector-data-offset vm:word-bytes)
 				    vm:other-pointer-type)))))
-    (let ((imag-tn (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-				   :offset (1+ (tn-offset value)))))
+    (let ((imag-tn (complex-single-reg-imag-tn value)))
       (with-empty-tn@fp-top (imag-tn)
 	(inst fld (make-ea :dword :base object :index index :scale 2
 			   :disp (- (* (1+ vm:vector-data-offset)
@@ -526,15 +524,13 @@
   (:results (value :scs (complex-single-reg)))
   (:result-types complex-single-float)
   (:generator 4
-    (let ((real-tn (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-				   :offset (tn-offset value))))
+    (let ((real-tn (complex-single-reg-real-tn value)))
       (with-empty-tn@fp-top (real-tn)
 	(inst fld (make-ea :dword :base object
 			   :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
 				       (* 8 index))
 				    vm:other-pointer-type)))))
-    (let ((imag-tn (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-				   :offset (1+ (tn-offset value)))))
+    (let ((imag-tn (complex-single-reg-imag-tn value)))
       (with-empty-tn@fp-top (imag-tn)
 	(inst fld (make-ea :dword :base object
 			   :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
@@ -553,12 +549,8 @@
   (:results (result :scs (complex-single-reg)))
   (:result-types complex-single-float)
   (:generator 5
-    (let ((value-real
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-			   :offset (tn-offset value)))
-	  (result-real
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-			   :offset (tn-offset result))))
+    (let ((value-real (complex-single-reg-real-tn value))
+	  (result-real (complex-single-reg-real-tn result)))
       (cond ((zerop (tn-offset value-real))
 	     ;; Value is in ST0
 	     (inst fst (make-ea :dword :base object :index index :scale 2
@@ -583,12 +575,8 @@
 		    (unless (location= value-real result-real)
 		      (inst fst result-real))
 		    (inst fxch value-real))))))
-    (let ((value-imag
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-			   :offset (1+ (tn-offset value))))
-	  (result-imag
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-			   :offset (1+ (tn-offset result)))))
+    (let ((value-imag (complex-single-reg-imag-tn value))
+	  (result-imag (complex-single-reg-imag-tn result)))
       (inst fxch value-imag)
       (inst fst (make-ea :dword :base object :index index :scale 2
 			 :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
@@ -610,12 +598,8 @@
   (:results (result :scs (complex-single-reg)))
   (:result-types complex-single-float)
   (:generator 4
-    (let ((value-real
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-			   :offset (tn-offset value)))
-	  (result-real
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-			   :offset (tn-offset result))))
+    (let ((value-real (complex-single-reg-real-tn value))
+	  (result-real (complex-single-reg-real-tn result)))
       (cond ((zerop (tn-offset value-real))
 	     ;; Value is in ST0
 	     (inst fst (make-ea :dword :base object
@@ -642,12 +626,8 @@
 		    (unless (location= value-real result-real)
 		      (inst fst result-real))
 		    (inst fxch value-real))))))
-    (let ((value-imag
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-			   :offset (1+ (tn-offset value))))
-	  (result-imag
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-			   :offset (1+ (tn-offset result)))))
+    (let ((value-imag (complex-single-reg-imag-tn value))
+	  (result-imag (complex-single-reg-imag-tn result)))
       (inst fxch value-imag)
       (inst fst (make-ea :dword :base object
 			 :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
@@ -668,14 +648,12 @@
   (:results (value :scs (complex-double-reg)))
   (:result-types complex-double-float)
   (:generator 7
-    (let ((real-tn (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				   :offset (tn-offset value))))
+    (let ((real-tn (complex-double-reg-real-tn value)))
       (with-empty-tn@fp-top (real-tn)
 	(inst fldd (make-ea :dword :base object :index index :scale 4
 			    :disp (- (* vm:vector-data-offset vm:word-bytes)
 				     vm:other-pointer-type)))))
-    (let ((imag-tn (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				   :offset (1+ (tn-offset value)))))
+    (let ((imag-tn (complex-double-reg-imag-tn value)))
       (with-empty-tn@fp-top (imag-tn)
 	(inst fldd (make-ea :dword :base object :index index :scale 4
 			    :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
@@ -692,15 +670,13 @@
   (:results (value :scs (complex-double-reg)))
   (:result-types complex-double-float)
   (:generator 6
-    (let ((real-tn (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				   :offset (tn-offset value))))
+    (let ((real-tn (complex-double-reg-real-tn value)))
       (with-empty-tn@fp-top (real-tn)
 	(inst fldd (make-ea :dword :base object
 			    :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
 					(* 16 index))
 				     vm:other-pointer-type)))))
-    (let ((imag-tn (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				   :offset (1+ (tn-offset value)))))
+    (let ((imag-tn (complex-double-reg-imag-tn value)))
       (with-empty-tn@fp-top (imag-tn)
 	(inst fldd (make-ea :dword :base object
 			    :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
@@ -719,12 +695,8 @@
   (:results (result :scs (complex-double-reg)))
   (:result-types complex-double-float)
   (:generator 20
-    (let ((value-real
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-			   :offset (tn-offset value)))
-	  (result-real
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-			   :offset (tn-offset result))))
+    (let ((value-real (complex-double-reg-real-tn value))
+	  (result-real (complex-double-reg-real-tn result)))
       (cond ((zerop (tn-offset value-real))
 	     ;; Value is in ST0
 	     (inst fstd (make-ea :dword :base object :index index :scale 4
@@ -749,12 +721,8 @@
 		    (unless (location= value-real result-real)
 		      (inst fstd result-real))
 		    (inst fxch value-real))))))
-    (let ((value-imag
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-			   :offset (1+ (tn-offset value))))
-	  (result-imag
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-			   :offset (1+ (tn-offset result)))))
+    (let ((value-imag (complex-double-reg-imag-tn value))
+	  (result-imag (complex-double-reg-imag-tn result)))
       (inst fxch value-imag)
       (inst fstd (make-ea :dword :base object :index index :scale 4
 			  :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
@@ -776,12 +744,8 @@
   (:results (result :scs (complex-double-reg)))
   (:result-types complex-double-float)
   (:generator 19
-    (let ((value-real
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-			   :offset (tn-offset value)))
-	  (result-real
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-			   :offset (tn-offset result))))
+    (let ((value-real (complex-double-reg-real-tn value))
+	  (result-real (complex-double-reg-real-tn result)))
       (cond ((zerop (tn-offset value-real))
 	     ;; Value is in ST0
 	     (inst fstd (make-ea :dword :base object
@@ -808,12 +772,8 @@
 		    (unless (location= value-real result-real)
 		      (inst fstd result-real))
 		    (inst fxch value-real))))))
-    (let ((value-imag
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-			   :offset (1+ (tn-offset value))))
-	  (result-imag
-	   (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-			   :offset (1+ (tn-offset result)))))
+    (let ((value-imag (complex-double-reg-imag-tn value))
+	  (result-imag (complex-double-reg-imag-tn result)))
       (inst fxch value-imag)
       (inst fstd (make-ea :dword :base object
 			  :disp (- (+ (* vm:vector-data-offset vm:word-bytes)
diff --git a/compiler/x86/float.lisp b/compiler/x86/float.lisp
index 3c9f68a1a..f12426917 100644
--- a/compiler/x86/float.lisp
+++ b/compiler/x86/float.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/float.lisp,v 1.19 1998/01/12 16:54:19 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/float.lisp,v 1.20 1998/01/17 05:47:15 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -86,7 +86,7 @@
      (assert (not (zerop (tn-offset ,reg))))
      (inst fstp fr0-tn)
      (inst fld (make-random-tn :kind :normal
-			       :sc (sc-or-lose 'double-reg)
+			       :sc (sc-or-lose 'double-reg *backend*)
 			       :offset (1- (tn-offset ,reg))))))
 ;;;
 ;;; Using Fxch then Fst to restore the original reg contents.
@@ -154,57 +154,63 @@
 #+complex-float
 (progn
 
+(defun complex-single-reg-real-tn (x)
+  (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg *backend*)
+		  :offset (tn-offset x)))
+(defun complex-single-reg-imag-tn (x)
+  (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg *backend*)
+		  :offset (1+ (tn-offset x))))
+
+(defun complex-double-reg-real-tn (x)
+  (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg *backend*)
+		  :offset (tn-offset x)))
+(defun complex-double-reg-imag-tn (x)
+  (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg *backend*)
+		  :offset (1+ (tn-offset x))))
+
 ;;; x is source, y is destination
 (define-move-function (load-complex-single 2) (vop x y)
   ((complex-single-stack) (complex-single-reg))
-  (let ((real-tn (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-				 :offset (tn-offset y))))
+  (let ((real-tn (complex-single-reg-real-tn y)))
     (with-empty-tn@fp-top (real-tn)
       (inst fld (ea-for-csf-real-stack x))))
-  (let ((imag-tn (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-				 :offset (1+ (tn-offset y)))))
+  (let ((imag-tn (complex-single-reg-imag-tn y)))
     (with-empty-tn@fp-top (imag-tn)
       (inst fld (ea-for-csf-imag-stack x)))))
 
 (define-move-function (store-complex-single 2) (vop x y)
   ((complex-single-reg) (complex-single-stack))
-  (let ((real-tn (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-				 :offset (tn-offset x))))
+  (let ((real-tn (complex-single-reg-real-tn x)))
     (cond ((zerop (tn-offset real-tn))
 	   (inst fst (ea-for-csf-real-stack y)))
 	  (t
 	   (inst fxch real-tn)
 	   (inst fst (ea-for-csf-real-stack y))
 	   (inst fxch real-tn))))
-  (let ((imag-tn (make-random-tn :kind :normal :sc (sc-or-lose 'single-reg)
-				 :offset (1+ (tn-offset x)))))
+  (let ((imag-tn (complex-single-reg-imag-tn x)))
     (inst fxch imag-tn)
     (inst fst (ea-for-csf-imag-stack y))
     (inst fxch imag-tn)))
 
 (define-move-function (load-complex-double 2) (vop x y)
   ((complex-double-stack) (complex-double-reg))
-  (let ((real-tn (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				 :offset (tn-offset y))))
+  (let ((real-tn (complex-double-reg-real-tn y)))
     (with-empty-tn@fp-top(real-tn)
       (inst fldd (ea-for-cdf-real-stack x))))
-  (let ((imag-tn (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				 :offset (1+ (tn-offset y)))))
+  (let ((imag-tn (complex-double-reg-imag-tn y)))
     (with-empty-tn@fp-top(imag-tn)
       (inst fldd (ea-for-cdf-imag-stack x)))))
 
 (define-move-function (store-complex-double 2) (vop x y)
   ((complex-double-reg) (complex-double-stack))
-  (let ((real-tn (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				 :offset (tn-offset x))))
+  (let ((real-tn (complex-double-reg-real-tn x)))
     (cond ((zerop (tn-offset real-tn))
 	   (inst fstd (ea-for-cdf-real-stack y)))
 	  (t
 	   (inst fxch real-tn)
 	   (inst fstd (ea-for-cdf-real-stack y))
 	   (inst fxch real-tn))))
-  (let ((imag-tn (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				 :offset (1+ (tn-offset x)))))
+  (let ((imag-tn (complex-double-reg-imag-tn x)))
     (inst fxch imag-tn)
     (inst fstd (ea-for-cdf-imag-stack y))
     (inst fxch imag-tn)))
@@ -254,10 +260,8 @@
      (unless (location= x y)
        ;; Note the complex-float-regs are aligned to every second
        ;; float register so there is not need to worry about overlap.
-       (let ((x-real (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				     :offset (tn-offset x)))
-	     (y-real (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				     :offset (tn-offset y))))
+       (let ((x-real (complex-double-reg-real-tn x))
+	     (y-real (complex-double-reg-real-tn y)))
 	 (cond ((zerop (tn-offset y-real))
 		(copy-fp-reg-to-fr0 x-real))
 	       ((zerop (tn-offset x-real))
@@ -266,10 +270,8 @@
 		(inst fxch x-real)
 		(inst fstd y-real)
 		(inst fxch x-real))))
-       (let ((x-imag (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				     :offset (1+ (tn-offset x))))
-	     (y-imag (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				     :offset (1+ (tn-offset y)))))
+       (let ((x-imag (complex-double-reg-imag-tn x))
+	     (y-imag (complex-double-reg-imag-tn y)))
 	 (inst fxch x-imag)
 	 (inst fstd y-imag)
 	 (inst fxch x-imag)))))
@@ -371,14 +373,10 @@
   (:generator 13
      (with-fixed-allocation (y vm:complex-single-float-type
 			       vm:complex-single-float-size node)
-       (let ((real-tn (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'single-reg)
-				      :offset (tn-offset x))))
+       (let ((real-tn (complex-single-reg-real-tn x)))
 	 (with-tn@fp-top(real-tn)
 	   (inst fst (ea-for-csf-real-desc y))))
-       (let ((imag-tn (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'single-reg)
-				      :offset (1+ (tn-offset x)))))
+       (let ((imag-tn (complex-single-reg-imag-tn x)))
 	 (with-tn@fp-top(imag-tn)
 	   (inst fst (ea-for-csf-imag-desc y)))))))
 (define-move-vop move-from-complex-single :move
@@ -392,14 +390,10 @@
   (:generator 13
      (with-fixed-allocation (y vm:complex-double-float-type
 			       vm:complex-double-float-size node)
-       (let ((real-tn (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
-				      :offset (tn-offset x))))
+       (let ((real-tn (complex-double-reg-real-tn x)))
 	 (with-tn@fp-top(real-tn)
 	   (inst fstd (ea-for-cdf-real-desc y))))
-       (let ((imag-tn (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
-				      :offset (1+ (tn-offset x)))))
+       (let ((imag-tn (complex-double-reg-imag-tn x)))
 	 (with-tn@fp-top(imag-tn)
 	   (inst fstd (ea-for-cdf-imag-desc y)))))))
 (define-move-vop move-from-complex-double :move
@@ -415,17 +409,12 @@
 		  (:results (y :scs (,sc)))
 		  (:note "pointer to complex float coercion")
 		  (:generator 2
-		    (let ((real-tn (make-random-tn :kind :normal
-						   :sc (sc-or-lose 'double-reg)
-						   :offset (tn-offset y))))
+		    (let ((real-tn (complex-double-reg-real-tn y)))
 		      (with-empty-tn@fp-top(real-tn)
 			,@(if double-p
 			      '((inst fldd (ea-for-cdf-real-desc x)))
 			      '((inst fld (ea-for-csf-real-desc x))))))
-		    (let ((imag-tn 
-			   (make-random-tn :kind :normal
-					   :sc (sc-or-lose 'double-reg)
-					   :offset (1+ (tn-offset y)))))
+		    (let ((imag-tn (complex-double-reg-imag-tn y)))
 		      (with-empty-tn@fp-top(imag-tn)
 			,@(if double-p
 			      '((inst fldd (ea-for-cdf-imag-desc x)))
@@ -499,14 +488,8 @@
 		    (sc-case y
 		      (,sc
 		       (unless (location= x y)
-			 (let ((x-real
-				(make-random-tn :kind :normal
-						:sc (sc-or-lose 'double-reg)
-						:offset (tn-offset x)))
-			       (y-real
-				(make-random-tn :kind :normal
-						:sc (sc-or-lose 'double-reg)
-						:offset (tn-offset y))))
+			 (let ((x-real (complex-double-reg-real-tn x))
+			       (y-real (complex-double-reg-real-tn y)))
 			   (cond ((zerop (tn-offset y-real))
 				  (copy-fp-reg-to-fr0 x-real))
 				 ((zerop (tn-offset x-real))
@@ -515,22 +498,13 @@
 				  (inst fxch x-real)
 				  (inst fstd y-real)
 				  (inst fxch x-real))))
-			 (let ((x-imag
-				(make-random-tn :kind :normal
-						:sc (sc-or-lose 'double-reg)
-						:offset (1+ (tn-offset x))))
-			       (y-imag
-				(make-random-tn :kind :normal
-						:sc (sc-or-lose 'double-reg)
-						:offset (1+ (tn-offset y)))))
+			 (let ((x-imag (complex-double-reg-imag-tn x))
+			       (y-imag (complex-double-reg-imag-tn y)))
 			   (inst fxch x-imag)
 			   (inst fstd y-imag)
 			   (inst fxch x-imag))))
 		      (,stack-sc
-		       (let ((real-tn
-			      (make-random-tn :kind :normal
-					      :sc (sc-or-lose 'double-reg)
-					      :offset (tn-offset x))))
+		       (let ((real-tn (complex-double-reg-real-tn x)))
 			 (cond ((zerop (tn-offset real-tn))
 				,@(if double-p
 				      '((inst fstd (ea-for-cdf-real-stack y)))
@@ -541,10 +515,7 @@
 				      '((inst fstd (ea-for-cdf-real-stack y)))
 				      '((inst fst (ea-for-csf-real-stack y))))
 				(inst fxch real-tn))))
-		       (let ((imag-tn
-			      (make-random-tn :kind :normal
-					      :sc (sc-or-lose 'double-reg)
-					      :offset (1+ (tn-offset x)))))
+		       (let ((imag-tn (complex-double-reg-imag-tn x)))
 			 (inst fxch imag-tn)
 			 ,@(if double-p
 			       '((inst fstd (ea-for-cdf-imag-stack y)))
@@ -1717,7 +1688,7 @@
 	(inst fstp fr0)
 	(inst fstp fr0)
 	(inst fldd (make-random-tn :kind :normal
-				   :sc (sc-or-lose 'double-reg)
+				   :sc (sc-or-lose 'double-reg *backend*)
 				   :offset (- (tn-offset x) 2)))))
     (inst fptan)
     ;; Result is in fr1
@@ -1807,7 +1778,7 @@
 	(inst fstp fr0)
 	(inst fstp fr0)
 	(inst fldd (make-random-tn :kind :normal
-				   :sc (sc-or-lose 'double-reg)
+				   :sc (sc-or-lose 'double-reg *backend*)
 				   :offset (- (tn-offset x) 2)))))
     (inst fptan)
     (inst fnstsw)			 ; status word to %ea
@@ -1901,7 +1872,7 @@
 	(inst fstp fr0)
 	(inst fstp fr0)
 	(inst fldd (make-random-tn :kind :normal
-				   :sc (sc-or-lose 'double-reg)
+				   :sc (sc-or-lose 'double-reg *backend*)
 				   :offset (- (tn-offset x) 2)))))
     (inst fptan)
     (inst fnstsw)			 ; status word to %ea
@@ -2061,7 +2032,7 @@
 	     (inst fstp fr0)
 	     (inst fldln2)
 	     (inst fldd (make-random-tn :kind :normal
-					:sc (sc-or-lose 'double-reg)
+					:sc (sc-or-lose 'double-reg *backend*)
 					:offset (1- (tn-offset x))))))
 	 (inst fyl2x))
 	((double-stack descriptor-reg)
@@ -2112,7 +2083,7 @@
 	     (inst fstp fr0)
 	     (inst fldlg2)
 	     (inst fldd (make-random-tn :kind :normal
-					:sc (sc-or-lose 'double-reg)
+					:sc (sc-or-lose 'double-reg *backend*)
 					:offset (1- (tn-offset x))))))
 	 (inst fyl2x))
 	((double-stack descriptor-reg)
@@ -2212,7 +2183,7 @@
        (sc-case y
           (double-reg
 	   (inst fldd (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
+				      :sc (sc-or-lose 'double-reg *backend*)
 				      :offset (- (tn-offset y) 2))))
 	  (double-stack
 	   (inst fldd (ea-for-df-stack y)))
@@ -2222,7 +2193,7 @@
        (sc-case x
           (double-reg
 	   (inst fldd (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
+				      :sc (sc-or-lose 'double-reg *backend*)
 				      :offset (1- (tn-offset x)))))
 	  (double-stack
 	   (inst fldd (ea-for-df-stack x)))
@@ -2291,7 +2262,7 @@
 	     (signed-stack
 	      (inst fild y)))
 	   (inst fld (make-random-tn :kind :normal
-				     :sc (sc-or-lose 'double-reg)
+				     :sc (sc-or-lose 'double-reg *backend*)
 				     :offset (1- (tn-offset x)))))))
        ((double-stack descriptor-reg)
 	(inst fstp fr0)
@@ -2391,7 +2362,7 @@
        (sc-case y
           (double-reg
 	   (inst fldd (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
+				      :sc (sc-or-lose 'double-reg *backend*)
 				      :offset (- (tn-offset y) 2))))
 	  (double-stack
 	   (inst fldd (ea-for-df-stack y)))
@@ -2401,7 +2372,7 @@
        (sc-case x
           (double-reg
 	   (inst fldd (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
+				      :sc (sc-or-lose 'double-reg *backend*)
 				      :offset (1- (tn-offset x)))))
 	  (double-stack
 	   (inst fldd (ea-for-df-stack x)))
@@ -2450,7 +2421,7 @@
 	     (inst fstp fr0)
 	     (inst fldln2)
 	     (inst fldd (make-random-tn :kind :normal
-					:sc (sc-or-lose 'double-reg)
+					:sc (sc-or-lose 'double-reg *backend*)
 					:offset (- (tn-offset x) 2)))))
 	 (inst fyl2xp1))
 	((double-stack descriptor-reg)
@@ -2496,7 +2467,7 @@
 	     (inst fstp fr0)
 	     (inst fstp fr0)
 	     (inst fldd (make-random-tn :kind :normal
-					:sc (sc-or-lose 'double-reg)
+					:sc (sc-or-lose 'double-reg *backend*)
 					:offset (- (tn-offset x) 2))))))
 	((double-stack descriptor-reg)
 	 (inst fstp fr0)
@@ -2544,7 +2515,7 @@
        (sc-case x
           (double-reg
 	   (inst fldd (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
+				      :sc (sc-or-lose 'double-reg *backend*)
 				      :offset (- (tn-offset x) 2))))
 	  (double-stack
 	   (inst fldd (ea-for-df-stack x)))
@@ -2640,7 +2611,7 @@
        (sc-case x
           (double-reg
 	   (inst fldd (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
+				      :sc (sc-or-lose 'double-reg *backend*)
 				      :offset (- (tn-offset x) 2))))
 	  (double-stack
 	   (inst fldd (ea-for-df-stack x)))
@@ -2650,7 +2621,7 @@
        (sc-case y
           (double-reg
 	   (inst fldd (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'double-reg)
+				      :sc (sc-or-lose 'double-reg *backend*)
 				      :offset (1- (tn-offset y)))))
 	  (double-stack
 	   (inst fldd (ea-for-df-stack y)))
@@ -2675,8 +2646,7 @@
   (:results (r :from (:argument 0)))
   (:policy :fast-safe)
   (:generator 5
-    (let ((r-real (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				  :offset (tn-offset r))))
+    (let ((r-real (complex-double-reg-real-tn r)))
       (unless (location= x r-real)
 	(cond ((zerop (tn-offset r-real))
 	       (copy-fp-reg-to-fr0 x))
@@ -2686,8 +2656,7 @@
 	       (inst fxch x)
 	       (inst fstd r-real)
 	       (inst fxch x)))))
-    (let ((r-imag (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
-				  :offset (1+ (tn-offset r)))))
+    (let ((r-imag (complex-double-reg-imag-tn r)))
       (unless (location= y r-imag)
 	(cond ((zerop (tn-offset y))
 	       (inst fstd r-imag))
@@ -2722,7 +2691,8 @@
   (:generator 3
     (cond ((sc-is x complex-single-reg complex-double-reg)
 	   (let ((value-tn
-		  (make-random-tn :kind :normal :sc (sc-or-lose 'double-reg)
+		  (make-random-tn :kind :normal
+				  :sc (sc-or-lose 'double-reg *backend*)
 				  :offset (+ offset (tn-offset x)))))
 	     (unless (location= value-tn r)
 	       (cond ((zerop (tn-offset r))
diff --git a/compiler/x86/type-vops.lisp b/compiler/x86/type-vops.lisp
index a98686517..80f01f892 100644
--- a/compiler/x86/type-vops.lisp
+++ b/compiler/x86/type-vops.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
 ;;;
 (ext:file-comment
- "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/type-vops.lisp,v 1.8 1998/01/06 16:48:52 dtc Exp $")
+ "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/x86/type-vops.lisp,v 1.9 1998/01/17 05:47:18 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;; 
@@ -17,7 +17,7 @@
 ;;; Written by William Lott.
 ;;;
 ;;; Debugged by Paul F. Werkowski, Spring-95.
-;;; Enhancements/debugging by Douglas T. Crosher 1996,1997.
+;;; Enhancements/debugging by Douglas T. Crosher 1996,1997,1998.
 ;;;
 (in-package :x86)
 
@@ -128,7 +128,7 @@
 		(or (= offset eax-offset) (= offset ebx-offset)
 		    (= offset ecx-offset) (= offset edx-offset)))
 	   (inst test (make-random-tn :kind :normal
-				      :sc (sc-or-lose 'byte-reg)
+				      :sc (sc-or-lose 'byte-reg *backend*)
 				      :offset offset)
 		 3))
 	  ((sc-is value control-stack)
@@ -155,7 +155,7 @@
 		(or (= offset eax-offset) (= offset ebx-offset)
 		    (= offset ecx-offset) (= offset edx-offset)))
 	   (inst cmp (make-random-tn :kind :normal
-				     :sc (sc-or-lose 'byte-reg)
+				     :sc (sc-or-lose 'byte-reg *backend*)
 				     :offset offset)
 		 immediate))
 	  (t
-- 
GitLab