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