blob: b93d1c10bffa1a72b10ad555f7a077f6c906de8e [file] [log] [blame]
Edward O'Callaghan2bf62722009-08-05 04:02:56 +00001/* ===-- fixunsdfdi.c - Implement __fixunsdfdi -----------------------------===
2 *
3 * The LLVM Compiler Infrastructure
4 *
Howard Hinnant9ad441f2010-11-16 22:13:33 +00005 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
Edward O'Callaghan2bf62722009-08-05 04:02:56 +00007 *
8 * ===----------------------------------------------------------------------===
Edward O'Callaghan2bf62722009-08-05 04:02:56 +00009 */
Daniel Dunbarb3a69012009-06-26 16:47:03 +000010
Pirama Arumuga Nainar7c915052015-04-08 08:58:29 -070011#define DOUBLE_PRECISION
12#include "fp_lib.h"
Daniel Dunbarb3a69012009-06-26 16:47:03 +000013
Chandler Carruth0193b742012-06-22 21:09:15 +000014ARM_EABI_FNALIAS(d2ulz, fixunsdfdi)
Anton Korobeynikov37b97d12011-04-19 17:51:24 +000015
Pirama Arumuga Nainar259f7062015-05-06 11:49:53 -070016#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
21COMPILER_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
35typedef du_int fixuint_t;
36#include "fp_fixuint_impl.inc"
37
Anton Korobeynikov1c5f89b2011-04-19 17:52:09 +000038COMPILER_RT_ABI du_int
Pirama Arumuga Nainar7c915052015-04-08 08:58:29 -070039__fixunsdfdi(fp_t a) {
40 return __fixuint(a);
Daniel Dunbarb3a69012009-06-26 16:47:03 +000041}
Pirama Arumuga Nainar259f7062015-05-06 11:49:53 -070042
43#endif