1.0.45.10: tools-for-build/Makefile path fixes
[sbcl.git] / src / compiler / x86-64 / arith.lisp
index 4735ce3..cc41f3d 100644 (file)
     (inst cqo)
     (inst idiv eax y)
     (if (location= quo eax)
-        (inst shl eax 3)
-        (inst lea quo (make-ea :qword :index eax :scale 8)))
+        (inst shl eax n-fixnum-tag-bits)
+        (inst lea quo (make-ea :qword :index eax
+                               :scale (ash 1 n-fixnum-tag-bits))))
     (move rem edx)))
 
 (define-vop (fast-truncate-c/fixnum=>fixnum fast-safe-arith-op)
         (setf y-arg (register-inline-constant :qword (fixnumize y))))
     (inst idiv eax y-arg)
     (if (location= quo eax)
-        (inst shl eax 3)
-        (inst lea quo (make-ea :qword :index eax :scale 8)))
+        (inst shl eax n-fixnum-tag-bits)
+        (inst lea quo (make-ea :qword :index eax
+                               :scale (ash 1 n-fixnum-tag-bits))))
     (move rem edx)))
 
 (define-vop (fast-truncate/unsigned=>unsigned fast-safe-arith-op)
                                        (location= number result)))))
   (:result-types tagged-num)
   (:note "inline ASH")
+  (:variant nil)
+  (:variant-vars modularp)
   (:generator 2
     (cond ((and (= amount 1) (not (location= number result)))
            (inst lea result (make-ea :qword :base number :index number)))
                         (inst sar result (- amount))
                         (inst and result (lognot fixnum-tag-mask)))))
                  ((plusp amount)
+                  (unless modularp
+                    (aver (not "Impossible: fixnum ASH should not be called with
+constant shift greater than word length")))
                   (if (sc-is result any-reg)
-                      (inst xor result result)
+                      (zeroize result)
                       (inst mov result 0)))
                  (t (inst sar result 63)
                     (inst and result (lognot fixnum-tag-mask))))))))
 
 (define-vop (fast-ash-left-smod61-c/fixnum=>fixnum
              fast-ash-c/fixnum=>fixnum)
+  (:variant :modular)
   (:translate ash-left-smod61))
 (define-vop (fast-ash-left-smod61/fixnum=>fixnum
              fast-ash-left/fixnum=>fixnum))