brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 0f2edde Raw
43 lines · c
1//===-- ucmpdi2.c - Implement __ucmpdi2 -----------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8//9// This file implements __ucmpdi2 for the compiler_rt library.10//11//===----------------------------------------------------------------------===//12 13#include "int_lib.h"14 15// Returns:  if (a <  b) returns 016//           if (a == b) returns 117//           if (a >  b) returns 218 19COMPILER_RT_ABI si_int __ucmpdi2(du_int a, du_int b) {20  udwords x;21  x.all = a;22  udwords y;23  y.all = b;24  if (x.s.high < y.s.high)25    return 0;26  if (x.s.high > y.s.high)27    return 2;28  if (x.s.low < y.s.low)29    return 0;30  if (x.s.low > y.s.low)31    return 2;32  return 1;33}34 35#ifdef __ARM_EABI__36// Returns: if (a <  b) returns -137//           if (a == b) returns  038//           if (a >  b) returns  139COMPILER_RT_ABI si_int __aeabi_ulcmp(di_int a, di_int b) {40  return __ucmpdi2(a, b) - 1;41}42#endif43