2009-08-05 12:02:56 +08:00
|
|
|
/* ===-- fixunssfdi.c - Implement __fixunssfdi -----------------------------===
|
|
|
|
*
|
|
|
|
* The LLVM Compiler Infrastructure
|
|
|
|
*
|
2010-11-17 06:13:33 +08:00
|
|
|
* This file is dual licensed under the MIT and the University of Illinois Open
|
|
|
|
* Source Licenses. See LICENSE.TXT for details.
|
2009-08-05 12:02:56 +08:00
|
|
|
*
|
|
|
|
* ===----------------------------------------------------------------------===
|
|
|
|
*/
|
2009-06-27 00:47:03 +08:00
|
|
|
|
2015-03-12 05:13:56 +08:00
|
|
|
#define SINGLE_PRECISION
|
|
|
|
#include "fp_lib.h"
|
2009-06-27 00:47:03 +08:00
|
|
|
|
2012-06-23 05:09:15 +08:00
|
|
|
ARM_EABI_FNALIAS(f2ulz, fixunssfdi)
|
2011-04-20 01:51:24 +08:00
|
|
|
|
2015-04-06 19:54:51 +08:00
|
|
|
#ifndef __SOFT_FP__
|
|
|
|
/* Support for systems that have hardware floating-point; can set the invalid
|
|
|
|
* flag as a side-effect of computation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
COMPILER_RT_ABI du_int
|
|
|
|
__fixunssfdi(float a)
|
|
|
|
{
|
2015-05-02 00:02:16 +08:00
|
|
|
if (a <= 0.0f) return 0;
|
2015-04-06 19:54:51 +08:00
|
|
|
double da = a;
|
|
|
|
su_int high = da/0x1p32f;
|
|
|
|
su_int low = da - (double)high*0x1p32f;
|
|
|
|
return ((du_int)high << 32) | low;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
/* Support for systems that don't have hardware floating-point; there are no
|
|
|
|
* flags to set, and we don't want to code-gen to an unknown soft-float
|
|
|
|
* implementation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef du_int fixuint_t;
|
|
|
|
#include "fp_fixuint_impl.inc"
|
|
|
|
|
2011-04-20 01:52:09 +08:00
|
|
|
COMPILER_RT_ABI du_int
|
2015-03-12 05:13:56 +08:00
|
|
|
__fixunssfdi(fp_t a) {
|
|
|
|
return __fixuint(a);
|
2009-06-27 00:47:03 +08:00
|
|
|
}
|
2015-04-06 19:54:51 +08:00
|
|
|
|
|
|
|
#endif
|