]> git.proxmox.com Git - qemu.git/blame - tests/cris/crisutils.h
Generalize -machine command line option
[qemu.git] / tests / cris / crisutils.h
CommitLineData
dd43edf4
TS
1static char *tst_cc_loc = NULL;
2
3#define cris_tst_cc_init() \
4do { tst_cc_loc = "test_cc failed at " CURRENT_LOCATION; } while(0)
5
6/* We need a real symbol to signal error. */
bd3a8454 7void _err(void) {
dd43edf4
TS
8 if (!tst_cc_loc)
9 tst_cc_loc = "tst_cc_failed\n";
10 _fail(tst_cc_loc);
11}
12
4a6648f4 13static inline void cris_tst_cc_n1(void)
dd43edf4
TS
14{
15 asm volatile ("bpl _err\n"
16 "nop\n");
17}
4a6648f4 18static inline void cris_tst_cc_n0(void)
dd43edf4
TS
19{
20 asm volatile ("bmi _err\n"
21 "nop\n");
22}
23
4a6648f4 24static inline void cris_tst_cc_z1(void)
dd43edf4
TS
25{
26 asm volatile ("bne _err\n"
27 "nop\n");
28}
4a6648f4 29static inline void cris_tst_cc_z0(void)
dd43edf4
TS
30{
31 asm volatile ("beq _err\n"
32 "nop\n");
33}
4a6648f4 34static inline void cris_tst_cc_v1(void)
dd43edf4
TS
35{
36 asm volatile ("bvc _err\n"
37 "nop\n");
38}
4a6648f4 39static inline void cris_tst_cc_v0(void)
dd43edf4
TS
40{
41 asm volatile ("bvs _err\n"
42 "nop\n");
43}
44
4a6648f4 45static inline void cris_tst_cc_c1(void)
dd43edf4
TS
46{
47 asm volatile ("bcc _err\n"
48 "nop\n");
49}
4a6648f4 50static inline void cris_tst_cc_c0(void)
dd43edf4
TS
51{
52 asm volatile ("bcs _err\n"
53 "nop\n");
54}
55
4a6648f4 56static inline void cris_tst_mov_cc(int n, int z)
dd43edf4
TS
57{
58 if (n) cris_tst_cc_n1(); else cris_tst_cc_n0();
59 if (z) cris_tst_cc_z1(); else cris_tst_cc_z0();
60 asm volatile ("" : : "g" (_err));
61}
62
4a6648f4 63static inline void cris_tst_cc(const int n, const int z,
dd43edf4
TS
64 const int v, const int c)
65{
66 if (n) cris_tst_cc_n1(); else cris_tst_cc_n0();
67 if (z) cris_tst_cc_z1(); else cris_tst_cc_z0();
68 if (v) cris_tst_cc_v1(); else cris_tst_cc_v0();
69 if (c) cris_tst_cc_c1(); else cris_tst_cc_c0();
70 asm volatile ("" : : "g" (_err));
71}