[MIPS] Add __ucmpdi2 implementation
authorThiemo Seufer <ths@networkno.de>
Tue, 1 May 2007 18:14:16 +0000 (19:14 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 11 May 2007 13:28:30 +0000 (14:28 +0100)
Recent GCC SVN versions may generate calls to __ucmpdi2.

Signed-off-by: Thiemo Seufer <ths@networkno.de>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/lib/Makefile
arch/mips/lib/ucmpdi2.c [new file with mode: 0644]

index d7d3b14dcfb2ba0bd3043e98253ed0aeac4cf5f1..5dad13efba7edb861607d33a81289f816dbcfa02 100644 (file)
@@ -9,4 +9,4 @@ obj-y                   += iomap.o
 obj-$(CONFIG_PCI)      += iomap-pci.o
 
 # libgcc-style stuff needed in the kernel
-lib-y += ashldi3.o ashrdi3.o lshrdi3.o
+lib-y += ashldi3.o ashrdi3.o lshrdi3.o ucmpdi2.o
diff --git a/arch/mips/lib/ucmpdi2.c b/arch/mips/lib/ucmpdi2.c
new file mode 100644 (file)
index 0000000..e9ff258
--- /dev/null
@@ -0,0 +1,19 @@
+#include <linux/module.h>
+
+#include "libgcc.h"
+
+word_type __ucmpdi2 (unsigned long a, unsigned long b)
+{
+       const DWunion au = {.ll = a};
+       const DWunion bu = {.ll = b};
+
+       if ((unsigned int) au.s.high < (unsigned int) bu.s.high)
+               return 0;
+       else if ((unsigned int) au.s.high > (unsigned int) bu.s.high)
+               return 2;
+       if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
+               return 0;
+       else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
+               return 2;
+       return 1;
+}