summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/spalign.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rts/spalign.c')
-rw-r--r--testsuite/tests/rts/spalign.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/rts/spalign.c b/testsuite/tests/rts/spalign.c
new file mode 100644
index 0000000000..0b776e17cc
--- /dev/null
+++ b/testsuite/tests/rts/spalign.c
@@ -0,0 +1,30 @@
+#include "Rts.h"
+
+#ifdef darwin_HOST_OS
+#define STG_GLOBAL ".globl "
+#else
+#define STG_GLOBAL ".global "
+#endif
+
+#ifdef LEADING_UNDERSCORE
+#define GETESP "_getesp"
+#else
+#define GETESP "getesp"
+#endif
+
+void __dummy__(void)
+{
+ __asm__ volatile (
+ STG_GLOBAL GETESP "\n"
+ GETESP ":\n\t"
+
+#if defined(i386_HOST_ARCH)
+ "movl %%esp, %%eax\n\t"
+#elif defined(x86_64_HOST_ARCH)
+ "movq %%rsp, %%rax\n\t"
+#else
+#error splign.c: not implemented for this architecture
+#endif
+ "ret"
+ : : );
+}