| Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame^] | 1 | //===-- 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 |  | 
|  | 20 | si_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 | } |