Path: blob/master/libs/compiler-rt/lib/builtins/fixsfdi.c
4395 views
/* ===-- fixsfdi.c - Implement __fixsfdi -----------------------------------===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_int __fixunssfdi(float a);1920COMPILER_RT_ABI di_int21__fixsfdi(float a)22{23if (a < 0.0f) {24return -__fixunssfdi(-a);25}26return __fixunssfdi(a);27}2829#else30/* Support for systems that don't have hardware floating-point; there are no31* flags to set, and we don't want to code-gen to an unknown soft-float32* implementation.33*/3435typedef di_int fixint_t;36typedef du_int fixuint_t;37#include "fp_fixint_impl.inc"3839COMPILER_RT_ABI di_int40__fixsfdi(fp_t a) {41return __fixint(a);42}4344#endif4546#if defined(__ARM_EABI__)47#if defined(COMPILER_RT_ARMHF_TARGET)48AEABI_RTABI di_int __aeabi_f2lz(fp_t a) {49return __fixsfdi(a);50}51#else52AEABI_RTABI di_int __aeabi_f2lz(fp_t a) COMPILER_RT_ALIAS(__fixsfdi);53#endif54#endif555657