[PATCH 5/6] Translate inline assembly to MSVC format
Peter Rosin
peda@lysator.liu.se
Thu Mar 22 23:33:00 GMT 2012
---
ChangeLog | 6 ++++++
testsuite/libffi.call/closure_stdcall.c | 8 ++++++++
testsuite/libffi.call/closure_thiscall.c | 8 ++++++++
3 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4951703..7e4a68f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-03-22 Peter Rosin <peda@lysator.liu.se>
+
+ * testsuite/libffi.call/closure_stdcall.c [MSVC]: Add inline
+ assembly version with Intel syntax.
+ * testsuite/libffi.call/closure_thiscall.c [MSVC]: Likewise.
+
2012-03-23 Peter Rosin <peda@lysator.liu.se>
* testsuite/libffi.call/ffitest.h: Provide abstration of
diff --git a/testsuite/libffi.call/closure_stdcall.c b/testsuite/libffi.call/closure_stdcall.c
index 6bfcc1f..1407f02 100644
--- a/testsuite/libffi.call/closure_stdcall.c
+++ b/testsuite/libffi.call/closure_stdcall.c
@@ -49,9 +49,17 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall,
(void *) 3 /* userdata */, code) == FFI_OK);
+#ifdef _MSC_VER
+ __asm { mov sp_pre, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
+#endif
res = (*(closure_test_type0)code)(0, 1, 2, 3);
+#ifdef _MSC_VER
+ __asm { mov sp_post, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_post));
+#endif
/* { dg-output "0 1 2 3: 9" } */
printf("res: %d\n",res);
diff --git a/testsuite/libffi.call/closure_thiscall.c b/testsuite/libffi.call/closure_thiscall.c
index 6c46f35..0f93649 100644
--- a/testsuite/libffi.call/closure_thiscall.c
+++ b/testsuite/libffi.call/closure_thiscall.c
@@ -49,9 +49,17 @@ int main (void)
CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_thiscall,
(void *) 3 /* userdata */, code) == FFI_OK);
+#ifdef _MSC_VER
+ __asm { mov sp_pre, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_pre));
+#endif
res = (*(closure_test_type0)code)(0, 1, 2, 3);
+#ifdef _MSC_VER
+ __asm { mov sp_post, esp }
+#else
asm volatile (" movl %%esp,%0" : "=g" (sp_post));
+#endif
/* { dg-output "0 1 2 3: 9" } */
printf("res: %d\n",res);
--
1.7.9
More information about the Libffi-discuss
mailing list