Changeset 9174


Ignore:
Timestamp:
Apr 17, 2008, 6:35:30 PM (11 years ago)
Author:
rme
Message:

Implement FIX-DIGIT-LOGAND; redo BIGNUM-SHIFT-LEFT-LOOP.

File:
1 edited

Legend:

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

    r9044 r9174  
    559559  (single-value-return 3))
    560560
     561(defx8632lapfunction fix-digit-logand ((fix 4) #|(ra 0)|# (big arg_y) (dest arg_z)) ; index 0
     562  (mark-as-imm temp0)
     563  (movl (@ fix (% esp)) (% temp0))
     564  (sarl ($ x8632::fixnumshift) (% temp0))
     565  (movl (@ x8632::misc-data-offset (% big)) (% imm0))
     566  (andl (% temp0) (% imm0))
     567  (mark-as-node temp0)
     568  (cmpl ($ x8632::nil-value) (% dest))
     569  (jne @store)
     570  (box-fixnum imm0 arg_z)
     571  (single-value-return 3)
     572  @store
     573  (movl (% imm0) (@ x8632::misc-data-offset (% dest)))
     574  (single-value-return 3))
     575
     576
    561577(defx8632lapfunction digit-lognot-move ((index 4) #|(ra 0)|# (source arg_y) (dest arg_z))
    562578  (movl (@ index (% esp)) (% temp0))
     
    612628    (single-value-return 3)))
    613629
    614 ;;; called from bignum-ashift-left-unaligned
    615 (defx8632lapfunction bignum-shift-left-loop ((nbits 12) (result 8) (bignum 4) #|(ra 0)|# (res-len-1 arg_y) (j arg_z))
    616   (let ((r temp0)
    617         (b temp1)
    618         (bb mm2)
    619         (bits mm3)
    620         (tt mm4)
    621         (remaining-bits mm5))
    622     (movl (% j) (% imm0))
    623     (subl ($ '1) (% imm0))
    624     (pushl (% imm0))                    ;digits
    625     (movl (@ nbits (% esp)) (% imm0))
    626     (unbox-fixnum imm0 imm0)
    627     (movd (% imm0) (% bits))            ;shift count
    628     (negl (% imm0))
    629     (addl ($ 32) (% imm0))
    630     (movd (% imm0) (% remaining-bits))
    631     (movl (@ result (% esp)) (% r))
    632     (movl (@ bignum (% esp)) (% b))
    633     (xorl (% imm0) (% imm0))
    634     @loop
    635     ;; bignum[i]
    636     (movd (@ x8632::misc-data-offset (% b) (% imm0)) (% bb))
    637     (psrlq (% remaining-bits) (% bb))
    638     ;; bignum[i+1]
    639     (movd (@ (+ x8632::misc-data-offset 4) (% b) (% imm0)) (% tt))
    640     (psllq (% bits) (% tt))
    641     (por (% tt) (% bb))
    642     (movd (% bb) (@ x8632::misc-data-offset (% r) (% j)))
    643     (addl ($ '1) (% imm0))
    644     (addl ($ '1) (% j))
    645     (cmpl (% j) (% res-len-1))
    646     (jne @loop)
    647     (movd (@ x8632::misc-data-offset (% bignum)) (% bb)) ;bignum[0]
    648     (psllq (% bits) (% bb))
    649     (popl (% arg_y))                    ;digits
    650     (movd (% bb) (@ x8632::misc-data-offset (% r) (% arg_y)))
    651     (movd (@ x8632::misc-data-offset (% bignum) (% imm0)) (% bb)) ;bignum[i]
    652     (psrlq (% remaining-bits) (% bb))
    653     (movd (% bb) (@ x8632::misc-data-offset (% r) (% j)))
    654     (single-value-return 5)))
     630(defx8632lapfunction bignum-shift-left-loop ((nbits 12) (result 8)
     631                                             (bignum 4) #|(ra 0)|#
     632                                             (res-len-1 arg_y) (j arg_z))
     633  (movl (@ nbits (% esp)) (% imm0))
     634  (sarl ($ x8632::fixnumshift) (% imm0))
     635  (movd (% imm0) (% mm7))               ;shift count
     636  (subl ($ 32) (% imm0))
     637  (movd (% imm0) (% mm6))               ;remaining bits
     638  (movl (@ result (% esp)) (% temp0))
     639  (movl (@ bignum (% esp)) (% temp1))
     640  (push (% arg_y))
     641  (xorl (% arg_y) (% arg_y))            ;i
     642  (jmp @test)
     643  @loop
     644  (movd (@ x8632::misc-data-offset (% temp1) (% arg_y)) (% mm0)) ;b[i]
     645  (psrlq (% mm6) (% mm0))
     646  (movd (@ (+ 4 x8632::misc-data-offset) (% temp1) (% arg_y)) (% mm1)) ;b[i+1]
     647  (psllq (% mm7) (% mm1))
     648  (por (% mm1) (% mm0))
     649  (movd (% mm0) (@ x8632::misc-data-offset (% temp0) (% arg_z))) ;r[j]
     650  (addl ($ '1) (% arg_y))
     651  (addl ($ '1) (% arg_z))
     652  @test
     653  (cmpl (@ (% esp)) (% j))              ;pity res-len-1 can't stay in a reg
     654  (jne @loop)
     655  (movd (@ x8632::misc-data-offset (% temp1) (% arg_y)) (% mm0)) ;b[i]
     656  (psrlq (% mm6) (% mm0))
     657  (movd (% mm0) (@ x8632::misc-data-offset (% temp0) (% arg_z))) ;r[j]
     658  ;; reconsititute "digits" arg to bignum-ashift-left-unaligned
     659  (pop (% arg_z))
     660  (subl ($ '1) (% arg_z))
     661  (movd (@ x8632::misc-data-offset (% temp1)) (% mm0)) ;b[0]
     662  (psllq (% mm7) (% mm0))
     663  (movd (% mm0) (@ x8632::misc-data-offset (% temp0) (% arg_z))) ;b[digits]
     664  (single-value-return 5))
    655665
    656666(defx8632lapfunction %logcount-complement ((bignum arg_y) (i arg_z))
Note: See TracChangeset for help on using the changeset viewer.