summaryrefslogtreecommitdiff
path: root/arch/sparc/lib/cmpdi2.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-08-25 15:10:44 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-08-26 18:49:09 -0700
commit6cc0735d0dbf6a0e5f802f47d51e1e463466955c (patch)
tree62840e618992c257eff51c65bfe66a14f5942c9a /arch/sparc/lib/cmpdi2.c
parent6c8f5b90bfbe69a27763fb0e181bd2465181446d (diff)
[SPARC32]: Add __cmpdi2() libcall implementation ala. MIPS.
Device mapper generates calls to this with recent versions of gcc. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/lib/cmpdi2.c')
-rw-r--r--arch/sparc/lib/cmpdi2.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/sparc/lib/cmpdi2.c b/arch/sparc/lib/cmpdi2.c
new file mode 100644
index 000000000000..8c1306437ed1
--- /dev/null
+++ b/arch/sparc/lib/cmpdi2.c
@@ -0,0 +1,27 @@
+#include <linux/module.h>
+
+#include "libgcc.h"
+
+word_type __cmpdi2(long long a, long long b)
+{
+ const DWunion au = {
+ .ll = a
+ };
+ const DWunion bu = {
+ .ll = b
+ };
+
+ if (au.s.high < bu.s.high)
+ return 0;
+ else if (au.s.high > 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;
+}
+
+EXPORT_SYMBOL(__cmpdi2);