aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mxp/demo/demo.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/mxp/demo/demo.c')
-rw-r--r--gcc/config/mxp/demo/demo.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/config/mxp/demo/demo.c b/gcc/config/mxp/demo/demo.c
new file mode 100644
index 00000000000..a5852708e9f
--- /dev/null
+++ b/gcc/config/mxp/demo/demo.c
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include "demo.h"
+
+static unsigned long rand_seed = 47114711;
+long
+simple_rand ()
+{
+ unsigned long this = rand_seed * 1103515245 + 12345;
+ rand_seed = this;
+ return this >> 8;
+}
+
+int
+main (int argc, char **argv)
+{
+ int i;
+ unsigned long res;
+
+ if (argc > 1)
+ rand_seed = atol (argv[1]);
+ for (i = 0; i < sizeof (s) / sizeof (ELEMTYPE); i++)
+ {
+ long el = simple_rand () & 0x7ff;
+
+ /* Make this a 15 bit signed number so that XORing two of these will
+ again yeild a 15 bit signed numbers, and adding two of those will
+ fit in a short. */
+ s.a[i] = (el & 0x4000) ? -0x8000 + el : el;
+ /* Hack: Using s.a to access all of s. */
+ s.a[i] = el;
+ }
+ res = f ();
+ printf ("result is:%ld 0x%lx\n", res, res);
+ return 0;
+}