handle non-standard slot allocations when updating classes
[sbcl.git] / src / compiler / ppc / arith.lisp
index 4cbfbb0..e5eabce 100644 (file)
   (:temporary (:scs (non-descriptor-reg)) temp)
   (:translate *)
   (:generator 2
-    (inst srawi temp y 2)
+    (inst srawi temp y n-fixnum-tag-bits)
     (inst mullw r x temp)))
 
 (define-vop (fast-*-c/fixnum=>fixnum fast-fixnum-binop-c)
     (inst mullw lo x y)
     (inst mulhwu hi x y)))
 
+#!+multiply-high-vops
+(define-vop (mulhi)
+  (:translate sb!kernel:%multiply-high)
+  (:policy :fast-safe)
+  (:args (x :scs (unsigned-reg))
+         (y :scs (unsigned-reg)))
+  (:arg-types unsigned-num unsigned-num)
+  (:results (hi :scs (unsigned-reg)))
+  (:result-types unsigned-num)
+  (:generator 20
+    (inst mulhwu hi x y)))
+
+#!+multiply-high-vops
+(define-vop (mulhi/fx)
+  (:translate sb!kernel:%multiply-high)
+  (:policy :fast-safe)
+  (:args (x :scs (any-reg))
+         (y :scs (unsigned-reg)))
+  (:arg-types positive-fixnum unsigned-num)
+  (:temporary (:sc non-descriptor-reg :from :eval :to :result) temp)
+  (:temporary (:sc non-descriptor-reg :from :eval :to :result) mask)
+  (:results (hi :scs (any-reg)))
+  (:result-types positive-fixnum)
+  (:generator 15
+    (inst mulhwu temp x y)
+    (inst lr mask fixnum-tag-mask)
+    (inst andc hi temp mask)))
+
 (define-vop (bignum-lognot lognot-mod32/unsigned=>unsigned)
   (:translate sb!bignum:%lognot))
 
   (:results (digit :scs (unsigned-reg)))
   (:result-types unsigned-num)
   (:generator 1
-    (inst srawi digit fixnum 2)))
+    (inst srawi digit fixnum n-fixnum-tag-bits)))
 
 
 (define-vop (bignum-floor)
-  (:translate sb!bignum:%floor)
+  (:translate sb!bignum:%bigfloor)
   (:policy :fast-safe)
   (:args (num-high :scs (unsigned-reg) :target rem)
          (num-low :scs (unsigned-reg) :target rem-low)
 #|
 
 (define-vop (bignum-floor)
-  (:translate sb!bignum:%floor)
+  (:translate sb!bignum:%bigfloor)
   (:policy :fast-safe)
   (:args (div-high :scs (unsigned-reg) :target rem)
          (div-low :scs (unsigned-reg) :target quo)
   (:generator 1
     (sc-case res
       (any-reg
-       (inst slwi res digit 2))
+       (inst slwi res digit n-fixnum-tag-bits))
       (signed-reg
        (move res digit)))))