summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/builtins/fixtfti.c
diff options
context:
space:
mode:
authorJoerg Sonnenberger <joerg@bec.de>2015-03-11 21:13:56 +0000
committerJoerg Sonnenberger <joerg@bec.de>2015-03-11 21:13:56 +0000
commit91bd698eafe5014cd2852d3bb6f5119b73128c6e (patch)
tree96ddcff3b700a5cb291bc4f10693e601d379ef29 /compiler-rt/lib/builtins/fixtfti.c
parentd6c9bd509eafe6e087a3a58a727c021c6406f3e4 (diff)
downloadbcm5719-llvm-91bd698eafe5014cd2852d3bb6f5119b73128c6e.tar.gz
bcm5719-llvm-91bd698eafe5014cd2852d3bb6f5119b73128c6e.zip
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 llvm-svn: 231965
Diffstat (limited to 'compiler-rt/lib/builtins/fixtfti.c')
-rw-r--r--compiler-rt/lib/builtins/fixtfti.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler-rt/lib/builtins/fixtfti.c b/compiler-rt/lib/builtins/fixtfti.c
new file mode 100644
index 00000000000..41a56384801
--- /dev/null
+++ b/compiler-rt/lib/builtins/fixtfti.c
@@ -0,0 +1,23 @@
+/* ===-- fixtfti.c - Implement __fixtfti -----------------------------------===
+ *
+ * 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 ti_int fixint_t;
+typedef tu_int fixuint_t;
+#include "fp_fixuint_impl.inc"
+
+COMPILER_RT_ABI ti_int
+__fixtfti(fp_t a) {
+ return __fixint(a);
+}
+#endif
OpenPOWER on IntegriCloud