xref: /freebsd/contrib/llvm-project/compiler-rt/lib/builtins/floattitf.c (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1 //===-- lib/floattitf.c - int128 -> quad-precision conversion -----*- 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 // This file implements ti_int to quad-precision conversion for the
10 // compiler-rt library in the IEEE-754 default round-to-nearest, ties-to-even
11 // mode.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #define QUAD_PRECISION
16 #include "fp_lib.h"
17 #include "int_lib.h"
18 
19 #if defined(CRT_HAS_TF_MODE)
20 #define SRC_I128
21 #define DST_QUAD
22 #include "int_to_fp_impl.inc"
23 
24 // Returns: convert a ti_int to a fp_t, rounding toward even.
25 
26 // Assumption: fp_t is a IEEE 128 bit floating point type
27 //             ti_int is a 128 bit integral type
28 
29 // seee eeee eeee eeee mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm
30 // mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm
31 // mmmm mmmm mmmm
32 
33 COMPILER_RT_ABI fp_t __floattitf(ti_int a) { return __floatXiYf__(a); }
34 
35 #endif
36