0.9.3.2:
[sbcl.git] / src / compiler / ppc / arith.lisp
index ee7a851..c633a13 100644 (file)
   (:policy :fast-safe)
   (:args (arg :scs (signed-reg)))
   (:arg-types signed-num)
-  (:results (res :scs (any-reg)))
-  (:result-types positive-fixnum)
-  (:temporary (:scs (non-descriptor-reg) :to (:argument 0)) shift)
+  (:results (res :scs (unsigned-reg)))
+  (:result-types unsigned-num)
   (:generator 6
     ; (integer-length arg) = (- 32 (cntlz (if (>= arg 0) arg (lognot arg))))
     (let ((nonneg (gen-label)))
-      (inst cntlzw. shift arg)
+      (inst cntlzw. res arg)
       (inst bne nonneg)
-      (inst not shift arg)
-      (inst cntlzw shift shift)
+      (inst not res arg)
+      (inst cntlzw res res)
       (emit-label nonneg)
-      (inst slwi shift shift 2)
-      (inst subfic res  shift (fixnumize 32)))))
+      (inst subfic res res 32))))
+
+(define-vop (unsigned-byte-32-len)
+  (:translate integer-length)
+  (:note "inline (unsigned-byte 32) integer-length")
+  (:policy :fast-safe)
+  (:args (arg :scs (unsigned-reg)))
+  (:arg-types unsigned-num)
+  (:results (res :scs (unsigned-reg)))
+  (:result-types unsigned-num)
+  (:generator 4
+    (inst cntlzw res arg)
+    (inst subfic res res 32)))
 
 (define-vop (unsigned-byte-32-count)
   (:translate logcount)