Changeset 13931 for branches


Ignore:
Timestamp:
Jul 7, 2010, 6:52:06 PM (9 years ago)
Author:
gb
Message:

arm-bignum.lisp: First stab at TRUNCATE-GUESS-LOOP; fix BIGNUM-SHIFT-LEFT-LOOP.
l0-bignum32.lisp: Don't use *TRUNCATE-X*/*TRUNCATE-Y*; pass extra arguments
around instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/arm/level-0/ARM/arm-bignum.lisp

    r13927 r13931  
    853853;; y1 is at index, y2 at index-1
    854854;; this doesnt help much
    855 #+notyet
    856855(defarmlapfunction truncate-guess-loop ((guess-h 8)(guess-l 4)(x 0)
    857856                                        (xidx arg_x)(yptr arg_y) (yidx arg_z))
     
    864863        (gy2-hi imm2)
    865864        (xptr temp0)
    866         (m imm3)
    867         (tem imm4)
    868         (y1-idx 28)
    869         (y2-idx 24)
    870         (x0-idx 20)
    871         (x1-idx 16)
    872         (x2-idx 12))
    873     (stru -32  (:$ tsp)) tsp
    874     (str tsp tsp  (:$ 4))
    875     (ldr y1 vsp (:$ guess-h))
    876     (ldr tem vsp (:$ guess-l))
    877     (compose-digit guess y1 tem)
    878     (addi tem yidx arm::misc-data-offset)
    879     (ldr y1 (:@ yptr tem))
    880     (str y1 tsp  (:$ y1-idx))
    881     (subi tem tem 4)
    882     (ldr y2 (:@ yptr tem))
    883     (str y2 tsp  (:$ y2-idx))
    884     (ldr xptr vsp (:$ x))
    885     (addi tem xidx arm::misc-data-offset)
    886     (ldr y1 (:@ xptr tem)) ; its x0
    887     (str y1 tsp  (:$ x0-idx))
    888     (subi tem tem 4)
    889     (ldr y1 (:@ xptr tem))
    890     (str y1 tsp  (:$ x1-idx))
    891     (subi tem tem 4)
    892     (ldr y1 (:@ xptr tem))
    893     (str y1 tsp  (:$ x2-idx))
     865        (m r3)
     866        (tem temp1)
     867        (save-rcontext temp2)
     868        (m-save 24)
     869        (y1-idx 20)
     870        (y2-idx 16)
     871        (x0-idx 12)
     872        (x1-idx 8)
     873        (x2-idx 4))
     874    (mov imm0 (:$ (ash 6 arm::num-subtag-bits)))
     875    (orr imm0 imm0 (:$ arm::subtag-u32-vector))
     876    (str imm0 (:@! sp (:$ -32)))
     877    (mov save-rcontext rcontext)
     878    (ldr y1 (:@ vsp (:$ guess-h)))
     879    (ldr y2 (:@ vsp (:$ guess-l)))
     880    (compose-digit guess y1 y2)
     881    (mov tem (:lsl yidx (:$ arm::fixnumshift)))
     882    (add tem tem (:$ (ash arm::misc-data-offset arm::fixnumshift)))
     883    (ldr y1 (:@ yptr (:asr tem (:$ arm::fixnumshift))))
     884    (str y1 (:@ sp  (:$ y1-idx)))
     885    (sub tem tem '4)
     886    (ldr y2 (:@ yptr (:asr tem (:$ arm::fixnumshift))))
     887    (str y2 (:@ sp  (:$ y2-idx)))
     888    (ldr xptr (:@ vsp (:$ x)))
     889    (mov tem (:lsl xidx (:$ arm::fixnumshift)))
     890    (add tem tem (:$ (ash arm::misc-data-offset arm::fixnumshift)))
     891    (ldr y1 (:@ xptr (:asr tem (:$ arm::fixnumshift)))) ; its x0
     892    (str y1 (:@ sp  (:$ x0-idx)))
     893    (sub tem tem '4)
     894    (ldr y1 (:@ xptr (:asr tem (:$ arm::fixnumshift))))
     895    (str y1 (:@ sp  (:$ x1-idx)))
     896    (sub tem tem '4)
     897    (ldr y1 (:@ xptr (:asr tem (:$ arm::fixnumshift))))
     898    (str y1 (:@ sp  (:$ x2-idx)))
    894899    @loop
    895     (ldr y1 tsp (:$ y1-idx))     ; get y1
    896     (mullw gy1-lo guess y1)
    897     (ldr m tsp (:$ x1-idx))      ; get x1
    898     (subc m m gy1-lo)      ; x1 - gy1-lo => m
    899     (mulhwu gy1-hi guess y1)
    900     (ldr tem tsp (:$ x0-idx))    ; get x0
    901     (subfe. tem gy1-hi tem)      ; - val not used just cr
    902     (ldr y2 tsp (:$ y2-idx))     ; get y2
    903     (mulhwu gy2-hi guess y2)   ; does it pay to do this now even tho may not need?
     900    (ldr y1 (:@ sp (:$ y1-idx)))     ; get y1
     901    (mul gy1-lo guess y1)
     902    (ldr m (:@ sp (:$ x1-idx)))      ; get x1
     903    (subs m m gy1-lo)      ; x1 - gy1-lo => m
     904    (umull gy1-hi y2 guess y1)
     905    (ldr y2 (:@ sp (:$ x0-idx)))    ; get x0
     906    (rscs y2 gy1-hi y2)      ; - val not used just cr
     907    (ldr y2 (:@ sp (:$ y2-idx)))     ; get y2
     908    (str m (:@ sp (:$ m-save)))
     909    (umull gy2-hi m guess y2)   ; does it pay to do this now even tho may not need?
     910    (ldr m (:@ sp (:$ m-save)))
    904911    (bne @done)
    905     (cmpl :cr0 gy2-hi m)       ; if > or = and foo then more - L means logical means unsigned
    906     (blt @done)           ; if < done
     912    (cmp gy2-hi m)       ; if > or = and foo then more - L means logical means unsigned
     913    (blo @done)           ; if < done
    907914    (bne @more)           ; if = test lo
    908     (mullw gy2-lo guess y2)
    909     (ldr tem tsp (:$ x2-idx)) ; get x2
    910     (cmpl :cr0 gy2-lo tem)
    911     (ble @done)
     915    (mul gy2-lo guess y2)
     916    (ldr y1 (:@ sp (:$ x2-idx))) ; get x2
     917    (cmp gy2-lo y1)
     918    (bls @done)
    912919    @more
    913     (subi guess guess 1)
     920    (sub guess guess (:$ 1))
    914921    (b @loop)
    915922    @done
     923    (mov rcontext save-rcontext)
    916924    (digit-h temp0 guess)
    917     (vpush temp0)
     925    (vpush1 temp0)
    918926    (digit-l temp0 guess)
    919     (vpush temp0)
     927    (vpush1 temp0)
    920928    (add temp0 vsp (:$ 20))
    921     (ldr tsp tsp (:$ 0))
     929    (add sp sp (:$ 32))
    922930    (set-nargs 2)
    923931    (ba .spvalues)))
     
    11601168    (ldr x (:@ bignum (:asr i (:$ 2))))
    11611169    (rsb shift shift (:$ 32))
    1162     (mov x (:asr x shift))
     1170    (mov x (:lsr x shift))
    11631171    (add i i '4)                        ;sic
    11641172    (ldr y (:@ bignum (:asr i (:$ 2))))
     
    11691177    (add j j '1)   
    11701178    (cmp j len)
    1171     (add i i '4)
    11721179    (blt @loop)   
    11731180    @done
    1174                                         ; do first - lo order
    1175        
    1176                                         ; do last - hi order   
    1177                                         ;(dbg t)
     1181    (rsb shift shift (:$ 32))
    11781182    (ldr y (:@ bignum (:asr i (:$ 2))))
    1179     (mov y (:asr y shift))
     1183    (mov y (:lsr y shift))
    11801184    (add x len (:$ arm::misc-data-offset))
    11811185    (str y (:@ resptr x))   
Note: See TracChangeset for help on using the changeset viewer.