brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · be5e9e5 Raw
64 lines · c
1//===-- lib/comparetf2.c - Quad-precision comparisons -------------*- C -*-===//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 the following soft-float comparison routines:10//11//   __eqtf2   __getf2   __unordtf212//   __letf2   __gttf213//   __lttf214//   __netf215//16// The semantics of the routines grouped in each column are identical, so there17// is a single implementation for each, and wrappers to provide the other names.18//19// The main routines behave as follows:20//21//   __letf2(a,b) returns -1 if a < b22//                         0 if a == b23//                         1 if a > b24//                         1 if either a or b is NaN25//26//   __getf2(a,b) returns -1 if a < b27//                         0 if a == b28//                         1 if a > b29//                        -1 if either a or b is NaN30//31//   __unordtf2(a,b) returns 0 if both a and b are numbers32//                           1 if either a or b is NaN33//34// Note that __letf2( ) and __getf2( ) are identical except in their handling of35// NaN values.36//37//===----------------------------------------------------------------------===//38 39#define QUAD_PRECISION40#include "fp_lib.h"41 42#if defined(CRT_HAS_TF_MODE)43#include "fp_compare_impl.inc"44 45COMPILER_RT_ABI CMP_RESULT __letf2(fp_t a, fp_t b) { return __leXf2__(a, b); }46 47#if defined(__ELF__)48// Alias for libgcc compatibility49COMPILER_RT_ALIAS(__letf2, __cmptf2)50#endif51COMPILER_RT_ALIAS(__letf2, __eqtf2)52COMPILER_RT_ALIAS(__letf2, __lttf2)53COMPILER_RT_ALIAS(__letf2, __netf2)54 55COMPILER_RT_ABI CMP_RESULT __getf2(fp_t a, fp_t b) { return __geXf2__(a, b); }56 57COMPILER_RT_ALIAS(__getf2, __gttf2)58 59COMPILER_RT_ABI CMP_RESULT __unordtf2(fp_t a, fp_t b) {60  return __unordXf2__(a, b);61}62 63#endif64