udivmod.c, [...]: Moved from here.
authorStephane Carrez <Stephane.Carrez@worldnet.fr>
Thu, 30 Nov 2000 08:25:59 +0000 (09:25 +0100)
committerJeff Law <law@gcc.gnu.org>
Thu, 30 Nov 2000 08:25:59 +0000 (01:25 -0700)
* 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.

From-SVN: r37868

gcc/ChangeLog
gcc/config/divmod.c [new file with mode: 0644]
gcc/config/m68hc11/t-m68hc11-gas
gcc/config/mn10200/divmod.c [deleted file]
gcc/config/mn10200/t-mn10200
gcc/config/mn10200/udivmod.c [deleted file]
gcc/config/mn10200/udivmodsi4.c [deleted file]
gcc/config/udivmod.c [new file with mode: 0644]
gcc/config/udivmodsi4.c [new file with mode: 0644]

index 654e0237d05eac39e406ab756d1d6c74edf79235..8ce00fedeff07e5857df2f07375094374179b6a9 100644 (file)
@@ -1,3 +1,12 @@
+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.
diff --git a/gcc/config/divmod.c b/gcc/config/divmod.c
new file mode 100644 (file)
index 0000000..6faa091
--- /dev/null
@@ -0,0 +1,50 @@
+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;
+}
index 221a8530c934cca0610278dfa25163561538124c..ec4b59e027be6fe7436d44483c01252e490979f4 100644 (file)
@@ -28,10 +28,9 @@ LIB1ASMFUNCS = _mulsi3 \
 
 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 =
diff --git a/gcc/config/mn10200/divmod.c b/gcc/config/mn10200/divmod.c
deleted file mode 100644 (file)
index 6faa091..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-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;
-}
index f27815a2dc068fa1e78ef37e4c12c061138f5984..072d6f42b88272e13d02fb7f68a26a850f4e6bcf 100644 (file)
@@ -33,8 +33,8 @@ LIB1ASMFUNCS    = _divhi3 \
 
 # 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
diff --git a/gcc/config/mn10200/udivmod.c b/gcc/config/mn10200/udivmod.c
deleted file mode 100644 (file)
index 1395e9c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-long udivmodsi4 ();
-
-long
-__udivsi3 (long a, long b)
-{
-  return udivmodsi4 (a, b, 0);
-}
-
-long
-__umodsi3 (long a, long b)
-{
-  return udivmodsi4 (a, b, 1);
-}
-
diff --git a/gcc/config/mn10200/udivmodsi4.c b/gcc/config/mn10200/udivmodsi4.c
deleted file mode 100644 (file)
index 83c2340..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-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;
-}
diff --git a/gcc/config/udivmod.c b/gcc/config/udivmod.c
new file mode 100644 (file)
index 0000000..1395e9c
--- /dev/null
@@ -0,0 +1,14 @@
+long udivmodsi4 ();
+
+long
+__udivsi3 (long a, long b)
+{
+  return udivmodsi4 (a, b, 0);
+}
+
+long
+__umodsi3 (long a, long b)
+{
+  return udivmodsi4 (a, b, 1);
+}
+
diff --git a/gcc/config/udivmodsi4.c b/gcc/config/udivmodsi4.c
new file mode 100644 (file)
index 0000000..83c2340
--- /dev/null
@@ -0,0 +1,24 @@
+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;
+}