Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*---------------------------------------------------------------------------+
0003  |  mul_Xsig.S                                                               |
0004  |                                                                           |
0005  | Multiply a 12 byte fixed point number by another fixed point number.      |
0006  |                                                                           |
0007  | Copyright (C) 1992,1994,1995                                              |
0008  |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
0009  |                       Australia.  E-mail billm@jacobi.maths.monash.edu.au |
0010  |                                                                           |
0011  | Call from C as:                                                           |
0012  |   void mul32_Xsig(Xsig *x, unsigned b)                                    |
0013  |                                                                           |
0014  |   void mul64_Xsig(Xsig *x, unsigned long long *b)                         |
0015  |                                                                           |
0016  |   void mul_Xsig_Xsig(Xsig *x, unsigned *b)                                |
0017  |                                                                           |
0018  | The result is neither rounded nor normalized, and the ls bit or so may    |
0019  | be wrong.                                                                 |
0020  |                                                                           |
0021  +---------------------------------------------------------------------------*/
0022     .file   "mul_Xsig.S"
0023 
0024 
0025 #include "fpu_emu.h"
0026 
0027 .text
0028 SYM_FUNC_START(mul32_Xsig)
0029     pushl %ebp
0030     movl %esp,%ebp
0031     subl $16,%esp
0032     pushl %esi
0033 
0034     movl PARAM1,%esi
0035     movl PARAM2,%ecx
0036 
0037     xor %eax,%eax
0038     movl %eax,-4(%ebp)
0039     movl %eax,-8(%ebp)
0040 
0041     movl (%esi),%eax        /* lsl of Xsig */
0042     mull %ecx       /* msl of b */
0043     movl %edx,-12(%ebp)
0044 
0045     movl 4(%esi),%eax   /* midl of Xsig */
0046     mull %ecx       /* msl of b */
0047     addl %eax,-12(%ebp)
0048     adcl %edx,-8(%ebp)
0049     adcl $0,-4(%ebp)
0050 
0051     movl 8(%esi),%eax   /* msl of Xsig */
0052     mull %ecx       /* msl of b */
0053     addl %eax,-8(%ebp)
0054     adcl %edx,-4(%ebp)
0055 
0056     movl -12(%ebp),%eax
0057     movl %eax,(%esi)
0058     movl -8(%ebp),%eax
0059     movl %eax,4(%esi)
0060     movl -4(%ebp),%eax
0061     movl %eax,8(%esi)
0062 
0063     popl %esi
0064     leave
0065     RET
0066 SYM_FUNC_END(mul32_Xsig)
0067 
0068 
0069 SYM_FUNC_START(mul64_Xsig)
0070     pushl %ebp
0071     movl %esp,%ebp
0072     subl $16,%esp
0073     pushl %esi
0074 
0075     movl PARAM1,%esi
0076     movl PARAM2,%ecx
0077 
0078     xor %eax,%eax
0079     movl %eax,-4(%ebp)
0080     movl %eax,-8(%ebp)
0081 
0082     movl (%esi),%eax        /* lsl of Xsig */
0083     mull 4(%ecx)        /* msl of b */
0084     movl %edx,-12(%ebp)
0085 
0086     movl 4(%esi),%eax   /* midl of Xsig */
0087     mull (%ecx)     /* lsl of b */
0088     addl %edx,-12(%ebp)
0089     adcl $0,-8(%ebp)
0090     adcl $0,-4(%ebp)
0091 
0092     movl 4(%esi),%eax   /* midl of Xsig */
0093     mull 4(%ecx)        /* msl of b */
0094     addl %eax,-12(%ebp)
0095     adcl %edx,-8(%ebp)
0096     adcl $0,-4(%ebp)
0097 
0098     movl 8(%esi),%eax   /* msl of Xsig */
0099     mull (%ecx)     /* lsl of b */
0100     addl %eax,-12(%ebp)
0101     adcl %edx,-8(%ebp)
0102     adcl $0,-4(%ebp)
0103 
0104     movl 8(%esi),%eax   /* msl of Xsig */
0105     mull 4(%ecx)        /* msl of b */
0106     addl %eax,-8(%ebp)
0107     adcl %edx,-4(%ebp)
0108 
0109     movl -12(%ebp),%eax
0110     movl %eax,(%esi)
0111     movl -8(%ebp),%eax
0112     movl %eax,4(%esi)
0113     movl -4(%ebp),%eax
0114     movl %eax,8(%esi)
0115 
0116     popl %esi
0117     leave
0118     RET
0119 SYM_FUNC_END(mul64_Xsig)
0120 
0121 
0122 
0123 SYM_FUNC_START(mul_Xsig_Xsig)
0124     pushl %ebp
0125     movl %esp,%ebp
0126     subl $16,%esp
0127     pushl %esi
0128 
0129     movl PARAM1,%esi
0130     movl PARAM2,%ecx
0131 
0132     xor %eax,%eax
0133     movl %eax,-4(%ebp)
0134     movl %eax,-8(%ebp)
0135 
0136     movl (%esi),%eax        /* lsl of Xsig */
0137     mull 8(%ecx)        /* msl of b */
0138     movl %edx,-12(%ebp)
0139 
0140     movl 4(%esi),%eax   /* midl of Xsig */
0141     mull 4(%ecx)        /* midl of b */
0142     addl %edx,-12(%ebp)
0143     adcl $0,-8(%ebp)
0144     adcl $0,-4(%ebp)
0145 
0146     movl 8(%esi),%eax   /* msl of Xsig */
0147     mull (%ecx)     /* lsl of b */
0148     addl %edx,-12(%ebp)
0149     adcl $0,-8(%ebp)
0150     adcl $0,-4(%ebp)
0151 
0152     movl 4(%esi),%eax   /* midl of Xsig */
0153     mull 8(%ecx)        /* msl of b */
0154     addl %eax,-12(%ebp)
0155     adcl %edx,-8(%ebp)
0156     adcl $0,-4(%ebp)
0157 
0158     movl 8(%esi),%eax   /* msl of Xsig */
0159     mull 4(%ecx)        /* midl of b */
0160     addl %eax,-12(%ebp)
0161     adcl %edx,-8(%ebp)
0162     adcl $0,-4(%ebp)
0163 
0164     movl 8(%esi),%eax   /* msl of Xsig */
0165     mull 8(%ecx)        /* msl of b */
0166     addl %eax,-8(%ebp)
0167     adcl %edx,-4(%ebp)
0168 
0169     movl -12(%ebp),%edx
0170     movl %edx,(%esi)
0171     movl -8(%ebp),%edx
0172     movl %edx,4(%esi)
0173     movl -4(%ebp),%edx
0174     movl %edx,8(%esi)
0175 
0176     popl %esi
0177     leave
0178     RET
0179 SYM_FUNC_END(mul_Xsig_Xsig)