Index: /trunk/source/compiler/X86/X8664/x8664-vinsns.lisp
===================================================================
--- /trunk/source/compiler/X86/X8664/x8664-vinsns.lisp	(revision 8352)
+++ /trunk/source/compiler/X86/X8664/x8664-vinsns.lisp	(revision 8353)
@@ -293,9 +293,9 @@
 
   ((:pred < n 16)
-   (xorl (:%l x8664::nargs.l ) (:%l x8664::nargs.l ))
+   (xorl (:%l x8664::nargs ) (:%l x8664::nargs ))
    ((:pred > n 0)
-    (addl (:$b (:apply ash n x8664::word-shift)) (:%l  x8664::nargs.l))))
+    (addl (:$b (:apply ash n x8664::word-shift)) (:%l  x8664::nargs))))
   ((:pred >= n 16)
-   (movl (:$l (:apply ash n x8664::word-shift)) (:%l x8664::nargs.l ))))
+   (movl (:$l (:apply ash n x8664::word-shift)) (:%l x8664::nargs ))))
 
 (define-x8664-vinsn check-exact-nargs (()
@@ -303,7 +303,10 @@
   :resume
   ((:pred = n 0)
-   (testw (:%w x8664::nargs) (:%w x8664::nargs)))
+   (testl (:%l x8664::nargs) (:%l x8664::nargs)))
   ((:not (:pred = n 0))
-   (cmpw (:$w (:apply ash n x8664::word-shift)) (:%w x8664::nargs)))
+   ((:pred < n 16)
+   (cmpl (:$b (:apply ash n x8664::word-shift)) (:%l x8664::nargs)))
+   ((:pred >= n 16)
+    (cmpl (:$l (:apply ash n x8664::word-shift)) (:%l x8664::nargs))))
   (jne :bad)
   (:anchored-uuo-section :resume)
@@ -315,8 +318,11 @@
   :resume
   ((:pred = min 1)
-   (testw (:%w x8664::nargs) (:%w x8664::nargs))
+   (testl (:%l x8664::nargs) (:%l x8664::nargs))
    (je :toofew))
   ((:not (:pred = min 1))
-   (rcmpw (:%w x8664::nargs) (:$w (:apply ash min x8664::word-shift)))
+   ((:pred < min 16)
+    (rcmpl (:%l x8664::nargs) (:$b (:apply ash min x8664::word-shift))))
+   ((:pred >= min 16)
+    (rcmpl (:%l x8664::nargs) (:$l (:apply ash min x8664::word-shift))))
    (jb :toofew))  
   
@@ -328,5 +334,8 @@
                                        ((n :u16const)))
   :resume
-  (rcmpw (:%w x8664::nargs) (:$w (:apply ash n x8664::word-shift)))
+  ((:pred < n 16)
+   (rcmpl (:%l x8664::nargs) (:$b (:apply ash n x8664::word-shift))))
+  ((:pred >= n 16)
+   (rcmpl (:%l x8664::nargs) (:$l (:apply ash n x8664::word-shift))))
   (ja :bad)
   
@@ -341,10 +350,16 @@
   :resume
   ((:pred = min 1)
-   (testw (:%w x8664::nargs) (:%w x8664::nargs))
+   (testl (:%l x8664::nargs) (:%l x8664::nargs))
    (je :toofew))
   ((:not (:pred = min 1))
-   (rcmpw (:%w x8664::nargs) (:$w (:apply ash min x8664::word-shift)))
+   ((:pred < min 16)
+    (rcmpl (:%l x8664::nargs) (:$b (:apply ash min x8664::word-shift))))
+   ((:pred >= min 16)
+    (rcmpl (:%l x8664::nargs) (:$l (:apply ash min x8664::word-shift))))
    (jb :toofew))
-  (rcmpw (:%w x8664::nargs) (:$w (:apply ash max x8664::word-shift)))
+  ((:pred < max 16)
+   (rcmpl (:%l x8664::nargs) (:$b (:apply ash max x8664::word-shift))))
+  ((:pred >= max 16)
+   (rcmpl (:%l x8664::nargs) (:$l (:apply ash max x8664::word-shift))))
   (ja :toomany)
   
