Changeset 11111
 Timestamp:
 Oct 17, 2008, 7:01:21 AM (11 years ago)
 Location:
 trunk/source/level0
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/source/level0/X86/X8664/x8664bignum.lisp
r8404 r11111 36 36 (singlevaluereturn)) 37 37 38 ;; multiply x[i] by y and add to result starting at digit idx 39 (defx86lapfunction %multiplyandaddloop 40 ((x 16) (y 8) #(ra 0)# (r arg_x) (idx arg_y) (ylen arg_z)) 41 (let ((cc mm2) 42 (xx mm3) 43 (yy mm4) 44 (rr mm5) 45 (i imm0) 46 (j imm1)) 47 (unboxfixnum idx i) 48 (movq (@ x (% rsp)) (% temp0)) 49 (movd (@ x8664::miscdataoffset (% temp0) (% i) 4) (% xx)) ;x[i] 50 (movq (@ y (% rsp)) (% temp0)) 51 (movq (% r) (% temp1)) 52 (pxor (% cc) (% cc)) 53 (xorq (% j) (% j)) 54 @loop 55 (movd (@ x8664::miscdataoffset (% temp0) (% j) 4) (% yy)) ;y[j] 56 (pmuludq (% xx) (% yy)) 57 ;; 64bit product now in %yy 58 (movd (@ x8664::miscdataoffset (% temp1) (% i) 4) (% rr)) 59 ;; add in digit from r[i] 60 (paddq (% yy) (% rr)) 61 ;; add in carry 62 (paddq (% cc) (% rr)) 63 (movd (% rr) (@ x8664::miscdataoffset (% temp1) (% i) 4)) ;update r[i] 64 (movq (% rr) (% cc)) 65 (psrlq ($ 32) (% cc)) ;get carry digit into low word 66 (addq ($ 1) (% i)) 67 (addq ($ 1) (% j)) 68 (subq ($ '1) (% ylen)) 69 (jg @loop) 70 (movd (% cc) (@ x8664::miscdataoffset (% temp1) (% i) 4)) 71 (singlevaluereturn 4))) 38 72 39 73 
trunk/source/level0/l0bignum64.lisp
r8529 r11111 755 755 (res (%allocatebignum lenres)) ) 756 756 (declare (bignumindex lena lenb lenres)) 757 (dotimes (i lena) 758 (declare (type bignumindex i)) 759 (let* ((carrydigit 0) 760 (x (bignumref a i)) 761 (k i)) 762 (declare (fixnum k)) 763 (dotimes (j lenb) 764 (multiplevaluebind (bigcarry resdigit) 765 (%multiplyandadd4 x 766 (bignumref b j) 767 (bignumref res k) 768 carrydigit) 769 (setf (bignumref res k) resdigit 770 carrydigit bigcarry 771 k (1+ k)))) 772 (setf (bignumref res k) carrydigit))) 773 res))) 757 (dotimes (i lena) 758 (declare (type bignumindex i)) 759 (%multiplyandaddloop a b res i lenb)) 760 res))) 774 761 (let* ((res (withnegatedbignumbuffers a b multiplyunsignedbignums))) 775 762 (if signsdiffer (negatebignuminplace res))
Note: See TracChangeset
for help on using the changeset viewer.