Changeset 13819
 Timestamp:
 Jun 14, 2010, 10:13:09 AM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

branches/arm/level0/ARM/armbignum.lisp
r13805 r13819 984 984 (bx lr))) 985 985 986 #+notyet987 986 (defarmlapfunction %normalizebignum2 ((fixp arg_y)(res arg_z)) 988 987 (let ((idx imm0) … … 991 990 (len arg_x) 992 991 (oldlen temp0)) 993 (ldr imm4 res (:$ ( arm::fulltagmisc))) 994 (headerlength len imm4) 995 (cmpwi len 0) 996 (mr oldlen len) 997 (addi idx len ( arm::miscdataoffset 4)) 998 (beqlr) ; huh  can this ever happen? 992 (vectorlength len res imm0) 993 (cmp len (:$ 0)) 994 (mov oldlen len) 995 (add idx len (:$ ( arm::miscdataoffset 4)) ) 996 (bxeq lr) ; huh  can this ever happen? 999 997 (ldr val (:@ res idx)) ; high order word 1000 ( srawi usign val 31) ; get sign998 (mov usign (:asr val (:$ 31))) ; get sign 1001 999 @loop 1002 1000 (ldr val (:@ res idx)) 1003 (cmp wval usign)1004 (sub iidx idx '1)1001 (cmp val usign) 1002 (sub idx idx '1) 1005 1003 (bne @neq) 1006 (sub ic.len len '1)1004 (subs len len '1) 1007 1005 (bgt @loop) 1008 1006 ; fall through  its all sign  return 1 1009 ( lilen '1)1010 ( rlwinm usign usign 0 0 0) ; hi bit1007 (mov len '1) 1008 (and usign usign (:$ #x80000000)) 1011 1009 (b @more) 1012 1010 @neq 1013 ( rlwinm usign usign 0 0 0) ; hi bit1014 ( rlwinm val val 0 0 0)1015 (cmp wusign val) ; is hi bit = sign, if so then done1011 (and usign usign (:$ #x80000000)) 1012 (and val val (:$ #x80000000)) 1013 (cmp usign val) ; is hi bit = sign, if so then done 1016 1014 (beq @more) 1017 (add ilen len '1) ; if not, need 1 more1015 (add len len '1) ; if not, need 1 more 1018 1016 (b @big) 1019 1017 @more 1020 (cmp wi :cr1 fixp arm::nilvalue)1021 ( cmpwi len '1)1022 ( beq :cr1 @big) ; dont return fixnum1018 (cmp fixp 'nil) 1019 (beq @big) ; dont return fixnum 1020 (cmp len '1) 1023 1021 (bgt @big) 1024 1022 ;; stuff for maybe fixnum 1025 1023 ;(dbg t) 1026 (ldr val res (:$ arm::miscdataoffset)) 1027 (rlwinm imm4 val 0 0 2) ; hi 3 bits same?  we assume fixnumshift is 2 1028 (srawi usign usign 2) 1029 (cmpw usign imm4) 1030 (bne @big) 1024 (ldr val (:@ res (:$ arm::miscdataoffset))) 1031 1025 (boxfixnum arg_z val) 1032 (bx lr) 1026 (cmp val (:asr arg_z (:$ arm::fixnumshift))) 1027 (bxeq lr) 1033 1028 @big 1034 (cmp woldlen len)1035 (b eqlr) ; same length  done1036 ( li imm4 arm::subtagbignum) ; set new length1037 ( rlwimi imm4 len ( arm::numsubtagbits arm::fixnumshift) 0 ( 31 arm::numsubtagbits))1038 ( str imm4 res (:$ arm::mischeaderoffset))1039 ; 0 to tail if negative1040 (cmpwi usign 0)1041 (b eqlr)1042 1043 ;(dbg t)1044 (add i idx len arm::miscdataoffset)1029 (cmp oldlen len) 1030 (bxeq lr) ; same length  done 1031 (mov imm2 (:$ arm::subtagbignum)) 1032 (cmp usign (:$ 0)) 1033 (orr imm2 imm2 (:lsl len (:$ ( arm::numsubtagbits arm::fixnumshift)))) 1034 (str imm2 (:@ res (:$ arm::mischeaderoffset))) 1035 ;; 0 to tail if negative 1036 (bxeq lr) 1037 ;; zero from len inclusive to oldlen exclusive 1038 (mov temp0 (:$ 0)) 1039 (add idx len (:$ arm::miscdataoffset)) 1045 1040 @loop2 1046 (str rzero(:@ idx res))1047 (add ilen len '1)1048 (cmp wlen oldlen)1049 (add iidx idx '1)1041 (str temp0 (:@ idx res)) 1042 (add len len '1) 1043 (cmp len oldlen) 1044 (add idx idx '1) 1050 1045 (blt @loop2) 1051 1046 (bx lr))) … … 1127 1122 (str header (:@ bignum (:$ arm::mischeaderoffset))) 1128 1123 (bx lr))) 1124 1125 ;;; Divide bignum x by single digit y (passed as two halves). 1126 ;;; The quotient in stored in q, and the remainder is returned 1127 ;;; in two halves. (cf. Knuth, 4.3.1, exercise 16) 1128 (defarmlapfunction %floorloopquo ((x 0) (res arg_x) (yhi arg_y) (ylo arg_z)) 1129 (let ((bignum temp0) 1130 (len temp2)) ;not nfn here. 1131 (ldr bignum (:@ vsp (:$ x))) 1132 (add imm1 vsp (:$ arm::nodesize)) 1133 (buildlispframe imm0 imm1) 1134 (vectorlength len bignum imm0) 1135 (mov imm2 (:$ 0)) 1136 (b @next) 1137 @loop 1138 (add imm0 len (:$ arm::miscdataoffset)) 1139 (ldr imm0 (:@ bignum imm0)) 1140 (mov imm1 imm2) 1141 (composedigit imm2 yhi ylo) 1142 (bl .SPudiv64by32) 1143 (add imm1 len (:$ arm::miscdataoffset)) 1144 (str imm0 (:@ res imm1)) 1145 @next 1146 (subs len len '1) 1147 (bge @loop) 1148 (digith yhi imm2) 1149 (digitl ylo imm2) 1150 (vpush1 yhi) 1151 (vpush1 ylo) 1152 (setnargs 2) 1153 (ba .SPnvalret))) 1129 1154 1155 1156 1130 1157 1131 1158 ; End of armbignum.lisp
Note: See TracChangeset
for help on using the changeset viewer.