@@ -359,5 +374,8 @@
 (define-x8664-vinsn default-1-arg (()
                                    ((min :u16const)))
-  (rcmpw (:%w x8664::nargs) (:$w (:apply ash min x8664::word-shift)))
+  ((:pred < min 16)
+   (rcmpl (:%l x8664::nargs) (:$b (:apply ash min x8664::word-shift))))
+  ((:pred >= min 16)
+   (rcmpl (:%l x8664::nargs) (:$l (:apply ash min x8664::word-shift))))
   (jne :done)
   ((:pred >= min 3)
@@ -373,5 +391,8 @@
 (define-x8664-vinsn default-2-args (()
 				    ((min :u16const)))
-  (rcmpw (:%w x8664::nargs ) (:$w (:apply ash (:apply 1+ min) x8664::word-shift)))
+  ((:pred < (:apply 1+ min) 16)
+   (rcmpl (:%l x8664::nargs ) (:$b (:apply ash (:apply 1+ min) x8664::word-shift))))
+  ((:pred >= (:apply 1+ min) 16)
+   (rcmpl (:%l x8664::nargs ) (:$l (:apply ash (:apply 1+ min) x8664::word-shift))))
   (ja :done)
   (je :one)
@@ -398,8 +419,14 @@
 (define-x8664-vinsn default-3-args (()
 				    ((min :u16const)))
-  (rcmpw (:%w x8664::nargs ) (:$w (:apply ash (:apply + 2 min) x8664::word-shift)))
+  ((:pred < (:apply + 2 min) 16)
+   (rcmpl (:%l x8664::nargs ) (:$b (:apply ash (:apply + 2 min) x8664::word-shift))))
+  ((:pred >= (:apply + 2 min) 16)
+   (rcmpl (:%l x8664::nargs ) (:$l (:apply ash (:apply + 2 min) x8664::word-shift))))
   (ja :done)
   (je :two)
-  (rcmpw (:%w x8664::nargs ) (:$w (:apply ash min x8664::word-shift)))
+  ((:pred < min 16)
+   (rcmpl (:%l x8664::nargs ) (:$b (:apply ash min x8664::word-shift))))
+  ((:pred >= min 16)
+   (rcmpl (:%l x8664::nargs ) (:$l (:apply ash min x8664::word-shift))))
   (je :none)
   ;; The first (of three) &optional args was supplied.
@@ -436,10 +463,16 @@
                                        ((n :u16const))
                                        ((temp :u64)))
-  (rcmpw (:%w x8664::nargs) (:$w (:apply ash n x8664::word-shift)))
-  (movw (:%w x8664::nargs) (:%w temp))
+  ((:pred < n 16)
+   (rcmpl (:%l x8664::nargs) (:$b (:apply ash n x8664::word-shift))))
+  ((:pred >= n 16)
+   (rcmpl (:%l x8664::nargs) (:$l (:apply ash n x8664::word-shift))))
+  (movl (:%l x8664::nargs) (:%l temp))
   (jae :done)
   :loop
-  (addw (:$w x8664::fixnumone) (:%w temp))
-  (cmpw (:$w (:apply ash n x8664::word-shift)) (:%w temp))
+  (addl (:$b x8664::fixnumone) (:%l temp))
+  ((:pred < n 16)
+   (cmpl (:$b (:apply ash n x8664::word-shift)) (:%l temp)))
+  ((:pred >= n 16)
+   (cmpl (:$l (:apply ash n x8664::word-shift)) (:%l temp)))  
   (pushq (:$l x8664::nil-value))
   (jne :loop)
@@ -462,5 +495,5 @@
                                                           ()
                                                           ((temp :u64)))
-  (movzwl (:%w x8664::nargs) (:%l temp))
+  (movl (:%l x8664::nargs) (:%l temp))
   (subq (:$b (* $numx8664argregs x8664::node-size)) (:%q temp))
   (jle :push)
@@ -479,5 +512,5 @@
                                                 ()
                                                 ((temp :u64)))
-  (movzwl (:%w x8664::nargs) (:%l temp))
+  (movl (:%l x8664::nargs) (:%l temp))
   (subq (:$b (* $numx8664argregs x8664::node-size)) (:%q temp))
   (movq (:%q x8664::rbp) (:@ x8664::node-size (:%q x8664::rsp) (:%q temp)))
@@ -1396,7 +1429,7 @@
 (define-x8664-vinsn (push-argregs :push :node :vsp) (()
                                                       ())
-  (testw (:%w x8664::nargs) (:%w x8664::nargs))
+  (testl (:%l x8664::nargs) (:%l x8664::nargs))
   (jz :done)
-  (rcmpw (:%w x8664::nargs) (:$w (* 2 x8664::node-size)))
+  (rcmpl (:%l x8664::nargs) (:$b (* 2 x8664::node-size)))
   (jb :one)
   (je :two)
@@ -1411,7 +1444,7 @@
                                                          ((max :u32const)))
   ((:pred >= max 3)
-   (testw (:%w x8664::nargs) (:%w x8664::nargs))
+   (testl (:%l x8664::nargs) (:%l x8664::nargs))
    (jz :done)
-   (rcmpw (:%w x8664::nargs) (:$w (* 2 x8664::node-size)))
+   (rcmpl (:%l x8664::nargs) (:$b (* 2 x8664::node-size)))
    (jb :one)
    (je :two)
@@ -1423,5 +1456,5 @@
    :done)
   ((:pred = max 2)
-   (rcmpw (:%w x8664::nargs) (:$w (* 1 x8664::node-size)))
+   (rcmpl (:%l x8664::nargs) (:$b (* 1 x8664::node-size)))
    (jb :done)
    (je :one)
@@ -1431,5 +1464,5 @@
    :done)
   ((:pred = max 1)
-   (testw (:%w x8664::nargs) (:%w x8664::nargs))
+   (testl (:%l x8664::nargs) (:%l x8664::nargs))
    (je :done)
    (pushq (:%q x8664::arg_z))
@@ -1646,16 +1679,16 @@
                              ((imm :u16)))
   ((:pred = n 0)
-   (xorq (:%q imm) (:%q imm)))
+   (xorl (:%l imm) (:%l imm)))
   ((:not (:pred = n 0))
-   (movw (:$w (:apply ash n x8664::fixnumshift)) (:%w imm)))
-  (subw (:%w x8664::nargs) (:%w imm))
+   (movl (:$l (:apply ash n x8664::fixnumshift)) (:%l imm)))
+  (subl (:%l x8664::nargs) (:%l imm))
   (jae :push-more)
