PR middle-end/27945
[official-gcc.git] / gcc / testsuite / gcc.dg / complete-port.c
blobc8ebcc10e42b11ec0dea1caeb0b13895401bf274
1 /* This small program uses all the arithmetic operators that may
2 generate calls to library routines which must be implemented in
3 port-specific assembly language. */
4 /* { dg-do link } */
6 #include <stddef.h>
8 int foo ();
9 double dfoo ();
10 void discard (int);
11 void ddiscard (double);
13 int
14 main (void)
16 int a = foo (), b = foo ();
17 unsigned int au = foo (), bu = foo ();
18 float af = dfoo (), bf = dfoo ();
19 double ad = dfoo (), bd = dfoo ();
21 discard (a * b);
22 discard (a / b);
23 discard (a % b);
25 discard (au / bu);
26 discard (au % bu);
28 discard (a >> b);
29 discard (a << b);
31 discard (au >> bu);
32 discard (au << bu);
34 ddiscard (ad + bd);
35 ddiscard (ad - bd);
36 ddiscard (ad * bd);
37 ddiscard (ad / bd);
38 ddiscard (-ad);
40 ddiscard (af + bf);
41 ddiscard (af - bf);
42 ddiscard (af * bf);
43 ddiscard (af / bf);
44 ddiscard (-af);
46 discard ((int) ad);
47 discard ((int) af);
49 ddiscard ((double) a);
50 ddiscard ((float) a);
51 ddiscard ((float) ad);
53 discard (ad == bd);
54 discard (ad < bd);
55 discard (ad > bd);
56 discard (ad != bd);
57 discard (ad <= bd);
58 discard (ad >= bd);
60 discard (af == bf);
61 discard (af < bf);
62 discard (af > bf);
63 discard (af != bf);
64 discard (af <= bf);
65 discard (af >= bf);
67 return 0;
70 void
71 discard (x)
72 int x __attribute__((__unused__));
75 void
76 ddiscard (x)
77 double x __attribute__((__unused__));
80 int
81 foo ()
83 static int table[] = {20, 69, 4, 12};
84 static int idx;
86 return table[idx++];
89 double
90 dfoo ()
92 static double table[] = {20.4, 69.96, 4.4, 202.202};
93 static int idx;
95 return table[idx++];