Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002     .file   "shr_Xsig.S"
0003 /*---------------------------------------------------------------------------+
0004  |  shr_Xsig.S                                                               |
0005  |                                                                           |
0006  | 12 byte right shift function                                              |
0007  |                                                                           |
0008  | Copyright (C) 1992,1994,1995                                              |
0009  |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
0010  |                       Australia.  E-mail billm@jacobi.maths.monash.edu.au |
0011  |                                                                           |
0012  | Call from C as:                                                           |
0013  |   void shr_Xsig(Xsig *arg, unsigned nr)                                   |
0014  |                                                                           |
0015  |   Extended shift right function.                                          |
0016  |   Fastest for small shifts.                                               |
0017  |   Shifts the 12 byte quantity pointed to by the first arg (arg)           |
0018  |   right by the number of bits specified by the second arg (nr).           |
0019  |                                                                           |
0020  +---------------------------------------------------------------------------*/
0021 
0022 #include "fpu_emu.h"
0023 
0024 .text
0025 SYM_FUNC_START(shr_Xsig)
0026     push    %ebp
0027     movl    %esp,%ebp
0028     pushl   %esi
0029     movl    PARAM2,%ecx
0030     movl    PARAM1,%esi
0031     cmpl    $32,%ecx    /* shrd only works for 0..31 bits */
0032     jnc L_more_than_31
0033 
0034 /* less than 32 bits */
0035     pushl   %ebx
0036     movl    (%esi),%eax /* lsl */
0037     movl    4(%esi),%ebx    /* midl */
0038     movl    8(%esi),%edx    /* msl */
0039     shrd    %cl,%ebx,%eax
0040     shrd    %cl,%edx,%ebx
0041     shr %cl,%edx
0042     movl    %eax,(%esi)
0043     movl    %ebx,4(%esi)
0044     movl    %edx,8(%esi)
0045     popl    %ebx
0046     popl    %esi
0047     leave
0048     RET
0049 
0050 L_more_than_31:
0051     cmpl    $64,%ecx
0052     jnc L_more_than_63
0053 
0054     subb    $32,%cl
0055     movl    4(%esi),%eax    /* midl */
0056     movl    8(%esi),%edx    /* msl */
0057     shrd    %cl,%edx,%eax
0058     shr %cl,%edx
0059     movl    %eax,(%esi)
0060     movl    %edx,4(%esi)
0061     movl    $0,8(%esi)
0062     popl    %esi
0063     leave
0064     RET
0065 
0066 L_more_than_63:
0067     cmpl    $96,%ecx
0068     jnc L_more_than_95
0069 
0070     subb    $64,%cl
0071     movl    8(%esi),%eax    /* msl */
0072     shr %cl,%eax
0073     xorl    %edx,%edx
0074     movl    %eax,(%esi)
0075     movl    %edx,4(%esi)
0076     movl    %edx,8(%esi)
0077     popl    %esi
0078     leave
0079     RET
0080 
0081 L_more_than_95:
0082     xorl    %eax,%eax
0083     movl    %eax,(%esi)
0084     movl    %eax,4(%esi)
0085     movl    %eax,8(%esi)
0086     popl    %esi
0087     leave
0088     RET
0089 SYM_FUNC_END(shr_Xsig)