1*0a6a1f1dSLionel Sambuc /* ===-- cmpti2.c - Implement __cmpti2 -------------------------------------=== 2*0a6a1f1dSLionel Sambuc * 3*0a6a1f1dSLionel Sambuc * The LLVM Compiler Infrastructure 4*0a6a1f1dSLionel Sambuc * 5*0a6a1f1dSLionel Sambuc * This file is dual licensed under the MIT and the University of Illinois Open 6*0a6a1f1dSLionel Sambuc * Source Licenses. See LICENSE.TXT for details. 7*0a6a1f1dSLionel Sambuc * 8*0a6a1f1dSLionel Sambuc * ===----------------------------------------------------------------------=== 9*0a6a1f1dSLionel Sambuc * 10*0a6a1f1dSLionel Sambuc * This file implements __cmpti2 for the compiler_rt library. 11*0a6a1f1dSLionel Sambuc * 12*0a6a1f1dSLionel Sambuc * ===----------------------------------------------------------------------=== 13*0a6a1f1dSLionel Sambuc */ 14*0a6a1f1dSLionel Sambuc 15*0a6a1f1dSLionel Sambuc #include "int_lib.h" 16*0a6a1f1dSLionel Sambuc 17*0a6a1f1dSLionel Sambuc #ifdef CRT_HAS_128BIT 18*0a6a1f1dSLionel Sambuc 19*0a6a1f1dSLionel Sambuc /* Returns: if (a < b) returns 0 20*0a6a1f1dSLionel Sambuc * if (a == b) returns 1 21*0a6a1f1dSLionel Sambuc * if (a > b) returns 2 22*0a6a1f1dSLionel Sambuc */ 23*0a6a1f1dSLionel Sambuc 24*0a6a1f1dSLionel Sambuc COMPILER_RT_ABI si_int __cmpti2(ti_int a,ti_int b)25*0a6a1f1dSLionel Sambuc__cmpti2(ti_int a, ti_int b) 26*0a6a1f1dSLionel Sambuc { 27*0a6a1f1dSLionel Sambuc twords x; 28*0a6a1f1dSLionel Sambuc x.all = a; 29*0a6a1f1dSLionel Sambuc twords y; 30*0a6a1f1dSLionel Sambuc y.all = b; 31*0a6a1f1dSLionel Sambuc if (x.s.high < y.s.high) 32*0a6a1f1dSLionel Sambuc return 0; 33*0a6a1f1dSLionel Sambuc if (x.s.high > y.s.high) 34*0a6a1f1dSLionel Sambuc return 2; 35*0a6a1f1dSLionel Sambuc if (x.s.low < y.s.low) 36*0a6a1f1dSLionel Sambuc return 0; 37*0a6a1f1dSLionel Sambuc if (x.s.low > y.s.low) 38*0a6a1f1dSLionel Sambuc return 2; 39*0a6a1f1dSLionel Sambuc return 1; 40*0a6a1f1dSLionel Sambuc } 41*0a6a1f1dSLionel Sambuc 42*0a6a1f1dSLionel Sambuc #endif /* CRT_HAS_128BIT */ 43