]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/compiler-rt/lib/ucmpdi2.c
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / compiler-rt / lib / ucmpdi2.c
1 /* ===-- ucmpdi2.c - Implement __ucmpdi2 -----------------------------------===
2  *
3  *                     The LLVM Compiler Infrastructure
4  *
5  * This file is dual licensed under the MIT and the University of Illinois Open
6  * Source Licenses. See LICENSE.TXT for details.
7  *
8  * ===----------------------------------------------------------------------===
9  *
10  * This file implements __ucmpdi2 for the compiler_rt library.
11  *
12  * ===----------------------------------------------------------------------===
13  */
14 #include "abi.h"
15
16 #include "int_lib.h"
17
18 /* Returns:  if (a <  b) returns 0
19  *           if (a == b) returns 1
20  *           if (a >  b) returns 2
21  */
22
23 COMPILER_RT_ABI si_int
24 __ucmpdi2(du_int a, du_int b)
25 {
26     udwords x;
27     x.all = a;
28     udwords y;
29     y.all = b;
30     if (x.s.high < y.s.high)
31         return 0;
32     if (x.s.high > y.s.high)
33         return 2;
34     if (x.s.low < y.s.low)
35         return 0;
36     if (x.s.low > y.s.low)
37         return 2;
38     return 1;
39 }