Edward O'Callaghan | 5583632 | 2009-08-07 20:30:09 +0000 | [diff] [blame] | 1 | /* ===-- fixsfdi.c - Implement __fixsfdi -----------------------------------=== |
| 2 | * |
Joerg Sonnenberger | 91bd698 | 2015-03-11 21:13:56 +0000 | [diff] [blame] | 3 | * The LLVM Compiler Infrastructure |
Edward O'Callaghan | 5583632 | 2009-08-07 20:30:09 +0000 | [diff] [blame] | 4 | * |
Howard Hinnant | 5b791f6 | 2010-11-16 22:13:33 +0000 | [diff] [blame] | 5 | * This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | * Source Licenses. See LICENSE.TXT for details. |
Edward O'Callaghan | 5583632 | 2009-08-07 20:30:09 +0000 | [diff] [blame] | 7 | * |
| 8 | * ===----------------------------------------------------------------------=== |
Edward O'Callaghan | 5583632 | 2009-08-07 20:30:09 +0000 | [diff] [blame] | 9 | */ |
Daniel Dunbar | fd08999 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 10 | |
Joerg Sonnenberger | 91bd698 | 2015-03-11 21:13:56 +0000 | [diff] [blame] | 11 | #define SINGLE_PRECISION |
| 12 | #include "fp_lib.h" |
Daniel Dunbar | fd08999 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 13 | |
Tim Northover | 0d8c9ca | 2013-01-13 19:18:00 +0000 | [diff] [blame] | 14 | ARM_EABI_FNALIAS(f2lz, fixsfdi) |
Anton Korobeynikov | 75e3c19 | 2011-04-19 17:51:24 +0000 | [diff] [blame] | 15 | |
Sergey Dmitrouk | f3206d6 | 2015-04-06 11:54:51 +0000 | [diff] [blame] | 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 |
| 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 | |
Joerg Sonnenberger | 91bd698 | 2015-03-11 21:13:56 +0000 | [diff] [blame] | 38 | typedef di_int fixint_t; |
| 39 | typedef du_int fixuint_t; |
| 40 | #include "fp_fixint_impl.inc" |
| 41 | |
Anton Korobeynikov | e63da93 | 2011-04-19 17:52:09 +0000 | [diff] [blame] | 42 | COMPILER_RT_ABI di_int |
Joerg Sonnenberger | 91bd698 | 2015-03-11 21:13:56 +0000 | [diff] [blame] | 43 | __fixsfdi(fp_t a) { |
| 44 | return __fixint(a); |
Daniel Dunbar | fd08999 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 45 | } |
Sergey Dmitrouk | f3206d6 | 2015-04-06 11:54:51 +0000 | [diff] [blame] | 46 | |
| 47 | #endif |