X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fppc%2Farith.lisp;h=5a20c341a29a7a8215c2f9fc0e6cdc4415a951ba;hb=40e3ba03d0e1b824e4d1ae75d74246b975b70964;hp=ee7a8518dce3bf2d493faf02c30cf2b603dd9228;hpb=52cfe54802db8736f1f4e2b67764c43bba9b78b3;p=sbcl.git diff --git a/src/compiler/ppc/arith.lisp b/src/compiler/ppc/arith.lisp index ee7a851..5a20c34 100644 --- a/src/compiler/ppc/arith.lisp +++ b/src/compiler/ppc/arith.lisp @@ -606,27 +606,35 @@ (inst srawi result number amount)) (inst slwi result number amount))))))) - - (define-vop (signed-byte-32-len) (:translate integer-length) (:note "inline (signed-byte 32) integer-length") (: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) :from :load)) + (: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)