summaryrefslogtreecommitdiff
path: root/gnu/egcs/gcc/libgcc1-test.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>1999-05-26 13:38:57 +0000
committerMarc Espie <espie@cvs.openbsd.org>1999-05-26 13:38:57 +0000
commit0126e157b87f137fc08dc7f46f6c291b9d06ac5d (patch)
treef8555e3e504eb82b4cd3cba5cec20ae4ce8124ff /gnu/egcs/gcc/libgcc1-test.c
parentff8e9a4356e55ed142306c3a375fa280800abc86 (diff)
egcs projects compiler system
Exact copy of the snapshot, except for the removal of texinfo/ gcc/ch/ libchill/
Diffstat (limited to 'gnu/egcs/gcc/libgcc1-test.c')
-rw-r--r--gnu/egcs/gcc/libgcc1-test.c106
1 files changed, 106 insertions, 0 deletions
diff --git a/gnu/egcs/gcc/libgcc1-test.c b/gnu/egcs/gcc/libgcc1-test.c
new file mode 100644
index 00000000000..d9c250e99d0
--- /dev/null
+++ b/gnu/egcs/gcc/libgcc1-test.c
@@ -0,0 +1,106 @@
+/* This small function uses all the arithmetic operators that
+ libgcc1.c can handle. If you can link it, then
+ you have provided replacements for all the libgcc1.c functions that
+ your target machine needs. */
+
+int foo ();
+double dfoo ();
+
+/* We don't want __main here because that can drag in atexit (among other
+ things) which won't necessarily exist yet. */
+
+main_without__main ()
+{
+ int a = foo (), b = foo ();
+ unsigned int au = foo (), bu = foo ();
+ float af = dfoo (), bf = dfoo ();
+ double ad = dfoo (), bd = dfoo ();
+
+ discard (a * b);
+ discard (a / b);
+ discard (a % b);
+
+ discard (au / bu);
+ discard (au % bu);
+
+ discard (a >> b);
+ discard (a << b);
+
+ discard (au >> bu);
+ discard (au << bu);
+
+ ddiscard (ad + bd);
+ ddiscard (ad - bd);
+ ddiscard (ad * bd);
+ ddiscard (ad / bd);
+ ddiscard (-ad);
+
+ ddiscard (af + bf);
+ ddiscard (af - bf);
+ ddiscard (af * bf);
+ ddiscard (af / bf);
+ ddiscard (-af);
+
+ discard ((int) ad);
+ discard ((int) af);
+
+ ddiscard ((double) a);
+ ddiscard ((float) a);
+ ddiscard ((float) ad);
+
+ discard (ad == bd);
+ discard (ad < bd);
+ discard (ad > bd);
+ discard (ad != bd);
+ discard (ad <= bd);
+ discard (ad >= bd);
+
+ discard (af == bf);
+ discard (af < bf);
+ discard (af > bf);
+ discard (af != bf);
+ discard (af <= bf);
+ discard (af >= bf);
+
+ return 0;
+}
+
+discard (x)
+ int x;
+{}
+
+ddiscard (x)
+ double x;
+{}
+
+foo ()
+{
+ static int table[] = {20, 69, 4, 12};
+ static int idx;
+
+ return table[idx++];
+}
+
+double
+dfoo ()
+{
+ static double table[] = {20.4, 69.96, 4.4, 202.202};
+ static int idx;
+
+ return table[idx++];
+}
+
+/* Provide functions that some versions of the linker use to default
+ the start address if -e symbol is not used, to avoid the warning
+ message saying the start address is defaulted. */
+extern void start() __asm__("start");
+extern void _start() __asm__("_start");
+extern void __start() __asm__("__start");
+
+/* Provide functions that might be needed by soft-float emulation routines. */
+void memcpy() {}
+
+void start() {}
+void _start() {}
+void __start() {}
+void mainCRTStartup() {}