1*7c3d14c8STreehugger Robot /* ===-- fixdfdi.c - Implement __fixdfdi -----------------------------------=== 2*7c3d14c8STreehugger Robot * 3*7c3d14c8STreehugger Robot * The LLVM Compiler Infrastructure 4*7c3d14c8STreehugger Robot * 5*7c3d14c8STreehugger Robot * This file is dual licensed under the MIT and the University of Illinois Open 6*7c3d14c8STreehugger Robot * Source Licenses. See LICENSE.TXT for details. 7*7c3d14c8STreehugger Robot * 8*7c3d14c8STreehugger Robot * ===----------------------------------------------------------------------=== 9*7c3d14c8STreehugger Robot */ 10*7c3d14c8STreehugger Robot 11*7c3d14c8STreehugger Robot #define DOUBLE_PRECISION 12*7c3d14c8STreehugger Robot #include "fp_lib.h" 13*7c3d14c8STreehugger Robot ARM_EABI_FNALIAS(d2lz, fixdfdi) 14*7c3d14c8STreehugger Robot 15*7c3d14c8STreehugger Robot #ifndef __SOFT_FP__ 16*7c3d14c8STreehugger Robot /* Support for systems that have hardware floating-point; can set the invalid 17*7c3d14c8STreehugger Robot * flag as a side-effect of computation. 18*7c3d14c8STreehugger Robot */ 19*7c3d14c8STreehugger Robot 20*7c3d14c8STreehugger Robot COMPILER_RT_ABI du_int __fixunsdfdi(double a); 21*7c3d14c8STreehugger Robot 22*7c3d14c8STreehugger Robot COMPILER_RT_ABI di_int __fixdfdi(double a)23*7c3d14c8STreehugger Robot__fixdfdi(double a) 24*7c3d14c8STreehugger Robot { 25*7c3d14c8STreehugger Robot if (a < 0.0) { 26*7c3d14c8STreehugger Robot return -__fixunsdfdi(-a); 27*7c3d14c8STreehugger Robot } 28*7c3d14c8STreehugger Robot return __fixunsdfdi(a); 29*7c3d14c8STreehugger Robot } 30*7c3d14c8STreehugger Robot 31*7c3d14c8STreehugger Robot #else 32*7c3d14c8STreehugger Robot /* Support for systems that don't have hardware floating-point; there are no 33*7c3d14c8STreehugger Robot * flags to set, and we don't want to code-gen to an unknown soft-float 34*7c3d14c8STreehugger Robot * implementation. 35*7c3d14c8STreehugger Robot */ 36*7c3d14c8STreehugger Robot 37*7c3d14c8STreehugger Robot typedef di_int fixint_t; 38*7c3d14c8STreehugger Robot typedef du_int fixuint_t; 39*7c3d14c8STreehugger Robot #include "fp_fixint_impl.inc" 40*7c3d14c8STreehugger Robot 41*7c3d14c8STreehugger Robot COMPILER_RT_ABI di_int 42*7c3d14c8STreehugger Robot __fixdfdi(fp_t a) { 43*7c3d14c8STreehugger Robot return __fixint(a); 44*7c3d14c8STreehugger Robot } 45*7c3d14c8STreehugger Robot 46*7c3d14c8STreehugger Robot #endif 47