-  (movswq (:%w imm) (:%q imm))
+  (movslq (:%l imm) (:%q imm))
   (subq (:%q imm) (:%q x8664::rsp))
   (jmp :done)
   :push-loop
   (pushq (:$l x8664::nil-value))
-  (addw (:$b x8664::node-size) (:%w x8664::nargs))
-  (subw (:$b x8664::node-size) (:%w imm))
+  (addl (:$b x8664::node-size) (:%l x8664::nargs))
+  (subl (:$b x8664::node-size) (:%l imm))
   :push-more
   (jne :push-loop)
@@ -3146,16 +3179,21 @@
 				 ((nfixed :s16const)))
   ((:pred > nfixed 0)
-   (addw (:$w (:apply - (:apply ash nfixed x8664::word-shift))) (:%w x8664::nargs))))
+   ((:pred < nfixed 16)
+    (subl (:$b (:apply ash nfixed x8664::word-shift)) (:%l x8664::nargs)))
+   ((:pred >= nfixed 16)
+    (subl (:$l (:apply ash nfixed x8664::word-shift)) (:%l x8664::nargs)))))
 
 (define-x8664-vinsn opt-supplied-p (()
-                                    ())
-  (xorl (:%l x8664::imm1) (:%l x8664::imm1))
-  (movl (:$l x8664::t-value) (:%l x8664::arg_y))
+                                    ((num-opt :u16const))
+                                    ((nargs (:u64 #.x8664::nargs))
+                                     (imm :imm)))
+  (xorl (:%l imm) (:%l imm))
+  (movl (:$l x8664::nil-value) (:%l x8664::arg_y))
   :loop
-  (rcmpw (:%w x8664::imm1) (:%w x8664::nargs))
-  (movl (:$l x8664::nil-value) (:%l x8664::arg_z))
-  (cmovll (:%l x8664::arg_y) (:%l  x8664::arg_z))
-  (addl (:$b x8664::node-size) (:%l x8664::imm1))
-  (cmpl (:%l x8664::imm1) (:%l x8664::imm0))
+  (rcmpl (:%l imm) (:%l nargs))
+  (movl (:%l x8664::arg_y) (:%l x8664::arg_z))
+  (cmovll (:@ x8664::t-offset (:%l x8664::arg_y)) (:%l  x8664::arg_z))
+  (addl (:$b x8664::node-size) (:%l imm))
+  (rcmpl (:%l imm) (:$l (:apply ash num-opt x8664::fixnumshift)))
   (pushq (:%q x8664::arg_z))
   (jne :loop))
@@ -3164,9 +3202,7 @@
                                         ()
                                         ((temp :u64)))
