13cab2bb3Spatrick //===-- lib/comparetf2.c - Quad-precision comparisons -------------*- C -*-===//
23cab2bb3Spatrick //
33cab2bb3Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
43cab2bb3Spatrick // See https://llvm.org/LICENSE.txt for license information.
53cab2bb3Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
63cab2bb3Spatrick //
73cab2bb3Spatrick //===----------------------------------------------------------------------===//
83cab2bb3Spatrick //
93cab2bb3Spatrick // // This file implements the following soft-float comparison routines:
103cab2bb3Spatrick //
113cab2bb3Spatrick // __eqtf2 __getf2 __unordtf2
123cab2bb3Spatrick // __letf2 __gttf2
133cab2bb3Spatrick // __lttf2
143cab2bb3Spatrick // __netf2
153cab2bb3Spatrick //
163cab2bb3Spatrick // The semantics of the routines grouped in each column are identical, so there
173cab2bb3Spatrick // is a single implementation for each, and wrappers to provide the other names.
183cab2bb3Spatrick //
193cab2bb3Spatrick // The main routines behave as follows:
203cab2bb3Spatrick //
213cab2bb3Spatrick // __letf2(a,b) returns -1 if a < b
223cab2bb3Spatrick // 0 if a == b
233cab2bb3Spatrick // 1 if a > b
243cab2bb3Spatrick // 1 if either a or b is NaN
253cab2bb3Spatrick //
263cab2bb3Spatrick // __getf2(a,b) returns -1 if a < b
273cab2bb3Spatrick // 0 if a == b
283cab2bb3Spatrick // 1 if a > b
293cab2bb3Spatrick // -1 if either a or b is NaN
303cab2bb3Spatrick //
313cab2bb3Spatrick // __unordtf2(a,b) returns 0 if both a and b are numbers
323cab2bb3Spatrick // 1 if either a or b is NaN
333cab2bb3Spatrick //
343cab2bb3Spatrick // Note that __letf2( ) and __getf2( ) are identical except in their handling of
353cab2bb3Spatrick // NaN values.
363cab2bb3Spatrick //
373cab2bb3Spatrick //===----------------------------------------------------------------------===//
383cab2bb3Spatrick
393cab2bb3Spatrick #define QUAD_PRECISION
403cab2bb3Spatrick #include "fp_lib.h"
413cab2bb3Spatrick
423cab2bb3Spatrick #if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
43*d89ec533Spatrick #include "fp_compare_impl.inc"
443cab2bb3Spatrick
__letf2(fp_t a,fp_t b)45*d89ec533Spatrick COMPILER_RT_ABI CMP_RESULT __letf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
463cab2bb3Spatrick
473cab2bb3Spatrick #if defined(__ELF__)
483cab2bb3Spatrick // Alias for libgcc compatibility
COMPILER_RT_ALIAS(__letf2,__cmptf2)493cab2bb3Spatrick COMPILER_RT_ALIAS(__letf2, __cmptf2)
503cab2bb3Spatrick #endif
513cab2bb3Spatrick COMPILER_RT_ALIAS(__letf2, __eqtf2)
523cab2bb3Spatrick COMPILER_RT_ALIAS(__letf2, __lttf2)
533cab2bb3Spatrick COMPILER_RT_ALIAS(__letf2, __netf2)
543cab2bb3Spatrick
55*d89ec533Spatrick COMPILER_RT_ABI CMP_RESULT __getf2(fp_t a, fp_t b) { return __geXf2__(a, b); }
563cab2bb3Spatrick
COMPILER_RT_ALIAS(__getf2,__gttf2)573cab2bb3Spatrick COMPILER_RT_ALIAS(__getf2, __gttf2)
583cab2bb3Spatrick
59*d89ec533Spatrick COMPILER_RT_ABI CMP_RESULT __unordtf2(fp_t a, fp_t b) {
60*d89ec533Spatrick return __unordXf2__(a, b);
613cab2bb3Spatrick }
623cab2bb3Spatrick
633cab2bb3Spatrick #endif
64