sdl: Fix termination in -no-shutdown mode
[qemu.git] / tests / cris / crisutils.h
blob29b71cd7b935fccbda859c84a90a14cf44861001
1 static char *tst_cc_loc = NULL;
3 #define cris_tst_cc_init() \
4 do { tst_cc_loc = "test_cc failed at " CURRENT_LOCATION; } while(0)
6 /* We need a real symbol to signal error. */
7 void _err(void) {
8 if (!tst_cc_loc)
9 tst_cc_loc = "tst_cc_failed\n";
10 _fail(tst_cc_loc);
13 static inline void cris_tst_cc_n1(void)
15 asm volatile ("bpl _err\n"
16 "nop\n");
18 static inline void cris_tst_cc_n0(void)
20 asm volatile ("bmi _err\n"
21 "nop\n");
24 static inline void cris_tst_cc_z1(void)
26 asm volatile ("bne _err\n"
27 "nop\n");
29 static inline void cris_tst_cc_z0(void)
31 asm volatile ("beq _err\n"
32 "nop\n");
34 static inline void cris_tst_cc_v1(void)
36 asm volatile ("bvc _err\n"
37 "nop\n");
39 static inline void cris_tst_cc_v0(void)
41 asm volatile ("bvs _err\n"
42 "nop\n");
45 static inline void cris_tst_cc_c1(void)
47 asm volatile ("bcc _err\n"
48 "nop\n");
50 static inline void cris_tst_cc_c0(void)
52 asm volatile ("bcs _err\n"
53 "nop\n");
56 static inline void cris_tst_mov_cc(int n, int z)
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));
63 static inline void cris_tst_cc(const int n, const int z,
64 const int v, const int c)
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));