1 Index: libc/sysdeps/i386/Makefile
2 ===================================================================
3 RCS file: /cvs/glibc/libc/sysdeps/i386/Makefile,v
4 retrieving revision 1.11
5 retrieving revision 1.11.2.1
6 diff -u -r1.11 -r1.11.2.1
7 --- libc/sysdeps/i386/Makefile 17 Sep 1999 16:59:13 -0000 1.11
8 +++ libc/sysdeps/i386/Makefile 28 Feb 2002 19:39:16 -0000 1.11.2.1
10 # On i686 we must avoid generating the trampoline functions generated
11 # to get the GOT pointer.
12 CFLAGS-initfini.s += -march=i386 -mcpu=i386
14 +ifeq (yes,$(build-shared))
16 +sysdep_routines += divdi3
17 +shared-only-routines += divdi3
22 Index: libc/sysdeps/m68k/Makefile
23 ===================================================================
24 RCS file: /cvs/glibc/libc/sysdeps/m68k/Makefile,v
25 retrieving revision 1.20
26 retrieving revision 1.20.2.1
27 diff -u -r1.20 -r1.20.2.1
28 --- libc/sysdeps/m68k/Makefile 6 Jul 2001 04:55:55 -0000 1.20
29 +++ libc/sysdeps/m68k/Makefile 28 Feb 2002 19:39:18 -0000 1.20.2.1
31 # The 68k `long double' is a distinct type we support.
32 long-double-fcts = yes
35 +ifeq (yes,$(build-shared))
37 +sysdep_routines += divdi3
38 +shared-only-routines += divdi3
43 CFLAGS-rtld.c += -Wno-uninitialized -Wno-unused
45 Index: libc/sysdeps/s390/s390-32/Makefile
46 ===================================================================
47 RCS file: /cvs/glibc/libc/sysdeps/s390/s390-32/Makefile,v
48 retrieving revision 1.1
49 retrieving revision 1.1.2.1
50 diff -u -r1.1 -r1.1.2.1
51 --- libc/sysdeps/s390/s390-32/Makefile 16 Mar 2001 08:59:44 -0000 1.1
52 +++ libc/sysdeps/s390/s390-32/Makefile 28 Feb 2002 19:39:19 -0000 1.1.2.1
57 +ifeq (yes,$(build-shared))
59 +sysdep_routines += divdi3
60 +shared-only-routines += divdi3
65 sysdep_routines += s390-mcount
67 Index: libc/sysdeps/wordsize-32/divdi3.c
68 ===================================================================
69 RCS file: sysdeps/wordsize-32/divdi3.c
70 diff -N sysdeps/wordsize-32/divdi3.c
71 --- /dev/null 1 Jan 1970 00:00:00 -0000
72 +++ libc/sysdeps/wordsize-32/divdi3.c 28 Feb 2002 19:38:59 -0000 1.1.2.1
74 +/* 64-bit multiplication and division
75 + Copyright (C) 1989, 1992-1999, 2000, 2001, 2002
76 + Free Software Foundation, Inc.
77 + This file is part of the GNU C Library.
79 + The GNU C Library is free software; you can redistribute it and/or
80 + modify it under the terms of the GNU Lesser General Public
81 + License as published by the Free Software Foundation; either
82 + version 2.1 of the License, or (at your option) any later version.
84 + The GNU C Library is distributed in the hope that it will be useful,
85 + but WITHOUT ANY WARRANTY; without even the implied warranty of
86 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 + Lesser General Public License for more details.
89 + You should have received a copy of the GNU Lesser General Public
90 + License along with the GNU C Library; if not, write to the Free
91 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
96 +#include <bits/wordsize.h>
99 +#error This is for 32-bit targets only
102 +typedef unsigned int UQItype __attribute__ ((mode (QI)));
103 +typedef int SItype __attribute__ ((mode (SI)));
104 +typedef unsigned int USItype __attribute__ ((mode (SI)));
105 +typedef int DItype __attribute__ ((mode (DI)));
106 +typedef unsigned int UDItype __attribute__ ((mode (DI)));
107 +#define Wtype SItype
108 +#define HWtype SItype
109 +#define DWtype DItype
110 +#define UWtype USItype
111 +#define UHWtype USItype
112 +#define UDWtype UDItype
113 +#define W_TYPE_SIZE 32
115 +#include <stdlib/longlong.h>
117 +#if __BYTE_ORDER == __BIG_ENDIAN
118 +struct DWstruct { Wtype high, low;};
119 +#elif __BYTE_ORDER == __LITTLE_ENDIAN
120 +struct DWstruct { Wtype low, high;};
122 +#error Unhandled endianity
124 +typedef union { struct DWstruct s; DWtype ll; } DWunion;
127 +__udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp)
132 + UWtype d0, d1, n0, n1, n2;
144 +#if !UDIV_NEEDS_NORMALIZATION
151 + udiv_qrnnd (q0, n0, n1, n0, d0);
154 + /* Remainder in n0. */
161 + d0 = 1 / d0; /* Divide intentionally by zero. */
163 + udiv_qrnnd (q1, n1, 0, n1, d0);
164 + udiv_qrnnd (q0, n0, n1, n0, d0);
166 + /* Remainder in n0. */
177 +#else /* UDIV_NEEDS_NORMALIZATION */
185 + count_leading_zeros (bm, d0);
189 + /* Normalize, i.e. make the most significant bit of the
190 + denominator set. */
193 + n1 = (n1 << bm) | (n0 >> (W_TYPE_SIZE - bm));
197 + udiv_qrnnd (q0, n0, n1, n0, d0);
200 + /* Remainder in n0 >> bm. */
207 + d0 = 1 / d0; /* Divide intentionally by zero. */
209 + count_leading_zeros (bm, d0);
213 + /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
214 + conclude (the most significant bit of n1 is set) /\ (the
215 + leading quotient digit q1 = 1).
217 + This special case is necessary, not an optimization.
218 + (Shifts counts of W_TYPE_SIZE are undefined.) */
227 + b = W_TYPE_SIZE - bm;
231 + n1 = (n1 << bm) | (n0 >> b);
234 + udiv_qrnnd (q1, n1, n2, n1, d0);
239 + udiv_qrnnd (q0, n0, n1, n0, d0);
241 + /* Remainder in n0 >> bm. */
246 + rr.s.low = n0 >> bm;
251 +#endif /* UDIV_NEEDS_NORMALIZATION */
262 + /* Remainder in n1n0. */
274 + count_leading_zeros (bm, d1);
277 + /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
278 + conclude (the most significant bit of n1 is set) /\ (the
279 + quotient digit q0 = 0 or 1).
281 + This special case is necessary, not an optimization. */
283 + /* The condition on the next line takes advantage of that
284 + n1 >= d1 (true due to program flow). */
285 + if (n1 > d1 || n0 >= d0)
288 + sub_ddmmss (n1, n0, n1, n0, d1, d0);
307 + b = W_TYPE_SIZE - bm;
309 + d1 = (d1 << bm) | (d0 >> b);
312 + n1 = (n1 << bm) | (n0 >> b);
315 + udiv_qrnnd (q0, n1, n2, n1, d1);
316 + umul_ppmm (m1, m0, q0, d0);
318 + if (m1 > n1 || (m1 == n1 && m0 > n0))
321 + sub_ddmmss (m1, m0, m1, m0, d1, d0);
326 + /* Remainder in (n1n0 - m1m0) >> bm. */
329 + sub_ddmmss (n1, n0, n1, n0, m1, m0);
330 + rr.s.low = (n1 << b) | (n0 >> bm);
331 + rr.s.high = n1 >> bm;
344 +__divdi3 (DWtype u, DWtype v)
359 + w = __udivmoddi4 (u, v, NULL);
366 +__moddi3 (DWtype u, DWtype v)
381 + __udivmoddi4 (u, v, &w);
388 +__udivdi3 (UDWtype u, UDWtype v)
390 + return __udivmoddi4 (u, v, NULL);
394 +__umoddi3 (UDWtype u, UDWtype v)
398 + __udivmoddi4 (u, v, &w);