Changeset 9488


Ignore:
Timestamp:
May 15, 2008, 4:50:14 PM (11 years ago)
Author:
rme
Message:

Correct errors in %multiply-and-add-harder-loop-2. Implement %floor-99.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ia32/level-0/X86/X8632/x8632-bignum.lisp

    r9400 r9488  
    372372        (xx mm3)
    373373        (yy mm4)
     374        (rr mm5)
    374375        (j imm0))
    375376    (movl (@ x (% esp)) (% temp0))
     
    382383    (movd (@ x8632::misc-data-offset (% temp0) (% j)) (% yy)) ;y[j]
    383384    (pmuludq (% xx) (% yy))
    384     (paddq (% cc) (% yy))
    385     (movd (% yy) (@ x8632::misc-data-offset (% temp1) (% i))) ;store r[i]
    386     (movq (% yy) (% cc))
    387     (psrlq ($ 32) (% cc))               ;carry high digit
     385    ;; 64-bit product now in %yy
     386    (movd (@ x8632::misc-data-offset (% temp1) (% i)) (% rr))
     387    ;; add in digit from r[i]
     388    (paddq (% yy) (% rr))
     389    ;; add in carry
     390    (paddq (% cc) (% rr))
     391    (movd (% rr) (@ x8632::misc-data-offset (% temp1) (% i))) ;update r[i]
     392    (movq (% rr) (% cc))
     393    (psrlq ($ 32) (% cc))               ;get carry digit into low word
    388394    (addl ($ '1) (% i))
    389395    (addl ($ '1) (% j))
     
    802808  (int ($ 3)))
    803809
     810;;; If x[i] = y[j], return the all ones digit (as two halves).
     811;;; Otherwise, compute floor x[i]x[i-1] / y[j].
    804812(defx8632lapfunction %floor-99 ((x-stk 8) (xidx 4) #|(ra 0)|#
    805813                                (yptr arg_y) (yidx arg_z))
    806   (int ($ 3)))
     814  (pop (% temp0))
     815  (pop (% imm0))
     816  (pop (% temp1))
     817  (discard-reserved-frame)
     818  (push (% temp1))
     819  (movl (% imm0) (% temp1))
     820  (movl (@ (% temp0) (% temp1)) (% imm0)) ;x[i]
     821  (cmpl (% imm0) (@ (% yptr) (% yidx)))   ;y[j]
     822  (jne @more)
     823  (pushl ($ '#xffff))
     824  (pushl ($ '#xffff))
     825  (lea (@ '2 (% esp)) (% temp0))
     826  (set-nargs 2)
     827  (jmp-subprim .SPvalues)
     828  @more
     829  (mark-as-imm edx)                     ;aka temp1 (contains a fixnum)
     830  (movl (@ -4 (% temp0) (% temp1)) (% eax)) ;low digit
     831  (movl (@ (% temp0) (% temp1)) (% edx))    ;high digit
     832  (divl (@ (% yptr) (% yidx)))
     833  (mark-as-node edx)
     834  ;; extract and push high half of quotient
     835  (movl ($ (- #x10000)) (% arg_y))
     836  (andl (% eax) (% arg_y))
     837  (shrl ($ (- 16 x8632::fixnumshift)) (% arg_y))
     838  (push (% arg_y))
     839  ;; extract and push low half
     840  (shrl ($ 16) (% eax))
     841  (shll ($ x8632::fixnumshift) (% eax))
     842  (push (% eax))
     843  (set-nargs 2)
     844  (lea (@ '2 (% esp)) (% temp0))
     845  (jmp-subprim .SPvalues))
    807846
    808847(defx8632lapfunction %multiply-and-add-1 ((x-high 16)
Note: See TracChangeset for help on using the changeset viewer.