- (let ((bignum (gen-label))
- (done (gen-label)))
- ;; We can't do the overflow check with SHL Y, 3, since the
- ;; state of the overflow flag is only reliably set when
- ;; shifting by 1. There used to be code here for doing "shift
- ;; by one, check whether it overflowed" three times. But on all
- ;; x86-64 processors IMUL is a reasonably fast instruction, so
- ;; we can just do a straight multiply instead of trying to
- ;; optimize it to a shift. This is both faster and smaller.
- ;; -- JES, 2006-07-08
- (inst imul y x (ash 1 n-fixnum-tag-bits))
- (inst jmp :o bignum)
- (emit-label done)
-
- (assemble (*elsewhere*)
- (emit-label bignum)
- (with-fixed-allocation
- (y bignum-widetag (+ bignum-digits-offset 1) node)
- (storew x y bignum-digits-offset other-pointer-lowtag))
- (inst jmp done)))))
+ (let ((done (gen-label)))
+ (inst imul y x #.(ash 1 n-fixnum-tag-bits))
+ (inst jmp :no done)
+ (inst mov y x)
+ (inst lea temp-reg-tn
+ (make-ea :qword :disp
+ (make-fixup (ecase (tn-offset y)
+ (#.rax-offset 'alloc-signed-bignum-in-rax)
+ (#.rcx-offset 'alloc-signed-bignum-in-rcx)
+ (#.rdx-offset 'alloc-signed-bignum-in-rdx)
+ (#.rbx-offset 'alloc-signed-bignum-in-rbx)
+ (#.rsi-offset 'alloc-signed-bignum-in-rsi)
+ (#.rdi-offset 'alloc-signed-bignum-in-rdi)
+ (#.r8-offset 'alloc-signed-bignum-in-r8)
+ (#.r9-offset 'alloc-signed-bignum-in-r9)
+ (#.r10-offset 'alloc-signed-bignum-in-r10)
+ (#.r12-offset 'alloc-signed-bignum-in-r12)
+ (#.r13-offset 'alloc-signed-bignum-in-r13)
+ (#.r14-offset 'alloc-signed-bignum-in-r14)
+ (#.r15-offset 'alloc-signed-bignum-in-r15))
+ :assembly-routine)))
+ (inst call temp-reg-tn)
+ (emit-label done))))