1156cd587Sjoerg /* ===-- ucmpti2.c - Implement __ucmpti2 -----------------------------------=== 2156cd587Sjoerg * 3156cd587Sjoerg * The LLVM Compiler Infrastructure 4156cd587Sjoerg * 5156cd587Sjoerg * This file is dual licensed under the MIT and the University of Illinois Open 6156cd587Sjoerg * Source Licenses. See LICENSE.TXT for details. 7156cd587Sjoerg * 8156cd587Sjoerg * ===----------------------------------------------------------------------=== 9156cd587Sjoerg * 10156cd587Sjoerg * This file implements __ucmpti2 for the compiler_rt library. 11156cd587Sjoerg * 12156cd587Sjoerg * ===----------------------------------------------------------------------=== 13156cd587Sjoerg */ 14156cd587Sjoerg 15156cd587Sjoerg #include "int_lib.h" 16156cd587Sjoerg 17156cd587Sjoerg #ifdef CRT_HAS_128BIT 18156cd587Sjoerg 19156cd587Sjoerg /* Returns: if (a < b) returns 0 20156cd587Sjoerg * if (a == b) returns 1 21156cd587Sjoerg * if (a > b) returns 2 22156cd587Sjoerg */ 23156cd587Sjoerg 24*f7f78b33Sjoerg COMPILER_RT_ABI si_int __ucmpti2(tu_int a,tu_int b)25156cd587Sjoerg__ucmpti2(tu_int a, tu_int b) 26156cd587Sjoerg { 27156cd587Sjoerg utwords x; 28156cd587Sjoerg x.all = a; 29156cd587Sjoerg utwords y; 30156cd587Sjoerg y.all = b; 31156cd587Sjoerg if (x.s.high < y.s.high) 32156cd587Sjoerg return 0; 33156cd587Sjoerg if (x.s.high > y.s.high) 34156cd587Sjoerg return 2; 35156cd587Sjoerg if (x.s.low < y.s.low) 36156cd587Sjoerg return 0; 37156cd587Sjoerg if (x.s.low > y.s.low) 38156cd587Sjoerg return 2; 39156cd587Sjoerg return 1; 40156cd587Sjoerg } 41156cd587Sjoerg 42156cd587Sjoerg #endif /* CRT_HAS_128BIT */ 43