Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.misc-tests / arm-isr.c
blob737f9ffb643bcc89cdf0a4e9e62133e9c91f5add
1 extern void abort ();
2 extern void exit (int);
4 #ifndef __thumb__
5 /* There used to be a couple of bugs in the ARM's prologue and epilogue
6 generation for ISR routines. The wrong epilogue instruction would be
7 generated to restore the IP register if it had to be pushed onto the
8 stack, and the wrong offset was being computed for local variables if
9 r0 - r3 had to be saved. This tests for both of these cases. */
11 int z = 9;
13 int
14 bar (void)
16 return z;
19 int
20 foo (int a, int b, int c, int d, int e, int f, int g, int h)
22 volatile int i = (a + b) - (g + h) + bar ();
23 volatile int j = (e + f) - (c + d);
25 return a + b + c + d + e + f + g + h + i + j;
28 int foo1 (int a, int b, int c, int d, int e, int f, int g, int h) __attribute__ ((interrupt ("IRQ")));
30 int
31 foo1 (int a, int b, int c, int d, int e, int f, int g, int h)
33 volatile int i = (a + b) - (g + h) + bar ();
34 volatile int j = (e + f) - (c + d);
36 return a + b + c + d + e + f + g + h + i + j;
38 #endif
40 int
41 main (void)
43 #ifndef __thumb__
44 if (foo (1, 2, 3, 4, 5, 6, 7, 8) != 32)
45 abort ();
47 if (foo1 (1, 2, 3, 4, 5, 6, 7, 8) != 32)
48 abort ();
49 #endif
50 exit (0);