Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/cmpti2.c
35260 views
//===-- cmpti2.c - Implement __cmpti2 -------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file implements __cmpti2 for the compiler_rt library.9//10//===----------------------------------------------------------------------===//1112#include "int_lib.h"1314#ifdef CRT_HAS_128BIT1516// Returns: if (a < b) returns 017// if (a == b) returns 118// if (a > b) returns 21920COMPILER_RT_ABI si_int __cmpti2(ti_int a, ti_int b) {21twords x;22x.all = a;23twords y;24y.all = b;25if (x.s.high < y.s.high)26return 0;27if (x.s.high > y.s.high)28return 2;29if (x.s.low < y.s.low)30return 0;31if (x.s.low > y.s.low)32return 2;33return 1;34}3536#endif // CRT_HAS_128BIT373839