Path: blob/master/libs/compiler-rt/lib/builtins/fixunsdfdi.c
4395 views
/* ===-- fixunsdfdi.c - Implement __fixunsdfdi -----------------------------===1*2* The LLVM Compiler Infrastructure3*4* This file is dual licensed under the MIT and the University of Illinois Open5* Source Licenses. See LICENSE.TXT for details.6*7* ===----------------------------------------------------------------------===8*/910#define DOUBLE_PRECISION11#include "fp_lib.h"1213#ifndef __SOFT_FP__14/* Support for systems that have hardware floating-point; can set the invalid15* flag as a side-effect of computation.16*/1718COMPILER_RT_ABI du_int19__fixunsdfdi(double a)20{21if (a <= 0.0) return 0;22su_int high = a / 4294967296.f; /* a / 0x1p32f; */23su_int low = a - (double)high * 4294967296.f; /* high * 0x1p32f; */24return ((du_int)high << 32) | low;25}2627#else28/* Support for systems that don't have hardware floating-point; there are no29* flags to set, and we don't want to code-gen to an unknown soft-float30* implementation.31*/3233typedef du_int fixuint_t;34#include "fp_fixuint_impl.inc"3536COMPILER_RT_ABI du_int37__fixunsdfdi(fp_t a) {38return __fixuint(a);39}4041#endif4243#if defined(__ARM_EABI__)44#if defined(COMPILER_RT_ARMHF_TARGET)45AEABI_RTABI du_int __aeabi_d2ulz(fp_t a) {46return __fixunsdfdi(a);47}48#else49AEABI_RTABI du_int __aeabi_d2ulz(fp_t a) COMPILER_RT_ALIAS(__fixunsdfdi);50#endif51#endif525354