Path: blob/main/contrib/llvm-project/compiler-rt/lib/builtins/comparetf2.c
35260 views
//===-- lib/comparetf2.c - Quad-precision comparisons -------------*- C -*-===//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 the following soft-float comparison routines:9//10// __eqtf2 __getf2 __unordtf211// __letf2 __gttf212// __lttf213// __netf214//15// The semantics of the routines grouped in each column are identical, so there16// is a single implementation for each, and wrappers to provide the other names.17//18// The main routines behave as follows:19//20// __letf2(a,b) returns -1 if a < b21// 0 if a == b22// 1 if a > b23// 1 if either a or b is NaN24//25// __getf2(a,b) returns -1 if a < b26// 0 if a == b27// 1 if a > b28// -1 if either a or b is NaN29//30// __unordtf2(a,b) returns 0 if both a and b are numbers31// 1 if either a or b is NaN32//33// Note that __letf2( ) and __getf2( ) are identical except in their handling of34// NaN values.35//36//===----------------------------------------------------------------------===//3738#define QUAD_PRECISION39#include "fp_lib.h"4041#if defined(CRT_HAS_TF_MODE)42#include "fp_compare_impl.inc"4344COMPILER_RT_ABI CMP_RESULT __letf2(fp_t a, fp_t b) { return __leXf2__(a, b); }4546#if defined(__ELF__)47// Alias for libgcc compatibility48COMPILER_RT_ALIAS(__letf2, __cmptf2)49#endif50COMPILER_RT_ALIAS(__letf2, __eqtf2)51COMPILER_RT_ALIAS(__letf2, __lttf2)52COMPILER_RT_ALIAS(__letf2, __netf2)5354COMPILER_RT_ABI CMP_RESULT __getf2(fp_t a, fp_t b) { return __geXf2__(a, b); }5556COMPILER_RT_ALIAS(__getf2, __gttf2)5758COMPILER_RT_ABI CMP_RESULT __unordtf2(fp_t a, fp_t b) {59return __unordXf2__(a, b);60}6162#endif636465