2009-08-08 04:30:09 +08:00
|
|
|
/* ===-- fixsfdi.c - Implement __fixsfdi -----------------------------------===
|
|
|
|
*
|
2015-03-12 05:13:56 +08:00
|
|
|
* The LLVM Compiler Infrastructure
|
2009-08-08 04:30:09 +08:00
|
|
|
*
|
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-08 04:30:09 +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
|
|
|
|
2013-01-14 03:18:00 +08:00
|
|
|
ARM_EABI_FNALIAS(f2lz, fixsfdi)
|
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);
|
|
|
|
|
|
|
|
COMPILER_RT_ABI di_int
|
|
|
|
__fixsfdi(float a)
|
|
|
|
{
|
|
|
|
if (a < 0.0f) {
|
|
|
|
return -__fixunssfdi(-a);
|
|
|
|
}
|
|
|
|
return __fixunssfdi(a);
|
|
|
|
}
|
|
|
|
|
|
|
|
#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.
|
|
|
|
*/
|
|
|
|
|
2015-03-12 05:13:56 +08:00
|
|
|
typedef di_int fixint_t;
|
|
|
|
typedef du_int fixuint_t;
|
|
|
|
#include "fp_fixint_impl.inc"
|
|
|
|
|
2011-04-20 01:52:09 +08:00
|
|
|
COMPILER_RT_ABI di_int
|
2015-03-12 05:13:56 +08:00
|
|
|
__fixsfdi(fp_t a) {
|
|
|
|
return __fixint(a);
|
2009-06-27 00:47:03 +08:00
|
|
|
}
|
2015-04-06 19:54:51 +08:00
|
|
|
|
|
|
|
#endif
|