xref: /freebsd/lib/libcompiler_rt/comparekf2.c (revision 255538cd906045095d0c2113ae6c4731ce36c0cf)
1 //===-- comparekf2.c - IEEE-128 comparisons for powerpc64le -----*- 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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // PowerPC names the IEEE binary128 comparison soft-float routines with a "kf"
10 // infix instead of the generic "tf".  The semantics are identical to the
11 // generic comparetf2.c routines; only the exported names differ.  We provide
12 // them here because comparetf2.c cannot be reused via a -D rename: its libgcc
13 // compatibility aliases stringize the (unrenamed) target symbol name.
14 //
15 //   __lekf2(a,b) returns -1 if a < b, 0 if a == b, 1 if a > b, 1 if NaN
16 //   __gekf2(a,b) returns -1 if a < b, 0 if a == b, 1 if a > b, -1 if NaN
17 //   __unordkf2(a,b) returns 1 if either operand is NaN, 0 otherwise
18 //
19 //===----------------------------------------------------------------------===//
20 
21 #define QUAD_PRECISION
22 #include "fp_lib.h"
23 
24 #if defined(CRT_HAS_TF_MODE)
25 #include "fp_compare_impl.inc"
26 
__eqkf2(fp_t a,fp_t b)27 COMPILER_RT_ABI CMP_RESULT __eqkf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
28 
__nekf2(fp_t a,fp_t b)29 COMPILER_RT_ABI CMP_RESULT __nekf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
30 
__ltkf2(fp_t a,fp_t b)31 COMPILER_RT_ABI CMP_RESULT __ltkf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
32 
__lekf2(fp_t a,fp_t b)33 COMPILER_RT_ABI CMP_RESULT __lekf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
34 
__gtkf2(fp_t a,fp_t b)35 COMPILER_RT_ABI CMP_RESULT __gtkf2(fp_t a, fp_t b) { return __geXf2__(a, b); }
36 
__gekf2(fp_t a,fp_t b)37 COMPILER_RT_ABI CMP_RESULT __gekf2(fp_t a, fp_t b) { return __geXf2__(a, b); }
38 
__unordkf2(fp_t a,fp_t b)39 COMPILER_RT_ABI CMP_RESULT __unordkf2(fp_t a, fp_t b) {
40   return __unordXf2__(a, b);
41 }
42 
43 #endif
44