Changeset 8827 for branches/ia32/level0
 Timestamp:
 Mar 19, 2008, 5:23:56 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/ia32/level0/X86/X8632/x8632bignum.lisp
r8213 r8827 17 17 (setnargs 2) 18 18 (jmpsubprim .SPvalues)) 19 20 (defx8632lapfunction %bignumrefhi ((bignum arg_y) (i arg_z)) 21 (int ($ 3))) 22 23 19 24 20 25 ;;; BIGNUM[I] := DIGIT[0] … … 691 696 ;;; in two halves. 692 697 (defx8632lapfunction %floorloopquo ((x 8) (q 4) #(ra 0)# (yhi arg_y) (ylo arg_z)) 693 ) 694 695 696 698 (int ($ 3))) 699 700 (defx8632lapfunction %floorloopnoquo ((q 4) #(ra 0)# (yhi arg_y) (ylo arg_z)) 701 (int ($ 3))) 702 703 (defx8632lapfunction truncateguessloop ((guessh 16) (guessl 12) (x 8) 704 (xidx 4) #(ra 0)# 705 (yptr arg_y) (yidx arg_z)) 706 (int ($ 3))) 707 708 (defx8632lapfunction %floor99 ((xstk 8) (xidx 4) #(ra 0)# 709 (yptr arg_y) (yidx arg_z)) 710 (int ($ 3))) 711 712 (defx8632lapfunction %multiplyandadd1 ((xhigh 16) 713 (xlow 12) 714 (yhigh 8) 715 (ylow 4) 716 #(ra 0)# 717 (carryinhigh arg_y) 718 (carryinlow arg_z)) 719 (int ($ 3))) 720 721 ;;; Copy the limb SRC points to to where DEST points. 722 (defx8632lapfunction copylimb ((src arg_y) (dest arg_z)) 723 (int ($ 3))) 724 725 ;;; Return T iff LIMB contains 0. 726 (defx8632lapfunction limbzerop ((limb arg_z)) 727 (int ($ 3))) 728 729 ;;; Return 1,0,1 according to whether the contents of Y are 730 ;;; <,=,> the contents of Z. 731 (defx8632lapfunction comparelimbs ((y arg_y) (z arg_z)) 732 (int ($ 3))) 733 734 ;;; Add a fixnum to the limb LIMB points to. Ignore overflow. 735 (defx8632lapfunction addfixnumtolimb ((fixnum arg_y) (limb arg_z)) 736 (int ($ 3))) 737 738 ;;; Store a fixnum value where LIMB points. 739 (defx8632lapfunction copyfixnumtolimb ((fixnum arg_y) (limb arg_z)) 740 (int ($ 3))) 741 742 ;;; Increment a "LIMB VECTOR" (bignum) by a small amount. The caller 743 ;;; knows that carries will only propagate for a word or two. 744 (defx8632lapfunction mpnincru ((limb arg_y) (fixby arg_z)) 745 (int ($ 3))) 746 747 ;;; Store XPYP at WP; return carry (0 or 1). 748 ;;; wp, xp, yp: wordaligned, unboxed ptrs (fixnums) 749 ;;; size: boxed fixnum 750 ;;; returns boxed carry 751 (defx8632lapfunction mpnsubn ((wp 8) (xp 4) #(ra 0)# 752 (yp arg_y) (size arg_z)) 753 (int ($ 3))) 754 755 ;;; Store XP+YP at WP; return carry (0 or 1). 756 ;;; wp, xp, yp = wordaligned, unboxed macptrs (fixnums). 757 ;;; size = boxed fixnum 758 ;;; result = boxed carry 759 (defx8632lapfunction mpnaddn ((wp 8) (xp 4) #(ra 0)# 760 (yp arg_y) (size arg_z)) 761 (int ($ 3))) 762 763 ;;; Add the single limb LIMB to S1P (propagating carry.) Store the 764 ;;; result at RP. RP and S1P may be the same place, so check for 765 ;;; that and do nothing after carry stops propagating. Return carry. 766 (defx8632lapfunction mpnadd1 ((rpoffset 8) (s1p 4) #(ra 0)# 767 (size arg_y) (limb arg_z)) 768 (int ($ 3))) 769 770 ;;; Multiply the limb vector S1 by the single limb at LIMBPTR, storing 771 ;;; the result at RES. Store the "carry out" (high word of last 64bit 772 ;;; partial product) at the limb RESULT. 773 ;;; res, s1, limbptr, result: 774 ;;; unboxed, wordaligned ptrs (fixnums). size: boxed fixnum 775 ;;; It'd be hard to transliterate the GMP code here; the GMP version 776 ;;; uses lots more immediate registers than we can easily use in LAP 777 ;;; (and is much more aggressively pipelined). 778 (defx8632lapfunction mpnmul1 ((resoffset 12) 779 (s1offset 8) 780 (size 4) 781 #(ra 0)# 782 (limbptr arg_y) 783 (result arg_z)) 784 (int ($ 3))) 785 786 ;;; multiply s1*limb and add result to res 787 ;;; res, s1, limbptr, result: 788 ;;; unboxed, wordaligned ptrs (fixnums). 789 ;;; size: boxed fixnum 790 ;;; limbptr: source "limb". 791 ;;; result: carry out (high word of product). 792 (defx8632lapfunction mpnaddmul1 ((resoffset 12) 793 (s1offset 8) 794 (size 4) 795 #(ra 0)# 796 (limbptr arg_y) 797 (result arg_z)) 798 (int ($ 3))) 799 800 ;;; Multiply the UNword limb vector at UP and the VNword limb vector 801 ;;; at VP, store the result at RP. 802 (defx8632lapfunction mpnmulbasecase ((rpoffset 12) 803 (upoffset 8) 804 (un 4) 805 #(ra 0)# 806 (vp arg_y) 807 (vn arg_z)) 808 (int ($ 3))) 809 810 ;;; leftshift src by 1 bit, storing result at res. Return 811 ;;; the bit that was shifted out. 812 (defx8632lapfunction mpnlshift1 ((resptr 4) #(ra 0)# 813 (s1ptr arg_y) (sizearg arg_z)) 814 (int ($ 3))) 815 816 ;;; Do a 32x32=64 unsigned multiply of the words at X and Y. Store 817 ;;; result (low word first) at RESULT. 818 (defx8632lapfunction umulppm ((x 4) #(ra 0)# (y arg_y) (result arg_z)) 819 (int ($ 3))) 820 821 (defx8632lapfunction %fixnumtobignumset ((bignum arg_y) (fixnum arg_z)) 822 (unboxfixnum fixnum imm0) 823 (movl (% imm0) (@ x8632::miscdataoffset (% bignum))) 824 (singlevaluereturn))
Note: See TracChangeset
for help on using the changeset viewer.