Path: blob/master/libs/compiler-rt/lib/builtins/fixunssfdi.c
4395 views
/* ===-- fixunssfdi.c - Implement __fixunssfdi -----------------------------===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 SINGLE_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__fixunssfdi(float a)20{21if (a <= 0.0f) return 0;22double da = a;23su_int high = da / 4294967296.f; /* da / 0x1p32f; */24su_int low = da - (double)high * 4294967296.f; /* high * 0x1p32f; */25return ((du_int)high << 32) | low;26}2728#else29/* Support for systems that don't have hardware floating-point; there are no30* flags to set, and we don't want to code-gen to an unknown soft-float31* implementation.32*/3334typedef du_int fixuint_t;35#include "fp_fixuint_impl.inc"3637COMPILER_RT_ABI du_int38__fixunssfdi(fp_t a) {39return __fixuint(a);40}4142#endif4344#if defined(__ARM_EABI__)45#if defined(COMPILER_RT_ARMHF_TARGET)46AEABI_RTABI du_int __aeabi_f2ulz(fp_t a) {47return __fixunssfdi(a);48}49#else50AEABI_RTABI du_int __aeabi_f2ulz(fp_t a) COMPILER_RT_ALIAS(__fixunssfdi);51#endif52#endif535455