Changeset 15569
 Timestamp:
 Jan 8, 2013, 8:25:19 AM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/source/level0/X86/X8664/x8664bignum.lisp
r13432 r15569 36 36 (singlevaluereturn)) 37 37 38 ;; multiply x[i] by y and add to result starting at digit idx 39 (defx86lapfunction %multiplyandaddloop 40 ((x 16) (y 8) #(ra 0)# (r arg_x) (idx arg_y) (ylen arg_z)) 41 (let ((cc mm2) 42 (xx mm3) 43 (yy mm4) 44 (rr mm5) 45 (i imm0) 46 (j imm1)) 47 (unboxfixnum idx i) 48 (movq (@ x (% rsp)) (% temp0)) 49 (movd (@ x8664::miscdataoffset (% temp0) (% i) 4) (% xx)) ;x[i] 50 (movq (@ y (% rsp)) (% temp0)) 51 (movq (% r) (% temp1)) 52 (pxor (% cc) (% cc)) 53 (xorq (% j) (% j)) 54 @loop 55 (movd (@ x8664::miscdataoffset (% temp0) (% j) 4) (% yy)) ;y[j] 56 (pmuludq (% xx) (% yy)) 57 ;; 64bit product now in %yy 58 (movd (@ x8664::miscdataoffset (% temp1) (% i) 4) (% rr)) 59 ;; add in digit from r[i] 60 (paddq (% yy) (% rr)) 61 ;; add in carry 62 (paddq (% cc) (% rr)) 63 (movd (% rr) (@ x8664::miscdataoffset (% temp1) (% i) 4)) ;update r[i] 64 (movq (% rr) (% cc)) 65 (psrlq ($ 32) (% cc)) ;get carry digit into low word 66 (addq ($ 1) (% i)) 67 (addq ($ 1) (% j)) 68 (subq ($ '1) (% ylen)) 69 (jg @loop) 70 (movd (% cc) (@ x8664::miscdataoffset (% temp1) (% i) 4)) 71 (singlevaluereturn 4))) 38 72 39 73 40 (defx86lapfunction %multiplyandaddloop64 … … 157 124 (setnargs 2) 158 125 (jmpsubprim .SPvalues))) 126 127 128 (defx86lapfunction %multiplyandaddfixnumloop ((len64 8) #(ra 0)# (x arg_x) (y arg_y) (result arg_z)) 129 (let ((carry imm2) 130 (i temp0) 131 (rlen temp1)) 132 (movq (@ len64 (% rsp)) (% rlen)) 133 (xorl (%l carry) (%l carry)) 134 (xorl (%l i) (%l i)) 135 (jmp @test) 136 @loop 137 (unboxfixnum y rax) 138 (mulq (@ x8664::miscdataoffset (% x) (% i))) 139 (addq (% carry) (% rax)) 140 (adcq ($ 0) (% rdx)) 141 (movq (% rdx) (% carry)) 142 (movq (% rax) (@ x8664::miscdataoffset (% result) (% i))) 143 (addq ($ 8) (% i)) 144 @test 145 (cmpq (% rlen) (% i)) 146 (jl @loop) 147 (movq (% carry) (@ x8664::miscdataoffset (% result) (% i))) 148 (singlevaluereturn 3))) 149 150 151 152 153 154 155 ;;; Set the ith 64bit digit of BIGNUM to R 156 (defx86lapfunction %setdigit ((bignum arg_x) (i arg_y) (r arg_z)) 157 158 (movq (@ x8664::miscdataoffset (% r)) (% imm0)) 159 (movq (% imm0) (@ x8664::miscdataoffset (% bignum) (% i))) 160 (singlevaluereturn)) 159 161 160 162 ;;; Return the (possibly truncated) 32bit quotient and remainder
Note: See TracChangeset
for help on using the changeset viewer.