• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ===-- fixsfdi.c - Implement __fixsfdi -----------------------------------===
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 SINGLE_PRECISION
12 #include "fp_lib.h"
13 
14 ARM_EABI_FNALIAS(f2lz, fixsfdi)
15 
16 #ifndef __SOFT_FP__
17 /* Support for systems that have hardware floating-point; can set the invalid
18  * flag as a side-effect of computation.
19  */
20 
21 COMPILER_RT_ABI du_int __fixunssfdi(float a);
22 
23 COMPILER_RT_ABI di_int
__fixsfdi(float a)24 __fixsfdi(float a)
25 {
26     if (a < 0.0f) {
27         return -__fixunssfdi(-a);
28     }
29     return __fixunssfdi(a);
30 }
31 
32 #else
33 /* Support for systems that don't have hardware floating-point; there are no
34  * flags to set, and we don't want to code-gen to an unknown soft-float
35  * implementation.
36  */
37 
38 typedef di_int fixint_t;
39 typedef du_int fixuint_t;
40 #include "fp_fixint_impl.inc"
41 
42 COMPILER_RT_ABI di_int
43 __fixsfdi(fp_t a) {
44     return __fixint(a);
45 }
46 
47 #endif
48