diff options
author | Joerg Sonnenberger <joerg@bec.de> | 2015-03-11 21:13:56 +0000 |
---|---|---|
committer | Joerg Sonnenberger <joerg@bec.de> | 2015-03-11 21:13:56 +0000 |
commit | 6c015134aead1e20986ebbda8d75e9125e0eeed9 (patch) | |
tree | 087bc7b4667f73e29e18876318fc024c41091346 /lib/builtins/fixunstfsi.c | |
parent | 4779d3501762b1c89b54dd852787e410d1dc3e5e (diff) |
Refactor float to integer conversion to share the same code.
80bit Intel/PPC long double is excluded due to lacking support
for the abstraction. Consistently provide saturation logic.
Extend to long double on 128bit IEEE extended platforms.
Initial patch with test cases from GuanHong Liu.
Reviewed by Steve Canon.
Differential Revision: http://reviews.llvm.org/D2804
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@231965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/builtins/fixunstfsi.c')
-rw-r--r-- | lib/builtins/fixunstfsi.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/builtins/fixunstfsi.c b/lib/builtins/fixunstfsi.c new file mode 100644 index 000000000..b5d3f6a7d --- /dev/null +++ b/lib/builtins/fixunstfsi.c @@ -0,0 +1,22 @@ +/* ===-- fixunstfsi.c - Implement __fixunstfsi -----------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ + +#define QUAD_PRECISION +#include "fp_lib.h" + +#if defined(CRT_HAS_128BIT) && defined(CRT_LDBL_128BIT) +typedef su_int fixuint_t; +#include "fp_fixuint_impl.inc" + +COMPILER_RT_ABI su_int +__fixunstfsi(fp_t a) { + return __fixuint(a); +} +#endif |