Changeset 12839
 Timestamp:
 Sep 16, 2009, 2:14:21 AM (10 years ago)
 Location:
 trunk/source/level0
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/source/level0/X86/X8664/x8664bignum.lisp
r11111 r12839 71 71 (singlevaluereturn 4))) 72 72 73 (defx86lapfunction %multiplyandaddloop64 74 ((xs 16) (ys 8) #(ra 0)# (r arg_x) (i arg_y) (ylen arg_z)) 75 (let ((y temp2) 76 (j temp0) 77 (c imm2)) 78 (movq (@ xs (% rsp)) (% temp0)) 79 (movq (@ x8664::miscdataoffset (% temp0) (% i)) (% mm0)) ;x[i] 80 (movq (@ ys (% rsp)) (% y)) 81 (xorl (%l j) (%l j)) 82 (xorl (%l c) (%l c)) 83 @loop 84 ;; It's a pity to have to reload this every time, but there's no 85 ;; imm3. (Give him 16 registers, and he still complains...) 86 (movd (% mm0) (% rax)) 87 (mulq (@ x8664::miscdataoffset (% y) (% j))) ;128bit x * y[j] in rdx:rax 88 (addq (@ x8664::miscdataoffset (% r) (% i)) (% rax)) ;add in r[i] 89 (adcq ($ 0) (% rdx)) 90 ;; add in carry digit 91 (addq (% c) (% rax)) 92 (movl ($ 0) (%l c)) 93 (adcq (% rdx) (% c)) ;new carry digit 94 (movq (% rax) (@ x8664::miscdataoffset (% r) (% i))) ;update r[i] 95 (addq ($ '1) (% i)) 96 (addq ($ '1) (% j)) 97 (subq ($ '1) (% ylen)) 98 (ja @loop) 99 (movq (% c) (@ x8664::miscdataoffset (% r) (% i))) 100 (singlevaluereturn 4))) 73 101 74 102 ;;; Multiply the (32bit) digits X and Y, producing a 64bit result. 
trunk/source/level0/l0bignum64.lisp
r11958 r12839 804 804 (lenb (%bignumlength b)) 805 805 (lenres (+ lena lenb)) 806 (res (%allocatebignum lenres)) 806 (res (%allocatebignum lenres))) 807 807 (declare (bignumindex lena lenb lenres)) 808 808 (dotimes (i lena) 809 809 (declare (type bignumindex i)) 810 810 (%multiplyandaddloop a b res i lenb)) 811 res)) 812 (multiplyunsignedbignums64 (a b) 813 (let* ((lena (ceiling (%bignumlength a) 2)) 814 (lenb (ceiling (%bignumlength b) 2)) 815 (lenres (+ lena lenb)) 816 (res (%allocatebignum (+ lenres lenres)))) 817 (declare (bignumindex lena lenb lenres)) 818 (dotimes (i lena) 819 (declare (type bignumindex i)) 820 (%multiplyandaddloop64 a b res i lenb)) 811 821 res))) 812 (let* ((res (withnegatedbignumbuffers a b multiplyunsignedbignums))) 822 (let* ((res (withnegatedbignumbuffers a b 823 #x86target 824 multiplyunsignedbignums 825 #+x86target 826 multiplyunsignedbignums64))) 813 827 (if signsdiffer (negatebignuminplace res)) 814 828 (%normalizebignummacro res)))))
Note: See TracChangeset
for help on using the changeset viewer.