summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/config/fixdfdi.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/config/fixdfdi.c')
-rw-r--r--contrib/gcc/config/fixdfdi.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/gcc/config/fixdfdi.c b/contrib/gcc/config/fixdfdi.c
new file mode 100644
index 0000000..9b49228
--- /dev/null
+++ b/contrib/gcc/config/fixdfdi.c
@@ -0,0 +1,28 @@
+/* Public domain. */
+typedef unsigned int USItype __attribute__ ((mode (SI)));
+typedef int DItype __attribute__ ((mode (DI)));
+typedef unsigned int UDItype __attribute__ ((mode (DI)));
+typedef float DFtype __attribute__ ((mode (DF)));
+
+DItype __fixdfdi (DFtype);
+
+/* This version is needed to prevent recursion; fixunsdfdi in libgcc
+ calls fixdfdi, which in turn calls calls fixunsdfdi. */
+
+static DItype
+local_fixunsdfdi (DFtype a)
+{
+ USItype hi, lo;
+
+ hi = a / (((UDItype) 1) << (sizeof (USItype) * 8));
+ lo = a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (USItype) * 8));
+ return ((UDItype) hi << (sizeof (USItype) * 8)) | lo;
+}
+
+DItype
+__fixdfdi (DFtype a)
+{
+ if (a < 0)
+ return - local_fixunsdfdi (-a);
+ return local_fixunsdfdi (a);
+}
OpenPOWER on IntegriCloud