xref: /linux/arch/microblaze/lib/cmpdi2.c (revision b24413180f5600bcb3bb70fbed5cf186b60864bd)
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 
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