1 1.1 joerg /* ===-- fixunssfdi.c - Implement __fixunssfdi -----------------------------=== 2 1.1 joerg * 3 1.1 joerg * 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.2 rin 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 20 1.2 rin __fixunssfdi(float a) 21 1.2 rin { 22 1.2 rin if (a <= 0.0f) return 0; 23 1.2 rin double da = a; 24 1.2 rin su_int high = da / 4294967296.f; /* da / 0x1p32f; */ 25 1.2 rin su_int low = da - (double)high * 4294967296.f; /* high * 0x1p32f; */ 26 1.2 rin return ((du_int)high << 32) | low; 27 1.2 rin } 28 1.2 rin 29 1.2 rin #else 30 1.2 rin /* Support for systems that don't have hardware floating-point; there are no 31 1.2 rin * flags to set, and we don't want to code-gen to an unknown soft-float 32 1.2 rin * implementation. 33 1.1 joerg */ 34 1.1 joerg 35 1.2 rin typedef du_int fixuint_t; 36 1.2 rin #include "fp_fixuint_impl.inc" 37 1.1 joerg 38 1.2 rin COMPILER_RT_ABI du_int 39 1.2 rin __fixunssfdi(fp_t a) { 40 1.2 rin return __fixuint(a); 41 1.2 rin } 42 1.2 rin 43 1.2 rin #endif 44 1.1 joerg 45 1.2 rin #if defined(__ARM_EABI__) 46 1.3 rin #if defined(COMPILER_RT_ARMHF_TARGET) 47 1.3 rin AEABI_RTABI du_int __aeabi_f2ulz(fp_t a) { 48 1.3 rin return __fixunssfdi(a); 49 1.3 rin } 50 1.2 rin #else 51 1.3 rin AEABI_RTABI du_int __aeabi_f2ulz(fp_t a) COMPILER_RT_ALIAS(__fixunssfdi); 52 1.2 rin #endif 53 1.2 rin #endif 54