1 //===-- lib/comparetf2.c - Quad-precision comparisons -------------*- C -*-===//
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-exception
7 //===----------------------------------------------------------------------===//
9 // // This file implements the following soft-float comparison routines:
11 // __eqtf2 __getf2 __unordtf2
16 // The semantics of the routines grouped in each column are identical, so there
17 // is a single implementation for each, and wrappers to provide the other names.
19 // The main routines behave as follows:
21 // __letf2(a,b) returns -1 if a < b
24 // 1 if either a or b is NaN
26 // __getf2(a,b) returns -1 if a < b
29 // -1 if either a or b is NaN
31 // __unordtf2(a,b) returns 0 if both a and b are numbers
32 // 1 if either a or b is NaN
34 // Note that __letf2( ) and __getf2( ) are identical except in their handling of
37 //===----------------------------------------------------------------------===//
39 #define QUAD_PRECISION
42 #if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT)
43 #include "fp_compare_impl.inc"
45 COMPILER_RT_ABI CMP_RESULT
__letf2(fp_t a
, fp_t b
) { return __leXf2__(a
, b
); }
48 // Alias for libgcc compatibility
49 COMPILER_RT_ALIAS(__letf2
, __cmptf2
)
51 COMPILER_RT_ALIAS(__letf2
, __eqtf2
)
52 COMPILER_RT_ALIAS(__letf2
, __lttf2
)
53 COMPILER_RT_ALIAS(__letf2
, __netf2
)
55 COMPILER_RT_ABI CMP_RESULT
__getf2(fp_t a
, fp_t b
) { return __geXf2__(a
, b
); }
57 COMPILER_RT_ALIAS(__getf2
, __gttf2
)
59 COMPILER_RT_ABI CMP_RESULT
__unordtf2(fp_t a
, fp_t b
) {
60 return __unordXf2__(a
, b
);