ucmpdi2.c revision 276789
1276789Sdim/* ===-- ucmpdi2.c - Implement __ucmpdi2 -----------------------------------=== 2276789Sdim * 3276789Sdim * The LLVM Compiler Infrastructure 4276789Sdim * 5276789Sdim * This file is dual licensed under the MIT and the University of Illinois Open 6276789Sdim * Source Licenses. See LICENSE.TXT for details. 7276789Sdim * 8276789Sdim * ===----------------------------------------------------------------------=== 9276789Sdim * 10276789Sdim * This file implements __ucmpdi2 for the compiler_rt library. 11276789Sdim * 12276789Sdim * ===----------------------------------------------------------------------=== 13276789Sdim */ 14276789Sdim 15276789Sdim#include "int_lib.h" 16276789Sdim 17276789Sdim/* Returns: if (a < b) returns 0 18276789Sdim * if (a == b) returns 1 19276789Sdim * if (a > b) returns 2 20276789Sdim */ 21276789Sdim 22276789SdimCOMPILER_RT_ABI si_int 23276789Sdim__ucmpdi2(du_int a, du_int b) 24276789Sdim{ 25276789Sdim udwords x; 26276789Sdim x.all = a; 27276789Sdim udwords y; 28276789Sdim y.all = b; 29276789Sdim if (x.s.high < y.s.high) 30276789Sdim return 0; 31276789Sdim if (x.s.high > y.s.high) 32276789Sdim return 2; 33276789Sdim if (x.s.low < y.s.low) 34276789Sdim return 0; 35276789Sdim if (x.s.low > y.s.low) 36276789Sdim return 2; 37276789Sdim return 1; 38276789Sdim} 39276789Sdim 40276789Sdim#ifdef __ARM_EABI__ 41276789Sdim/* Returns: if (a < b) returns -1 42276789Sdim* if (a == b) returns 0 43276789Sdim* if (a > b) returns 1 44276789Sdim*/ 45276789SdimCOMPILER_RT_ABI si_int 46276789Sdim__aeabi_ulcmp(di_int a, di_int b) 47276789Sdim{ 48276789Sdim return __ucmpdi2(a, b) - 1; 49276789Sdim} 50276789Sdim#endif 51276789Sdim 52