Rebase.
[official-gcc.git] / gcc / testsuite / gcc.target / mips / mips16-attributes.c
blob28bb9aae7fa23efe2514b987d5b5e874a7311ce8
1 /* Verify that mips16 and nomips16 attributes work, checking all combinations
2 of calling a nomips16/mips16/default function from a nomips16/mips16/default
3 function. */
4 /* { dg-do run } */
5 /* { dg-options "(-mips16)" } */
7 #include <stdlib.h>
9 #define ATTR1 __attribute__ ((nomips16))
10 #define ATTR2 __attribute__ ((mips16))
11 #define ATTR3
13 double ATTR1
14 f1 (int i, float f, double d)
16 return i + f + d;
19 double ATTR2
20 f2 (int i, float f, double d)
22 return i + f + d;
25 double ATTR3
26 f3 (int i, float f, double d)
28 return i + f + d;
31 void ATTR1
32 g1 (int i, float f, double d)
34 double r = i + f + d;
36 if (f1 (i, f, d) != r)
37 abort ();
38 if (f2 (i+1, f+1, d+1) != r + 3)
39 abort ();
40 if (f3 (i+2, f+2, d+2) != r + 6)
41 abort ();
44 void ATTR2
45 g2 (int i, float f, double d)
47 double r = i + f + d;
49 if (f1 (i, f, d) != r)
50 abort ();
51 if (f2 (i+1, f+1, d+1) != r + 3)
52 abort ();
53 if (f3 (i+2, f+2, d+2) != r + 6)
54 abort ();
57 void ATTR3
58 g3 (int i, float f, double d)
60 double r = i + f + d;
62 if (f1 (i, f, d) != r)
63 abort ();
64 if (f2 (i+1, f+1, d+1) != r + 3)
65 abort ();
66 if (f3 (i+2, f+2, d+2) != r + 6)
67 abort ();
70 int ATTR3
71 main (void)
73 int i = 1;
74 float f = -2.0;
75 double d = 3.0;
77 g1 (i, f, d);
78 g2 (i, f, d);
79 g3 (i, f, d);
81 exit (0);