Commit | Line | Data |
---|---|---|
7c650d4e GCI |
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 | * | |
fb0297e9 PR |
8 | * Copyright (C) 1992,1993,1994 |
9 | * W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | |
10 | * Australia. E-mail billm@vaxc.cc.monash.edu.au | |
7c650d4e GCI |
11 | * All rights reserved. |
12 | * | |
13 | * This copyright notice covers the redistribution and use of the | |
14 | * FPU emulator developed by W. Metzenthen. It covers only its use | |
fb0297e9 PR |
15 | * in the 386BSD, FreeBSD and NetBSD operating systems. Any other |
16 | * use is not permitted under this copyright. | |
7c650d4e GCI |
17 | * |
18 | * Redistribution and use in source and binary forms, with or without | |
19 | * modification, are permitted provided that the following conditions | |
20 | * are met: | |
21 | * 1. Redistributions of source code must retain the above copyright | |
22 | * notice, this list of conditions and the following disclaimer. | |
23 | * 2. Redistributions in binary form must include information specifying | |
24 | * that source code for the emulator is freely available and include | |
25 | * either: | |
26 | * a) an offer to provide the source code for a nominal distribution | |
27 | * fee, or | |
28 | * b) list at least two alternative methods whereby the source | |
29 | * can be obtained, e.g. a publically accessible bulletin board | |
30 | * and an anonymous ftp site from which the software can be | |
31 | * downloaded. | |
32 | * 3. All advertising materials specifically mentioning features or use of | |
33 | * this emulator must acknowledge that it was developed by W. Metzenthen. | |
34 | * 4. The name of W. Metzenthen may not be used to endorse or promote | |
35 | * products derived from this software without specific prior written | |
36 | * permission. | |
37 | * | |
38 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, | |
39 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | |
40 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | |
41 | * W. METZENTHEN BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
42 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
43 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
44 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
45 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
46 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
47 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
48 | * | |
ffb8a815 | 49 | * |
fb0297e9 PR |
50 | * The purpose of this copyright, based upon the Berkeley copyright, is to |
51 | * ensure that the covered software remains freely available to everyone. | |
52 | * | |
53 | * The software (with necessary differences) is also available, but under | |
54 | * the terms of the GNU copyleft, for the Linux operating system and for | |
55 | * the djgpp ms-dos extender. | |
56 | * | |
57 | * W. Metzenthen June 1994. | |
58 | * | |
59 | * | |
60 | * $Id: poly_div.s,v 1.2 1994/04/29 21:23:27 gclarkii Exp $ | |
ffb8a815 | 61 | * |
7c650d4e GCI |
62 | */ |
63 | ||
64 | #include "fpu_asm.h" | |
65 | ||
66 | .text | |
67 | ||
68 | /*---------------------------------------------------------------------------*/ | |
69 | .align 2,144 | |
70 | .globl _poly_div2 | |
71 | _poly_div2: | |
72 | pushl %ebp | |
73 | movl %esp,%ebp | |
74 | ||
75 | movl PARAM1,%ecx | |
76 | movw (%ecx),%ax | |
77 | ||
78 | shrl $1,4(%ecx) | |
79 | rcrl $1,(%ecx) | |
80 | ||
81 | testw $1,%ax | |
82 | je poly_div2_exit | |
83 | ||
84 | addl $1,(%ecx) | |
85 | adcl $0,4(%ecx) | |
86 | poly_div2_exit: | |
87 | ||
88 | leave | |
89 | ret | |
90 | /*---------------------------------------------------------------------------*/ | |
91 | .align 2,144 | |
92 | .globl _poly_div4 | |
93 | _poly_div4: | |
94 | pushl %ebp | |
95 | movl %esp,%ebp | |
96 | ||
97 | movl PARAM1,%ecx | |
98 | movw (%ecx),%ax | |
99 | ||
100 | movl 4(%ecx),%edx | |
101 | shll $30,%edx | |
102 | ||
103 | shrl $2,4(%ecx) | |
104 | shrl $2,(%ecx) | |
105 | ||
106 | orl %edx,(%ecx) | |
107 | ||
108 | testw $2,%ax | |
109 | je poly_div4_exit | |
110 | ||
111 | addl $1,(%ecx) | |
112 | adcl $0,4(%ecx) | |
113 | poly_div4_exit: | |
114 | ||
115 | leave | |
116 | ret | |
117 | /*---------------------------------------------------------------------------*/ | |
118 | .align 2,144 | |
119 | .globl _poly_div16 | |
120 | _poly_div16: | |
121 | pushl %ebp | |
122 | movl %esp,%ebp | |
123 | ||
124 | movl PARAM1,%ecx | |
125 | movw (%ecx),%ax | |
126 | ||
127 | movl 4(%ecx),%edx | |
128 | shll $28,%edx | |
129 | ||
130 | shrl $4,4(%ecx) | |
131 | shrl $4,(%ecx) | |
132 | ||
133 | orl %edx,(%ecx) | |
134 | ||
135 | testw $8,%ax | |
136 | je poly_div16_exit | |
137 | ||
138 | addl $1,(%ecx) | |
139 | adcl $0,4(%ecx) | |
140 | poly_div16_exit: | |
141 | ||
142 | leave | |
143 | ret | |
144 | /*---------------------------------------------------------------------------*/ |