From 2bd85005adc981c68f7210431b621417ae2e52e0 Mon Sep 17 00:00:00 2001 From: Alastair Bridgewater Date: Thu, 24 Apr 2014 09:18:58 -0400 Subject: [PATCH] compiler/arm/arith: Two more bignum fixes. * From stassats: add-w/carry needs the same C input sense as sub-w/borrow. * And we need a VOP for %FIXNUM-DIGIT-WITH-CORRECT-SIGN, VOP definition also supplied by stassats. --- src/compiler/arm/arith.lisp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/compiler/arm/arith.lisp b/src/compiler/arm/arith.lisp index 8c391b11f..d611db3e1 100644 --- a/src/compiler/arm/arith.lisp +++ b/src/compiler/arm/arith.lisp @@ -450,12 +450,11 @@ (b :scs (unsigned-reg)) (c :scs (any-reg))) (:arg-types unsigned-num unsigned-num positive-fixnum) - (:temporary (:scs (unsigned-reg) :to (:result 0) :target result) temp) (:results (result :scs (unsigned-reg)) (carry :scs (unsigned-reg) :from :eval)) (:result-types unsigned-num positive-fixnum) (:generator 3 - (inst rsbs temp c 0) ;; Clear carry if c=0, else set. + (inst cmp c 1) ;; Set carry if (fixnum 0 or 1) c=0, else clear. (inst adcs result a b) (inst mov :cs carry 1) (inst mov :cc carry 0))) @@ -543,6 +542,18 @@ (unless (= i 32) (inst adc rem rem rem))))) +(define-vop (signify-digit) + (:translate sb!bignum:%fixnum-digit-with-correct-sign) + (:policy :fast-safe) + (:args (digit :scs (unsigned-reg) :target res)) + (:arg-types unsigned-num) + (:results (res :scs (any-reg signed-reg))) + (:result-types signed-num) + (:generator 1 + (if (sc-is res any-reg) + (inst mov res (lsl digit n-fixnum-tag-bits)) + (inst mov res digit)))) + (define-vop (digit-ashr) (:translate sb!bignum:%ashr) (:policy :fast-safe) -- 2.11.4.GIT