1 /* { dg-do run } */
2 /* { dg-options "-std=c99" } */
3
4 #include "../isr-test.h"
5
6 int volatile v;
7
8 /**********************************************************************/
9
10 ISR (1, signal)
11 {
12 }
13
14 MK_RUN_ISR (1, 0)
15
test1(void)16 void test1 (void)
17 {
18 run_isr_1();
19 }
20
21 /**********************************************************************/
22
23 ISR (2, signal)
24 {
25 v++;
26 }
27
28 MK_RUN_ISR (2, 0)
29
test2(void)30 void test2 (void)
31 {
32 v = 0;
33 run_isr_2();
34 if (v != 1)
35 __builtin_abort();
36 }
37
38
39 /**********************************************************************/
40
41 ISR (3, signal)
42 {
43 __asm __volatile__ ("$ lds r27, v"
44 "$ swap r27"
45 "$ sts v, r27"
46 ::: "memory", "r27");
47 }
48
49 MK_RUN_ISR (3, 0)
50
test3(void)51 void test3 (void)
52 {
53 run_isr_3();
54 if (v != 0x10)
55 __builtin_abort();
56 }
57
58 /**********************************************************************/
59
60 ISR (4, signal)
61 {
62 __asm __volatile__ ("sts v,__zero_reg__" ::: "memory");
63 }
64
65 MK_RUN_ISR (4, 0)
66
test4(void)67 void test4 (void)
68 {
69 run_isr_4();
70 if (v != 0)
71 __builtin_abort();
72 }
73
74 /**********************************************************************/
75
76 ISR (5, signal)
77 {
78 __asm __volatile__ ("clt");
79 }
80
81 MK_RUN_ISR (5, 0)
82
test5(void)83 void test5 (void)
84 {
85 run_isr_5();
86 }
87
88 /**********************************************************************/
89
main(void)90 int main (void)
91 {
92 test1();
93 test2();
94 test3();
95 test4();
96 test5();
97 return 0;
98 }
99