root/arch/i386/math-emu/shr_Xsig.S

/* [previous][next][first][last][top][bottom][index][help] */
   1         .file   "shr_Xsig.S"
   2 /*---------------------------------------------------------------------------+
   3  |  shr_Xsig.S                                                               |
   4  |                                                                           |
   5  | 12 byte right shift function                                              |
   6  |                                                                           |
   7  | Copyright (C) 1992,1994                                                   |
   8  |                       W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
   9  |                       Australia.  E-mail   billm@vaxc.cc.monash.edu.au    |
  10  |                                                                           |
  11  | Call from C as:                                                           |
  12  |   void shr_Xsig(Xsig *arg, unsigned nr)                                   |
  13  |                                                                           |
  14  |   Extended shift right function.                                          |
  15  |   Fastest for small shifts.                                               |
  16  |   Shifts the 12 byte quantity pointed to by the first arg (arg)           |
  17  |   right by the number of bits specified by the second arg (nr).           |
  18  |                                                                           |
  19  +---------------------------------------------------------------------------*/
  20 
  21 #include "fpu_asm.h"
  22 
  23 .text
  24         .align 2,144
  25 
  26         .globl  _shr_Xsig
  27 _shr_Xsig:
  28         push    %ebp
  29         movl    %esp,%ebp
  30         pushl   %esi
  31         movl    PARAM2,%ecx
  32         movl    PARAM1,%esi
  33         cmpl    $32,%ecx        /* shrd only works for 0..31 bits */
  34         jnc     L_more_than_31
  35 
  36 /* less than 32 bits */
  37         pushl   %ebx
  38         movl    (%esi),%eax     /* lsl */
  39         movl    4(%esi),%ebx    /* midl */
  40         movl    8(%esi),%edx    /* msl */
  41         shrd    %cl,%ebx,%eax
  42         shrd    %cl,%edx,%ebx
  43         shr     %cl,%edx
  44         movl    %eax,(%esi)
  45         movl    %ebx,4(%esi)
  46         movl    %edx,8(%esi)
  47         popl    %ebx
  48         popl    %esi
  49         leave
  50         ret
  51 
  52 L_more_than_31:
  53         cmpl    $64,%ecx
  54         jnc     L_more_than_63
  55 
  56         subb    $32,%cl
  57         movl    4(%esi),%eax    /* midl */
  58         movl    8(%esi),%edx    /* msl */
  59         shrd    %cl,%edx,%eax
  60         shr     %cl,%edx
  61         movl    %eax,(%esi)
  62         movl    %edx,4(%esi)
  63         movl    $0,8(%esi)
  64         popl    %esi
  65         leave
  66         ret
  67 
  68 L_more_than_63:
  69         cmpl    $96,%ecx
  70         jnc     L_more_than_95
  71 
  72         subb    $64,%cl
  73         movl    8(%esi),%eax    /* msl */
  74         shr     %cl,%eax
  75         xorl    %edx,%edx
  76         movl    %eax,(%esi)
  77         movl    %edx,4(%esi)
  78         movl    %edx,8(%esi)
  79         popl    %esi
  80         leave
  81         ret
  82 
  83 L_more_than_95:
  84         xorl    %eax,%eax
  85         movl    %eax,(%esi)
  86         movl    %eax,4(%esi)
  87         movl    %eax,8(%esi)
  88         popl    %esi
  89         leave
  90         ret

/* [previous][next][first][last][top][bottom][index][help] */