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