Alex Leach <beamesle...@gmail.com> added the comment:

I just had a dig around my cpython build dir, and found an ffi64.c I hacked at 
a 
while back.
I copied the edits over to the latest libffi git revision, rebuilt, and `make 
check` (of libffi) passes all tests. So as far as I can tell the below patch 
works, but it is a hack, and I'm sure it could be improved..

Regards to submitting it upstream, I've just written to the libffi-
discuss/sourceware.org mailing list, sending them the below patch also. So it 
might work, but you know that GPL clause about coming with no warranty? ;)

HTH,
Alex

libffi-git> diff -u src/x86/ffi64.c.orig src/x86/ffi64.c

--- src/x86/ffi64.c.orig        2012-07-16 11:38:34.681045084 +0100
+++ src/x86/ffi64.c     2012-07-16 22:34:42.959552750 +0100
@@ -38,7 +38,7 @@
 #define MAX_SSE_REGS 8

 #ifdef __INTEL_COMPILER
-#define UINT128 __m128
+typedef struct { int64_t m[2]; } __int128_t;
 #else
 #define UINT128 __int128_t
 #endif
@@ -47,7 +47,7 @@
 {
   /* Registers for argument passing.  */
   UINT64 gpr[MAX_GPR_REGS];
-  UINT128 sse[MAX_SSE_REGS];
+  __int128_t sse[MAX_SSE_REGS];
 };

 extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags,
@@ -477,10 +477,20 @@
                  break;
                case X86_64_SSE_CLASS:
                case X86_64_SSEDF_CLASS:
+#ifdef __INTEL_COMPILER
+                 reg_args->sse[ssecount].m[0] = *(UINT64 *) a;
+                 reg_args->sse[ssecount++].m[1] = 0;
+#else
                  reg_args->sse[ssecount++] = *(UINT64 *) a;
+#endif
                  break;
                case X86_64_SSESF_CLASS:
+#ifdef __INTEL_COMPILER
+                 reg_args->sse[ssecount].m[0] = *(UINT32 *) a;
+                 reg_args->sse[ssecount++].m[1] = 0;
+#else
                  reg_args->sse[ssecount++] = *(UINT32 *) a;
+#endif
                  break;
                default:
                  abort();

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue4130>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to