Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | /*---------------------------------------------------------------------------+ | mul_Xsig.S | | | | Multiply a 12 byte fixed point number by another fixed point number. | | | | Copyright (C) 1992,1994 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | | Australia. E-mail billm@vaxc.cc.monash.edu.au | | | | Call from C as: | | void mul32_Xsig(Xsig *x, unsigned b) | | | | void mul64_Xsig(Xsig *x, unsigned long long *b) | | | | void mul_Xsig_Xsig(Xsig *x, unsigned *b) | | | | The result is neither rounded nor normalized, and the ls bit or so may | | be wrong. | | | +---------------------------------------------------------------------------*/ .file "mul_Xsig.S" #include "fpu_asm.h" .text .align 2,144 .globl _mul32_Xsig _mul32_Xsig: pushl %ebp movl %esp,%ebp subl $16,%esp pushl %esi movl PARAM1,%esi movl PARAM2,%ecx xor %eax,%eax movl %eax,-4(%ebp) movl %eax,-8(%ebp) movl (%esi),%eax /* lsl of Xsig */ mull %ecx /* msl of b */ movl %edx,-12(%ebp) movl 4(%esi),%eax /* midl of Xsig */ mull %ecx /* msl of b */ addl %eax,-12(%ebp) adcl %edx,-8(%ebp) adcl $0,-4(%ebp) movl 8(%esi),%eax /* msl of Xsig */ mull %ecx /* msl of b */ addl %eax,-8(%ebp) adcl %edx,-4(%ebp) movl -12(%ebp),%eax movl %eax,(%esi) movl -8(%ebp),%eax movl %eax,4(%esi) movl -4(%ebp),%eax movl %eax,8(%esi) popl %esi leave ret .align 2,144 .globl _mul64_Xsig _mul64_Xsig: pushl %ebp movl %esp,%ebp subl $16,%esp pushl %esi movl PARAM1,%esi movl PARAM2,%ecx xor %eax,%eax movl %eax,-4(%ebp) movl %eax,-8(%ebp) movl (%esi),%eax /* lsl of Xsig */ mull 4(%ecx) /* msl of b */ movl %edx,-12(%ebp) movl 4(%esi),%eax /* midl of Xsig */ mull (%ecx) /* lsl of b */ addl %edx,-12(%ebp) adcl $0,-8(%ebp) adcl $0,-4(%ebp) movl 4(%esi),%eax /* midl of Xsig */ mull 4(%ecx) /* msl of b */ addl %eax,-12(%ebp) adcl %edx,-8(%ebp) adcl $0,-4(%ebp) movl 8(%esi),%eax /* msl of Xsig */ mull (%ecx) /* lsl of b */ addl %eax,-12(%ebp) adcl %edx,-8(%ebp) adcl $0,-4(%ebp) movl 8(%esi),%eax /* msl of Xsig */ mull 4(%ecx) /* msl of b */ addl %eax,-8(%ebp) adcl %edx,-4(%ebp) movl -12(%ebp),%eax movl %eax,(%esi) movl -8(%ebp),%eax movl %eax,4(%esi) movl -4(%ebp),%eax movl %eax,8(%esi) popl %esi leave ret .align 2,144 .globl _mul_Xsig_Xsig _mul_Xsig_Xsig: pushl %ebp movl %esp,%ebp subl $16,%esp pushl %esi movl PARAM1,%esi movl PARAM2,%ecx xor %eax,%eax movl %eax,-4(%ebp) movl %eax,-8(%ebp) movl (%esi),%eax /* lsl of Xsig */ mull 8(%ecx) /* msl of b */ movl %edx,-12(%ebp) movl 4(%esi),%eax /* midl of Xsig */ mull 4(%ecx) /* midl of b */ addl %edx,-12(%ebp) adcl $0,-8(%ebp) adcl $0,-4(%ebp) movl 8(%esi),%eax /* msl of Xsig */ mull (%ecx) /* lsl of b */ addl %edx,-12(%ebp) adcl $0,-8(%ebp) adcl $0,-4(%ebp) movl 4(%esi),%eax /* midl of Xsig */ mull 8(%ecx) /* msl of b */ addl %eax,-12(%ebp) adcl %edx,-8(%ebp) adcl $0,-4(%ebp) movl 8(%esi),%eax /* msl of Xsig */ mull 4(%ecx) /* midl of b */ addl %eax,-12(%ebp) adcl %edx,-8(%ebp) adcl $0,-4(%ebp) movl 8(%esi),%eax /* msl of Xsig */ mull 8(%ecx) /* msl of b */ addl %eax,-8(%ebp) adcl %edx,-4(%ebp) movl -12(%ebp),%edx movl %edx,(%esi) movl -8(%ebp),%edx movl %edx,4(%esi) movl -4(%ebp),%edx movl %edx,8(%esi) popl %esi leave ret |