Ignore:
Timestamp:
Oct 9, 2009, 8:40:00 PM (10 years ago)
Author:
gz
Message:

Faster bignum multiplication (r12839, r12847, r12850)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-0/X86/X8664/x8664-bignum.lisp

    r11164 r12973  
    7171    (single-value-return 4)))
    7272
     73(defx86lapfunction %multiply-and-add-loop64
     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::misc-data-offset (% 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::misc-data-offset (% y) (% j))) ;128-bit x * y[j] in rdx:rax
     88    (addq (@ x8664::misc-data-offset (% 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::misc-data-offset (% r) (% i))) ;update r[i]
     95    (addq ($ '1) (% i))
     96    (addq ($ '1) (% j))
     97    (subq ($ '1) (% ylen))
     98    (ja @loop)
     99    (movq (% c) (@ x8664::misc-data-offset (% r) (% i)))
     100    (single-value-return 4)))
    73101
    74102;;; Multiply the (32-bit) digits X and Y, producing a 64-bit result.
Note: See TracChangeset for help on using the changeset viewer.