blob: f398ea257a9d18a66c026020e0eadf77386ede9a [file] [log] [blame]
Daniel Dunbarb3a69012009-06-26 16:47:03 +00001//===-- cmpdi2.c - Implement __cmpdi2 -------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements __cmpdi2 for the compiler_rt library.
11//
12//===----------------------------------------------------------------------===//
13
14#include "int_lib.h"
15
16// Returns: if (a < b) returns 0
17// if (a == b) returns 1
18// if (a > b) returns 2
19
20si_int
21__cmpdi2(di_int a, di_int b)
22{
23 dwords x;
24 x.all = a;
25 dwords y;
26 y.all = b;
27 if (x.high < y.high)
28 return 0;
29 if (x.high > y.high)
30 return 2;
31 if (x.low < y.low)
32 return 0;
33 if (x.low > y.low)
34 return 2;
35 return 1;
36}