Index: /trunk/source/compiler/X86/X8632/x8632-vinsns.lisp
===================================================================
--- /trunk/source/compiler/X86/X8632/x8632-vinsns.lisp	(revision 16306)
+++ /trunk/source/compiler/X86/X8632/x8632-vinsns.lisp	(revision 16307)
@@ -4358,48 +4358,66 @@
  (()
                                                         ((val :single-float)
-                                                         (offset :u16const)
-                                                         (nfp :imm)))
-  (movss (:%xmm val) (:@ (:apply + 16 offset) (:% nfp))))
+                                                         (offset :u16const)))
+  (movd (:%l x8632::imm0) (:%mmx x8632::stack-temp))
+  (movl (:@ (:%seg :rcontext) x8632::tcr.nfp) (:%l x8632::imm0))
+  (movss (:%xmm val) (:@ (:apply + 16 offset) (:% x8632::imm0)))
+  (movd (:%mmx x8632::stack-temp) (:%l x8632::imm0)))
+
+
 
 (define-x8632-vinsn (nfp-store-double-float :nfp :set) (()
                                                         ((val :double-float)
-                                                         (offset :u16const)
-                                                         (nfp :imm)))
-  (movsd (:%xmm val) (:@ (:apply + 16 offset) (:% nfp))))
+                                                         (offset :u16const)))
+  (movd (:%l x8632::imm0) (:%mmx x8632::stack-temp))
+  (movl (:@ (:%seg :rcontext) x8632::tcr.nfp) (:%l x8632::imm0))
+  (movsd (:%xmm val) (:@ (:apply + 16 offset) (:% x8632::imm0)))
+  (movd (:%mmx x8632::stack-temp) (:%l x8632::imm0)))
 
 
 (define-x8632-vinsn (nfp-load-double-float :nfp :ref) (((val :double-float))
-                                                       ((offset :u16const)
-                                                       (nfp :imm)))
-  (movsd (:@ (:apply + 16 offset) (:% nfp)) (:%xmm val)))
+                                                       ((offset :u16const)))
+  (movd (:%l x8632::imm0) (:%mmx x8632::stack-temp))
+  (movl (:@ (:%seg :rcontext) x8632::tcr.nfp) (:%l x8632::imm0))
+  (movsd (:@ (:apply + 16 offset) (:% x8632::imm0)) (:%xmm val))
+  (movd (:%mmx x8632::stack-temp) (:%l x8632::imm0)))
 
 
 (define-x8632-vinsn (nfp-load-single-float :nfp :ref) (((val :single-float))
-                                                       ((offset :u16const)
-                                                        (nfp :imm)))
-  (movss (:@ (:apply + 16 offset) (:% nfp)) (:%xmm val)))
+                                                       ((offset :u16const)))
+  (movd (:%l x8632::imm0) (:%mmx x8632::stack-temp))
+  (movl (:@ (:%seg :rcontext) x8632::tcr.nfp) (:%l x8632::imm0))
+  (movss (:@ (:apply + 16 offset) (:% x8632::imm0)) (:%xmm val))
+  (movd (:%mmx x8632::stack-temp) (:%l x8632::imm0)))
 
 (define-x8632-vinsn (nfp-store-complex-single-float :nfp :set) (()
                                                                 ((val :complex-single-float)
-                                                                 (offset :u16const)
-                                                                (nfp :imm)))
-  (movq (:%xmm val) (:@ (:apply + 16 offset) (:%l nfp))))
+                                                                 (offset :u16const)))
+  (movd (:%l x8632::imm0) (:%mmx x8632::stack-temp))
+  (movl (:@ (:%seg :rcontext) x8632::tcr.nfp) (:%l x8632::imm0))
+  (movq (:%xmm val) (:@ (:apply + 16 offset) (:%l x8632::imm0)))
+  (movd (:%mmx x8632::stack-temp) (:%l x8632::imm0)))
 
 (define-x8632-vinsn nfp-load-complex-single-float (((val :complex-single-float))
-                                                   ((offset :u16const)
-                                                  (nfp :imm)))
-  (movq (:@ (:apply + 16 offset) (:%l nfp)) (:%xmm val)))
+                                                   ((offset :u16const)))
+  (movd (:%l x8632::imm0) (:%mmx x8632::stack-temp))
+  (movl (:@ (:%seg :rcontext) x8632::tcr.nfp) (:%l x8632::imm0))
+  (movq (:@ (:apply + 16 offset) (:%l x8632::imm0)) (:%xmm val))
+  (movd (:%mmx x8632::stack-temp) (:%l x8632::imm0)))
 
 
 (define-x8632-vinsn (nfp-store-complex-double-float :nfp :set) (()
                                                                 ((val :complex-double-float)
-                                                                 (offset :u16const)
-                                                                (nfp :imm)))
-  (movdqu (:%xmm val) (:@ (:apply + 16 offset) (:%l nfp))))
+                                                                 (offset :u16const)))
+  (movd (:%l x8632::imm0) (:%mmx x8632::stack-temp))
+  (movl (:@ (:%seg :rcontext) x8632::tcr.nfp) (:%l x8632::imm0))
+  (movdqu (:%xmm val) (:@ (:apply + 16 offset) (:%l x8632::imm0)))
+  (movd (:%mmx x8632::stack-temp) (:%l x8632::imm0)))
 
 (define-x8632-vinsn (nfp-load-complex-double-float :nfp :ref) (((val :complex-double-float))
-                                                               ((offset :u16const)
-                                                               (nfp :imm)))
-  (movdqu (:@ (:apply + 16 offset) (:%l nfp)) (:%xmm val)))
+                                                               ((offset :u16const)))
+  (movd (:%l x8632::imm0) (:%mmx x8632::stack-temp))
+  (movl (:@ (:%seg :rcontext) x8632::tcr.nfp) (:%l x8632::imm0))
+  (movdqu (:@ (:apply + 16 offset) (:%l x8632::imm0)) (:%xmm val))
+  (movd (:%mmx x8632::stack-temp) (:%l x8632::imm0)))
 
 (define-x8632-vinsn nfp-compare-natural-register (()
Index: /trunk/source/compiler/X86/X8664/x8664-vinsns.lisp
===================================================================
--- /trunk/source/compiler/X86/X8664/x8664-vinsns.lisp	(revision 16306)
+++ /trunk/source/compiler/X86/X8664/x8664-vinsns.lisp	(revision 16307)
@@ -2471,62 +2471,82 @@
 (define-x8664-vinsn (nfp-store-unboxed-word :nfp :set) (()
                                                         ((val :u64)
-                                                         (offset :u16const)
-                                                         (nfp :imm)))
-  (movq (:%q val) (:@ (:apply + 16 offset) (:% nfp))))
+                                                         (offset :u16const)))
+  (movd (:%q val) (:%mmx x8664::stack-temp))
+  (movq (:rcontext x8664::tcr.nfp) (:%q val))
+  (movd (:%mmx x8664::stack-temp)(:@ (:apply + 16 offset) (:% val)))
+  (movd (:%mmx x8664::stack-temp) (:%q val)))
 
 
 (define-x8664-vinsn (nfp-load-unboxed-word :nfp :ref) (((val :u64))
-                                                       ((offset :u16const)
-                                                        (nfp :imm)))
-  (movq (:@ (:apply + 16 offset) (:% nfp)) (:%q val)))
+                                                       ((offset :u16const))
+                                                       )
+  (movq (:rcontext x8664::tcr.nfp) (:%q val))
+  (movq (:@ (:apply + 16 offset) (:% val)) (:%q val)))
 
 (define-x8664-vinsn (nfp-store-single-float :nfp :set) (()
-                                            ((val :single-float)
-                                             (offset :u16const)
-                                             (nfp :imm)))
-  (movss (:%xmm val) (:@ (:apply + 16 offset) (:% nfp))))
+                                                        ((val :single-float)
+                                                         (offset :u16const))
+                                                        )
+  (movd (:%q x8664::imm0) (:%mmx x8664::stack-temp))
+  (movq (:rcontext x8664::tcr.nfp) (:%q x8664::imm0))
+  (movss (:%xmm val) (:@ (:apply + 16 offset) (:% x8664::imm0)))
+  (movd (:%mmx x8664::stack-temp) (:%q x8664::imm0)))
 
 (define-x8664-vinsn (nfp-store-double-float :nfp :set) (()
-                                            ((val :double-float)
-                                             (offset :u16const)
-                                             (nfp :imm)))
-  (movsd (:%xmm val) (:@ (:apply + 16 offset) (:% nfp))))
+                                                        ((val :double-float)
+                                                         (offset :u16const)))
+  (movd (:%q x8664::imm0) (:%mmx x8664::stack-temp))
+  (movq (:rcontext x8664::tcr.nfp) (:%q x8664::imm0))
+  (movsd (:%xmm val) (:@ (:apply + 16 offset) (:% x8664::imm0)))
+  (movd (:%mmx x8664::stack-temp) (:%q x8664::imm0)))
 
 
 (define-x8664-vinsn (nfp-load-double-float :nfp :ref) (((val :double-float))
-                                                       ((offset :u16const)
-                                                        (nfp :imm)))
-  (movsd (:@ (:apply + 16 offset) (:% nfp)) (:%xmm val)))
+                                                       ((offset :u16const)))
+    (movd (:%q x8664::imm0) (:%mmx x8664::stack-temp))
+    (movq (:rcontext x8664::tcr.nfp) (:%q x8664::imm0))
+    (movsd (:@ (:apply + 16 offset) (:% x8664::imm0)) (:%xmm val))
+    (movd (:%mmx x8664::stack-temp) (:%q x8664::imm0)))
 
 
 (define-x8664-vinsn (nfp-load-single-float :nfp :ref) (((val :single-float))
-                                           ((offset :u16const)
-                                            (nfp :imm)))
-  (movss (:@ (:apply + 16 offset) (:% nfp)) (:%xmm val)))
+                                                       ((offset :u16const)))
+  (movd (:%q x8664::imm0) (:%mmx x8664::stack-temp))
+  (movq (:rcontext x8664::tcr.nfp) (:%q x8664::imm0))
+  (movss (:@ (:apply + 16 offset) (:% x8664::imm0)) (:%xmm val))
+  (movd (:%mmx x8664::stack-temp) (:%q x8664::imm0)))
 
 (define-x8664-vinsn (nfp-store-complex-single-float :nfp :set) (()
                                                    ((val :complex-single-float)
-                                                    (offset :u16const)
-                                                    (nfp :imm)))
-
-  (movq (:%xmm val) (:@ (:apply + 16 offset) (:%q nfp))))
+                                                    (offset :u16const)))
+
+  (movd (:%q x8664::imm0) (:%mmx x8664::stack-temp))
+  (movq (:rcontext x8664::tcr.nfp) (:%q x8664::imm0))
+  (movq (:%xmm val) (:@ (:apply + 16 offset) (:%q x8664::imm0)))
+  (movd (:%mmx x8664::stack-temp) (:%q x8664::imm0)))
 
 
 (define-x8664-vinsn (nfp-load-complex-single-float :nfp :ref) (((val :complex-single-float))
-                                                               ((offset :u16const)
-                                                                (nfp :imm)))
-  (movq (:@ (:apply + 16 offset) (:% nfp)) (:%xmm val)))
+                                                               ((offset :u16const)))
+  (movd (:%q x8664::imm0) (:%mmx x8664::stack-temp))
+  (movq (:rcontext x8664::tcr.nfp) (:%q x8664::imm0))
+  (movq (:@ (:apply + 16 offset) (:% x8664::imm0)) (:%xmm val))
+  (movd (:%mmx x8664::stack-temp) (:%q x8664::imm0)))
 
 
 (define-x8664-vinsn (nfp-store-complex-double-float :nfp :set) (()
                                                                 ((val :complex-double-float)
-                                                                 (offset :u16const)
-                                                                 (nfp :imm)))
-  (movdqu (:%xmm val) (:@ (:apply + 16 offset) (:% nfp))))
+                                                                 (offset :u16const)))
+  (movd (:%q x8664::imm0) (:%mmx x8664::stack-temp))
+  (movq (:rcontext x8664::tcr.nfp) (:%q x8664::imm0))
+  (movdqu (:%xmm val) (:@ (:apply + 16 offset) (:% x8664::imm0)))
+  (movd (:%mmx x8664::stack-temp) (:%q x8664::imm0)))
 
 (define-x8664-vinsn (nfp-load-complex-double-float :nfp :ref) (((val :complex-double-float))
-                                                               ((offset :u16const)
-                                                                (nfp :imm)))
-  (movdqu (:@ (:apply + 16 offset) (:% nfp)) (:%xmm val)))
+                                                               ((offset :u16const)))
+  (movd (:%q x8664::imm0) (:%mmx x8664::stack-temp))
+  (movq (:rcontext x8664::tcr.nfp) (:%q x8664::imm0))
+  (movdqu (:@ (:apply + 16 offset) (:% x8664::imm0)) (:%xmm val))
+  (movd (:%mmx x8664::stack-temp) (:%q x8664::imm0)))
 
 (define-x8664-vinsn (temp-push-unboxed-word :push :word :csp)
Index: /trunk/source/compiler/X86/x862.lisp
===================================================================
--- /trunk/source/compiler/X86/x862.lisp	(revision 16306)
+++ /trunk/source/compiler/X86/x862.lisp	(revision 16307)
@@ -41,5 +41,5 @@
 (defparameter *x862-all-nfp-pushes* ())
 (defparameter *x862-nfp-vars* ())
-(defparameter *x862-nfp-reg* ())
+
 
 
@@ -289,6 +289,5 @@
            (vreg-mode (get-regspec-mode vreg))
            (vinsn nil)
-           (reg vreg)
-           (nfp (x862-nfp-reg seg)))
+           (reg vreg))
       (ecase type
         (#. memspec-nfp-type-natural
@@ -299,5 +298,5 @@
                          :natural)))            
             (setq vinsn
-                  (! nfp-load-unboxed-word reg offset nfp)))
+                  (! nfp-load-unboxed-word reg offset)))
         (#. memspec-nfp-type-double-float
             (unless (and (eql vreg-class hard-reg-class-fpr)
@@ -307,5 +306,5 @@
                          :double-float)))
             (setq vinsn
-                  (! nfp-load-double-float reg offset nfp)))
+                  (! nfp-load-double-float reg offset)))
         (#. memspec-nfp-type-single-float
             (unless (and (eql vreg-class hard-reg-class-fpr)
@@ -315,5 +314,5 @@
                          :single-float)))
             (setq vinsn
-                  (! nfp-load-single-float  reg offset nfp)))    
+                  (! nfp-load-single-float  reg offset)))    
         (#. memspec-nfp-type-complex-double-float
             (unless (and (eql vreg-class hard-reg-class-fpr)
@@ -323,5 +322,5 @@
                          :complex-double-float)))
             (setq vinsn
-                  (! nfp-load-complex-double-float reg offset nfp)))
+                  (! nfp-load-complex-double-float reg offset)))
         (#. memspec-nfp-type-complex-single-float
             (unless (and (eql vreg-class hard-reg-class-fpr)
@@ -331,5 +330,5 @@
                          :complex-single-float)))
             (setq vinsn
-                  (! nfp-load-complex-single-float  reg offset nfp))))
+                  (! nfp-load-complex-single-float  reg offset))))
       (when (memspec-single-ref-p ea)
         (let* ((push-vinsn
@@ -384,20 +383,20 @@
 (defun x862-nfp-set (seg reg ea)
   (with-x86-local-vinsn-macros (seg )
-    (let* ((offset (logand #xfff8 ea))
-           (nfp (x862-nfp-reg seg)))
+    (let* ((offset (logand #xfff8 ea)))
       (ecase (logand #x7 ea)
         (#. memspec-nfp-type-natural
-            (! nfp-store-unboxed-word reg offset nfp))
+            (! nfp-store-unboxed-word reg offset))
         (#. memspec-nfp-type-double-float
-            (! nfp-store-double-float reg offset nfp))
+            (! nfp-store-double-float reg offset))
         (#. memspec-nfp-type-single-float
-            (! nfp-store-single-float  reg offset nfp))    
+            (! nfp-store-single-float  reg offset))    
         (#. memspec-nfp-type-complex-double-float
-           (! nfp-store-complex-double-float reg offset nfp))
+           (! nfp-store-complex-double-float reg offset))
         (#. memspec-nfp-type-complex-single-float
-            (! nfp-store-complex-single-float  reg offset nfp))))))
+            (! nfp-store-complex-single-float  reg offset))))))
 
 ;;; Depending on the variable's type and other attributes, maybe
 ;;; push it on the NFP.  Return the nfp-relative EA if we push it.
+
 (defun x862-nfp-bind (seg var initform)
   (let* ((bits (nx-var-bits var)))
@@ -408,26 +407,28 @@
              (reg nil)
              (nfp-bits 0))
-        (cond ((and (subtypep type *nx-target-natural-type*)
-                    NIL
-                    (not (subtypep type *nx-target-fixnum-type*)))
-               (setq reg (available-imm-temp
-                          *available-backend-imm-temps* :natural)
-                     nfp-bits memspec-nfp-type-natural))
-              ((subtypep type 'single-float)
-               (setq reg (available-fp-temp *available-backend-fp-temps*
-                                            :single-float)
-                     nfp-bits memspec-nfp-type-single-float))
-              ((subtypep type 'double-float)
-               (setq reg (available-fp-temp *available-backend-fp-temps*
-                                            :double-float)
-                     nfp-bits memspec-nfp-type-double-float))
-              ((subtypep type 'complex-single-float)
-               (setq reg (available-fp-temp *available-backend-fp-temps*
-                                            :complex-single-float)
-                     nfp-bits memspec-nfp-type-complex-single-float))
-              ((subtypep type 'complex-double-float)
-               (setq reg (available-fp-temp *available-backend-fp-temps*
-                                            :complex-double-float)
-                     nfp-bits memspec-nfp-type-complex-double-float)))
+        (unless (and (acode-constant-p initform)
+                     (not (logbitp $vbitsetq bits)))
+          (cond ((and (subtypep type *nx-target-natural-type*)
+                      NIL
+                      (not (subtypep type *nx-target-fixnum-type*)))
+                 (setq reg (available-imm-temp
+                            *available-backend-imm-temps* :natural)
+                       nfp-bits memspec-nfp-type-natural))
+                ((subtypep type 'single-float)
+                 (setq reg (available-fp-temp *available-backend-fp-temps*
+                                              :single-float)
+                       nfp-bits memspec-nfp-type-single-float))
+                ((subtypep type 'double-float)
+                 (setq reg (available-fp-temp *available-backend-fp-temps*
+                                              :double-float)
+                       nfp-bits memspec-nfp-type-double-float))
+                ((subtypep type 'complex-single-float)
+                 (setq reg (available-fp-temp *available-backend-fp-temps*
+                                              :complex-single-float)
+                       nfp-bits memspec-nfp-type-complex-single-float))
+                ((subtypep type 'complex-double-float)
+                 (setq reg (available-fp-temp *available-backend-fp-temps*
+                                              :complex-double-float)
+                       nfp-bits memspec-nfp-type-complex-double-float))))
         (when reg
           (let* ((vinsn (x862-push-register
@@ -717,5 +718,4 @@
 					  (:x8664 x8664-temp-fp-regs)))
            (*x862-nfp-depth* 0)
-           (*x862-nfp-reg* ())
            (*x862-max-nfp-depth* ())
            (*x862-all-nfp-pushes* ())
@@ -962,20 +962,9 @@
 
 (defun x862-invalidate-regmap ()
-  (setq *x862-nfp-reg* nil)
   (setq *x862-gpr-locations-valid-mask* 0))
 
-(defun x862-nfp-reg (seg)
-  (with-x86-local-vinsn-macros (seg)
-    (or *x862-nfp-reg*
-        (let* ((reg (target-arch-case (:x8664 x8664::temp1) (:x8632 x8632::nargs))))
-          (! load-nfp reg)
-          (setq *x862-nfp-reg* reg)))))
+
 
 (defun x862-update-regmap (vinsn)
-  (when *x862-nfp-reg*
-    (when (or (vinsn-attribute-p vinsn :call)
-              (logbitp (hard-regspec-value *x862-nfp-reg*)
-                       (vinsn-gprs-set vinsn)))
-      (setq *x862-nfp-reg* nil)))
   (if (vinsn-attribute-p vinsn :call)
     (x862-invalidate-regmap)
@@ -3786,16 +3775,13 @@
         (setq vinsn (x862-vpush-register seg areg inhibit-note))
         (let* ((offset *x862-nfp-depth*)
-               (size 16)
-               (nfp (if (target-arch-case (:x8664 t) (:x8632 a-float))(x862-nfp-reg seg))))
+               (size 16))
           (setq vinsn
                 (if a-float
                   (ecase (fpr-mode-value-name mode)
-                    (:single-float (! nfp-store-single-float areg offset nfp))
-                    (:double-float (! nfp-store-double-float areg offset nfp))
-                    (:complex-single-float (! nfp-store-complex-single-float areg offset nfp))
-                    (:complex-double-float (! nfp-store-complex-double-float areg offset nfp)))
-                  (target-arch-case
-                   (:x8664 (! nfp-store-unboxed-word areg offset nfp))
-                   (:x8632 (! nfp-store-unboxed-word areg offset)))))
+                    (:single-float (! nfp-store-single-float areg offset))
+                    (:double-float (! nfp-store-double-float areg offset))
+                    (:complex-single-float (! nfp-store-complex-single-float areg offset))
+                    (:complex-double-float (! nfp-store-complex-double-float areg offset)))
+                  (! nfp-store-unboxed-word areg offset)))
           (incf offset size)
           (push vinsn *x862-all-nfp-pushes*)
@@ -3814,19 +3800,13 @@
       (if a-node
         (setq vinsn (x862-vpop-register seg areg))
-        (let* ((offset (- *x862-nfp-depth* 16))
-               (nfp (if (target-arch-case (:x8664 t) (:x8632 a-float))
-                      (x862-nfp-reg seg))))
+        (let* ((offset (- *x862-nfp-depth* 16)))
           (setq vinsn
                 (if a-float
                   (ecase (fpr-mode-value-name mode)
-                    (:single-float (! nfp-load-single-float areg offset nfp))
-                    (:double-float (! nfp-load-double-float areg offset nfp))
-                    (:complex-single-float (! nfp-load-complex-single-float areg offset nfp))
-                    (:complex-double-float (! nfp-load-complex-double-float areg offset nfp)))
-                  (target-arch-case
-                   (:x8664
-                    (! nfp-load-unboxed-word areg offset nfp))
-                   (:x8632
-                    (! nfp-load-unboxed-word areg offset)))))
+                    (:single-float (! nfp-load-single-float areg offset))
+                    (:double-float (! nfp-load-double-float areg offset))
+                    (:complex-single-float (! nfp-load-complex-single-float areg offset))
+                    (:complex-double-float (! nfp-load-complex-double-float areg offset)))
+                  (! nfp-load-unboxed-word areg offset)))
           (setq *x862-nfp-depth* offset)))
       vinsn)))
