Index: /branches/working-0711/ccl/compiler/X86/X8664/x8664-vinsns.lisp
===================================================================
--- /branches/working-0711/ccl/compiler/X86/X8664/x8664-vinsns.lisp	(revision 9629)
+++ /branches/working-0711/ccl/compiler/X86/X8664/x8664-vinsns.lisp	(revision 9630)
@@ -441,9 +441,12 @@
                                        ((temp :u64)))
   (rcmpw (:%w x8664::nargs) (:$w (:apply ash n x8664::word-shift)))
-  (movw (:%w x8664::nargs) (:%w temp))
+  (movzwl (:%w 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)
@@ -1640,17 +1643,18 @@
                              ((n :u16const))
                              ((imm :u16)))
+  (movzwl (:%w x8664::nargs) (:%l x8664::nargs))
   ((: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)
@@ -3192,8 +3196,9 @@
 (define-x8664-vinsn opt-supplied-p (()
                                     ())
+  (movzwl (:%w x8664::nargs) (:%l x8664::nargs))
   (xorl (:%l x8664::imm1) (:%l x8664::imm1))
   (movl (:$l x8664::t-value) (:%l x8664::arg_y))
   :loop
-  (rcmpw (:%w x8664::imm1) (:%w x8664::nargs))
+  (rcmpl (:%l x8664::imm1) (:%l x8664::nargs))
   (movl (:$l x8664::nil-value) (:%l x8664::arg_z))
   (cmovll (:%l x8664::arg_y) (:%l  x8664::arg_z))
@@ -3575,6 +3580,10 @@
 				  ((temp :u32)))
   (movl (:%l src) (:%l temp))
-  (sarl (:$ub (+ x8664::fixnumshift 11)) (:%l temp))
+  (sarl (:$ub (+ x8664::fixnumshift 1)) (:%l temp))
+  (cmpl (:$l (ash #xfffe -1)) (:%l temp))
+  (je :bad-if-eq)
+  (sarl (:$ub (- 11 1)) (:%l temp))
   (cmpl (:$b (ash #xd800 -11))(:%l temp))
+  :bad-if-eq
   (movl (:$l x8664::nil-value) (:%l temp))
   (cmovel (:%l temp) (:%l dest))
