diff dyncallback/dyncall_args_ppc64.c @ 83:54930a037e8a

- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!) - changelog and todo update
author cslag
date Mon, 28 Mar 2016 23:46:59 +0200
parents 3e629dc19168
children 71c884e610f0
line wrap: on
line diff
--- a/dyncallback/dyncall_args_ppc64.c	Thu Mar 24 23:53:03 2016 +0100
+++ b/dyncallback/dyncall_args_ppc64.c	Mon Mar 28 23:46:59 2016 +0200
@@ -50,8 +50,8 @@
 
 DCpointer   dcbArgPointer  (DCArgs* p) { return (DCpointer)dcbArgLongLong(p); }
 
-DCdouble    dcbArgDouble   (DCArgs* p) 
-{ 
+DCdouble    dcbArgDouble   (DCArgs* p)
+{
   DCdouble result;
 
   if (p->freg_count < 13) {
@@ -67,5 +67,26 @@
   return result;
 }
 
-DCfloat     dcbArgFloat    (DCArgs* p) { return (DCfloat)dcbArgDouble(p); }
+DCfloat    dcbArgFloat   (DCArgs* p)
+{
+  DCfloat result;
+
+#if defined(DC__Endian_BIG)
+  struct sf { DCfloat f_pad; DCfloat f; } sf;
+#else /* Endian_LITTLE */
+  struct sf { DCfloat f; DCfloat f_pad; } sf;
+#endif
 
+  if (p->freg_count < 13) {
+    result = (float)p->freg_data[p->freg_count++];
+    if (p->ireg_count < 8) {
+      p->ireg_count++;
+    }
+  } else {
+    sf = * ( (struct sf*) p->stackptr );
+    result = sf.f;
+  }
+
+  p->stackptr += sizeof(double);
+  return result;
+}