summaryrefslogtreecommitdiff
path: root/ghc/misc/test-arch.c
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/misc/test-arch.c')
-rw-r--r--ghc/misc/test-arch.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/ghc/misc/test-arch.c b/ghc/misc/test-arch.c
new file mode 100644
index 0000000000..d0e9666b96
--- /dev/null
+++ b/ghc/misc/test-arch.c
@@ -0,0 +1,37 @@
+/*
+ Compile this with GCC on a new platform, to learn various
+ things about argument-passing, return-returning, stack
+ layout, etc. WDP 95/05
+*/
+
+extern long int foo (long int, double, void *, char *, double, long int, char, long int);
+extern double bar (char, float, long int, long int, char *, char **);
+
+long int
+foo (long int a, double b, void *c, char *d, double e, long int f, char g, long int h)
+{
+ __asm__ volatile ("--- BEGIN ---");
+ bar(*d, (float) b, a, f, d, (char **) d);
+ __asm__ volatile ("--- END ---");
+}
+
+double
+bar (char a, float b, long int c, long int d, char *e, char **f)
+{
+ __asm__ volatile ("--- BEGIN ---");
+ foo(c, (double) b, (void *) 0, e, 0.0, d, a, d);
+ __asm__ volatile ("--- END ---");
+}
+
+double
+baz(w)
+ int w;
+{
+ int x[1000];
+ int y;
+
+ for(y = 0; y < 1000; y++)
+ w += x[y];
+
+ return ((double) w);
+}