git subrepo pull --force deps/lightrec
[pcsx_rearmed.git] / deps / lightning / check / self.c
1 #include <lightning.h>
2 #include <stdio.h>
3 #include <assert.h>
4
5 int
6 main(int argc, char *argv[])
7 {
8     jit_state_t         *_jit;
9
10     /* Same JIT_XY are not constants */
11     init_jit(argv[0]);
12
13     _jit = jit_new_state();
14     assert(JIT_R0 == jit_r(0));
15     (void)jit_callee_save_p(JIT_R0);
16     assert(JIT_R1 == jit_r(1));
17     (void)jit_callee_save_p(JIT_R1);
18     assert(JIT_R2 == jit_r(2));
19     (void)jit_callee_save_p(JIT_R2);
20 #if defined(JIT_R3)
21     assert(JIT_R3 == jit_r(3));
22     (void)jit_callee_save_p(JIT_R3);
23 #  if defined(JIT_R4)
24     assert(JIT_R4 == jit_r(4));
25     (void)jit_callee_save_p(JIT_R4);
26 #    if defined(JIT_R5)
27     assert(JIT_R5 == jit_r(5));
28     (void)jit_callee_save_p(JIT_R5);
29 #      if defined(JIT_R6)
30     assert(JIT_R6 == jit_r(6));
31     (void)jit_callee_save_p(JIT_R6);
32 #        if defined(JIT_R7)
33     assert(JIT_R7 == jit_r(7));
34     (void)jit_callee_save_p(JIT_R7);
35 #        endif
36 #      endif
37 #    endif
38 #  endif
39 #endif
40     assert(JIT_V0 == jit_v(0));
41     assert(jit_callee_save_p(JIT_V0));
42     assert(JIT_V1 == jit_v(1));
43     assert(jit_callee_save_p(JIT_V1));
44     assert(JIT_V2 == jit_v(2));
45     assert(jit_callee_save_p(JIT_V2));
46 #if defined(JIT_V3)
47     assert(JIT_V3 == jit_v(3));
48     assert(jit_callee_save_p(JIT_V3));
49 #  if defined(JIT_V4)
50     assert(JIT_V4 == jit_v(4));
51     assert(jit_callee_save_p(JIT_V4));
52 #    if defined(JIT_V5)
53     assert(JIT_V5 == jit_v(5));
54     assert(jit_callee_save_p(JIT_V5));
55 #      if defined(JIT_V6)
56     assert(JIT_V6 == jit_v(6));
57     assert(jit_callee_save_p(JIT_V6));
58 #        if defined(JIT_V7)
59     assert(JIT_V7 == jit_v(7));
60     assert(jit_callee_save_p(JIT_V7));
61 #          if defined(JIT_V8)
62     assert(JIT_V8 == jit_v(8));
63     assert(jit_callee_save_p(JIT_V8));
64 #            if defined(JIT_V9)
65     assert(JIT_V9 == jit_v(9));
66     assert(jit_callee_save_p(JIT_V9));
67 #              if defined(JIT_V10)
68     assert(JIT_V10 == jit_v(10));
69     assert(jit_callee_save_p(JIT_V10));
70 #                if defined(JIT_V11)
71     assert(JIT_V11 == jit_v(11));
72     assert(jit_callee_save_p(JIT_V11));
73 #                  if defined(JIT_V12)
74     assert(JIT_V12 == jit_v(12));
75     assert(jit_callee_save_p(JIT_V12));
76 #                    if defined(JIT_V13)
77     assert(JIT_V13 == jit_v(13));
78     assert(jit_callee_save_p(JIT_V13));
79 #                      if defined(JIT_V14)
80     assert(JIT_V14 == jit_v(14));
81     assert(jit_callee_save_p(JIT_V14));
82 #                        if defined(JIT_V15)
83     assert(JIT_V15 == jit_v(15));
84     assert(jit_callee_save_p(JIT_V15));
85 #                          if defined(JIT_V16)
86     assert(JIT_V16 == jit_v(16));
87     assert(jit_callee_save_p(JIT_V16));
88 #                          endif
89 #                        endif
90 #                      endif
91 #                    endif
92 #                  endif
93 #                endif
94 #              endif
95 #            endif
96 #          endif
97 #        endif
98 #      endif
99 #    endif
100 #  endif
101 #endif
102     assert(JIT_F0 == jit_f(0));
103     (void)jit_callee_save_p(JIT_F0);
104     assert(JIT_F1 == jit_f(1));
105     (void)jit_callee_save_p(JIT_F1);
106     assert(JIT_F2 == jit_f(2));
107     (void)jit_callee_save_p(JIT_F2);
108     assert(JIT_F3 == jit_f(3));
109     (void)jit_callee_save_p(JIT_F3);
110     assert(JIT_F4 == jit_f(4));
111     (void)jit_callee_save_p(JIT_F4);
112     assert(JIT_F5 == jit_f(5));
113     (void)jit_callee_save_p(JIT_F5);
114 #if defined(JIT_F6)
115     assert(JIT_F6 == jit_f(6));
116     (void)jit_callee_save_p(JIT_F6);
117 #  if defined(JIT_F7)
118     assert(JIT_F7 == jit_f(7));
119     (void)jit_callee_save_p(JIT_F7);
120 #    if defined(JIT_F8)
121     assert(JIT_F8 == jit_f(8));
122     (void)jit_callee_save_p(JIT_F8);
123 #      if defined(JIT_F9)
124     assert(JIT_F9 == jit_f(9));
125     (void)jit_callee_save_p(JIT_F9);
126 #      endif
127 #    endif
128 #  endif
129 #endif
130
131     jit_clear_state();
132     jit_destroy_state();
133     finish_jit();
134
135     return (0);
136 }