From: Paul Khuong Date: Sat, 8 Jun 2013 01:43:16 +0000 (-0400) Subject: New VOP for LOGAND of bignum and word-sized constant on x86-64 X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=91a5cbf7375439309fede4776d8debc7a132dc20;p=sbcl.git New VOP for LOGAND of bignum and word-sized constant on x86-64 We can directly read the first bignum digit and AND it. --- diff --git a/src/compiler/x86-64/arith.lisp b/src/compiler/x86-64/arith.lisp index 76f3b00..9229626 100644 --- a/src/compiler/x86-64/arith.lisp +++ b/src/compiler/x86-64/arith.lisp @@ -1891,6 +1891,27 @@ constant shift greater than word length"))) (move ecx count) (inst shl result :cl))) +(define-vop (logand-bignum/c) + (:translate logand) + (:policy :fast-safe) + (:args (x :scs (descriptor-reg))) + (:arg-types bignum (:constant word)) + (:results (r :scs (unsigned-reg))) + (:info mask) + (:result-types unsigned-num) + (:generator 4 + (let ((mask (constantize mask))) + (cond ((or (integerp mask) + (location= x r)) + (loadw r x bignum-digits-offset other-pointer-lowtag) + (unless (eql mask -1) + (inst and r mask))) + (t + (inst mov r mask) + (inst and r (make-ea-for-object-slot x + bignum-digits-offset + other-pointer-lowtag))))))) + ;; Specialised mask-signed-field VOPs. (define-vop (mask-signed-field-word/c) (:translate sb!c::mask-signed-field)