llvm-project
37 строк · 978.0 Байт
1//===-- ucmpti2.c - Implement __ucmpti2 -----------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements __ucmpti2 for the compiler_rt library.
10//
11//===----------------------------------------------------------------------===//
12
13#include "int_lib.h"14
15#ifdef CRT_HAS_128BIT16
17// Returns: if (a < b) returns 0
18// if (a == b) returns 1
19// if (a > b) returns 2
20
21COMPILER_RT_ABI si_int __ucmpti2(tu_int a, tu_int b) {22utwords x;23x.all = a;24utwords y;25y.all = b;26if (x.s.high < y.s.high)27return 0;28if (x.s.high > y.s.high)29return 2;30if (x.s.low < y.s.low)31return 0;32if (x.s.low > y.s.low)33return 2;34return 1;35}
36
37#endif // CRT_HAS_128BIT38