-  (testw (:%w x8664::nargs) (:%w x8664::nargs))
-  (setne (:%b temp))
-  (negb (:%b temp))
-  (andl (:$b x8664::t-offset) (:%l temp))
-  (addl (:$l x8664::nil-value) (:%l temp))
+  (testl (:%l x8664::nargs) (:%l x8664::nargs))
+  (movl (:$l x8664::nil-value) (:%l temp))
+  (cmovnel (:@ x8664::t-offset (:%l temp)) (:%l temp))
   (pushq (:%q temp)))
 
@@ -3175,13 +3211,9 @@
                                         ((temp0 :u64)
                                          (temp1 :u64)))
-  (rcmpw (:%w x8664::nargs) (:$w x8664::node-size))
-  (setae (:%b temp0))
-  (seta (:%b temp1))
-  (negb (:%b temp0))
-  (negb (:%b temp1))
-  (andl (:$b x8664::t-offset) (:%l temp0))
-  (andl (:$b x8664::t-offset) (:%l temp1))
-  (addl (:$l x8664::nil-value) (:%l temp0))
-  (addl (:$l x8664::nil-value) (:%l temp1))
+  (rcmpl (:%l x8664::nargs) (:$b x8664::node-size))
+  (movl (:$l x8664::nil-value) (:%l temp0))
+  (movl (:%l temp0) (:%l temp1))
+  (cmovael (:@ x8664::t-offset (:%l temp0)) (:%l temp0))
+  (cmoval (:@ x8664::t-offset (:%l temp1)) (:%l temp1))
   (pushq (:%q temp0))
   (pushq (:%q temp1)))
@@ -3252,5 +3284,5 @@
    (pushq (:%q x8664::arg_z)))
   ((:pred = min-fixed 2)                ; at least 2 args
-   (cmpw (:$w (ash 2 x8664::word-shift)) (:%w x8664::nargs))
+   (cmpl (:$b (ash 2 x8664::word-shift)) (:%l x8664::nargs))
    (je :yz2)                      ; skip arg_x if exactly 2
    (pushq (:%q x8664::arg_x))
@@ -3259,5 +3291,5 @@
    (pushq (:%q x8664::arg_z)))
   ((:pred = min-fixed 1)                ; at least one arg
-   (rcmpw (:%w x8664::nargs) (:$w  (ash 2 x8664::word-shift)))
+   (rcmpl (:%l x8664::nargs) (:$b  (ash 2 x8664::word-shift)))
    (jl :z1)                       ; branch if exactly one
    (je :yz1)                      ; branch if exactly two
@@ -3268,7 +3300,7 @@
    (pushq (:%q x8664::arg_z)))
   ((:pred = min-fixed 0)
-   (testw (:%w x8664::nargs) (:%w x8664::nargs))
+   (testl (:%l x8664::nargs) (:%l x8664::nargs))
    (je  :none)                     ; exactly zero
-   (rcmpw (:%w x8664::nargs) (:$w (ash 2 x8664::word-shift)))
+   (rcmpl (:%l x8664::nargs) (:$b (ash 2 x8664::word-shift)))
    (je :yz0)                      ; exactly two
    (jl :z0)                       ; one
@@ -3281,5 +3313,4 @@
    :none
    )
-  (movzwl (:%w x8664::nargs) (:%l x8664::nargs))
   ((:not (:pred = min-fixed 0))
    (leaq (:@ (:apply - (:apply ash min-fixed x8664::word-shift)) (:%q x8664::nargs))
@@ -3576,5 +3607,4 @@
                                ()
                                ((imm0 :u64)))
-  (movzwl (:%w x8664::nargs) (:%l x8664::nargs))
   (leaq (:@ (:%q x8664::rsp) (:%q x8664::nargs)) (:%q imm0))
   (subq (:@ (:%q imm0)) (:%q x8664::nargs))
@@ -3802,7 +3832,7 @@
 (define-x8664-vinsn pop-argument-registers (()
                                             ())
-  (testw (:%w x8664::nargs) (:%w x8664::nargs))
+  (testl (:%l x8664::nargs) (:%l x8664::nargs))
   (je :done)
-  (rcmpw (:%w x8664::nargs) (:$w (ash 2 x8664::word-shift)))
+  (rcmpl (:%l x8664::nargs) (:$b (ash 2 x8664::word-shift)))
   (popq (:%q x8664::arg_z))
   (jb :done)
@@ -3833,7 +3863,4 @@
   (movss (:@ (:%q src) (:%q index)) (:%xmm dest)))
 
-(define-x8664-vinsn zero-extend-nargs (()
-                                       ())
-  (movzwl (:%w x8664::nargs) (:%l x8664::nargs)))
 
 (define-x8664-vinsn load-adl (()
