xref: /freebsd/lib/libcompiler_rt/comparekf2.c (revision d15f2551b25f79ddcbe289faa95e655100b952da)
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 
27 COMPILER_RT_ABI CMP_RESULT __eqkf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
28 
29 COMPILER_RT_ABI CMP_RESULT __nekf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
30 
31 COMPILER_RT_ABI CMP_RESULT __ltkf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
32 
33 COMPILER_RT_ABI CMP_RESULT __lekf2(fp_t a, fp_t b) { return __leXf2__(a, b); }
34 
35 COMPILER_RT_ABI CMP_RESULT __gtkf2(fp_t a, fp_t b) { return __geXf2__(a, b); }
36 
37 COMPILER_RT_ABI CMP_RESULT __gekf2(fp_t a, fp_t b) { return __geXf2__(a, b); }
38 
39 COMPILER_RT_ABI CMP_RESULT __unordkf2(fp_t a, fp_t b) {
40   return __unordXf2__(a, b);
41 }
42 
43 #endif
44