xref: /linux/arch/microblaze/lib/cmpdi2.c (revision eecb20720f1b29019725515051e41bc7c079f91f)
1*eecb2072SMichal Simek #include <linux/module.h>
2*eecb2072SMichal Simek 
3*eecb2072SMichal Simek #include "libgcc.h"
4*eecb2072SMichal Simek 
5*eecb2072SMichal Simek word_type __cmpdi2(long long a, long long b)
6*eecb2072SMichal Simek {
7*eecb2072SMichal Simek 	const DWunion au = {
8*eecb2072SMichal Simek 		.ll = a
9*eecb2072SMichal Simek 	};
10*eecb2072SMichal Simek 	const DWunion bu = {
11*eecb2072SMichal Simek 		.ll = b
12*eecb2072SMichal Simek 	};
13*eecb2072SMichal Simek 
14*eecb2072SMichal Simek 	if (au.s.high < bu.s.high)
15*eecb2072SMichal Simek 		return 0;
16*eecb2072SMichal Simek 	else if (au.s.high > bu.s.high)
17*eecb2072SMichal Simek 		return 2;
18*eecb2072SMichal Simek 
19*eecb2072SMichal Simek 	if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
20*eecb2072SMichal Simek 		return 0;
21*eecb2072SMichal Simek 	else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
22*eecb2072SMichal Simek 		return 2;
23*eecb2072SMichal Simek 
24*eecb2072SMichal Simek 	return 1;
25*eecb2072SMichal Simek }
26*eecb2072SMichal Simek EXPORT_SYMBOL(__cmpdi2);
27