+2000-11-05 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+
+ * config/mn10200/udivmod.c, config/mn10200/divmod.c,
+ config/mn10200/udivmodsi4.c: Moved from here.
+ * config/udivmod.c, config/divmod.c, config/udivmodsi4.c: To here.
+ * config/mn10200/t-mn10200 (LIB2FUNCS_EXTRA): Use the generic
+ C division functions.
+ * config/m68hc11/t-m68hc11-gas (LIB2FUNCS_EXTRA): Likewise.
+
Thu Nov 30 01:12:52 2000 Jeffrey A Law (law@cygnus.com)
* pa.md (conditional moves): Avoid holes in operand list.
--- /dev/null
+long udivmodsi4 ();
+
+long
+__divsi3 (long a, long b)
+{
+ int neg = 0;
+ long res;
+
+ if (a < 0)
+ {
+ a = -a;
+ neg = !neg;
+ }
+
+ if (b < 0)
+ {
+ b = -b;
+ neg = !neg;
+ }
+
+ res = udivmodsi4 (a, b, 0);
+
+ if (neg)
+ res = -res;
+
+ return res;
+}
+
+long
+__modsi3 (long a, long b)
+{
+ int neg = 0;
+ long res;
+
+ if (a < 0)
+ {
+ a = -a;
+ neg = 1;
+ }
+
+ if (b < 0)
+ b = -b;
+
+ res = udivmodsi4 (a, b, 1);
+
+ if (neg)
+ res = -res;
+
+ return res;
+}
TARGET_LIBGCC2_CFLAGS = -DUSE_GAS -DIN_GCC
-# 32-bit div/mod from the mn10200 port. Prototypes have been added
-# to avoid problems in passing 16/32-bit int (last param of udivmodsi4).
-LIB2FUNCS_EXTRA = $(srcdir)/config/m68hc11/udivmodsi4.c \
- $(srcdir)/config/m68hc11/divmod.c $(srcdir)/config/m68hc11/udivmod.c
+# C implementation of 32-bit div/mod.
+LIB2FUNCS_EXTRA = $(srcdir)/config/udivmodsi4.c \
+ $(srcdir)/config/divmod.c $(srcdir)/config/udivmod.c
# Don't compile with -g1 this reduces the size of some sections (.eh_frame).
LIBGCC2_DEBUG_CFLAGS =
+++ /dev/null
-long udivmodsi4 ();
-
-long
-__divsi3 (long a, long b)
-{
- int neg = 0;
- long res;
-
- if (a < 0)
- {
- a = -a;
- neg = !neg;
- }
-
- if (b < 0)
- {
- b = -b;
- neg = !neg;
- }
-
- res = udivmodsi4 (a, b, 0);
-
- if (neg)
- res = -res;
-
- return res;
-}
-
-long
-__modsi3 (long a, long b)
-{
- int neg = 0;
- long res;
-
- if (a < 0)
- {
- a = -a;
- neg = 1;
- }
-
- if (b < 0)
- b = -b;
-
- res = udivmodsi4 (a, b, 1);
-
- if (neg)
- res = -res;
-
- return res;
-}
# We do not have DF or DI types, so fake out the libgcc2 compilation.
TARGET_LIBGCC2_CFLAGS=-DDF=SF -DDI=SI
-LIB2FUNCS_EXTRA = $(srcdir)/config/mn10200/udivmodsi4.c \
- $(srcdir)/config/mn10200/divmod.c $(srcdir)/config/mn10200/udivmod.c
+LIB2FUNCS_EXTRA = $(srcdir)/config/udivmodsi4.c \
+ $(srcdir)/config/divmod.c $(srcdir)/config/udivmod.c
# We want fine grained libraries, so use the new code to build the
# floating point emulation libraries. The mn10200 only has single
+++ /dev/null
-long udivmodsi4 ();
-
-long
-__udivsi3 (long a, long b)
-{
- return udivmodsi4 (a, b, 0);
-}
-
-long
-__umodsi3 (long a, long b)
-{
- return udivmodsi4 (a, b, 1);
-}
-
+++ /dev/null
-unsigned long
-udivmodsi4(unsigned long num, unsigned long den, int modwanted)
-{
- unsigned long bit = 1;
- unsigned long res = 0;
-
- while (den < num && bit && !(den & (1L<<31)))
- {
- den <<=1;
- bit <<=1;
- }
- while (bit)
- {
- if (num >= den)
- {
- num -= den;
- res |= bit;
- }
- bit >>=1;
- den >>=1;
- }
- if (modwanted) return num;
- return res;
-}
--- /dev/null
+long udivmodsi4 ();
+
+long
+__udivsi3 (long a, long b)
+{
+ return udivmodsi4 (a, b, 0);
+}
+
+long
+__umodsi3 (long a, long b)
+{
+ return udivmodsi4 (a, b, 1);
+}
+
--- /dev/null
+unsigned long
+udivmodsi4(unsigned long num, unsigned long den, int modwanted)
+{
+ unsigned long bit = 1;
+ unsigned long res = 0;
+
+ while (den < num && bit && !(den & (1L<<31)))
+ {
+ den <<=1;
+ bit <<=1;
+ }
+ while (bit)
+ {
+ if (num >= den)
+ {
+ num -= den;
+ res |= bit;
+ }
+ bit >>=1;
+ den >>=1;
+ }
+ if (modwanted) return num;
+ return res;
+}