root/kernel/FPU-emu/poly_div.S

/* [previous][next][first][last][top][bottom][index][help] */
   1         .file   "poly_div.S"
   2 /*---------------------------------------------------------------------------+
   3  |  poly_div.S                                                               |
   4  |                                                                           |
   5  | A set of functions to divide 64 bit integers by fixed numbers.            |
   6  |                                                                           |
   7  | Copyright (C) 1992    W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
   8  |                       Australia.  E-mail apm233m@vaxc.cc.monash.edu.au    |
   9  |                                                                           |
  10  | Call from C as:                                                           |
  11  |   void poly_div2(long long *x)                                            |
  12  |   void poly_div4(long long *x)                                            |
  13  |   void poly_div16(long long *x)                                           |
  14  |                                                                           |
  15  +---------------------------------------------------------------------------*/
  16 
  17 #include "fpu_asm.h"
  18 
  19 .text
  20 
  21 /*---------------------------------------------------------------------------*/
  22         .align 2,144
  23 .globl _poly_div2
  24 _poly_div2:
  25         pushl %ebp
  26         movl %esp,%ebp
  27 
  28         movl PARAM1,%ecx
  29         movw (%ecx),%ax
  30 
  31         shrl $1,4(%ecx)
  32         rcrl $1,(%ecx)
  33 
  34         testw $1,%ax
  35         je poly_div2_exit
  36 
  37         addl $1,(%ecx)
  38         adcl $0,4(%ecx)
  39 poly_div2_exit:
  40 
  41         leave
  42         ret
  43 /*---------------------------------------------------------------------------*/
  44         .align 2,144
  45 .globl _poly_div4
  46 _poly_div4:
  47         pushl %ebp
  48         movl %esp,%ebp
  49 
  50         movl PARAM1,%ecx
  51         movw (%ecx),%ax
  52 
  53         movl 4(%ecx),%edx
  54         shll $30,%edx
  55 
  56         shrl $2,4(%ecx)
  57         shrl $2,(%ecx)
  58 
  59         orl %edx,(%ecx)
  60 
  61         testw $2,%ax
  62         je poly_div4_exit
  63 
  64         addl $1,(%ecx)
  65         adcl $0,4(%ecx)
  66 poly_div4_exit:
  67 
  68         leave
  69         ret
  70 /*---------------------------------------------------------------------------*/
  71         .align 2,144
  72 .globl _poly_div16
  73 _poly_div16:
  74         pushl %ebp
  75         movl %esp,%ebp
  76 
  77         movl PARAM1,%ecx
  78         movw (%ecx),%ax
  79 
  80         movl 4(%ecx),%edx
  81         shll $28,%edx
  82 
  83         shrl $4,4(%ecx)
  84         shrl $4,(%ecx)
  85 
  86         orl %edx,(%ecx)
  87 
  88         testw $8,%ax
  89         je poly_div16_exit
  90 
  91         addl $1,(%ecx)
  92         adcl $0,4(%ecx)
  93 poly_div16_exit:
  94 
  95         leave
  96         ret
  97 /*---------------------------------------------------------------------------*/

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