]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/compiler-rt/lib/builtins/fixdfdi.c
Update llvm, clang and lldb to trunk r257626, and update build glue.
[FreeBSD/FreeBSD.git] / contrib / compiler-rt / lib / builtins / fixdfdi.c
1 /* ===-- fixdfdi.c - Implement __fixdfdi -----------------------------------===
2  *
3  *                     The LLVM Compiler Infrastructure
4  *
5  * This file is dual licensed under the MIT and the University of Illinois Open
6  * Source Licenses. See LICENSE.TXT for details.
7  *
8  * ===----------------------------------------------------------------------===
9  */
10
11 #define DOUBLE_PRECISION
12 #include "fp_lib.h"
13 ARM_EABI_FNALIAS(d2lz, fixdfdi)
14
15 #ifndef __SOFT_FP__
16 /* Support for systems that have hardware floating-point; can set the invalid
17  * flag as a side-effect of computation.
18  */
19
20 COMPILER_RT_ABI du_int __fixunsdfdi(double a);
21
22 COMPILER_RT_ABI di_int
23 __fixdfdi(double a)
24 {
25     if (a < 0.0) {
26         return -__fixunsdfdi(-a);
27     }
28     return __fixunsdfdi(a);
29 }
30
31 #else
32 /* Support for systems that don't have hardware floating-point; there are no
33  * flags to set, and we don't want to code-gen to an unknown soft-float
34  * implementation.
35  */
36
37 typedef di_int fixint_t;
38 typedef du_int fixuint_t;
39 #include "fp_fixint_impl.inc"
40
41 COMPILER_RT_ABI di_int
42 __fixdfdi(fp_t a) {
43     return __fixint(a);
44 }
45
46 #endif