X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fx86%2Ftype-vops.lisp;h=0284ae4dd6726308b8a9c78d90946bbe1de71176;hb=09d3e0862347c08634268d49dc2f72c2375b9d8c;hp=9d53fe955d2d89efa997a4cfad3f725ccaf1186a;hpb=d95f1e6476aa63695e018a7769a1ae9e002fca36;p=sbcl.git diff --git a/src/compiler/x86/type-vops.lisp b/src/compiler/x86/type-vops.lisp index 9d53fe9..0284ae4 100644 --- a/src/compiler/x86/type-vops.lisp +++ b/src/compiler/x86/type-vops.lisp @@ -212,8 +212,27 @@ (:arg-types unsigned-num) (:translate fixnump) (:generator 5 + ;; We could encode this with :Z and SHR, analogously to the signed-byte-32 + ;; case below -- as we do on x86-64 -- but that costs us an extra + ;; register. Compromises... (inst cmp value #.sb!xc:most-positive-fixnum))) +(define-vop (fixnump/signed-byte-32 type-predicate) + (:args (value :scs (signed-reg))) + (:info) + (:conditional :z) + (:arg-types signed-num) + (:translate fixnump) + (:generator 5 + ;; Hackers Delight, p. 53: signed + ;; a <= x <= a + 2^n - 1 + ;; is equivalent to unsigned + ;; ((x-a) >> n) = 0 + (inst mov eax-tn value) + (inst sub eax-tn #.sb!xc:most-negative-fixnum) + (inst shr eax-tn #.(integer-length (- sb!xc:most-positive-fixnum + sb!xc:most-negative-fixnum))))) + ;;; A (SIGNED-BYTE 32) can be represented with either fixnum or a bignum with ;;; exactly one digit.