cmpdi2.c revision 214152
1214152Sed/* ===-- cmpdi2.c - Implement __cmpdi2 -------------------------------------=== 2214152Sed * 3214152Sed * The LLVM Compiler Infrastructure 4214152Sed * 5214152Sed * This file is distributed under the University of Illinois Open Source 6214152Sed * License. See LICENSE.TXT for details. 7214152Sed * 8214152Sed * ===----------------------------------------------------------------------=== 9214152Sed * 10214152Sed * This file implements __cmpdi2 for the compiler_rt library. 11214152Sed * 12214152Sed * ===----------------------------------------------------------------------=== 13214152Sed */ 14214152Sed 15214152Sed#include "int_lib.h" 16214152Sed 17214152Sed/* Returns: if (a < b) returns 0 18214152Sed* if (a == b) returns 1 19214152Sed* if (a > b) returns 2 20214152Sed*/ 21214152Sed 22214152Sedsi_int 23214152Sed__cmpdi2(di_int a, di_int b) 24214152Sed{ 25214152Sed dwords x; 26214152Sed x.all = a; 27214152Sed dwords y; 28214152Sed y.all = b; 29214152Sed if (x.s.high < y.s.high) 30214152Sed return 0; 31214152Sed if (x.s.high > y.s.high) 32214152Sed return 2; 33214152Sed if (x.s.low < y.s.low) 34214152Sed return 0; 35214152Sed if (x.s.low > y.s.low) 36214152Sed return 2; 37214152Sed return 1; 38214152Sed} 39