- ;; Faster but bigger then SHL Y 4. The cost of doing this
- ;; speculatively should be noise compared to bignum consing if
- ;; that is needed and saves one branch.
- (inst lea y (make-ea :qword :index x :scale (ash 1 n-fixnum-tag-bits)))
+ ;; Using LEA is faster but bigger than MOV+SHL; it also doesn't
+ ;; twiddle the sign flag. The cost of doing this speculatively
+ ;; should be noise compared to bignum consing if that is needed
+ ;; and saves one branch.
+ (if (= n-fixnum-tag-bits 1)
+ (inst lea y (make-ea :qword :base x :index x))
+ (inst lea y (make-ea :qword :index x
+ :scale (ash 1 n-fixnum-tag-bits))))