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