| Edward O'Callaghan | 2bf6272 | 2009-08-05 04:02:56 +0000 | [diff] [blame] | 1 | /* ===-- fixunsdfdi.c - Implement __fixunsdfdi -----------------------------=== |
| 2 | * |
| 3 | * The LLVM Compiler Infrastructure |
| 4 | * |
| Howard Hinnant | 9ad441f | 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 | 2bf6272 | 2009-08-05 04:02:56 +0000 | [diff] [blame] | 7 | * |
| 8 | * ===----------------------------------------------------------------------=== |
| Edward O'Callaghan | 2bf6272 | 2009-08-05 04:02:56 +0000 | [diff] [blame] | 9 | */ |
| Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 10 | |
| Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 11 | #define DOUBLE_PRECISION |
| 12 | #include "fp_lib.h" |
| Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 13 | |
| Chandler Carruth | 0193b74 | 2012-06-22 21:09:15 +0000 | [diff] [blame] | 14 | ARM_EABI_FNALIAS(d2ulz, fixunsdfdi) |
| Anton Korobeynikov | 37b97d1 | 2011-04-19 17:51:24 +0000 | [diff] [blame] | 15 | |
| Pirama Arumuga Nainar | 259f706 | 2015-05-06 11:49:53 -0700 | [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 |
| 22 | __fixunsdfdi(double a) |
| 23 | { |
| 24 | su_int high = a/0x1p32f; |
| 25 | su_int low = a - (double)high*0x1p32f; |
| 26 | return ((du_int)high << 32) | low; |
| 27 | } |
| 28 | |
| 29 | #else |
| 30 | /* Support for systems that don't have hardware floating-point; there are no |
| 31 | * flags to set, and we don't want to code-gen to an unknown soft-float |
| 32 | * implementation. |
| 33 | */ |
| 34 | |
| 35 | typedef du_int fixuint_t; |
| 36 | #include "fp_fixuint_impl.inc" |
| 37 | |
| Anton Korobeynikov | 1c5f89b | 2011-04-19 17:52:09 +0000 | [diff] [blame] | 38 | COMPILER_RT_ABI du_int |
| Pirama Arumuga Nainar | 7c91505 | 2015-04-08 08:58:29 -0700 | [diff] [blame] | 39 | __fixunsdfdi(fp_t a) { |
| 40 | return __fixuint(a); |
| Daniel Dunbar | b3a6901 | 2009-06-26 16:47:03 +0000 | [diff] [blame] | 41 | } |
| Pirama Arumuga Nainar | 259f706 | 2015-05-06 11:49:53 -0700 | [diff] [blame^] | 42 | |
| 43 | #endif |