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